Files
Purpur/patches/server/0052-Implement-bamboo-growth-settings.patch
William Blake Galbreath 193c511fce Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly

Paper Changes:
a4f066cc Fix method profiler inbalance introduced in a2a9ffe (#3132)
c65dcad3 Don't delay chunk unloads during entity ticking
bc17ce69 Delay unsafe actions until after entity ticking is done - Fixes #3114
5553e6b3 Disable Sync Events firing Async errors during shutdown
e12c51d9 Use better variable for isStopping() API
586ee2bb Remove patch for MC-111480, fixed in 1.14
09a94215 Remove streams from Mob AI System
bb5c294e Fix Disabling Asynchronous Chunks
089d8356 Implement Chunk Priority / Urgency System for World Gen
fce69af7 Use dedicated thread for main thread blocking chunk loads
588b62e4 Add tick times API and /mspt command (#3102)
11de41c7 Add API MinecraftServer#isStopping (#3129)
942ff3c2 My patches are under MIT (#3130)
2020-04-12 03:45:54 -05:00

99 lines
5.6 KiB
Diff

From e763204c910ac50b29391bcdd9f0310d903621a0 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 23 Aug 2019 20:57:29 -0500
Subject: [PATCH] Implement bamboo growth settings
---
.../java/net/minecraft/server/BlockBamboo.java | 14 +++++++-------
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 7 +++++++
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java
index 02c548dd9c..016ceebb9d 100644
--- a/src/main/java/net/minecraft/server/BlockBamboo.java
+++ b/src/main/java/net/minecraft/server/BlockBamboo.java
@@ -10,7 +10,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
protected static final VoxelShape c = Block.a(6.5D, 0.0D, 6.5D, 9.5D, 16.0D, 9.5D);
public static final BlockStateInteger d = BlockProperties.Y;
public static final BlockStateEnum<BlockPropertyBambooSize> e = BlockProperties.aG;
- public static final BlockStateInteger f = BlockProperties.au;
+ public static final BlockStateInteger f = BlockProperties.au; private BlockStateInteger stage() { return f; } // Purpur - OBFHELPER
public BlockBamboo(Block.Info block_info) {
super(block_info);
@@ -89,7 +89,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot
int i = this.b(worldserver, blockposition) + 1;
- if (i < 16) {
+ if (i < worldserver.purpurConfig.bambooMaxHeight) { // Purpur
this.a(iblockdata, (World) worldserver, 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 && iblockaccess.getType(blockposition.up(i)).get(stage()) != 1; // Purpur
}
@Override
@@ -139,7 +139,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
BlockPosition blockposition1 = blockposition.up(i);
IBlockData iblockdata1 = worldserver.getType(blockposition1);
- if (k >= 16 || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) {
+ if (k >= worldserver.purpurConfig.bambooMaxHeight || iblockdata1.get(stage()) == 1 || !worldserver.isEmpty(blockposition1.up())) { // Purpur
return;
}
@@ -180,7 +180,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)) {
@@ -195,7 +195,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
;
}
@@ -205,7 +205,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 da12d94601..829ab945fa 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -72,6 +72,13 @@ public class PurpurWorldConfig {
return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
}
+ public int bambooMaxHeight = 16;
+ public int bambooSmallHeight = 10;
+ private void bambooSettings() {
+ bambooMaxHeight = getInt("blocks.bamboo.max-height", bambooMaxHeight);
+ bambooSmallHeight = getInt("blocks.bamboo.small-height", bambooSmallHeight);
+ }
+
public int campfireRegenInterval = 0;
public int campfireRegenDuration = 80;
public int campfireRegenRange = 5;
--
2.24.0