2021-12-04 02:40:42 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
|
|
Date: Fri, 3 Dec 2021 17:09:24 -0800
|
2022-10-30 13:27:37 +01:00
|
|
|
Subject: [PATCH] Fix Spigot growth modifiers
|
2021-12-04 02:40:42 +01:00
|
|
|
|
2022-10-30 13:27:37 +01:00
|
|
|
Fixes kelp modifier changing growth for other crops
|
|
|
|
Also add growth modifiers for glow berries
|
2021-12-04 03:12:42 +01:00
|
|
|
Also fix above-mentioned modifiers from having the reverse effect
|
|
|
|
|
|
|
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
2022-10-30 13:27:37 +01:00
|
|
|
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
|
2021-12-04 03:12:42 +01:00
|
|
|
|
2021-12-04 02:40:42 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
2023-03-14 21:55:49 +01:00
|
|
|
index 55f2fa02a36f0500b47f9ce377926719557106e5..18b5bce1138d50be32e5da013221be69dc47e21f 100644
|
2021-12-04 02:40:42 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
2023-03-14 21:55:49 +01:00
|
|
|
@@ -47,9 +47,17 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
|
2021-12-04 02:40:42 +01:00
|
|
|
|
|
|
|
@Override
|
2022-06-08 16:29:32 +02:00
|
|
|
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
|
2023-03-14 21:55:49 +01:00
|
|
|
- return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F));
|
2021-12-04 02:40:42 +01:00
|
|
|
+ // Paper start
|
|
|
|
+ return this.getGrowIntoState(state, random, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
2022-06-08 16:29:32 +02:00
|
|
|
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
|
2022-06-15 00:37:14 +02:00
|
|
|
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);
|
2022-06-08 16:29:32 +02:00
|
|
|
+ return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value);
|
2021-12-04 02:40:42 +01:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
|
|
|
|
return new ItemStack(Items.GLOW_BERRIES);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
2022-12-07 22:35:34 +01:00
|
|
|
index 53b91cf8092b46dbf45afea9ccf439d565d1914a..3a1aa4e2405090ccebefb7f5944f36462929e221 100644
|
2021-12-04 02:40:42 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
2022-10-23 19:41:34 +02:00
|
|
|
@@ -56,12 +56,18 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
2021-12-04 02:40:42 +01:00
|
|
|
BlockPos blockposition1 = pos.relative(this.growthDirection);
|
|
|
|
|
|
|
|
if (this.canGrowInto(world.getBlockState(blockposition1))) {
|
|
|
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random)); // CraftBukkit
|
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
2022-06-08 16:29:32 +02:00
|
|
|
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
|
2021-12-04 02:40:42 +01:00
|
|
|
+ return this.getGrowIntoState(state, random);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2022-06-08 16:29:32 +02:00
|
|
|
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
|
2021-12-04 02:40:42 +01:00
|
|
|
return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2022-10-23 19:41:34 +02:00
|
|
|
index 102b038e2566cba4f259a61e502ff0808c47234c..6bcc46795d1f78746192cc107c4a1f61580ec3c5 100644
|
2021-12-04 02:40:42 +01:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2022-10-23 19:41:34 +02:00
|
|
|
@@ -106,6 +106,7 @@ public class SpigotWorldConfig
|
|
|
|
public int twistingVinesModifier;
|
|
|
|
public int weepingVinesModifier;
|
|
|
|
public int caveVinesModifier;
|
|
|
|
+ public int glowBerryModifier; // Paper
|
2021-12-04 02:40:42 +01:00
|
|
|
private int getAndValidateGrowth(String crop)
|
|
|
|
{
|
|
|
|
int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 );
|
2022-10-23 19:41:34 +02:00
|
|
|
@@ -139,6 +140,7 @@ public class SpigotWorldConfig
|
|
|
|
this.twistingVinesModifier = this.getAndValidateGrowth( "TwistingVines" );
|
|
|
|
this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" );
|
|
|
|
this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" );
|
|
|
|
+ this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry"); // Paper
|
2021-12-04 02:40:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public double itemMerge;
|