mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
01a13871de
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
109 lines
5.9 KiB
Diff
109 lines
5.9 KiB
Diff
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
|
|
Subject: [PATCH] Fix kelp modifier changing growth for other crops
|
|
|
|
Also add growth modifiers for twisting vines, weeping vines, cave vines,
|
|
and glow berries
|
|
|
|
Also fix above-mentioned modifiers from having the reverse effect
|
|
|
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
|
index 7d9056f9d841fbbdeaf1e323d818f2f1267b47e8..4940e101250874111e9c55aeb5b87b28602246f0 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
|
|
@@ -47,9 +47,17 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
|
|
|
|
@Override
|
|
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
|
|
- return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, random.nextFloat() < 0.11F);
|
|
+ // Paper start
|
|
+ return this.getGrowIntoState(state, random, null);
|
|
}
|
|
|
|
+ @Override
|
|
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
|
|
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);
|
|
+ return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value);
|
|
+ }
|
|
+ // 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
|
|
index ae9052efc48dc05c7b41cb18c4330d7e62839a07..4d1e1cf4c541793492a02681087a6242e7977acd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
|
|
@@ -40,16 +40,36 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
|
|
|
|
@Override
|
|
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
- if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / world.spigotConfig.kelpModifier) * this.growPerTickProbability) { // Spigot
|
|
+ // Paper start
|
|
+ final int modifier;
|
|
+ if (state.is(Blocks.TWISTING_VINES) || state.is(Blocks.TWISTING_VINES_PLANT)) {
|
|
+ modifier = world.spigotConfig.twistingVinesModifier;
|
|
+ } else if (state.is(Blocks.WEEPING_VINES) || state.is(Blocks.WEEPING_VINES_PLANT)) {
|
|
+ modifier = world.spigotConfig.weepingVinesModifier;
|
|
+ } else if (state.is(Blocks.CAVE_VINES) || state.is(Blocks.CAVE_VINES_PLANT)) {
|
|
+ modifier = world.spigotConfig.caveVinesModifier;
|
|
+ } else if (state.is(Blocks.KELP) || state.is(Blocks.KELP_PLANT)) {
|
|
+ modifier = world.spigotConfig.kelpModifier;
|
|
+ } else {
|
|
+ modifier = 100; // Above cases are exhaustive as of 1.18
|
|
+ }
|
|
+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (modifier / 100.0D) * this.growPerTickProbability) { // Spigot // Paper - fix growth modifier having the reverse effect
|
|
+ // Paper end
|
|
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
|
|
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
|
|
+ return this.getGrowIntoState(state, random);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
|
|
return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE);
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 40984144a062230fd45cc6c707b03e5cd7d89efc..cf96f9fdc4ae561f01d44503b9851c60140e4ea7 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -103,6 +103,12 @@ public class SpigotWorldConfig
|
|
public int bambooModifier;
|
|
public int sweetBerryModifier;
|
|
public int kelpModifier;
|
|
+ // Paper start
|
|
+ public int twistingVinesModifier;
|
|
+ public int weepingVinesModifier;
|
|
+ public int caveVinesModifier;
|
|
+ public int glowBerryModifier;
|
|
+ // Paper end
|
|
private int getAndValidateGrowth(String crop)
|
|
{
|
|
int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 );
|
|
@@ -133,6 +139,12 @@ public class SpigotWorldConfig
|
|
this.bambooModifier = this.getAndValidateGrowth( "Bamboo" );
|
|
this.sweetBerryModifier = this.getAndValidateGrowth( "SweetBerry" );
|
|
this.kelpModifier = this.getAndValidateGrowth( "Kelp" );
|
|
+ // Paper start
|
|
+ this.twistingVinesModifier = this.getAndValidateGrowth("TwistingVines");
|
|
+ this.weepingVinesModifier = this.getAndValidateGrowth("WeepingVines");
|
|
+ this.caveVinesModifier = this.getAndValidateGrowth("CaveVines");
|
|
+ this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry");
|
|
+ // Paper end
|
|
}
|
|
|
|
public double itemMerge;
|