diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index f6478d4cb..646a8fb9d 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -239,6 +239,16 @@ editable-signs * **default**: true * **description**: Ability to edit signs by right clicking them with another sign in hand +bamboo +~~~~~~ +* max-height: + - **default**: 16 + - **description**: Maximum height bamboo may grow to + +* small-height: + - **default**: 10 + - **description**: Maximum height bamboo may be small thickness + campfire-obeys-gravity ~~~~~~~~~~~~~~~~~~~~~~ * **default**: true diff --git a/patches/server/0057-Implement-bamboo-growth-settings.patch b/patches/server/0057-Implement-bamboo-growth-settings.patch new file mode 100644 index 000000000..1d018113f --- /dev/null +++ b/patches/server/0057-Implement-bamboo-growth-settings.patch @@ -0,0 +1,89 @@ +From 88a916a3fcbe9b2fdfcdaa376a6232ce696b318d Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Fri, 23 Aug 2019 20:57:29 -0500 +Subject: [PATCH] Implement bamboo growth settings + +--- + src/main/java/net/minecraft/server/BlockBamboo.java | 12 ++++++------ + src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 7 +++++++ + 2 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java +index d94368b03..24f7c1683 100644 +--- a/src/main/java/net/minecraft/server/BlockBamboo.java ++++ b/src/main/java/net/minecraft/server/BlockBamboo.java +@@ -89,7 +89,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + if (world.random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmpty(blockposition.up()) && world.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot + int i = this.b((IBlockAccess) world, blockposition) + 1; + +- if (i < 16) { ++ if (i < world.purpurConfig.bambooMaxHeight) { // Purpur + this.a(iblockdata, world, blockposition, random, i); + } + } +@@ -120,7 +120,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + int i = this.a(iblockaccess, blockposition); + int j = this.b(iblockaccess, blockposition); + +- return i + j + 1 < 16 && (Integer) iblockaccess.getType(blockposition.up(i)).get(BlockBamboo.f) != 1; ++ return i + j + 1 < ((World) iblockaccess).purpurConfig.bambooMaxHeight && (Integer) iblockaccess.getType(blockposition.up(i)).get(BlockBamboo.f) != 1; // Purpur + } + + @Override +@@ -139,7 +139,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + BlockPosition blockposition1 = blockposition.up(i); + IBlockData iblockdata1 = world.getType(blockposition1); + +- if (k >= 16 || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !world.isEmpty(blockposition1.up())) { ++ if (k >= world.purpurConfig.bambooMaxHeight || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !world.isEmpty(blockposition1.up())) { // Purpur + return; + } + +@@ -185,7 +185,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + } + + int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && iblockdata2.getBlock() != Blocks.BAMBOO ? 0 : 1; +- int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1; ++ int k = (i <= world.purpurConfig.bambooSmallHeight || random.nextFloat() >= 0.25F) && i != (world.purpurConfig.bambooMaxHeight - 1) ? 0 : 1; // Purpur + + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) { +@@ -200,7 +200,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) { + int i; + +- for (i = 0; i < 16 && iblockaccess.getType(blockposition.up(i + 1)).getBlock() == Blocks.BAMBOO; ++i) { ++ for (i = 0; i < ((World) iblockaccess).purpurConfig.bambooMaxHeight && iblockaccess.getType(blockposition.up(i + 1)).getBlock() == Blocks.BAMBOO; ++i) { // Purpur + ; + } + +@@ -210,7 +210,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { + protected int b(IBlockAccess iblockaccess, BlockPosition blockposition) { + int i; + +- for (i = 0; i < 16 && iblockaccess.getType(blockposition.down(i + 1)).getBlock() == Blocks.BAMBOO; ++i) { ++ for (i = 0; i < ((World) iblockaccess).purpurConfig.bambooMaxHeight && iblockaccess.getType(blockposition.down(i + 1)).getBlock() == Blocks.BAMBOO; ++i) { // Purpur + ; + } + +diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +index f4fc0b014..2ecf5f9eb 100644 +--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java ++++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java +@@ -67,6 +67,13 @@ public class PurpurWorldConfig { + editableSigns = getBoolean("editable-signs", editableSigns); + } + ++ public int bambooMaxHeight = 16; ++ public int bambooSmallHeight = 10; ++ private void bambooSettings() { ++ bambooMaxHeight = getInt("bamboo.max-height", bambooMaxHeight); ++ bambooSmallHeight = getInt("bamboo.small-height", bambooSmallHeight); ++ } ++ + public boolean campfireObeysGravity = true; + private void campfireObeysGravity() { + campfireObeysGravity = getBoolean("campfire-obeys-gravity", campfireObeysGravity); +-- +2.23.0.rc1 +