mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
90 lines
5.0 KiB
Diff
90 lines
5.0 KiB
Diff
From b5225a87d8287f91f4e06ce13c54f98cb0118c78 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
|
|
|
|
---
|
|
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 14790c167..bac1b8b30 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockBamboo.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockBamboo.java
|
|
@@ -97,7 +97,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);
|
|
}
|
|
}
|
|
@@ -128,7 +128,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(BlockBamboo.f) != 1; // Purpur
|
|
}
|
|
|
|
@Override
|
|
@@ -147,7 +147,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(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) { // Purpur
|
|
return;
|
|
}
|
|
|
|
@@ -188,7 +188,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
|
}
|
|
|
|
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(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)) {
|
|
@@ -203,7 +203,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)).a(Blocks.BAMBOO); ++i) {
|
|
+ for (i = 0; i < ((World) iblockaccess).purpurConfig.bambooMaxHeight && iblockaccess.getType(blockposition.up(i + 1)).a(Blocks.BAMBOO); ++i) { // Purpur
|
|
;
|
|
}
|
|
|
|
@@ -213,7 +213,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)).a(Blocks.BAMBOO); ++i) {
|
|
+ for (i = 0; i < ((World) iblockaccess).purpurConfig.bambooMaxHeight && iblockaccess.getType(blockposition.down(i + 1)).a(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 abfa1d79b..f21b01565 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -148,6 +148,13 @@ public class PurpurWorldConfig {
|
|
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
|
}
|
|
|
|
+ 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 boolean dispenserApplyCursedArmor = true;
|
|
private void dispenserSettings() {
|
|
dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
|
--
|
|
2.26.2
|
|
|