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
|
2023-06-09 14:23:38 +02:00
|
|
|
Also add growth modifiers for glow berries, mangrove propagules,
|
|
|
|
torchflower crops and pitcher plant crops
|
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>
|
2023-05-15 20:25:38 +02:00
|
|
|
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.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
|
2024-04-24 18:15:59 +02:00
|
|
|
index 1e7235413fae39dc530eb843f1846f74bb5268b6..635fc086d832c641f840cf36d18cdc0fcc3beef3 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
|
2024-04-24 18:15:59 +02:00
|
|
|
@@ -50,9 +50,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
|
2023-12-06 16:17:00 +01:00
|
|
|
return to.setValue(BERRIES, from.getValue(BERRIES));
|
2021-12-04 02:40:42 +01:00
|
|
|
}
|
|
|
|
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start - Fix Spigot growth modifiers
|
2021-12-04 02:40:42 +01:00
|
|
|
+ @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
|
|
|
+ }
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper end - Fix Spigot growth modifiers
|
2021-12-04 02:40:42 +01:00
|
|
|
+
|
|
|
|
@Override
|
2023-12-06 16:17:00 +01:00
|
|
|
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
|
|
|
|
- return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F));
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper start - Fix Spigot growth modifiers
|
2023-12-06 16:17:00 +01:00
|
|
|
+ return this.getGrowIntoState(state, random, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-05-15 20:25:38 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
2024-04-24 18:15:59 +02:00
|
|
|
index 73595922dcff8e7a8595fcf033ab238bc4096630..112d2feba5f75a2a873b595617780515945c10e4 100644
|
2023-05-15 20:25:38 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
2023-12-06 16:17:00 +01:00
|
|
|
@@ -91,6 +91,10 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
2023-05-15 20:25:38 +02:00
|
|
|
modifier = world.spigotConfig.carrotModifier;
|
|
|
|
} else if (this == Blocks.POTATOES) {
|
|
|
|
modifier = world.spigotConfig.potatoModifier;
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper start - Fix Spigot growth modifiers
|
2023-05-15 20:25:38 +02:00
|
|
|
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
|
|
+ modifier = world.spigotConfig.torchFlowerModifier;
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper end - Fix Spigot growth modifiers
|
2023-05-15 20:25:38 +02:00
|
|
|
} else {
|
|
|
|
modifier = world.spigotConfig.wheatModifier;
|
|
|
|
}
|
2021-12-04 02:40:42 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
2024-04-24 18:15:59 +02:00
|
|
|
index 164a855d99cf36205bd9fce04640109f20a2b96c..cf05da1c86e3018db11dc079bf50317b6639e5cc 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
|
2023-12-06 16:17:00 +01:00
|
|
|
@@ -60,12 +60,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
|
2024-01-18 22:00:40 +01:00
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper - Fix Spigot growth modifiers
|
2021-12-04 02:40:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper start - Fix Spigot growth modifiers
|
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);
|
|
|
|
+ }
|
2024-01-18 22:00:40 +01:00
|
|
|
+ // Paper end - Fix Spigot growth modifiers
|
2021-12-04 02:40:42 +01:00
|
|
|
+
|
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);
|
|
|
|
}
|
2023-05-15 20:25:38 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
2024-04-24 18:15:59 +02:00
|
|
|
index fd7f7d58cd159f663f8f474d9c73841c795d2990..b98e17d21d43610fb7a7ce1641c518598ff48cb0 100644
|
2023-05-15 20:25:38 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -114,7 +114,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
|
2023-05-15 20:25:38 +02:00
|
|
|
@Override
|
2024-04-24 18:15:59 +02:00
|
|
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
2023-05-15 20:25:38 +02:00
|
|
|
if (!isHanging(state)) {
|
|
|
|
- if (random.nextInt(7) == 0) {
|
2024-01-18 22:00:40 +01:00
|
|
|
+ if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper - Fix Spigot growth modifiers
|
2023-05-15 20:25:38 +02:00
|
|
|
this.advanceTree(world, pos, state, random);
|
|
|
|
}
|
2024-04-12 21:14:06 +02:00
|
|
|
} else {
|
2023-06-09 14:23:38 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
2024-04-12 21:14:06 +02:00
|
|
|
index c9ed129db2cadd0a33d69993961f43088725c3cb..d06e3892cf42723f8e3f621b5497c5348fa1a715 100644
|
2023-06-09 14:23:38 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -123,7 +123,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
|
2023-06-09 14:23:38 +02:00
|
|
|
@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;
|
2024-01-18 22:00:40 +01:00
|
|
|
+ boolean bl = random.nextFloat() < (world.spigotConfig.pitcherPlantModifier / (100.0F * (Math.floor(25.0F / f) + 1))); // Paper - Fix Spigot growth modifiers
|
2023-06-09 14:23:38 +02:00
|
|
|
if (bl) {
|
|
|
|
this.grow(world, state, pos, 1);
|
|
|
|
}
|
2021-12-04 02:40:42 +01:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2024-01-23 15:43:48 +01:00
|
|
|
index 2a787b641fec29427963ac2bdc14df60f32af2bc..41f4416d820ed1ca2d02b457749cbb6c3dbb20af 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
|
2023-05-15 20:25:38 +02:00
|
|
|
@@ -96,6 +96,7 @@ public class SpigotWorldConfig
|
|
|
|
public int beetrootModifier;
|
|
|
|
public int carrotModifier;
|
|
|
|
public int potatoModifier;
|
|
|
|
+ public int torchFlowerModifier; // Paper
|
|
|
|
public int wheatModifier;
|
|
|
|
public int wartModifier;
|
|
|
|
public int vineModifier;
|
2023-06-09 14:23:38 +02:00
|
|
|
@@ -106,6 +107,8 @@ public class SpigotWorldConfig
|
2022-10-23 19:41:34 +02:00
|
|
|
public int twistingVinesModifier;
|
|
|
|
public int weepingVinesModifier;
|
|
|
|
public int caveVinesModifier;
|
|
|
|
+ public int glowBerryModifier; // Paper
|
2023-06-09 14:23:38 +02:00
|
|
|
+ public int pitcherPlantModifier; // 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 );
|
2023-06-09 14:23:38 +02:00
|
|
|
@@ -129,6 +132,7 @@ public class SpigotWorldConfig
|
2023-05-15 20:25:38 +02:00
|
|
|
this.beetrootModifier = this.getAndValidateGrowth( "Beetroot" );
|
|
|
|
this.carrotModifier = this.getAndValidateGrowth( "Carrot" );
|
|
|
|
this.potatoModifier = this.getAndValidateGrowth( "Potato" );
|
|
|
|
+ this.torchFlowerModifier = this.getAndValidateGrowth("TorchFlower"); // Paper
|
|
|
|
this.wheatModifier = this.getAndValidateGrowth( "Wheat" );
|
|
|
|
this.wartModifier = this.getAndValidateGrowth( "NetherWart" );
|
|
|
|
this.vineModifier = this.getAndValidateGrowth( "Vine" );
|
2023-06-09 14:23:38 +02:00
|
|
|
@@ -139,6 +143,8 @@ public class SpigotWorldConfig
|
2022-10-23 19:41:34 +02:00
|
|
|
this.twistingVinesModifier = this.getAndValidateGrowth( "TwistingVines" );
|
|
|
|
this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" );
|
|
|
|
this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" );
|
|
|
|
+ this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry"); // Paper
|
2023-06-09 14:23:38 +02:00
|
|
|
+ this.pitcherPlantModifier = this.getAndValidateGrowth("PitcherPlant"); // Paper
|
2021-12-04 02:40:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public double itemMerge;
|