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
continued dehardcoding of features
Lera
11 months ago
1079abbe
2e43ad31
+146
-120
13 changed files
expand all
collapse all
unified
split
common
src
main
java
net
lerariemann
infinity
dimensions
RandomFeaturesList.java
features
RandomisedFeature.java
surface_structures
RandomWell.java
underground_structures
RandomFossil.java
vegetation
RandomKelp.java
RandomPickle.java
RandomSeagrass.java
util
core
ConfigType.java
resources
config
hardcoded
features
lakes.json
undergroundstructures.json
vegetation
seagrass.json
vegetation_part3.json
infinity.json
+13
-15
common/src/main/java/net/lerariemann/infinity/dimensions/RandomFeaturesList.java
···
14
14
import net.lerariemann.infinity.dimensions.features.underground_ores.RandomDisk;
15
15
import net.lerariemann.infinity.dimensions.features.underground_ores.RandomOre;
16
16
import net.lerariemann.infinity.dimensions.features.underground_structures.RandomDungeon;
17
17
-
import net.lerariemann.infinity.dimensions.features.vegetation.RandomFloatingPatch;
18
18
-
import net.lerariemann.infinity.dimensions.features.vegetation.RandomFlowerPatch;
19
19
-
import net.lerariemann.infinity.dimensions.features.vegetation.RandomSurfacePatch;
20
20
-
import net.lerariemann.infinity.dimensions.features.vegetation.RandomVegetation;
17
17
+
import net.lerariemann.infinity.dimensions.features.underground_structures.RandomFossil;
18
18
+
import net.lerariemann.infinity.dimensions.features.vegetation.*;
21
19
import net.lerariemann.infinity.util.core.ConfigType;
22
20
import net.lerariemann.infinity.util.core.RandomProvider;
23
21
import net.minecraft.nbt.NbtCompound;
···
46
44
blocks = new ArrayList<>();
47
45
useVanillaFeatures = roll("generate_vanilla_features");
48
46
data = new NbtList();
49
49
-
data.add(endIsland());
47
47
+
data.add(rawGeneration());
50
48
data.add(lakes());
51
49
data.add(localModifications());
52
50
data.add(undergroundStructures());
···
56
54
data.add(fluidSprings());
57
55
data.add(vegetation());
58
56
data.add(getAllElements(ConfigType.TOP_LAYER));
59
59
-
}
60
60
-
61
61
-
NbtString randomPlant(ConfigType path) {
62
62
-
return NbtString.of(PROVIDER.randomName(random, path));
63
57
}
64
58
65
59
NbtList getAllElements(ConfigType name) {
···
84
78
return PROVIDER.roll(random, key);
85
79
}
86
80
87
87
-
NbtList endIsland() {
81
81
+
NbtList rawGeneration() {
88
82
NbtList res = new NbtList();
89
83
addRandomFeature("end_island", res, RandomEndIsland::new);
90
84
if (roll("shape")) addRandomFeature(res, new RandomShape(this, PROVIDER.randomName(random, ConfigType.SHAPE_TYPES)));
···
92
86
}
93
87
94
88
NbtList lakes() {
95
95
-
NbtList res = getAllElements(ConfigType.LAKES);
89
89
+
NbtList res = new NbtList();
96
90
addRandomFeature("lake", res, RandomLake::new);
97
91
return res;
98
92
}
···
106
100
}
107
101
108
102
NbtList undergroundStructures() {
109
109
-
NbtList res = getAllElements(ConfigType.UNDERGROUND_STRUCTURES);
103
103
+
NbtList res = new NbtList();
110
104
addRandomFeature("dungeon", res, RandomDungeon::new);
105
105
+
addRandomFeature("fossil", res, RandomFossil::new);
111
106
return res;
112
107
}
113
108
···
152
147
addRandomFeature("vegetation", res, RandomVegetation::new);
153
148
res.addAll(getAllElements(ConfigType.VEG1));
154
149
addRandomFeature(res, RandomFlowerPatch::new);
155
155
-
res.add(randomPlant(ConfigType.GRASS));
150
150
+
res.add(NbtString.of(PROVIDER.randomName(random, ConfigType.GRASS)));
156
151
res.addAll(getAllElements(ConfigType.VEG2));
157
152
addRandomFeature("surface_patch", res, RandomSurfacePatch::new);
158
153
addRandomFeature("floating_patch", res, RandomFloatingPatch::new);
159
159
-
res.add(randomPlant(ConfigType.SEAGRASS));
160
160
-
res.addAll(getAllElements(ConfigType.VEG3));
154
154
+
if (parent.parent.default_fluid.getString("Name").contains("water")) {
155
155
+
addRandomFeature("water_plants", res, RandomSeagrass::new);
156
156
+
addRandomFeature("water_plants", res, RandomPickle::new);
157
157
+
addRandomFeature("water_plants", res, RandomKelp::new);
158
158
+
}
161
159
return res;
162
160
}
163
161
+7
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomisedFeature.java
···
44
44
CommonIO.write(moredata, parent.storagePath + "/worldgen/placed_feature", name + ".json");
45
45
}
46
46
47
47
+
protected void savePlacement(String feature) {
48
48
+
NbtCompound moredata = new NbtCompound();
49
49
+
moredata.putString("feature", feature);
50
50
+
moredata.put("placement", placement());
51
51
+
CommonIO.write(moredata, parent.storagePath + "/worldgen/placed_feature", name + ".json");
52
52
+
}
53
53
+
47
54
public NbtCompound genBlockOrFluid() {
48
55
NbtCompound block2;
49
56
if (parent.roll("solid_lakes")) {
+2
-7
common/src/main/java/net/lerariemann/infinity/dimensions/features/surface_structures/RandomWell.java
···
3
3
import net.lerariemann.infinity.dimensions.RandomFeaturesList;
4
4
import net.lerariemann.infinity.dimensions.features.Placement;
5
5
import net.lerariemann.infinity.dimensions.features.RandomisedFeature;
6
6
-
import net.lerariemann.infinity.util.core.CommonIO;
7
6
import net.minecraft.nbt.NbtCompound;
8
7
import net.minecraft.nbt.NbtList;
9
8
10
9
public class RandomWell extends RandomisedFeature {
11
10
public RandomWell(RandomFeaturesList lst) {
12
11
super(lst, "well");
13
13
-
14
14
-
NbtCompound moredata = new NbtCompound();
15
15
-
moredata.putString("feature", "minecraft:desert_well");
16
16
-
moredata.put("placement", placement());
17
17
-
CommonIO.write(moredata, parent.storagePath + "/worldgen/placed_feature", name + ".json");
12
12
+
savePlacement("minecraft:desert_well");
18
13
}
19
14
20
15
public NbtCompound feature() {
···
22
17
}
23
18
public NbtList placement() {
24
19
Placement res = new Placement();
25
25
-
res.addRarityFilter(random.nextInt(1200));
20
20
+
res.addRarityFilter(random.nextInt(1, 1000));
26
21
res.addInSquare();
27
22
res.addHeightmap("MOTION_BLOCKING");
28
23
res.addBiome();
+28
common/src/main/java/net/lerariemann/infinity/dimensions/features/underground_structures/RandomFossil.java
···
1
1
+
package net.lerariemann.infinity.dimensions.features.underground_structures;
2
2
+
3
3
+
import net.lerariemann.infinity.dimensions.RandomFeaturesList;
4
4
+
import net.lerariemann.infinity.dimensions.features.Placement;
5
5
+
import net.lerariemann.infinity.dimensions.features.RandomisedFeature;
6
6
+
import net.lerariemann.infinity.util.core.NbtUtils;
7
7
+
import net.minecraft.nbt.NbtCompound;
8
8
+
import net.minecraft.nbt.NbtList;
9
9
+
10
10
+
public class RandomFossil extends RandomisedFeature {
11
11
+
public RandomFossil(RandomFeaturesList lst) {
12
12
+
super(lst, "well");
13
13
+
savePlacement("minecraft:fossil_coal");
14
14
+
}
15
15
+
16
16
+
public NbtCompound feature() {
17
17
+
return null;
18
18
+
}
19
19
+
public NbtList placement() {
20
20
+
Placement res = new Placement();
21
21
+
res.addRarityFilter(random.nextInt(1, 128));
22
22
+
res.addInSquare();
23
23
+
res.addHeightRange(NbtUtils.randomHeightProvider(random, daddy.min_y,
24
24
+
daddy.min_y + daddy.height, false, true));
25
25
+
res.addBiome();
26
26
+
return res.data;
27
27
+
}
28
28
+
}
+33
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomKelp.java
···
1
1
+
package net.lerariemann.infinity.dimensions.features.vegetation;
2
2
+
3
3
+
import net.lerariemann.infinity.dimensions.RandomFeaturesList;
4
4
+
import net.lerariemann.infinity.dimensions.features.Placement;
5
5
+
import net.lerariemann.infinity.dimensions.features.RandomisedFeature;
6
6
+
import net.minecraft.nbt.NbtCompound;
7
7
+
import net.minecraft.nbt.NbtList;
8
8
+
9
9
+
public class RandomKelp extends RandomisedFeature {
10
10
+
public RandomKelp(RandomFeaturesList lst) {
11
11
+
super(lst.parent.id, lst, "kelp");
12
12
+
savePlacement("minecraft:kelp");
13
13
+
}
14
14
+
public NbtCompound feature() {
15
15
+
return null;
16
16
+
}
17
17
+
public NbtCompound noiseCount() {
18
18
+
NbtCompound res = Placement.ofType("minecraft:noise_based_count");
19
19
+
res.putDouble("noise_factor", 80.0);
20
20
+
res.putDouble("noise_offset", 0.0);
21
21
+
res.putInt("noise_to_count_ratio", 20 + random.nextInt(120));
22
22
+
return res;
23
23
+
}
24
24
+
25
25
+
public NbtList placement() {
26
26
+
Placement res = new Placement();
27
27
+
res.data.add(noiseCount());
28
28
+
res.addInSquare();
29
29
+
res.addHeightmap("OCEAN_FLOOR_WG");
30
30
+
res.addBiome();
31
31
+
return res.data;
32
32
+
}
33
33
+
}
+28
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomPickle.java
···
1
1
+
package net.lerariemann.infinity.dimensions.features.vegetation;
2
2
+
3
3
+
import net.lerariemann.infinity.dimensions.RandomFeaturesList;
4
4
+
import net.lerariemann.infinity.dimensions.features.Placement;
5
5
+
import net.lerariemann.infinity.dimensions.features.RandomisedFeature;
6
6
+
import net.minecraft.nbt.NbtCompound;
7
7
+
import net.minecraft.nbt.NbtList;
8
8
+
9
9
+
public class RandomPickle extends RandomisedFeature {
10
10
+
public RandomPickle(RandomFeaturesList lst) {
11
11
+
super(lst.parent.id, lst, "pickle");
12
12
+
id = "minecraft:sea_pickle";
13
13
+
savePlacement();
14
14
+
}
15
15
+
public NbtCompound feature() {
16
16
+
NbtCompound config = new NbtCompound();
17
17
+
config.putInt("count", 1 + random.nextInt(30));
18
18
+
return feature(config);
19
19
+
}
20
20
+
public NbtList placement() {
21
21
+
Placement res = new Placement();
22
22
+
res.addRarityFilter(4 + random.nextInt(20));
23
23
+
res.addInSquare();
24
24
+
res.addHeightmap("OCEAN_FLOOR_WG");
25
25
+
res.addBiome();
26
26
+
return res.data;
27
27
+
}
28
28
+
}
+28
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomSeagrass.java
···
1
1
+
package net.lerariemann.infinity.dimensions.features.vegetation;
2
2
+
3
3
+
import net.lerariemann.infinity.dimensions.RandomFeaturesList;
4
4
+
import net.lerariemann.infinity.dimensions.features.Placement;
5
5
+
import net.lerariemann.infinity.dimensions.features.RandomisedFeature;
6
6
+
import net.minecraft.nbt.NbtCompound;
7
7
+
import net.minecraft.nbt.NbtList;
8
8
+
9
9
+
public class RandomSeagrass extends RandomisedFeature {
10
10
+
public RandomSeagrass(RandomFeaturesList lst) {
11
11
+
super(lst.parent.id, lst, "seagrass");
12
12
+
id = "minecraft:seagrass";
13
13
+
savePlacement();
14
14
+
}
15
15
+
public NbtCompound feature() {
16
16
+
NbtCompound config = new NbtCompound();
17
17
+
config.putDouble("probability", random.nextDouble());
18
18
+
return feature(config);
19
19
+
}
20
20
+
public NbtList placement() {
21
21
+
Placement res = new Placement();
22
22
+
res.addInSquare();
23
23
+
res.addHeightmap("OCEAN_FLOOR_WG");
24
24
+
res.addCount(random.nextInt(10, 100));
25
25
+
res.addBiome();
26
26
+
return res.data;
27
27
+
}
28
28
+
}
+3
-8
common/src/main/java/net/lerariemann/infinity/util/core/ConfigType.java
···
49
49
TREE_DECORATORS("tree_decorators", "attached_to_leaves"),
50
50
TRUNK_PLACERS("trunk_placers", "straight_trunk_placer"),
51
51
GRASS("grass", "minecraft:patch_grass_normal"),
52
52
-
SEAGRASS("seagrass", "minecraft:seagrass_normal"),
53
52
VEG1("vegetation_part1", "minecraft:patch_sunflower"),
54
53
VEG2("vegetation_part2", "minecraft:patch_pumpkin"),
55
55
-
VEG3("vegetation_part3", "minecraft:sea_pickle"),
56
56
-
LAKES("lakes", "minecraft:lake_lava_surface"),
57
54
LOCAL_MOD("localmodifications", "minecraft:large_dripstone"),
58
55
TOP_LAYER("toplayermodification", "minecraft:freeze_top_layer"),
59
56
UNDERGROUND_DEC("undergrounddecoration", "minecraft:pointed_dripstone"),
60
60
-
UNDERGROUND_ORES("undergroundores", "minecraft:ore_dirt"),
61
61
-
UNDERGROUND_STRUCTURES("undergroundstructures", "minecraft:fossil_upper");
57
57
+
UNDERGROUND_ORES("undergroundores", "minecraft:ore_dirt");
62
58
63
59
public static final ConfigType[] normalModular = new ConfigType[]{COLOR_PRESETS, EFFECTS, STRUCTURES,
64
60
LOOT_TABLES, TAGS, PARTICLES, MUSIC, SOUNDS, ITEMS, TREES, JUKEBOXES};
···
70
66
FLORAL_DISTRIBUTION, FOLIAGE_PLACERS, GENERATOR_TYPES, MOB_CATEGORIES, MULTINOISE_PRESETS, NOISE_PRESETS,
71
67
SHAPE_TYPES, STRUCTURE_PLACEMENT_TYPES, TREE_DECORATORS, TRUNK_PLACERS};
72
68
73
73
-
public static final ConfigType[] vegetation = new ConfigType[]{GRASS, SEAGRASS, VEG1, VEG2, VEG3};
69
69
+
public static final ConfigType[] vegetation = new ConfigType[]{GRASS, VEG1, VEG2};
74
70
75
75
-
public static final ConfigType[] features = new ConfigType[]{LAKES, LOCAL_MOD, TOP_LAYER, UNDERGROUND_DEC,
76
76
-
UNDERGROUND_ORES, UNDERGROUND_STRUCTURES};
71
71
+
public static final ConfigType[] features = new ConfigType[]{LOCAL_MOD, TOP_LAYER, UNDERGROUND_DEC, UNDERGROUND_ORES};
77
72
78
73
public static boolean addsName(ConfigType type) {
79
74
return type != STRUCTURES;
-12
common/src/main/resources/config/hardcoded/features/lakes.json
···
1
1
-
{
2
2
-
"elements": [
3
3
-
{
4
4
-
"key": "minecraft:lake_lava_underground",
5
5
-
"weight": 0.5
6
6
-
},
7
7
-
{
8
8
-
"key": "minecraft:lake_lava_surface",
9
9
-
"weight": 0.5
10
10
-
}
11
11
-
]
12
12
-
}
-20
common/src/main/resources/config/hardcoded/features/undergroundstructures.json
···
1
1
-
{
2
2
-
"elements": [
3
3
-
{
4
4
-
"key": "minecraft:fossil_upper",
5
5
-
"weight": 0.1
6
6
-
},
7
7
-
{
8
8
-
"key": "minecraft:fossil_lower",
9
9
-
"weight": 0.1
10
10
-
},
11
11
-
{
12
12
-
"key": "minecraft:monster_room",
13
13
-
"weight": 0.5
14
14
-
},
15
15
-
{
16
16
-
"key": "minecraft:monster_room_deep",
17
17
-
"weight": 0.5
18
18
-
}
19
19
-
]
20
20
-
}
-40
common/src/main/resources/config/hardcoded/vegetation/seagrass.json
···
1
1
-
{
2
2
-
"elements": [
3
3
-
{
4
4
-
"key": "minecraft:seagrass_cold",
5
5
-
"weight": 1.0
6
6
-
},
7
7
-
{
8
8
-
"key": "minecraft:seagrass_normal",
9
9
-
"weight": 1.0
10
10
-
},
11
11
-
{
12
12
-
"key": "minecraft:seagrass_warm",
13
13
-
"weight": 1.0
14
14
-
},
15
15
-
{
16
16
-
"key": "minecraft:seagrass_deep_cold",
17
17
-
"weight": 1.0
18
18
-
},
19
19
-
{
20
20
-
"key": "minecraft:seagrass_deep",
21
21
-
"weight": 1.0
22
22
-
},
23
23
-
{
24
24
-
"key": "minecraft:seagrass_deep_warm",
25
25
-
"weight": 1.0
26
26
-
},
27
27
-
{
28
28
-
"key": "minecraft:seagrass_simple",
29
29
-
"weight": 1.0
30
30
-
},
31
31
-
{
32
32
-
"key": "minecraft:seagrass_river",
33
33
-
"weight": 1.0
34
34
-
},
35
35
-
{
36
36
-
"key": "minecraft:seagrass_swamp",
37
37
-
"weight": 1.0
38
38
-
}
39
39
-
]
40
40
-
}
-16
common/src/main/resources/config/hardcoded/vegetation/vegetation_part3.json
···
1
1
-
{
2
2
-
"elements": [
3
3
-
{
4
4
-
"key": "minecraft:sea_pickle",
5
5
-
"weight": 0.1
6
6
-
},
7
7
-
{
8
8
-
"key": "minecraft:kelp_cold",
9
9
-
"weight": 0.2
10
10
-
},
11
11
-
{
12
12
-
"key": "minecraft:kelp_warm",
13
13
-
"weight": 0.2
14
14
-
}
15
15
-
]
16
16
-
}
+4
-2
common/src/main/resources/config/infinity.json
···
1
1
{
2
2
-
"infinity_version": 2004004,
2
2
+
"infinity_version": 2004005,
3
3
"gameRules": {
4
4
"runtimeGenerationEnabled": true,
5
5
"longArithmeticEnabled": false,
···
66
66
"geode": 0.5,
67
67
"rock": 0.33,
68
68
"dungeon": 1.0,
69
69
+
"fossil": 0.2,
69
70
"end_spikes": 0.2,
70
71
"end_gateway": 0.05,
71
72
"delta": 0.2,
···
76
77
"ceiling_blobs": 0.5,
77
78
"vegetation": 1.0,
78
79
"surface_patch": 0.5,
79
79
-
"floating_patch": 0.1
80
80
+
"floating_patch": 0.1,
81
81
+
"water_plants": 0.75
80
82
},
81
83
"features_rules": {
82
84
"generate_vanilla_features": 0.5,