Add pitcher plant api (#9286)
This commit is contained in:
@@ -4,8 +4,8 @@ Date: Fri, 3 Dec 2021 17:09:24 -0800
|
||||
Subject: [PATCH] Fix Spigot growth modifiers
|
||||
|
||||
Fixes kelp modifier changing growth for other crops
|
||||
Also add growth modifiers for glow berries, mangrove propagules
|
||||
and torchflower crops
|
||||
Also add growth modifiers for glow berries, mangrove propagules,
|
||||
torchflower crops and pitcher plant crops
|
||||
Also fix above-mentioned modifiers from having the reverse effect
|
||||
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
@@ -87,6 +87,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.advanceTree(world, pos, state, random);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
||||
@@ -0,0 +0,0 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
- boolean bl = random.nextInt((int)(25.0F / f) + 1) == 0;
|
||||
+ boolean bl = random.nextFloat() < (world.spigotConfig.pitcherPlantModifier / (100.0F * (Math.floor(25.0F / f) + 1))); // Paper
|
||||
if (bl) {
|
||||
this.grow(world, state, pos, 1);
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -104,6 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public int weepingVinesModifier;
|
||||
public int caveVinesModifier;
|
||||
+ public int glowBerryModifier; // Paper
|
||||
+ public int pitcherPlantModifier; // Paper
|
||||
private int getAndValidateGrowth(String crop)
|
||||
{
|
||||
int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 );
|
||||
@@ -120,6 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" );
|
||||
this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" );
|
||||
+ this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry"); // Paper
|
||||
+ this.pitcherPlantModifier = this.getAndValidateGrowth("PitcherPlant"); // Paper
|
||||
}
|
||||
|
||||
public double itemMerge;
|
||||
|
||||
Reference in New Issue
Block a user