forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Zach Brown <[email protected]> | ||
Date: Tue, 1 Mar 2016 13:02:51 -0600 | ||
Subject: [PATCH] Configurable cactus bamboo and reed growth heights | ||
Subject: [PATCH] Configurable cactus bamboo and reed growth height | ||
|
||
Bamboo - Both the minimum fully-grown heights and the maximum are configurable | ||
Bamboo - Both the minimum fully-grown height and the maximum are configurable | ||
- Machine_Maker | ||
|
||
diff --git a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java | ||
index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c17ebd304d 100644 | ||
index bd72deadb59289ae90afc379ee61e8198ddaf4ed..e8dc4ea90d74036dacb0785fcb9125df192a4c22 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java | ||
@@ -137,7 +137,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { | ||
if (random.nextFloat() < (world.spigotConfig.bambooModifier / (100.0f * 3)) && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - SPIGOT-7159: Better modifier resolution | ||
int i = this.getHeightBelowUpToMax(world, pos) + 1; | ||
|
||
- if (i < 16) { | ||
+ if (i < world.paperConfig().maxGrowthHeight.bamboo.max) { // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ if (i < world.paperConfig().maxGrowthHeight.bamboo.max) { // Paper - Configurable cactus/bamboo/reed growth height | ||
this.growBamboo(state, world, pos, random, i); | ||
} | ||
} | ||
|
@@ -24,7 +24,7 @@ index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c1 | |
int j = this.getHeightBelowUpToMax(world, pos); | ||
|
||
- return i + j + 1 < 16 && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; | ||
+ return i + j + 1 < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ return i + j + 1 < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && (Integer) world.getBlockState(pos.above(i)).getValue(BambooStalkBlock.STAGE) != 1; // Paper - Configurable cactus/bamboo/reed growth height | ||
} | ||
|
||
@Override | ||
|
@@ -33,7 +33,7 @@ index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c1 | |
BlockState iblockdata1 = world.getBlockState(blockposition1); | ||
|
||
- if (k >= 16 || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here | ||
+ if (k >= world.paperConfig().maxGrowthHeight.bamboo.max || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ if (k >= world.paperConfig().maxGrowthHeight.bamboo.max || !iblockdata1.is(Blocks.BAMBOO) || (Integer) iblockdata1.getValue(BambooStalkBlock.STAGE) == 1 || !world.isEmptyBlock(blockposition1.above())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus/bamboo/reed growth height | ||
return; | ||
} | ||
|
||
|
@@ -42,7 +42,7 @@ index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c1 | |
|
||
int j = (Integer) state.getValue(BambooStalkBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; | ||
- int k = (height < 11 || random.nextFloat() >= 0.25F) && height != 15 ? 0 : 1; | ||
+ int k = (height < world.paperConfig().maxGrowthHeight.bamboo.min || random.nextFloat() >= 0.25F) && height != (world.paperConfig().maxGrowthHeight.bamboo.max - 1) ? 0 : 1; // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ int k = (height < world.paperConfig().maxGrowthHeight.bamboo.min || random.nextFloat() >= 0.25F) && height != (world.paperConfig().maxGrowthHeight.bamboo.max - 1) ? 0 : 1; // Paper - Configurable cactus/bamboo/reed growth height | ||
|
||
// CraftBukkit start | ||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, blockpropertybamboosize)).setValue(BambooStalkBlock.STAGE, k), 3)) { | ||
|
@@ -51,7 +51,7 @@ index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c1 | |
int i; | ||
|
||
- for (i = 0; i < 16 && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { | ||
+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.above(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth height | ||
; | ||
} | ||
|
||
|
@@ -60,33 +60,33 @@ index bd72deadb59289ae90afc379ee61e8198ddaf4ed..b54c76ce5c9433765495a5dd0f2166c1 | |
int i; | ||
|
||
- for (i = 0; i < 16 && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { | ||
+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ for (i = 0; i < ((Level) world).paperConfig().maxGrowthHeight.bamboo.max && world.getBlockState(pos.below(i + 1)).is(Blocks.BAMBOO); ++i) { // Paper - Configurable cactus/bamboo/reed growth height | ||
; | ||
} | ||
|
||
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java | ||
index fcd5b593c79aab42928cb1ddd0e6c1b03b7bafaf..43ecbeaced4d50910a59b24934908ff40d894770 100644 | ||
index fcd5b593c79aab42928cb1ddd0e6c1b03b7bafaf..b3b21763079698b86ea27bb60ea12f078d101901 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java | ||
@@ -61,7 +61,7 @@ public class CactusBlock extends Block { | ||
; | ||
} | ||
|
||
- if (i < 3) { | ||
+ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth heightst | ||
+ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable cactus/bamboo/reed growth heightt | ||
int j = (Integer) state.getValue(CactusBlock.AGE); | ||
|
||
int modifier = world.spigotConfig.cactusModifier; // Spigot - SPIGOT-7159: Better modifier resolution | ||
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java | ||
index 47d4fc5bcf2657078abc7a2637b6337fc0ea0977..e4a9ddf77d36f2d6df55c666c16677adb2e4fbe7 100644 | ||
index 47d4fc5bcf2657078abc7a2637b6337fc0ea0977..0c052892e930e08fafac729d6bd238eaf261a474 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java | ||
@@ -59,7 +59,7 @@ public class SugarCaneBlock extends Block { | ||
; | ||
} | ||
|
||
- if (i < 3) { | ||
+ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable cactus/bamboo/reed growth heights | ||
+ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable cactus/bamboo/reed growth height | ||
int j = (Integer) state.getValue(SugarCaneBlock.AGE); | ||
|
||
int modifier = world.spigotConfig.caneModifier; // Spigot - SPIGOT-7159: Better modifier resolution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters