diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ColdSteppe.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ColdSteppe.java index a164a0c..e114c54 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ColdSteppe.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ColdSteppe.java @@ -33,27 +33,30 @@ import net.minecraft.world.IWorldReader; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; +import net.minecraft.world.gen.feature.structure.VillageConfig; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; public class ColdSteppe extends BiomeVariant { public ColdSteppe() { super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(RainType.SNOW).category(Biome.Category.TAIGA).depth(0.2F).scale(0.25F).temperature(0.2F).downfall(0.1F).waterColor(4159204).waterFogColor(329011).parent((String) null)); + this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/taiga/town_centers", 6))); + this.addStructure(Feature.PILLAGER_OUTPOST.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); DefaultBiomeFeatures.addTaigaLargeFerns(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); -// DefaultBiomeFeatures.addTaigaConifers(this); -// DefaultBiomeFeatures.addDefaultFlowers(this); DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addVeryDenseGrass(this); -// DefaultBiomeFeatures.addMushrooms(this); -// DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); DefaultBiomeFeatures.addBerryBushes(this); DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Marshland.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Marshland.java index 35e77b3..2e17f27 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Marshland.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Marshland.java @@ -33,6 +33,9 @@ import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.gen.GenerationStage; import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; import net.minecraft.world.gen.placement.FrequencyConfig; import net.minecraft.world.gen.placement.HeightWithChanceConfig; import net.minecraft.world.gen.placement.Placement; @@ -41,7 +44,8 @@ import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; public class Marshland extends BiomeVariant { public Marshland() { super((new Builder()).surfaceBuilder(SurfaceBuilder.SWAMP, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(RainType.RAIN).category(Category.SWAMP).depth(0.2F).scale(0.2F).temperature(0.8F).downfall(0.4F).waterColor(6388580).waterFogColor(2302743).parent((String) null)); - this.setRegistryName("terraforged", "marshland"); + this.addStructure(Feature.SWAMP_HUT.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); DefaultBiomeFeatures.addMonsterRooms(this); @@ -74,6 +78,7 @@ public class Marshland extends BiomeVariant { this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + this.setRegistryName("terraforged", "marshland"); } public int getGrassColor(double p_225528_1_, double p_225528_3_) { diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SavannaScrub.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SavannaScrub.java index 854d14d..3ce4ee9 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SavannaScrub.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SavannaScrub.java @@ -35,6 +35,11 @@ import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.Heightmap; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; +import net.minecraft.world.gen.feature.structure.VillageConfig; import net.minecraft.world.gen.surfacebuilders.DefaultSurfaceBuilder; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig; @@ -45,26 +50,23 @@ public class SavannaScrub extends BiomeVariant { public SavannaScrub() { super((new Biome.Builder()).surfaceBuilder(new Builder(), SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(Biome.RainType.NONE).category(Biome.Category.SAVANNA).depth(0.125F).scale(0.05F).temperature(1.2F).downfall(0.0F).waterColor(4159204).waterFogColor(329011).parent((String) null)); - this.setRegistryName("terraforged", "savanna_scrub"); + this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/savanna/town_centers", 6))); + this.addStructure(Feature.PILLAGER_OUTPOST.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); DefaultBiomeFeatures.addTallGrass(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); -// DefaultBiomeFeatures.addSavannaTrees(this); DefaultBiomeFeatures.addExtraDefaultFlowers(this); - // func_222339_L - add grasses - add this a few times since there are no trees DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addVeryDenseGrass(this); - DefaultBiomeFeatures.addMushrooms(this); DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); -// DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 10, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.CHICKEN, 10, 4, 4)); @@ -80,6 +82,7 @@ public class SavannaScrub extends BiomeVariant { this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + this.setRegistryName("terraforged", "savanna_scrub"); } @Override diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ShatteredSavannaScrub.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ShatteredSavannaScrub.java index d39ca20..2121706 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ShatteredSavannaScrub.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/ShatteredSavannaScrub.java @@ -35,6 +35,10 @@ import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.Heightmap; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; import net.minecraft.world.gen.surfacebuilders.DefaultSurfaceBuilder; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilderConfig; @@ -44,24 +48,19 @@ import java.util.Random; public class ShatteredSavannaScrub extends BiomeVariant { public ShatteredSavannaScrub() { super((new Biome.Builder()).surfaceBuilder(new Builder(), SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(Biome.RainType.NONE).category(Biome.Category.SAVANNA).depth(0.3625F).scale(1.225F).temperature(1.1F).downfall(0.0F).waterColor(4159204).waterFogColor(329011).parent("terraforged:savanna_scrub")); - this.setRegistryName("terraforged", "shattered_savanna_scrub"); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); -// DefaultBiomeFeatures.addShatteredSavannaTrees(this); DefaultBiomeFeatures.addDefaultFlowers(this); - - // func_222314_K - addGrasses - add this a few times since there are no trees DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addVeryDenseGrass(this); - DefaultBiomeFeatures.addMushrooms(this); DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 10, 4, 4)); @@ -78,6 +77,7 @@ public class ShatteredSavannaScrub extends BiomeVariant { this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new Biome.SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + this.setRegistryName("terraforged", "shattered_savanna_scrub"); } @Override diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SnowyTaigaScrub.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SnowyTaigaScrub.java index 7f23b7a..84ab46c 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SnowyTaigaScrub.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/SnowyTaigaScrub.java @@ -31,27 +31,30 @@ import net.minecraft.entity.EntityType; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; public class SnowyTaigaScrub extends BiomeVariant { public SnowyTaigaScrub() { super((new Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(RainType.SNOW).category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(-0.5F).downfall(0.4F).waterColor(4020182).waterFogColor(329011).parent((String) null)); - this.setRegistryName("terraforged", "snowy_taiga_scrub"); + this.addStructure(Feature.IGLOO.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); DefaultBiomeFeatures.addTaigaLargeFerns(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); -// DefaultBiomeFeatures.addTaigaConifers(this); DefaultBiomeFeatures.addDefaultFlowers(this); DefaultBiomeFeatures.addTaigaGrassAndMushrooms(this); DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addMushrooms(this); DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); DefaultBiomeFeatures.addSparseBerryBushes(this); DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); @@ -70,6 +73,7 @@ public class SnowyTaigaScrub extends BiomeVariant { this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + this.setRegistryName("terraforged", "snowy_taiga_scrub"); } @Override diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Steppe.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Steppe.java index a6bbc55..e85f77d 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Steppe.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/Steppe.java @@ -33,29 +33,29 @@ import net.minecraft.world.IWorldReader; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; +import net.minecraft.world.gen.feature.structure.VillageConfig; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; public class Steppe extends BiomeVariant { protected Steppe() { super((new Biome.Builder()).surfaceBuilder(SurfaceBuilder.GIANT_TREE_TAIGA, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(RainType.SNOW).category(Category.SAVANNA).depth(0.2F).scale(0.2F).temperature(0.7F).downfall(0.1F).waterColor(4159204).waterFogColor(329011).parent((String) null)); + this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/savanna/town_centers", 6))); + this.addStructure(Feature.PILLAGER_OUTPOST.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); -// DefaultBiomeFeatures.addTaigaRocks(this); -// DefaultBiomeFeatures.addTaigaLargeFerns(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); - // extra grasses as no trees/ferns DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addVeryDenseGrass(this); -// DefaultBiomeFeatures.func_222285_H(this); -// DefaultBiomeFeatures.addDefaultFlowers(this); -// DefaultBiomeFeatures.addMushrooms(this); -// DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); this.addSpawn(EntityClassification.CREATURE, new Biome.SpawnListEntry(EntityType.PIG, 10, 4, 4)); diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/TaigaScrub.java b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/TaigaScrub.java index b735217..c6d3985 100644 --- a/TerraForgedMod/src/main/java/com/terraforged/mod/biome/TaigaScrub.java +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/biome/TaigaScrub.java @@ -31,31 +31,33 @@ import net.minecraft.entity.EntityType; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biomes; import net.minecraft.world.biome.DefaultBiomeFeatures; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.gen.feature.structure.MineshaftConfig; +import net.minecraft.world.gen.feature.structure.MineshaftStructure; +import net.minecraft.world.gen.feature.structure.VillageConfig; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; public class TaigaScrub extends BiomeVariant { public TaigaScrub() { super((new Builder()).surfaceBuilder(SurfaceBuilder.DEFAULT, SurfaceBuilder.GRASS_DIRT_GRAVEL_CONFIG).precipitation(RainType.RAIN).category(Category.TAIGA).depth(0.2F).scale(0.2F).temperature(0.25F).downfall(0.8F).waterColor(4159204).waterFogColor(329011).parent((String) null)); - this.setRegistryName("terraforged", "taiga_scrub"); + this.addStructure(Feature.VILLAGE.withConfiguration(new VillageConfig("village/taiga/town_centers", 6))); + this.addStructure(Feature.PILLAGER_OUTPOST.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); + this.addStructure(Feature.MINESHAFT.withConfiguration(new MineshaftConfig(0.004D, MineshaftStructure.Type.NORMAL))); + this.addStructure(Feature.STRONGHOLD.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG)); DefaultBiomeFeatures.addCarvers(this); DefaultBiomeFeatures.addStructures(this); -// DefaultBiomeFeatures.addLakes(this); DefaultBiomeFeatures.addMonsterRooms(this); DefaultBiomeFeatures.addTaigaLargeFerns(this); DefaultBiomeFeatures.addStoneVariants(this); DefaultBiomeFeatures.addOres(this); DefaultBiomeFeatures.addSedimentDisks(this); -// DefaultBiomeFeatures.addTaigaConifers(this); DefaultBiomeFeatures.addDefaultFlowers(this); DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addVeryDenseGrass(this); - - // extra grass since there are no trees DefaultBiomeFeatures.addGrass(this); DefaultBiomeFeatures.addGrass(this); - DefaultBiomeFeatures.addReedsAndPumpkins(this); -// DefaultBiomeFeatures.addSprings(this); DefaultBiomeFeatures.addBerryBushes(this); DefaultBiomeFeatures.addFreezeTopLayer(this); this.addSpawn(EntityClassification.CREATURE, new SpawnListEntry(EntityType.SHEEP, 12, 4, 4)); @@ -74,6 +76,7 @@ public class TaigaScrub extends BiomeVariant { this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.SLIME, 100, 4, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.ENDERMAN, 10, 1, 4)); this.addSpawn(EntityClassification.MONSTER, new SpawnListEntry(EntityType.WITCH, 5, 1, 1)); + this.setRegistryName("terraforged", "taiga_scrub"); } @Override diff --git a/TerraForgedMod/src/main/java/com/terraforged/mod/util/NBTLeavesFixer.java b/TerraForgedMod/src/main/java/com/terraforged/mod/util/NBTLeavesFixer.java new file mode 100644 index 0000000..099b0b4 --- /dev/null +++ b/TerraForgedMod/src/main/java/com/terraforged/mod/util/NBTLeavesFixer.java @@ -0,0 +1,102 @@ +package com.terraforged.mod.util; + +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.INBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.StringNBT; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; + +public class NBTLeavesFixer { + + public static void main(String[] args) { + RuleSet ruleSet = new RuleSet(); + ruleSet.put("persistent", new Rule("true", "false")); + String path = "H:\\Projects\\TerraForged\\TerraForgedMod\\src\\main\\resources\\data\\terraforged\\structures\\trees"; + visit(new File(path), ruleSet); + } + + public static void visit(File file, RuleSet ruleSet) { + if (file.isDirectory()) { + for (File f : file.listFiles()) { + visit(f, ruleSet); + } + } else if (file.getName().endsWith(".nbt")) { + try { + System.out.println("Opening file: " + file); + CompoundNBT value; + INBT result; + try (InputStream in = new FileInputStream(file)) { + value = CompressedStreamTools.readCompressed(in); + result = modify("", value, ruleSet); + if (value == result) { + return; + } + } + System.out.println("Writing file: " + file); + try (OutputStream out = new FileOutputStream(file)) { + CompressedStreamTools.writeCompressed((CompoundNBT) result, out); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private static INBT modify(String name, INBT nbt, RuleSet ruleSet) { + if (nbt instanceof CompoundNBT) { + CompoundNBT map = (CompoundNBT) nbt; + boolean change = false; + for (String key : map.keySet()) { + INBT value = map.get(key); + INBT result = modify(key, value, ruleSet); + map.put(key, result); + change |= value != result; + } + return change ? map.copy() : map; + } else if (nbt instanceof ListNBT) { + ListNBT list = (ListNBT) nbt; + boolean change = false; + for (int i = 0; i < list.size(); i++) { + INBT value = list.get(i); + INBT result = modify(name + "[" + i + "]", value, ruleSet); + list.set(i, result); + change |= result != value; + } + return change ? list.copy() : list; + } else { + Rule rule = ruleSet.get(name); + if (rule == null) { + return nbt; + } + if (nbt instanceof StringNBT) { + String value = nbt.getString(); + if (value.equals(rule.match)) { + System.out.println(" Replaced value for: " + name); + return StringNBT.valueOf(rule.replace.toString()); + } + } + return nbt; + } + } + + private static class RuleSet extends HashMap {} + + private static class Rule { + + private final Object match; + private final Object replace; + + private Rule(Object match, Object replace) { + this.match = match; + this.replace = replace; + } + } +} diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_1.nbt index 4c39cfd..25bfaa9 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_2.nbt index 9202c79..88b159b 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/dark_oak/small/dark_oak_bush_2.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_1.nbt index 533df04..f6e7ddc 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_2.nbt index 0b86d6b..557b4b4 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_2.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_3.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_3.nbt index 31b9186..a9068dc 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_3.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_3.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_4.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_4.nbt index eb1f0f2..32bcd61 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_4.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_4.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_5.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_5.nbt index ac2da9d..842471c 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_5.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_5.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_6.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_6.nbt index 398d72c..77e8e14 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_6.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/huge/jungle_massive_6.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_1.nbt index 6f0516a..975566d 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_2.nbt index 76ff007..e298e80 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_2.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_3.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_3.nbt index ca3719c..7ebb022 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_3.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_3.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_4.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_4.nbt index cc3a06f..a3abdbc 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_4.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/jungle/large/jungle_tall_4.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/oak/huge/oak_big_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/oak/huge/oak_big_1.nbt index 7f40e0b..06387f7 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/oak/huge/oak_big_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/oak/huge/oak_big_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_1.nbt index d261f77..844a9e4 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_2.nbt index 35f97ba..7183b7a 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_2.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_3.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_3.nbt index 438ed8f..7f7417f 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_3.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_3.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_4.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_4.nbt index 1b8af9b..4ce6494 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_4.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_4.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_5.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_5.nbt index b405fc5..377d1f6 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_5.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_5.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_6.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_6.nbt index d12955d..0db8d0c 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_6.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/huge/redwood_massive_6.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/large/redwood_tall_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/large/redwood_tall_1.nbt index f662868..f548aa5 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/large/redwood_tall_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/redwood/large/redwood_tall_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_1.nbt index 5ec0972..9773995 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_2.nbt index 3e43aa5..00b6325 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/spruce/bush/spruce_bush_2.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_1.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_1.nbt index 9ca0260..52b80b3 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_1.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_1.nbt differ diff --git a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_2.nbt b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_2.nbt index b5852e6..2f46f61 100644 Binary files a/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_2.nbt and b/TerraForgedMod/src/main/resources/data/terraforged/structures/trees/willow/large/weeping_willow_big_2.nbt differ