From 9a6abe495cf5f8c1ec7029acb99482b6b32eddd7 Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 21 Jun 2025 12:08:26 +0200 Subject: [PATCH] block cleanup #5 --- .../main/java/common/block/foliage/BlockLeaves.java | 8 +++++++- .../src/main/java/server/biome/BiomeBlackened.java | 3 ++- server/src/main/java/server/biome/BiomeForest.java | 9 +++++---- server/src/main/java/server/biome/BiomeJungle.java | 5 +++-- server/src/main/java/server/biome/BiomeTian.java | 9 +++++---- server/src/main/java/server/biome/GenBiome.java | 7 +++---- .../java/server/worldgen/foliage/WorldGenShrub.java | 9 +++++---- .../java/server/worldgen/tree/WorldGenBaseTree.java | 13 +++++++------ .../java/server/worldgen/tree/WorldGenBigTree.java | 10 +++++----- .../java/server/worldgen/tree/WorldGenBirch.java | 8 ++++---- .../java/server/worldgen/tree/WorldGenDarkOak.java | 8 ++++---- .../java/server/worldgen/tree/WorldGenHugeTree.java | 11 ++++++----- .../java/server/worldgen/tree/WorldGenJungle.java | 3 ++- .../java/server/worldgen/tree/WorldGenPine.java | 6 ++++-- .../java/server/worldgen/tree/WorldGenSavanna.java | 8 ++++---- .../java/server/worldgen/tree/WorldGenSwamp.java | 8 ++++---- .../java/server/worldgen/tree/WorldGenTaiga1.java | 8 ++++---- .../java/server/worldgen/tree/WorldGenTaiga2.java | 8 ++++---- 18 files changed, 78 insertions(+), 63 deletions(-) diff --git a/common/src/main/java/common/block/foliage/BlockLeaves.java b/common/src/main/java/common/block/foliage/BlockLeaves.java index 78d89f18..191a7dee 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -35,11 +35,16 @@ public class BlockLeaves extends BlockLeavesBase { public static final PropertyBool DECAY = PropertyBool.create("decay"); public static final List LEAVES = Lists.newArrayList(); + private static final BlockLeaves[] MAPPING = new BlockLeaves[WoodType.values().length * LeavesType.values().length]; private final WoodType type; private final LeavesType subType; int[] surroundings; + + public static BlockLeaves getLeavesBlock(WoodType type, LeavesType subType) { + return MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()]; + } public BlockLeaves(WoodType type, LeavesType subType) { @@ -53,6 +58,7 @@ public class BlockLeaves extends BlockLeavesBase this.setLightOpacity(1); this.setStepSound(SoundType.GRASS); LEAVES.add(this); + MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this; } public LeavesType getType() { @@ -91,7 +97,7 @@ public class BlockLeaves extends BlockLeavesBase public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) { - worldIn.setState(pos, BlockRegistry.getRegisteredBlock(this.type + "_leaves_" + worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)), 2); + worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)), 2); } if(Vars.leafDry && worldIn.getTemperatureC(pos) >= 50.0f) { worldIn.setState(pos, worldIn.rand.chance(40) ? Blocks.air.getState() : Blocks.dry_leaves.getState()); diff --git a/server/src/main/java/server/biome/BiomeBlackened.java b/server/src/main/java/server/biome/BiomeBlackened.java index 04383c2d..653d486e 100644 --- a/server/src/main/java/server/biome/BiomeBlackened.java +++ b/server/src/main/java/server/biome/BiomeBlackened.java @@ -4,6 +4,7 @@ import common.biome.Biome; import common.block.foliage.BlockFlower; import common.entity.npc.EntityMetalhead; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.rng.WeightedList; import common.util.BlockPos; @@ -11,7 +12,7 @@ import server.worldgen.tree.WorldGenBaseTree; import server.worldgen.tree.WorldGenTree; public class BiomeBlackened extends GenBiome { - protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), Blocks.blackwood_leaves.getState()); + protected final WorldGenTree treeGen = new WorldGenBaseTree(false, Blocks.blackwood_log.getState(), WoodType.BLACKWOOD); public BiomeBlackened() { super(Biome.BLACKENED); diff --git a/server/src/main/java/server/biome/BiomeForest.java b/server/src/main/java/server/biome/BiomeForest.java index a7e9bd5b..af373827 100755 --- a/server/src/main/java/server/biome/BiomeForest.java +++ b/server/src/main/java/server/biome/BiomeForest.java @@ -8,6 +8,7 @@ import common.entity.animal.EntityWolf; import common.entity.npc.EntityElf; import common.entity.npc.EntityWoodElf; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -35,13 +36,13 @@ public class BiomeForest extends GenBiome // protected WorldGenBigTree cherryBig; // protected WorldGenBigTree mapleBig; protected WorldGenBaseTree cherry = new WorldGenBaseTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY), - Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBaseTree maple = new WorldGenBaseTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree cherryBig = new WorldGenBigTree(false, Blocks.cherry_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY), - Blocks.cherry_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.CHERRY); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); protected WorldGenBigTree mapleBig = new WorldGenBigTree(false, Blocks.maple_log.getState(), // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE), - Blocks.maple_leaves.getState()); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); + WoodType.MAPLE); // .withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen())); public BiomeForest(Biome base, int type) { diff --git a/server/src/main/java/server/biome/BiomeJungle.java b/server/src/main/java/server/biome/BiomeJungle.java index b0a056e5..092ea23b 100755 --- a/server/src/main/java/server/biome/BiomeJungle.java +++ b/server/src/main/java/server/biome/BiomeJungle.java @@ -5,6 +5,7 @@ import common.block.foliage.BlockTallGrass; import common.entity.animal.EntityChicken; import common.entity.animal.EntityOcelot; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -21,8 +22,8 @@ import server.worldgen.tree.WorldGenTree; public class BiomeJungle extends GenBiome { private static final State LOG = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - private static final State LEAVES = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final State BUSH = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final WoodType LEAVES = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final WoodType BUSH = WoodType.OAK; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); private final boolean edge; diff --git a/server/src/main/java/server/biome/BiomeTian.java b/server/src/main/java/server/biome/BiomeTian.java index 021a9728..0bd9f78e 100755 --- a/server/src/main/java/server/biome/BiomeTian.java +++ b/server/src/main/java/server/biome/BiomeTian.java @@ -7,6 +7,7 @@ import common.entity.animal.EntityMouse; import common.entity.animal.EntityRabbit; import common.entity.npc.EntityCultivator; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.rng.WeightedList; import common.util.BlockPos; @@ -22,12 +23,12 @@ public class BiomeTian extends GenBiome { protected FeatureGenerator spikeGen = new WorldGenSpikes(Blocks.tian_soil, 128, 2, 3, Blocks.obsidian.getState(), true); protected FeatureGenerator mushroomBlueGen = new WorldGenMushroom(Blocks.blue_mushroom); - protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen1 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(6, 8); - protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen2 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(14, 20); - protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()); - protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + protected WorldGenTree treeGen3 = new WorldGenBaseTree(false, Blocks.tian_log.getState(), WoodType.TIAN); + protected WorldGenTree treeGen4 = new WorldGenBigTree(false, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(12, 15); public BiomeTian() diff --git a/server/src/main/java/server/biome/GenBiome.java b/server/src/main/java/server/biome/GenBiome.java index 04753209..ccfae42d 100755 --- a/server/src/main/java/server/biome/GenBiome.java +++ b/server/src/main/java/server/biome/GenBiome.java @@ -672,8 +672,7 @@ public abstract class GenBiome implements IBiome { WoodType type = state.getBlock() instanceof BlockSapling ? ((BlockSapling)state.getBlock()).getWoodType() : WoodType.OAK; State log = type == WoodType.CHERRY ? Blocks.cherry_log.getState() : // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.CHERRY) : (type == WoodType.MAPLE ? Blocks.maple_log.getState() /* .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.MAPLE) */ : Blocks.oak_log.getState()); - State leaves = type == WoodType.CHERRY ? Blocks.cherry_leaves.getState() : - (type == WoodType.MAPLE ? Blocks.maple_leaves.getState() : Blocks.oak_leaves.getState()); + WoodType leaves = type == WoodType.CHERRY || type == WoodType.MAPLE ? type : WoodType.OAK; FeatureGenerator worldgenerator = (FeatureGenerator)(rand.chance(10) ? new WorldGenBigTree(true, log, leaves) : new WorldGenBaseTree(true, log, leaves)); int i = 0; int j = 0; @@ -711,13 +710,13 @@ public abstract class GenBiome implements IBiome { break; case TIAN: - worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), Blocks.tian_leaves.getState()) + worldgenerator = new WorldGenBigTree(true, Blocks.tian_log.getState(), WoodType.TIAN) .setHeightLimit(6, 20); break; case JUNGLE: State iblockstate = Blocks.jungle_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); - State iblockstate1 = Blocks.jungle_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + WoodType iblockstate1 = WoodType.JUNGLE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); label269: for (i = 0; i >= -1; --i) diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java index 65d93768..5d1566a2 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenShrub.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -12,14 +13,14 @@ import server.worldgen.tree.WorldGenBaseTree; public class WorldGenShrub extends WorldGenBaseTree { - private final State leavesMetadata; + private final WoodType leavesMetadata; private final State woodMetadata; - public WorldGenShrub(State log, State leaves) + public WorldGenShrub(State log, WoodType leaves) { super(false); this.woodMetadata = log; - this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.leavesMetadata = leaves; } public boolean generate(WorldServer worldIn, Random rand, BlockPos position) @@ -57,7 +58,7 @@ public class WorldGenShrub extends WorldGenBaseTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java index 58583165..cd5cf3ba 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBaseTree.java @@ -6,6 +6,7 @@ import common.block.foliage.BlockCocoa; import common.block.foliage.BlockLeaves; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -16,29 +17,29 @@ import server.world.WorldServer; public class WorldGenBaseTree extends WorldGenTree { private static final State defLog = Blocks.oak_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); - private static final State defLeaves = Blocks.oak_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); + private static final WoodType defLeaves = WoodType.OAK; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); private final int minTreeHeight; private final boolean vinesGrow; private final State metaWood; - private final State metaLeaves; + private final WoodType metaLeaves; public WorldGenBaseTree(boolean notify) { this(notify, 4, defLog, defLeaves, false); } - public WorldGenBaseTree(boolean notify, State log, State leaves) + public WorldGenBaseTree(boolean notify, State log, WoodType leaves) { this(notify, 4, log, leaves, false); } - public WorldGenBaseTree(boolean notify, int minHeight, State log, State leaves, boolean vines) + public WorldGenBaseTree(boolean notify, int minHeight, State log, WoodType leaves, boolean vines) { super(notify); this.minTreeHeight = minHeight; this.metaWood = log; - this.metaLeaves = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.metaLeaves = leaves; this.vinesGrow = vines; } @@ -118,7 +119,7 @@ public class WorldGenBaseTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES || block.getMaterial() == Material.BUSH) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.metaLeaves, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java index 4daf686b..712dcb0a 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBigTree.java @@ -8,6 +8,7 @@ import common.block.foliage.BlockLeaves; import common.block.foliage.BlockLog; import common.collect.Lists; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -16,7 +17,7 @@ import server.world.WorldServer; public class WorldGenBigTree extends WorldGenTree { - private final State leavesBase; + private final WoodType leavesBase; private final State logBase; private Random rand; @@ -34,7 +35,7 @@ public class WorldGenBigTree extends WorldGenTree private int leafDistanceLimit = 4; List field_175948_j; - public WorldGenBigTree(boolean notify, State logBase, State leavesBase) + public WorldGenBigTree(boolean notify, State logBase, WoodType leavesBase) { super(notify); this.leavesBase = leavesBase; @@ -43,7 +44,7 @@ public class WorldGenBigTree extends WorldGenTree public WorldGenBigTree(boolean notify) { - this(notify, Blocks.oak_log.getState(), Blocks.oak_leaves.getState()); + this(notify, Blocks.oak_log.getState(), WoodType.OAK); } public WorldGenBigTree setHeightLimit(int lower, int limit) { @@ -176,8 +177,7 @@ public class WorldGenBigTree extends WorldGenTree { for (int i = 0; i < this.leafDistanceLimit; ++i) { - this.func_181631_a(pos.up(i), this.leafSize(i), this.leavesBase.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)) - .withProperty(BlockLeaves.TYPE, this.world.getLeavesGen(pos.up(i)))); + this.func_181631_a(pos.up(i), this.leafSize(i), BlockLeaves.getLeavesBlock(this.leavesBase, this.world.getLeavesGen(pos.up(i))).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java index 58bdda10..54378827 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenBirch.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenBirch.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -12,9 +13,8 @@ import server.world.WorldServer; public class WorldGenBirch extends WorldGenTree { private static final State logBlock = Blocks.birch_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH); - private static final State leavesBlock = Blocks.birch_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.BIRCH) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType leavesBlock = WoodType.BIRCH; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.BIRCH); private boolean useExtraRandomHeight; public WorldGenBirch(boolean notify, boolean extra) @@ -103,7 +103,7 @@ public class WorldGenBirch extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java index 65286b20..e8b95ac4 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenDarkOak.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -13,9 +14,8 @@ import server.world.WorldServer; public class WorldGenDarkOak extends WorldGenTree { private static final State logBlock = Blocks.dark_oak_log.getState(); // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK); - private static final State leavesBlock = Blocks.dark_oak_leaves.getState() -// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType leavesBlock = WoodType.DARK_OAK; +// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK); public WorldGenDarkOak(boolean notify) { @@ -212,7 +212,7 @@ public class WorldGenDarkOak extends WorldGenTree if (block == Blocks.air) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, leavesBlock.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(leavesBlock, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java index 05ddd76b..5f661fc6 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenHugeTree.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -18,16 +19,16 @@ public abstract class WorldGenHugeTree extends WorldGenTree protected final State woodMetadata; /** Sets the metadata for the leaves used in huge trees */ - protected final State leavesMetadata; + protected final WoodType leavesMetadata; protected int extraRandomHeight; - public WorldGenHugeTree(boolean notify, int base, int extra, State log, State leaves) + public WorldGenHugeTree(boolean notify, int base, int extra, State log, WoodType leaves) { super(notify); this.baseHeight = base; this.extraRandomHeight = extra; this.woodMetadata = log; - this.leavesMetadata = leaves.withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + this.leavesMetadata = leaves; } protected int func_150533_a(Random p_150533_1_) @@ -123,7 +124,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } @@ -145,7 +146,7 @@ public abstract class WorldGenHugeTree extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(this.leavesMetadata, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java index ba30cdb2..03e15476 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenJungle.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenJungle.java @@ -2,6 +2,7 @@ package server.worldgen.tree; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -11,7 +12,7 @@ import server.world.WorldServer; public class WorldGenJungle extends WorldGenHugeTree { - public WorldGenJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, State p_i46448_4_, State p_i46448_5_) + public WorldGenJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, State p_i46448_4_, WoodType p_i46448_5_) { super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_); } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenPine.java b/server/src/main/java/server/worldgen/tree/WorldGenPine.java index 26b98200..9f424a93 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenPine.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenPine.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.natural.BlockDirt; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.ExtMath; @@ -13,8 +14,9 @@ import server.world.WorldServer; public class WorldGenPine extends WorldGenHugeTree { private static final State field_181633_e = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181634_f = Blocks.spruce_leaves.getState(); // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); - private static final State field_181635_g = Blocks.dirt.getState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); + private static final WoodType field_181634_f = WoodType.SPRUCE; // .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); // .withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final State field_181635_g = Blocks.podzol.getState(); + private boolean useBaseHeight; public WorldGenPine(boolean p_i45457_1_, boolean p_i45457_2_) diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java index dfd389b5..757f98d4 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSavanna.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.util.Facing; @@ -14,9 +15,8 @@ public class WorldGenSavanna extends WorldGenTree { private static final State field_181643_a = Blocks.acacia_log.getState(); // .withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA); - private static final State field_181644_b = Blocks.acacia_leaves.getState() -// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181644_b = WoodType.ACACIA; +// .withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA); public WorldGenSavanna(boolean p_i45463_1_) { @@ -213,7 +213,7 @@ public class WorldGenSavanna extends WorldGenTree if (block == Blocks.air || block.getMaterial() == Material.LEAVES) { - this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(p_175924_2_))); + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, BlockLeaves.getLeavesBlock(field_181644_b, worldIn.getLeavesGen(p_175924_2_)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java index 276ed3cb..ceaf681b 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenSwamp.java @@ -5,6 +5,7 @@ import common.block.Material; import common.block.foliage.BlockLeaves; import common.block.foliage.BlockVine; import common.init.Blocks; +import common.init.WoodType; import common.properties.PropertyBool; import common.rng.Random; import common.util.BlockPos; @@ -15,9 +16,8 @@ public class WorldGenSwamp extends WorldGenTree { private static final State field_181648_a = Blocks.oak_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); - private static final State field_181649_b = Blocks.oak_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181649_b = WoodType.OAK; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK); public WorldGenSwamp() { @@ -112,7 +112,7 @@ public class WorldGenSwamp extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181649_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java index 2ae38594..efb87ba1 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga1.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -13,9 +14,8 @@ public class WorldGenTaiga1 extends WorldGenTree { private static final State field_181636_a = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181637_b = Blocks.spruce_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181637_b = WoodType.SPRUCE; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); public WorldGenTaiga1() { @@ -95,7 +95,7 @@ public class WorldGenTaiga1 extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181637_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } } diff --git a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java index ba017a36..78f01240 100755 --- a/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java +++ b/server/src/main/java/server/worldgen/tree/WorldGenTaiga2.java @@ -4,6 +4,7 @@ import common.block.Block; import common.block.Material; import common.block.foliage.BlockLeaves; import common.init.Blocks; +import common.init.WoodType; import common.rng.Random; import common.util.BlockPos; import common.world.State; @@ -13,9 +14,8 @@ public class WorldGenTaiga2 extends WorldGenTree { private static final State field_181645_a = Blocks.spruce_log.getState(); // .withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); - private static final State field_181646_b = Blocks.spruce_leaves.getState() -// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE) - .withProperty(BlockLeaves.DECAY, Boolean.valueOf(false)); + private static final WoodType field_181646_b = WoodType.SPRUCE; +// .withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE); public WorldGenTaiga2(boolean p_i2025_1_) { @@ -101,7 +101,7 @@ public class WorldGenTaiga2 extends WorldGenTree if (!worldIn.getState(blockpos).getBlock().isFullBlock()) { - this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b.withProperty(BlockLeaves.TYPE, worldIn.getLeavesGen(blockpos))); + this.setBlockAndNotifyAdequately(worldIn, blockpos, BlockLeaves.getLeavesBlock(field_181646_b, worldIn.getLeavesGen(blockpos)).getState().withProperty(BlockLeaves.DECAY, Boolean.valueOf(false))); } } }