Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

continued dehardcoding of features

Lera 1079abbe 2e43ad31

+146 -120
+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 - import net.lerariemann.infinity.dimensions.features.vegetation.RandomFloatingPatch; 18 - import net.lerariemann.infinity.dimensions.features.vegetation.RandomFlowerPatch; 19 - import net.lerariemann.infinity.dimensions.features.vegetation.RandomSurfacePatch; 20 - import net.lerariemann.infinity.dimensions.features.vegetation.RandomVegetation; 17 + import net.lerariemann.infinity.dimensions.features.underground_structures.RandomFossil; 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 - data.add(endIsland()); 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 - } 60 - 61 - NbtString randomPlant(ConfigType path) { 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 - NbtList endIsland() { 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 - NbtList res = getAllElements(ConfigType.LAKES); 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 - NbtList res = getAllElements(ConfigType.UNDERGROUND_STRUCTURES); 103 + NbtList res = new NbtList(); 110 104 addRandomFeature("dungeon", res, RandomDungeon::new); 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 - res.add(randomPlant(ConfigType.GRASS)); 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 - res.add(randomPlant(ConfigType.SEAGRASS)); 160 - res.addAll(getAllElements(ConfigType.VEG3)); 154 + if (parent.parent.default_fluid.getString("Name").contains("water")) { 155 + addRandomFeature("water_plants", res, RandomSeagrass::new); 156 + addRandomFeature("water_plants", res, RandomPickle::new); 157 + addRandomFeature("water_plants", res, RandomKelp::new); 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 + protected void savePlacement(String feature) { 48 + NbtCompound moredata = new NbtCompound(); 49 + moredata.putString("feature", feature); 50 + moredata.put("placement", placement()); 51 + CommonIO.write(moredata, parent.storagePath + "/worldgen/placed_feature", name + ".json"); 52 + } 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 - 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 - 14 - NbtCompound moredata = new NbtCompound(); 15 - moredata.putString("feature", "minecraft:desert_well"); 16 - moredata.put("placement", placement()); 17 - CommonIO.write(moredata, parent.storagePath + "/worldgen/placed_feature", name + ".json"); 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 - res.addRarityFilter(random.nextInt(1200)); 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 + package net.lerariemann.infinity.dimensions.features.underground_structures; 2 + 3 + import net.lerariemann.infinity.dimensions.RandomFeaturesList; 4 + import net.lerariemann.infinity.dimensions.features.Placement; 5 + import net.lerariemann.infinity.dimensions.features.RandomisedFeature; 6 + import net.lerariemann.infinity.util.core.NbtUtils; 7 + import net.minecraft.nbt.NbtCompound; 8 + import net.minecraft.nbt.NbtList; 9 + 10 + public class RandomFossil extends RandomisedFeature { 11 + public RandomFossil(RandomFeaturesList lst) { 12 + super(lst, "well"); 13 + savePlacement("minecraft:fossil_coal"); 14 + } 15 + 16 + public NbtCompound feature() { 17 + return null; 18 + } 19 + public NbtList placement() { 20 + Placement res = new Placement(); 21 + res.addRarityFilter(random.nextInt(1, 128)); 22 + res.addInSquare(); 23 + res.addHeightRange(NbtUtils.randomHeightProvider(random, daddy.min_y, 24 + daddy.min_y + daddy.height, false, true)); 25 + res.addBiome(); 26 + return res.data; 27 + } 28 + }
+33
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomKelp.java
··· 1 + package net.lerariemann.infinity.dimensions.features.vegetation; 2 + 3 + import net.lerariemann.infinity.dimensions.RandomFeaturesList; 4 + import net.lerariemann.infinity.dimensions.features.Placement; 5 + import net.lerariemann.infinity.dimensions.features.RandomisedFeature; 6 + import net.minecraft.nbt.NbtCompound; 7 + import net.minecraft.nbt.NbtList; 8 + 9 + public class RandomKelp extends RandomisedFeature { 10 + public RandomKelp(RandomFeaturesList lst) { 11 + super(lst.parent.id, lst, "kelp"); 12 + savePlacement("minecraft:kelp"); 13 + } 14 + public NbtCompound feature() { 15 + return null; 16 + } 17 + public NbtCompound noiseCount() { 18 + NbtCompound res = Placement.ofType("minecraft:noise_based_count"); 19 + res.putDouble("noise_factor", 80.0); 20 + res.putDouble("noise_offset", 0.0); 21 + res.putInt("noise_to_count_ratio", 20 + random.nextInt(120)); 22 + return res; 23 + } 24 + 25 + public NbtList placement() { 26 + Placement res = new Placement(); 27 + res.data.add(noiseCount()); 28 + res.addInSquare(); 29 + res.addHeightmap("OCEAN_FLOOR_WG"); 30 + res.addBiome(); 31 + return res.data; 32 + } 33 + }
+28
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomPickle.java
··· 1 + package net.lerariemann.infinity.dimensions.features.vegetation; 2 + 3 + import net.lerariemann.infinity.dimensions.RandomFeaturesList; 4 + import net.lerariemann.infinity.dimensions.features.Placement; 5 + import net.lerariemann.infinity.dimensions.features.RandomisedFeature; 6 + import net.minecraft.nbt.NbtCompound; 7 + import net.minecraft.nbt.NbtList; 8 + 9 + public class RandomPickle extends RandomisedFeature { 10 + public RandomPickle(RandomFeaturesList lst) { 11 + super(lst.parent.id, lst, "pickle"); 12 + id = "minecraft:sea_pickle"; 13 + savePlacement(); 14 + } 15 + public NbtCompound feature() { 16 + NbtCompound config = new NbtCompound(); 17 + config.putInt("count", 1 + random.nextInt(30)); 18 + return feature(config); 19 + } 20 + public NbtList placement() { 21 + Placement res = new Placement(); 22 + res.addRarityFilter(4 + random.nextInt(20)); 23 + res.addInSquare(); 24 + res.addHeightmap("OCEAN_FLOOR_WG"); 25 + res.addBiome(); 26 + return res.data; 27 + } 28 + }
+28
common/src/main/java/net/lerariemann/infinity/dimensions/features/vegetation/RandomSeagrass.java
··· 1 + package net.lerariemann.infinity.dimensions.features.vegetation; 2 + 3 + import net.lerariemann.infinity.dimensions.RandomFeaturesList; 4 + import net.lerariemann.infinity.dimensions.features.Placement; 5 + import net.lerariemann.infinity.dimensions.features.RandomisedFeature; 6 + import net.minecraft.nbt.NbtCompound; 7 + import net.minecraft.nbt.NbtList; 8 + 9 + public class RandomSeagrass extends RandomisedFeature { 10 + public RandomSeagrass(RandomFeaturesList lst) { 11 + super(lst.parent.id, lst, "seagrass"); 12 + id = "minecraft:seagrass"; 13 + savePlacement(); 14 + } 15 + public NbtCompound feature() { 16 + NbtCompound config = new NbtCompound(); 17 + config.putDouble("probability", random.nextDouble()); 18 + return feature(config); 19 + } 20 + public NbtList placement() { 21 + Placement res = new Placement(); 22 + res.addInSquare(); 23 + res.addHeightmap("OCEAN_FLOOR_WG"); 24 + res.addCount(random.nextInt(10, 100)); 25 + res.addBiome(); 26 + return res.data; 27 + } 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 - SEAGRASS("seagrass", "minecraft:seagrass_normal"), 53 52 VEG1("vegetation_part1", "minecraft:patch_sunflower"), 54 53 VEG2("vegetation_part2", "minecraft:patch_pumpkin"), 55 - VEG3("vegetation_part3", "minecraft:sea_pickle"), 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 - UNDERGROUND_ORES("undergroundores", "minecraft:ore_dirt"), 61 - UNDERGROUND_STRUCTURES("undergroundstructures", "minecraft:fossil_upper"); 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 - public static final ConfigType[] vegetation = new ConfigType[]{GRASS, SEAGRASS, VEG1, VEG2, VEG3}; 69 + public static final ConfigType[] vegetation = new ConfigType[]{GRASS, VEG1, VEG2}; 74 70 75 - public static final ConfigType[] features = new ConfigType[]{LAKES, LOCAL_MOD, TOP_LAYER, UNDERGROUND_DEC, 76 - UNDERGROUND_ORES, UNDERGROUND_STRUCTURES}; 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 - { 2 - "elements": [ 3 - { 4 - "key": "minecraft:lake_lava_underground", 5 - "weight": 0.5 6 - }, 7 - { 8 - "key": "minecraft:lake_lava_surface", 9 - "weight": 0.5 10 - } 11 - ] 12 - }
-20
common/src/main/resources/config/hardcoded/features/undergroundstructures.json
··· 1 - { 2 - "elements": [ 3 - { 4 - "key": "minecraft:fossil_upper", 5 - "weight": 0.1 6 - }, 7 - { 8 - "key": "minecraft:fossil_lower", 9 - "weight": 0.1 10 - }, 11 - { 12 - "key": "minecraft:monster_room", 13 - "weight": 0.5 14 - }, 15 - { 16 - "key": "minecraft:monster_room_deep", 17 - "weight": 0.5 18 - } 19 - ] 20 - }
-40
common/src/main/resources/config/hardcoded/vegetation/seagrass.json
··· 1 - { 2 - "elements": [ 3 - { 4 - "key": "minecraft:seagrass_cold", 5 - "weight": 1.0 6 - }, 7 - { 8 - "key": "minecraft:seagrass_normal", 9 - "weight": 1.0 10 - }, 11 - { 12 - "key": "minecraft:seagrass_warm", 13 - "weight": 1.0 14 - }, 15 - { 16 - "key": "minecraft:seagrass_deep_cold", 17 - "weight": 1.0 18 - }, 19 - { 20 - "key": "minecraft:seagrass_deep", 21 - "weight": 1.0 22 - }, 23 - { 24 - "key": "minecraft:seagrass_deep_warm", 25 - "weight": 1.0 26 - }, 27 - { 28 - "key": "minecraft:seagrass_simple", 29 - "weight": 1.0 30 - }, 31 - { 32 - "key": "minecraft:seagrass_river", 33 - "weight": 1.0 34 - }, 35 - { 36 - "key": "minecraft:seagrass_swamp", 37 - "weight": 1.0 38 - } 39 - ] 40 - }
-16
common/src/main/resources/config/hardcoded/vegetation/vegetation_part3.json
··· 1 - { 2 - "elements": [ 3 - { 4 - "key": "minecraft:sea_pickle", 5 - "weight": 0.1 6 - }, 7 - { 8 - "key": "minecraft:kelp_cold", 9 - "weight": 0.2 10 - }, 11 - { 12 - "key": "minecraft:kelp_warm", 13 - "weight": 0.2 14 - } 15 - ] 16 - }
+4 -2
common/src/main/resources/config/infinity.json
··· 1 1 { 2 - "infinity_version": 2004004, 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 + "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 - "floating_patch": 0.1 80 + "floating_patch": 0.1, 81 + "water_plants": 0.75 80 82 }, 81 83 "features_rules": { 82 84 "generate_vanilla_features": 0.5,