Updated Upstream (Bukkit/Spigot) (#8445)

This commit is contained in:
Jake Potrebic 2022-10-23 10:41:34 -07:00 committed by GitHub
parent b8131a09b2
commit 44ce9b3e9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
207 changed files with 37 additions and 1800 deletions

View file

@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 5 Jan 2022 12:12:58 -0800
Subject: [PATCH] Remove upstream snakeyaml fix
See Server Patch: Fix saving configs with more long comments
diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
index 21d73587e535c43e13473e441dea6fe86c3bf266..0a03cefda788b1dc57ddd61914492a15788aa3d5 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
@@ -65,7 +65,7 @@ public class YamlConfiguration extends FileConfiguration {
yamlLoaderOptions = new LoaderOptions();
yamlLoaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); // SPIGOT-5881: Not ideal, but was default pre SnakeYAML 1.26
- yaml = new BukkitYaml(constructor, representer, yamlDumperOptions, yamlLoaderOptions);
+ yaml = new /*BukkitYaml*/Yaml(constructor, representer, yamlDumperOptions, yamlLoaderOptions); // Paper - don't use upstream BukkitYaml fix, add the whole snakeyaml Emitter class itself with the fix
}
@NotNull
diff --git a/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java b/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
index 194949d74a3f1c69f7869a826ee3a011a6c26786..9f83d16341b4efd5c7150d2ab9abd579f373fa95 100644
--- a/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
+++ b/src/test/java/org/bukkit/configuration/file/YamlConfigurationTest.java
@@ -152,6 +152,7 @@ public class YamlConfigurationTest extends FileConfigurationTest {
}
@Test
+ @org.junit.Ignore // Paper - ignore test because our fix doesn't work in testing environment
public void test100Comments() throws InvalidConfigurationException {
StringBuilder commentBuilder = new StringBuilder();
for (int i = 0; i < 100; i++) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose codepoint limit in YamlConfigOptions, and increase
diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
index 0a03cefda788b1dc57ddd61914492a15788aa3d5..df98d2c12ef4867118aba3452c3aba1175faab4e 100644
index 559b876d1156c04e4e417fb07439bbbc78bea065..9903be1739a5f8657f182b641e93d8b3480f3d57 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlConfiguration.java
@@ -96,6 +96,7 @@ public class YamlConfiguration extends FileConfiguration {
@@ -97,6 +97,7 @@ public class YamlConfiguration extends FileConfiguration {
public void loadFromString(@NotNull String contents) throws InvalidConfigurationException {
Preconditions.checkArgument(contents != null, "Contents cannot be null");
yamlLoaderOptions.setProcessComments(options().parseComments());
@ -18,14 +18,14 @@ index 0a03cefda788b1dc57ddd61914492a15788aa3d5..df98d2c12ef4867118aba3452c3aba11
MappingNode node;
try (Reader reader = new UnicodeReader(new ByteArrayInputStream(contents.getBytes(StandardCharsets.UTF_8)))) {
diff --git a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java
index 3f7f6caf5fcf38b65c282cd83b93e45a272b138f..2a64bc9ab9ae4a7931ebce238cdab7a37e5f85b2 100644
index 3f7f6caf5fcf38b65c282cd83b93e45a272b138f..5d0ec7436f4487c686473248f332689224156fd5 100644
--- a/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java
+++ b/src/main/java/org/bukkit/configuration/file/YamlConfigurationOptions.java
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.Nullable;
public class YamlConfigurationOptions extends FileConfigurationOptions {
private int indent = 2;
private int width = 80;
+ private int codePointLimit = 64 * 1024 * 1024; // 64 MB // Paper
+ private int codePointLimit = Integer.MAX_VALUE; // Paper - use upstream's default from YamlConfiguration
protected YamlConfigurationOptions(@NotNull YamlConfiguration configuration) {
super(configuration);

View file

@ -7,11 +7,11 @@ Bamboo - Both the minimum fully-grown heights and the maximum are configurable
- Machine_Maker
diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java
index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..4eaf778f43b67210321ffafa3da622cb4262d57b 100644
index 3a6894c3cdee0d55f0546cda50c824ea5e95bfe0..2db8fd4fb03642fce2c7eca9c6b189f38d5cbf4a 100644
--- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java
@@ -130,7 +130,7 @@ public class BambooBlock extends Block implements BonemealableBlock {
if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot
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) {
@ -65,7 +65,7 @@ index 4d9c6b462101dd533b0d08c40e0257e39ccbead3..4eaf778f43b67210321ffafa3da622cb
}
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 3b4be44e4204435a360bc224a9b2651952dedf02..cb3d26af146859b87fc471174f8f63dfe7caa5fd 100644
index ea052e4a5e5cb23609129fd08869bcd38f675cd0..7f137f43f725cd2866e10f0ade40d4906b64fac1 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -55,7 +55,7 @@ public class CactusBlock extends Block {
@ -76,9 +76,9 @@ index 3b4be44e4204435a360bc224a9b2651952dedf02..cb3d26af146859b87fc471174f8f63df
+ if (i < world.paperConfig().maxGrowthHeight.cactus) { // Paper - Configurable growth height
int j = (Integer) state.getValue(CactusBlock.AGE);
if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot
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 e5956a2a68f168a4c08c6c409ae7b288eb792660..5554889adbade3af627b11348e9cc04191bfea36 100644
index 2aa81f93a2e1e94d0788b4d7b67f94494101c397..6b400a4759c8c8612a3b5c96ca0d87ef9dc71435 100644
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
@@ -52,7 +52,7 @@ public class SugarCaneBlock extends Block {
@ -89,4 +89,4 @@ index e5956a2a68f168a4c08c6c409ae7b288eb792660..5554889adbade3af627b11348e9cc041
+ if (i < world.paperConfig().maxGrowthHeight.reeds) { // Paper - Configurable growth height
int j = (Integer) state.getValue(SugarCaneBlock.AGE);
if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot
int modifier = world.spigotConfig.caneModifier; // Spigot - SPIGOT-7159: Better modifier resolution

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Restore vanilla default mob-spawn-range and water animals
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index d139cbcf0b159372f229bef6ae49b45a74c163ad..d4d2d11cf19167410ec6ad3417495e7130330d11 100644
index 3b7724a8ad8b9df0bbbca7fd2f8328e9885c5a73..70b3ff4a6a9aea24e28d99997a936e850d46b05e 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -184,7 +184,7 @@ public class SpigotWorldConfig
@@ -190,7 +190,7 @@ public class SpigotWorldConfig
public byte mobSpawnRange;
private void mobSpawnRange()
{

View file

@ -303,7 +303,7 @@ index f957c0aca36b7228ac3a33ca04c948b1d10642d1..39fc94b1e1555fd6706391223dd27831
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
index 540c23f6297c34cf8e7bf8312ceaa5fc868f414c..2866385a64b22b7dc82b6122c62bcea6b0908a60 100644
index 3f8990d15bd6815db0ccb924e621dfcc3220e0e0..70f1916185b79bbb9f033f4ef8119d7b17a13ef8 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
@@ -57,6 +57,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
@ -742,10 +742,10 @@ index 2861c585710eaa00541ff417a29f1f6a2fb5b46a..b1ed97618d08d7691d24f89e9e9b0ed0
isActive = false;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index d4d2d11cf19167410ec6ad3417495e7130330d11..9c9723e13b5440d4803a7268057d63cbdc973b77 100644
index 70b3ff4a6a9aea24e28d99997a936e850d46b05e..a345befaee2e4703294c3941f4060c496838c496 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -199,14 +199,60 @@ public class SpigotWorldConfig
@@ -205,14 +205,60 @@ public class SpigotWorldConfig
public int monsterActivationRange = 32;
public int raiderActivationRange = 48;
public int miscActivationRange = 16;

View file

@ -65,10 +65,10 @@ index c187e9df237ee71562343bbb4b577b2dcd9b4f1c..a0194e78913017693df7d92516dfbacb
this.checkPressed(state, world, pos);
}
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 cb3d26af146859b87fc471174f8f63dfe7caa5fd..0fbabb84ef13e68b12212d9bfeb885c78893c116 100644
index 7f137f43f725cd2866e10f0ade40d4906b64fac1..1ec242205b82a5a1f10deb2312795cc5dc157a76 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -116,6 +116,7 @@ public class CactusBlock extends Block {
@@ -117,6 +117,7 @@ public class CactusBlock extends Block {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -89,7 +89,7 @@ index 930421c72326fabfa3f2e3ab37c4dd6f416d6d44..a4c44cb59dee29cf227dbb51bfc1576d
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, pos); // CraftBukkit
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 76fc886013b6c53f7888292f8fda50abe72e43bf..275e5334b1206a2dcafc3772c7e2ad0ebe3693f9 100644
index 26b4a4d8784923cb2caea3c20a180a9fe7bb4d8b..7d8394d09ec11c96b9329857a0d347565dd07b32 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -163,6 +163,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@ -197,7 +197,7 @@ index 47f54002654d198a56a85884de34e305e545eb4b..518d3832c36c9ecf1ed9267ffc1f926d
entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
if (world.isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
index 1eddae82b9a438eefa49add5e3706aba755ccf45..1561be49f3a2761ce48bb16ea2dffbf1c37d0536 100644
index 3eba9715601fcd1e86cb50bdef2434b404009caf..9871249335b67cfcfc17e7a1d504da1bc9b08c8a 100644
--- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
@@ -77,6 +77,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock

View file

@ -34,29 +34,10 @@ index 7d9056f9d841fbbdeaf1e323d818f2f1267b47e8..4940e101250874111e9c55aeb5b87b28
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
index 4e30917fbc5c539fefc8dc391b902241f7c5ad35..b7517d1e8a5d5eb719de5eda424b7dd2449f1182 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
@@ -56,12 +56,18 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
BlockPos blockposition1 = pos.relative(this.growthDirection);
if (this.canGrowInto(world.getBlockState(blockposition1))) {
@ -77,32 +58,22 @@ index ae9052efc48dc05c7b41cb18c4330d7e62839a07..4d1e1cf4c541793492a02681087a6242
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
index 102b038e2566cba4f259a61e502ff0808c47234c..6bcc46795d1f78746192cc107c4a1f61580ec3c5 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
@@ -106,6 +106,7 @@ public class SpigotWorldConfig
public int twistingVinesModifier;
public int weepingVinesModifier;
public int caveVinesModifier;
+ public int glowBerryModifier; // Paper
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
@@ -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
}
public double itemMerge;

View file

@ -162,10 +162,10 @@ index 2fd1284c7f0d8e2cf35d03072089256d990b06eb..8ef0e9fa126cd96289bab48eaa06c2a1
@Override
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index cf96f9fdc4ae561f01d44503b9851c60140e4ea7..46ef3400605cc420bd88f13838df7d1f1106235e 100644
index 6bcc46795d1f78746192cc107c4a1f61580ec3c5..5503ad6a93d331771a0e92c0da6adedf2ac81aff 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -366,6 +366,16 @@ public class SpigotWorldConfig
@@ -362,6 +362,16 @@ public class SpigotWorldConfig
public int mansionSeed;
public int fossilSeed;
public int portalSeed;
@ -182,7 +182,7 @@ index cf96f9fdc4ae561f01d44503b9851c60140e4ea7..46ef3400605cc420bd88f13838df7d1f
private void initWorldGenSeeds()
{
this.villageSeed = this.getInt( "seed-village", 10387312 );
@@ -383,6 +393,12 @@ public class SpigotWorldConfig
@@ -379,6 +389,12 @@ public class SpigotWorldConfig
this.mansionSeed = this.getInt( "seed-mansion", 10387319 );
this.fossilSeed = this.getInt( "seed-fossil", 14357921 );
this.portalSeed = this.getInt( "seed-portal", 34222645 );

Some files were not shown because too many files have changed in this diff Show more