tangled
alpha
login
or
join now
codexarchonic.nekoweb.org
/
ProjectInfinity
0
fork
atom
Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.
0
fork
atom
overview
issues
6
pulls
pipelines
leaps and bounds
cassian.cc
1 year ago
9f9d9890
41fe6c82
+64
-52
11 changed files
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
dimensions
RandomDimensionType.java
features
RandomBlobs.java
RandomColumns.java
RandomDelta.java
RandomDisk.java
RandomFlowerPatch.java
RandomTree.java
util
core
NbtUtils.java
resources
data
infinity
loot_tables
blocks
chromatic_carpet.json
chromatic_wool.json
recipes
iridescence_bottle_from_portal.json
+1
-1
common/src/main/java/net/lerariemann/infinity/dimensions/RandomDimensionType.java
···
42
42
data.putInt("monster_spawn_block_light_limit", random.nextInt(16));
43
43
NbtCompound lightLevel = new NbtCompound();
44
44
lightLevel.putString("type", "uniform");
45
45
-
lightLevel.put("value", RandomProvider.genBounds(0, random.nextInt(16)));
45
45
+
lightLevel.put("value", RandomProvider.genBounds(0, random.nextInt(15)));
46
46
data.put("monster_spawn_light_level", lightLevel);
47
47
data.putString("infiniburn", "#" + dim.PROVIDER.randomName(random, "tags"));
48
48
String s = dim.PROVIDER.randomName(random, "dimension_effects");
+1
-1
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomBlobs.java
···
20
20
21
21
NbtCompound feature() {
22
22
NbtCompound config = new NbtCompound();
23
23
-
addRandomIntProvider(config, "radius", 0, 12);
23
23
+
addRandomIntProvider(config, "radius", 0, 11);
24
24
config.put("state", block);
25
25
config.put("target", daddy.default_block);
26
26
return feature(config);
+2
-2
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomColumns.java
···
16
16
17
17
NbtCompound feature() {
18
18
NbtCompound config = new NbtCompound();
19
19
-
addRandomIntProvider(config, "reach", 0, 3);
20
20
-
addRandomIntProvider(config, "height", 1, 15);
19
19
+
addRandomIntProvider(config, "reach", 0, 2);
20
20
+
addRandomIntProvider(config, "height", 1, 14);
21
21
addRandomBlockProvider(config, "block_provider", "full_blocks_worldgen");
22
22
return feature(config);
23
23
}
+2
-2
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomDelta.java
···
20
20
NbtCompound block = genBlockOrFluid();
21
21
config.put("contents", block);
22
22
addRandomBlock(config, "rim", "full_blocks");
23
23
-
config.put("size", NbtUtils.randomIntProvider(random, 17, true));
24
24
-
config.put("rim_size", NbtUtils.randomIntProvider(random, 17, true));
23
23
+
config.put("size", NbtUtils.randomIntProvider(random, 16, true));
24
24
+
config.put("rim_size", NbtUtils.randomIntProvider(random, 16, true));
25
25
return feature(config);
26
26
}
27
27
}
+1
-1
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomDisk.java
···
28
28
NbtCompound config = new NbtCompound();
29
29
NbtCompound blockProvider = PROVIDER.randomBlockProvider(random, "full_blocks_worldgen");
30
30
config.putInt("half_height", random.nextInt(5));
31
31
-
addRandomIntProvider(config, "radius", 0, 9);
31
31
+
addRandomIntProvider(config, "radius", 0, 8);
32
32
NbtCompound targets = new NbtCompound();
33
33
boolean awt = PROVIDER.roll(random, "ores_spawn_everywhere");
34
34
targets.putString("type", awt ? "true" : "matching_blocks");
+1
-1
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomFlowerPatch.java
···
12
12
}
13
13
14
14
void placement() {
15
15
-
int a = random.nextInt(1, 9);
15
15
+
int a = random.nextInt(1, 8);
16
16
if (a>1) addCount(a);
17
17
addRarityFilter(1 + random.nextInt(32));
18
18
addInSquare();
+6
-6
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomTree.java
···
45
45
NbtCompound res = new NbtCompound();
46
46
res.putString("type", "mangrove_root_placer");
47
47
addRandomBlockProvider(res, "root_provider", "full_blocks");
48
48
-
res.put("trunk_offset_y", NbtUtils.randomIntProvider(random, 10, true));
48
48
+
res.put("trunk_offset_y", NbtUtils.randomIntProvider(random, 9, true));
49
49
if (random.nextBoolean()) {
50
50
NbtCompound above = new NbtCompound();
51
51
addRandomBlockProvider(above, "above_root_provider", "blocks_features");
···
82
82
res.putString("can_grow_through", "#" + PROVIDER.randomName(random, "tags"));
83
83
}
84
84
case "cherry_trunk_placer" -> {
85
85
-
addRandomIntProvider(res, "branch_count", 1, 3);
86
86
-
addRandomIntProvider(res, "branch_horizontal_length", 2, 16);
85
85
+
addRandomIntProvider(res, "branch_count", 1, 2);
86
86
+
addRandomIntProvider(res, "branch_horizontal_length", 2, 15);
87
87
NbtCompound branch_start_offset_from_top = new NbtCompound();
88
88
int a = random.nextInt(-16, 0);
89
89
int b = random.nextInt(-16, 0);
···
94
94
branch_start_offset_from_top.putInt("min_inclusive", Math.min(a, b));
95
95
branch_start_offset_from_top.putInt("max_inclusive", Math.max(a, b));
96
96
res.put("branch_start_offset_from_top", branch_start_offset_from_top);
97
97
-
addRandomIntProvider(res, "branch_end_offset_from_top", -16, 16);
97
97
+
addRandomIntProvider(res, "branch_end_offset_from_top", -16, 15);
98
98
}
99
99
case "infinity:wonky" -> {
100
100
float a = random.nextFloat();
···
119
119
case "spruce_foliage_placer" -> res.put("trunk_height", NbtUtils.randomIntProvider(random, ishuge ? 24 : 6, true));
120
120
case "mega_pine_foliage_placer" -> res.put("crown_height", NbtUtils.randomIntProvider(random, ishuge ? 24 : 6, true));
121
121
case "random_spread_foliage_placer" -> {
122
122
-
addRandomIntProvider(res, "foliage_height", 1, ishuge ? 512 : 16);
122
122
+
addRandomIntProvider(res, "foliage_height", 1, ishuge ? 512 : 15);
123
123
res.putInt("leaf_placement_attempts", random.nextInt(256));
124
124
}
125
125
case "cherry_foliage_placer" -> {
126
126
-
res.put("height", NbtUtils.randomIntProvider(random, 4, 16, true));
126
126
+
res.put("height", NbtUtils.randomIntProvider(random, 4, 15, true));
127
127
res.putFloat("wide_bottom_layer_hole_chance", random.nextFloat());
128
128
res.putFloat("corner_hole_chance", random.nextFloat());
129
129
res.putFloat("hanging_leaves_chance", random.nextFloat());
+29
-28
common/src/main/java/net/lerariemann/infinity/util/core/NbtUtils.java
···
81
81
}
82
82
case 1, 2 -> {
83
83
res.putString("type", i==1 ? "uniform" : "biased_to_bottom");
84
84
-
addBounds(res, random, lbound, bound);
84
84
+
res.put("value", genBounds(lbound, bound));
85
85
return res;
86
86
}
87
87
case 4 -> {
···
93
93
}
94
94
case 3 -> {
95
95
res.putString("type", "clamped_normal");
96
96
-
addBounds(res, random, lbound, bound);
97
96
NbtCompound value = genBounds(lbound, bound);
98
97
value.putDouble("mean", lbound + random.nextDouble()*(bound-lbound));
99
98
value.putDouble("deviation", random.nextExponential());
···
171
170
return res;
172
171
}
173
172
174
174
-
static NbtCompound randomFloatProvider(Random random, float lbound, float bound) {
175
175
-
int i = random.nextInt(3);
176
176
-
String[] types = new String[]{"uniform", "clamped_normal", "trapezoid"};
177
177
-
NbtCompound res = new NbtCompound();
178
178
-
res.putString("type", types[i]);
179
179
-
float a = random.nextFloat(lbound, bound);
180
180
-
float b = random.nextFloat(lbound, bound);
181
181
-
float min = Math.min(a, b);
182
182
-
float max = Math.max(a, b);
183
183
-
switch (i) {
184
184
-
case 0 -> {
185
185
-
res.putFloat("max_exclusive", max);
186
186
-
res.putFloat("min_inclusive", min);
187
187
-
}
188
188
-
case 1 -> {
189
189
-
res.putFloat("max", max);
190
190
-
res.putFloat("min", min);
191
191
-
res.putFloat("mean", random.nextFloat(min, max));
192
192
-
res.putFloat("deviation", random.nextFloat(max - min));
193
193
-
}
194
194
-
case 2 -> {
195
195
-
res.putFloat("max", max);
196
196
-
res.putFloat("min", min);
197
197
-
res.putFloat("plateau", random.nextFloat(max - min));
173
173
+
static NbtCompound randomFloatProvider(Random random, float lbound, float bound) {
174
174
+
int i = random.nextInt(3);
175
175
+
String[] types = new String[]{"uniform", "clamped_normal", "trapezoid"};
176
176
+
NbtCompound res = new NbtCompound();
177
177
+
res.putString("type", types[i]);
178
178
+
NbtCompound value = new NbtCompound();
179
179
+
float a = random.nextFloat(lbound, bound);
180
180
+
float b = random.nextFloat(lbound, bound);
181
181
+
float min = Math.min(a, b);
182
182
+
float max = Math.max(a, b);
183
183
+
switch (i) {
184
184
+
case 0 -> {
185
185
+
value.putFloat("max_exclusive", max);
186
186
+
value.putFloat("min_inclusive", min);
187
187
+
}
188
188
+
case 1 -> {
189
189
+
value.putFloat("max", max);
190
190
+
value.putFloat("min", min);
191
191
+
value.putFloat("mean", random.nextFloat(min, max));
192
192
+
value.putFloat("deviation", random.nextFloat(max - min));
193
193
+
}
194
194
+
case 2 -> {
195
195
+
value.putFloat("max", max);
196
196
+
value.putFloat("min", min);
197
197
+
value.putFloat("plateau", random.nextFloat(max - min));
198
198
+
}
198
199
}
200
200
+
res.put("value", value);
201
201
+
return res;
199
202
}
200
200
-
return res;
201
201
-
}
202
203
}
+10
-3
common/src/main/resources/data/infinity/loot_tables/blocks/chromatic_carpet.json
···
9
9
"name": "infinity:chromatic_carpet",
10
10
"functions": [
11
11
{
12
12
-
"function": "minecraft:copy_components",
12
12
+
"function": "minecraft:copy_nbt",
13
13
"include": [
14
14
"infinity:color"
15
15
],
16
16
-
"source": "block_entity"
16
16
+
"source": "block_entity",
17
17
+
"ops": [
18
18
+
{
19
19
+
"source": "infinity:color",
20
20
+
"target": "infinity:color",
21
21
+
"op": "replace"
22
22
+
}
23
23
+
]
17
24
}
18
25
]
19
26
}
···
25
32
]
26
33
}
27
34
]
28
28
-
}
35
35
+
}
+10
-6
common/src/main/resources/data/infinity/loot_tables/blocks/chromatic_wool.json
···
9
9
"name": "infinity:chromatic_wool",
10
10
"functions": [
11
11
{
12
12
-
"function": "minecraft:copy_components",
13
13
-
"include": [
14
14
-
"infinity:color"
15
15
-
],
16
16
-
"source": "block_entity"
12
12
+
"function": "minecraft:copy_nbt",
13
13
+
"source": "block_entity",
14
14
+
"ops": [
15
15
+
{
16
16
+
"source": "infinity:color",
17
17
+
"target": "infinity:color",
18
18
+
"op": "replace"
19
19
+
}
20
20
+
]
17
21
}
18
22
]
19
23
}
···
25
29
]
26
30
}
27
31
]
28
28
-
}
32
32
+
}
+1
-1
common/src/main/resources/data/infinity/recipes/iridescence_bottle_from_portal.json
···
4
4
"item": "infinity:chromatic_potion"
5
5
},
6
6
"output": {
7
7
-
"id": "infinity:iridescent_potion"
7
7
+
"item": "infinity:iridescent_potion"
8
8
}
9
9
}