From d5b95a2832432cebec3d276300e624e37eb4bb8e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 28 Jul 2018 08:41:45 +1000 Subject: [PATCH] Fix growing large dark oak trees --- nms-patches/WorldGenMegaTreeProvider.patch | 20 +------- nms-patches/WorldGenTreeProvider.patch | 53 ++++++++++++++-------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/nms-patches/WorldGenMegaTreeProvider.patch b/nms-patches/WorldGenMegaTreeProvider.patch index 66577618f3..74037fdd08 100644 --- a/nms-patches/WorldGenMegaTreeProvider.patch +++ b/nms-patches/WorldGenMegaTreeProvider.patch @@ -1,26 +1,10 @@ --- a/net/minecraft/server/WorldGenMegaTreeProvider.java +++ b/net/minecraft/server/WorldGenMegaTreeProvider.java -@@ -2,6 +2,7 @@ - - import java.util.Random; - import javax.annotation.Nullable; -+import org.bukkit.TreeType; // CraftBukkit - - public abstract class WorldGenMegaTreeProvider extends WorldGenTreeProvider { - -@@ -28,6 +29,15 @@ +@@ -28,6 +28,7 @@ if (worldgentreeabstract == null) { return false; } else { -+ // CraftBukkit start -+ if (worldgentreeabstract instanceof WorldGenJungleTree) { -+ BlockSapling.treeType = TreeType.JUNGLE; -+ } else if (worldgentreeabstract instanceof WorldGenMegaTree) { -+ BlockSapling.treeType = TreeType.MEGA_REDWOOD; -+ } else { -+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract); -+ } -+ // CraftBukkit end ++ setTreeType(worldgentreeabstract); // CraftBukkit IBlockData iblockdata1 = Blocks.AIR.getBlockData(); generatoraccess.setTypeAndData(blockposition.a(i, 0, j), iblockdata1, 4); diff --git a/nms-patches/WorldGenTreeProvider.patch b/nms-patches/WorldGenTreeProvider.patch index 41d9998c33..ba2116c74c 100644 --- a/nms-patches/WorldGenTreeProvider.patch +++ b/nms-patches/WorldGenTreeProvider.patch @@ -8,29 +8,42 @@ public abstract class WorldGenTreeProvider { -@@ -16,6 +17,25 @@ +@@ -16,6 +17,7 @@ if (worldgentreeabstract == null) { return false; } else { -+ // CraftBukkit start -+ if (worldgentreeabstract instanceof WorldGenAcaciaTree) { -+ BlockSapling.treeType = TreeType.ACACIA; -+ } else if (worldgentreeabstract instanceof WorldGenBigTree) { -+ BlockSapling.treeType = TreeType.BIG_TREE; -+ } else if (worldgentreeabstract instanceof WorldGenForest) { -+ BlockSapling.treeType = TreeType.BIRCH; -+ } else if (worldgentreeabstract instanceof WorldGenForestTree) { -+ BlockSapling.treeType = TreeType.DARK_OAK; -+ } else if (worldgentreeabstract instanceof WorldGenTaiga1) { -+ BlockSapling.treeType = TreeType.REDWOOD; -+ } else if (worldgentreeabstract instanceof WorldGenTaiga2) { -+ BlockSapling.treeType = TreeType.REDWOOD; -+ } else if (worldgentreeabstract instanceof WorldGenTrees) { -+ BlockSapling.treeType = TreeType.TREE; -+ } else { -+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract); -+ } -+ // CraftBukkit end ++ setTreeType(worldgentreeabstract); // CraftBukkit generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4); if (worldgentreeabstract.generate(generatoraccess, generatoraccess.getChunkProvider().getChunkGenerator(), random, blockposition, WorldGenFeatureConfiguration.e)) { return true; +@@ -25,4 +27,30 @@ + } + } + } ++ ++ // CraftBukkit start ++ protected void setTreeType(WorldGenTreeAbstract worldgentreeabstract) { ++ if (worldgentreeabstract instanceof WorldGenAcaciaTree) { ++ BlockSapling.treeType = TreeType.ACACIA; ++ } else if (worldgentreeabstract instanceof WorldGenBigTree) { ++ BlockSapling.treeType = TreeType.BIG_TREE; ++ } else if (worldgentreeabstract instanceof WorldGenForest) { ++ BlockSapling.treeType = TreeType.BIRCH; ++ } else if (worldgentreeabstract instanceof WorldGenForestTree) { ++ BlockSapling.treeType = TreeType.DARK_OAK; ++ } else if (worldgentreeabstract instanceof WorldGenJungleTree) { ++ BlockSapling.treeType = TreeType.JUNGLE; ++ } else if (worldgentreeabstract instanceof WorldGenMegaTree) { ++ BlockSapling.treeType = TreeType.MEGA_REDWOOD; ++ } else if (worldgentreeabstract instanceof WorldGenTaiga1) { ++ BlockSapling.treeType = TreeType.REDWOOD; ++ } else if (worldgentreeabstract instanceof WorldGenTaiga2) { ++ BlockSapling.treeType = TreeType.REDWOOD; ++ } else if (worldgentreeabstract instanceof WorldGenTrees) { ++ BlockSapling.treeType = TreeType.TREE; ++ } else { ++ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract); ++ } ++ } ++ // CraftBukkit end + }