diff options
author | Bjarne Koll <[email protected]> | 2024-10-23 13:13:00 +0200 |
---|---|---|
committer | Bjarne Koll <[email protected]> | 2024-10-23 13:13:00 +0200 |
commit | 8851d25a4df4fed9547c990fc834c83f77675e59 (patch) | |
tree | 09c9834a9dce04d6277993a43882cfb98df74b03 | |
parent | a400929816ca74a5b100da0aadc5793699f867bf (diff) | |
download | Paper-8851d25a4df4fed9547c990fc834c83f77675e59.tar.gz Paper-8851d25a4df4fed9547c990fc834c83f77675e59.zip |
Fluid Flowing ifLoaded patch
-rw-r--r-- | patches/server/0242-Allow-chests-to-be-placed-with-NBT-data.patch (renamed from patches/unapplied/server/0243-Allow-chests-to-be-placed-with-NBT-data.patch) | 18 | ||||
-rw-r--r-- | patches/server/0243-Mob-Pathfinding-API.patch (renamed from patches/unapplied/server/0244-Mob-Pathfinding-API.patch) | 6 | ||||
-rw-r--r-- | patches/server/0244-Prevent-various-interactions-from-causing-chunk-load.patch (renamed from patches/unapplied/server/0245-Prevent-various-interactions-from-causing-chunk-load.patch) | 18 | ||||
-rw-r--r-- | patches/server/0245-Prevent-mob-spawning-from-loading-generating-chunks.patch (renamed from patches/unapplied/server/0246-Prevent-mob-spawning-from-loading-generating-chunks.patch) | 6 | ||||
-rw-r--r-- | patches/server/0246-Implement-furnace-cook-speed-multiplier-API.patch (renamed from patches/unapplied/server/0247-Implement-furnace-cook-speed-multiplier-API.patch) | 71 | ||||
-rw-r--r-- | patches/server/0247-Honor-EntityAgeable.ageLock.patch (renamed from patches/unapplied/server/0248-Honor-EntityAgeable.ageLock.patch) | 10 | ||||
-rw-r--r-- | patches/server/0248-Configurable-connection-throttle-kick-message.patch (renamed from patches/unapplied/server/0249-Configurable-connection-throttle-kick-message.patch) | 0 | ||||
-rw-r--r-- | patches/server/0249-Prevent-chunk-loading-from-Fluid-Flowing.patch | 88 | ||||
-rw-r--r-- | patches/unapplied/server/0250-Prevent-chunk-loading-from-Fluid-Flowing.patch | 75 |
9 files changed, 154 insertions, 138 deletions
diff --git a/patches/unapplied/server/0243-Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/0242-Allow-chests-to-be-placed-with-NBT-data.patch index 92d7a5d3fc..4b282589d9 100644 --- a/patches/unapplied/server/0243-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/patches/server/0242-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index b0d0e08e81e3b87e5d4faf62e9afe9606c254115..2ee949e1b0015c62499c557d5e359df4b9de6027 100644 +index 957c112b4145fda5078a6f8f1689935fa0290806..f00b756fe5dad616323e3b11e35e27353f347042 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -490,6 +490,7 @@ public final class ItemStack implements DataComponentHolder { - enuminteractionresult = InteractionResult.FAIL; // cancel placement - // PAIL: Remove this when MC-99075 fixed - placeEvent.getPlayer().updateInventory(); +@@ -496,6 +496,7 @@ public final class ItemStack implements DataComponentHolder { + enuminteractionresult = InteractionResult.FAIL; // cancel placement + // PAIL: Remove this when MC-99075 fixed + placeEvent.getPlayer().updateInventory(); + world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot - // revert back all captured blocks - world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710 - for (BlockState blockstate : blocks) { + // revert back all captured blocks + world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710 + for (BlockState blockstate : blocks) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java -index 9d6262e286a00f840d88d6eb6bfdb304467466e3..b88aa184cd06a0485146f58a5b61a56a50911209 100644 +index a3cdb4af2b7a3c7f884c8af2cba0d3d5e1c184a6..8847617f6a23e6d2fe9bf7444a2072dc53f741b8 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java @@ -238,7 +238,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement diff --git a/patches/unapplied/server/0244-Mob-Pathfinding-API.patch b/patches/server/0243-Mob-Pathfinding-API.patch index 427d08a157..638eb9310c 100644 --- a/patches/unapplied/server/0244-Mob-Pathfinding-API.patch +++ b/patches/server/0243-Mob-Pathfinding-API.patch @@ -177,10 +177,10 @@ index f6419f3b345e9e21a05b315aa4669090d7da4194..d9d0fff9962131808d54cca20f209df5 public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) { this.nodes = nodes; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 58e690a91aea9ea294f8e4ec9861aa92bc6060a0..d597eea5d5c2f223e87bff06f292619657596f1f 100644 +index 31f7b19b8978d941df801c97ad8989ef18d9fe2d..26c9bc53fe50636ca1eb32144c648f382d4172ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -@@ -13,8 +13,11 @@ import org.bukkit.loot.LootTable; +@@ -14,8 +14,11 @@ import org.bukkit.loot.LootTable; public abstract class CraftMob extends CraftLivingEntity implements Mob { public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) { super(server, entity); @@ -192,7 +192,7 @@ index 58e690a91aea9ea294f8e4ec9861aa92bc6060a0..d597eea5d5c2f223e87bff06f2926196 @Override public void setTarget(LivingEntity target) { Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation"); -@@ -55,6 +58,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { +@@ -56,6 +59,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { return (net.minecraft.world.entity.Mob) this.entity; } diff --git a/patches/unapplied/server/0245-Prevent-various-interactions-from-causing-chunk-load.patch b/patches/server/0244-Prevent-various-interactions-from-causing-chunk-load.patch index 01a574e73c..b7f9185ebb 100644 --- a/patches/unapplied/server/0245-Prevent-various-interactions-from-causing-chunk-load.patch +++ b/patches/server/0244-Prevent-various-interactions-from-causing-chunk-load.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent various interactions from causing chunk loads Co-authored-by: Shane Freeder <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a75c954116 100644 +index 90f61511429799b1e852326d0d014551e5c35d5d..9d245d08be61d7edee9138196ae3bf52023e3993 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java -@@ -126,7 +126,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -127,7 +127,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @Nullable private BlockPos getPosWithBlock(BlockPos pos, BlockGetter world) { @@ -20,7 +20,7 @@ index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a7 return pos; } else { BlockPos[] ablockposition = new BlockPos[]{pos.below(), pos.west(), pos.east(), pos.north(), pos.south(), pos.below().below()}; -@@ -136,7 +138,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -137,7 +139,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal { for (int j = 0; j < i; ++j) { BlockPos blockposition1 = ablockposition1[j]; @@ -30,7 +30,7 @@ index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a7 return blockposition1; } } -@@ -147,7 +150,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { +@@ -148,7 +151,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { @Override protected boolean isValidTarget(LevelReader world, BlockPos pos) { @@ -40,10 +40,10 @@ index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a7 return ichunkaccess == null ? false : ichunkaccess.getBlockState(pos).is(this.blockToRemove) && ichunkaccess.getBlockState(pos.above()).isAir() && ichunkaccess.getBlockState(pos.above(2)).isAir(); } diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -index 70888dd25b6a1d1ab7702d73a64a47eebafe76fe..0214e8bbcaefdd92ee3719d9a570f9d256ee29ba 100644 +index 5f1bbb4302013c2c1788db6b64eafba2a11a373a..512de8e79a842d4389e8528983b94af4843ffd11 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -502,7 +502,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -489,7 +489,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D); int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D); BlockPos blockposition = new BlockPos(i, j, k); @@ -53,7 +53,7 @@ index 70888dd25b6a1d1ab7702d73a64a47eebafe76fe..0214e8bbcaefdd92ee3719d9a570f9d2 BlockPos blockposition1 = blockposition.below(); BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata2 = this.enderman.getCarriedBlock(); -@@ -546,7 +547,8 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -533,7 +534,8 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D); int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D); BlockPos blockposition = new BlockPos(i, j, k); @@ -77,10 +77,10 @@ index c02a2f9e1b4e727b1deeb73377e1f7193f5ee072..cdd1f6939ce33e62f6609f7eb3a5dff5 : new LodestoneTracker(Optional.empty(), true); } diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index d6d8bbc98fc71997cb52521d59ebb59d727d3c22..c3760e0c8ac0b3ea200f4e1c237e250137a78caf 100644 +index 6850ac324ee4d202f112dbd057ea1bde9de17ea9..8e58efd0d8010a3499a1eb1add9fa976aa2b0a3e 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java -@@ -70,7 +70,15 @@ public interface BlockGetter extends LevelHeightAccessor { +@@ -71,7 +71,15 @@ public interface BlockGetter extends LevelHeightAccessor { // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) { diff --git a/patches/unapplied/server/0246-Prevent-mob-spawning-from-loading-generating-chunks.patch b/patches/server/0245-Prevent-mob-spawning-from-loading-generating-chunks.patch index 1ca48ef5a8..1908c1da0c 100644 --- a/patches/unapplied/server/0246-Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/patches/server/0245-Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks also prevents if out of world border bounds diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index bce78beaadbfd0e400457bd14bcf6538be702879..41eef8bfd1572aecaf086bfbec300abeae2df794 100644 +index 0b41149ae134084cef4016241ce923dac0349846..be2412ef8f8c331a881e442577cf05aec43f52bb 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -165,9 +165,9 @@ public final class NaturalSpawner { +@@ -187,9 +187,9 @@ public final class NaturalSpawner { StructureManager structuremanager = world.structureManager(); ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator(); int i = pos.getY(); @@ -21,7 +21,7 @@ index bce78beaadbfd0e400457bd14bcf6538be702879..41eef8bfd1572aecaf086bfbec300abe BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); int j = 0; int k = 0; -@@ -196,7 +196,7 @@ public final class NaturalSpawner { +@@ -218,7 +218,7 @@ public final class NaturalSpawner { if (entityhuman != null) { double d2 = entityhuman.distanceToSqr(d0, (double) i, d1); diff --git a/patches/unapplied/server/0247-Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/0246-Implement-furnace-cook-speed-multiplier-API.patch index 24067a522f..1f16e28913 100644 --- a/patches/unapplied/server/0247-Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/0246-Implement-furnace-cook-speed-multiplier-API.patch @@ -9,35 +9,33 @@ to the nearest Integer when updating its current cook time. Co-authored-by: Eric Su <[email protected]> diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..5ea2b05961590732a43bb5a1abf00bf8a00c72c2 100644 +index 62c49afd4da165d0cb4156f106e6e5480d267d4e..b9dd5f710533b156311cac2c020fd0d5f64b6265 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -79,6 +79,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -74,11 +74,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit protected NonNullList<ItemStack> items; public int litTime; int litDuration; + public double cookSpeedMultiplier = 1.0; // Paper - cook speed multiplier API public int cookingProgress; public int cookingTotalTime; - @Nullable -@@ -86,6 +87,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit protected final ContainerData dataAccess; - public final Object2IntOpenHashMap<ResourceLocation> recipesUsed; + public final Reference2IntOpenHashMap<ResourceKey<Recipe<?>>> recipesUsed; private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck; + public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper - cook speed multiplier API protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) { super(blockEntityType, pos, state); -@@ -132,6 +134,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -126,6 +128,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit }; - this.recipesUsed = new Object2IntOpenHashMap(); + this.recipesUsed = new Reference2IntOpenHashMap(); this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail + this.recipeType = recipeType; // Paper - cook speed multiplier API } - public static void invalidateCache() { -@@ -295,6 +298,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - this.recipesUsed.put(ResourceLocation.parse(s), nbttagcompound1.getInt(s)); + // CraftBukkit start - add fields and methods +@@ -180,6 +183,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + this.recipesUsed.put(ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(s)), nbttagcompound1.getInt(s)); } + // Paper start - cook speed multiplier API @@ -48,24 +46,24 @@ index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..5ea2b05961590732a43bb5a1abf00bf8 } @Override -@@ -303,6 +311,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -188,6 +196,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit nbt.putShort("BurnTime", (short) this.litTime); nbt.putShort("CookTime", (short) this.cookingProgress); nbt.putShort("CookTimeTotal", (short) this.cookingTotalTime); + nbt.putDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API - ContainerHelper.saveAllItems(nbt, this.items, registryLookup); + ContainerHelper.saveAllItems(nbt, this.items, registries); CompoundTag nbttagcompound1 = new CompoundTag(); -@@ -375,7 +384,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -263,7 +272,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0)); CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe(); - FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(world, pos), source, recipe); -+ FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(world, pos), source, recipe, AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier)); // Paper - cook speed multiplier API ++ FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(world, pos), source, recipe, AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity, blockEntity.recipeType, blockEntity.cookSpeedMultiplier)); // Paper - cook speed multiplier API world.getCraftServer().getPluginManager().callEvent(event); blockEntity.cookingTotalTime = event.getTotalCookTime(); -@@ -383,9 +392,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -271,9 +280,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit // CraftBukkit end ++blockEntity.cookingProgress; @@ -73,44 +71,49 @@ index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..5ea2b05961590732a43bb5a1abf00bf8 + if (blockEntity.cookingProgress >= blockEntity.cookingTotalTime) { // Paper - cook speed multiplier API blockEntity.cookingProgress = 0; - blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity); -+ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper - cook speed multiplier API - if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit ++ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity, blockEntity.recipeType, blockEntity.cookSpeedMultiplier); // Paper - cook speed multiplier API + if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, singlerecipeinput, blockEntity.items, i)) { // CraftBukkit blockEntity.setRecipeUsed(recipeholder); } -@@ -485,13 +494,14 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - } +@@ -367,13 +376,14 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + return fuelRegistry.burnDuration(stack); } -- private static int getTotalCookTime(Level world, AbstractFurnaceBlockEntity furnace) { +- private static int getTotalCookTime(ServerLevel world, AbstractFurnaceBlockEntity furnace) { - if (world == null) return 200; // CraftBukkit - SPIGOT-4302 -+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { // Paper - cook speed multiplier API ++ private static int getTotalCookTime(@Nullable ServerLevel world, AbstractFurnaceBlockEntity furnace, RecipeType<? extends AbstractCookingRecipe> recipeType, double cookSpeedMultiplier) { // Paper - cook speed multiplier API SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0)); - return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> { -- return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime(); +- return ((AbstractCookingRecipe) recipeholder.value()).cookingTime(); - }).orElse(200); + // Paper start - cook speed multiplier API + /* Scale the recipe's cooking time to the current cookSpeedMultiplier */ -+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, singlerecipeinput, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200)); ++ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map(holder -> holder.value().cookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, singlerecipeinput, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().cookingTime()).orElse(200)); + return (int) Math.ceil (cookTime / cookSpeedMultiplier); + // Paper end - cook speed multiplier API } - public static boolean isFuel(ItemStack stack) { -@@ -536,7 +546,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - this.items.set(slot, stack); - stack.limitSize(this.getMaxStackSize(stack)); - if (slot == 0 && !flag) { -- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this); -+ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API - this.cookingProgress = 0; - this.setChanged(); + @Override +@@ -419,12 +429,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + if (world instanceof ServerLevel) { + ServerLevel worldserver = (ServerLevel) world; + +- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(worldserver, this); ++ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(worldserver, this, this.recipeType, this.cookSpeedMultiplier); // Paper - cook speed multiplier API + this.cookingProgress = 0; + this.setChanged(); + } } +- + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java -index 46a1c96efc5ffb5c8d6c20af758bdca5bb4a5049..ddbbf977c8f536a156ff6b2462353f7be5ab5742 100644 +index 7ed43bc29a4bc0f6db2cabd3cd4c8489ed81ee81..0ec30feb68efc1747e489ee4bb60e6a503cb31c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java -@@ -89,4 +89,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends +@@ -88,4 +88,20 @@ public abstract class CraftFurnace<T extends AbstractFurnaceBlockEntity> extends @Override public abstract CraftFurnace<T> copy(Location location); diff --git a/patches/unapplied/server/0248-Honor-EntityAgeable.ageLock.patch b/patches/server/0247-Honor-EntityAgeable.ageLock.patch index 1522ccc882..aaaf81b894 100644 --- a/patches/unapplied/server/0248-Honor-EntityAgeable.ageLock.patch +++ b/patches/server/0247-Honor-EntityAgeable.ageLock.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Honor EntityAgeable.ageLock diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java -index f07cf6d91e0cbad80c3c630c0d505820e701ce81..3dc3609d13a7b823d15384d1c385b68eeb933d26 100644 +index d7020068a9ea3e5e1cacfe53ef19a88139687205..119856b22df5bbcd4e5bf5f95645156f774c6168 100644 --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java -@@ -85,6 +85,7 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -86,6 +86,7 @@ public abstract class AgeableMob extends PathfinderMob { } public void ageUp(int age, boolean overGrow) { @@ -17,10 +17,10 @@ index f07cf6d91e0cbad80c3c630c0d505820e701ce81..3dc3609d13a7b823d15384d1c385b68e int k = j; diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index 4ee7a4e5637fe36eb50e8ec9186d72d1253bfd98..b345403cdf5b2828f99708fef65136594a3331c3 100644 +index f3687ecd2d757b22b224346bbb8342d83221efdb..0fab8826e14af9184f07bc1262555a71effcd84b 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -@@ -446,6 +446,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -447,6 +447,7 @@ public class BeehiveBlockEntity extends BlockEntity { } private static void setBeeReleaseData(int ticksInHive, Bee beeEntity) { @@ -28,7 +28,7 @@ index 4ee7a4e5637fe36eb50e8ec9186d72d1253bfd98..b345403cdf5b2828f99708fef6513659 int j = beeEntity.getAge(); if (j < 0) { -@@ -455,6 +456,7 @@ public class BeehiveBlockEntity extends BlockEntity { +@@ -456,6 +457,7 @@ public class BeehiveBlockEntity extends BlockEntity { } beeEntity.setInLoveTime(Math.max(0, beeEntity.getInLoveTime() - ticksInHive)); diff --git a/patches/unapplied/server/0249-Configurable-connection-throttle-kick-message.patch b/patches/server/0248-Configurable-connection-throttle-kick-message.patch index ed8fbcb06d..ed8fbcb06d 100644 --- a/patches/unapplied/server/0249-Configurable-connection-throttle-kick-message.patch +++ b/patches/server/0248-Configurable-connection-throttle-kick-message.patch diff --git a/patches/server/0249-Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/0249-Prevent-chunk-loading-from-Fluid-Flowing.patch new file mode 100644 index 0000000000..8426fd78fd --- /dev/null +++ b/patches/server/0249-Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -0,0 +1,88 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Mon, 10 Sep 2018 23:36:16 -0400 +Subject: [PATCH] Prevent chunk loading from Fluid Flowing + + +diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +index 2053d1e0b7577ec99958bae828b4c219b835edfc..83dc8bcd9e2b8ecbd32225e4e10aec392ef28325 100644 +--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java ++++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +@@ -184,6 +184,8 @@ public abstract class FlowingFluid extends Fluid { + Direction enumdirection = (Direction) entry.getKey(); + FluidState fluid1 = (FluidState) entry.getValue(); + BlockPos blockposition1 = pos.relative(enumdirection); ++ final BlockState blockStateIfLoaded = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing ++ if (blockStateIfLoaded == null) continue; // Paper - Prevent chunk loading from fluid flowing + + // CraftBukkit start + org.bukkit.block.Block source = CraftBlock.at(world, pos); +@@ -194,7 +196,7 @@ public abstract class FlowingFluid extends Fluid { + continue; + } + // CraftBukkit end +- this.spreadTo(world, blockposition1, world.getBlockState(blockposition1), enumdirection, fluid1); ++ this.spreadTo(world, blockposition1, blockStateIfLoaded, enumdirection, fluid1); // Paper - Prevent chunk loading from fluid flowing + } + + } +@@ -209,7 +211,8 @@ public abstract class FlowingFluid extends Fluid { + while (iterator.hasNext()) { + Direction enumdirection = (Direction) iterator.next(); + BlockPos.MutableBlockPos blockposition_mutableblockposition1 = blockposition_mutableblockposition.setWithOffset(pos, enumdirection); +- BlockState iblockdata1 = world.getBlockState(blockposition_mutableblockposition1); ++ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition_mutableblockposition1); // Paper - Prevent chunk loading from fluid flowing ++ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing + FluidState fluid = iblockdata1.getFluidState(); + + if (fluid.getType().isSame(this) && FlowingFluid.canPassThroughWall(enumdirection, world, pos, state, blockposition_mutableblockposition1, iblockdata1)) { +@@ -332,7 +335,8 @@ public abstract class FlowingFluid extends Fluid { + + if (enumdirection1 != direction) { + BlockPos blockposition1 = pos.relative(enumdirection1); +- BlockState iblockdata1 = spreadCache.getBlockState(blockposition1); ++ BlockState iblockdata1 = spreadCache.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing ++ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing + FluidState fluid = iblockdata1.getFluidState(); + + if (this.canPassThrough(world, this.getFlowing(), pos, state, enumdirection1, blockposition1, iblockdata1, fluid)) { +@@ -398,7 +402,8 @@ public abstract class FlowingFluid extends Fluid { + while (iterator.hasNext()) { + Direction enumdirection = (Direction) iterator.next(); + BlockPos blockposition1 = pos.relative(enumdirection); +- BlockState iblockdata1 = world.getBlockState(blockposition1); ++ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing ++ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing + FluidState fluid = iblockdata1.getFluidState(); + + if (this.canMaybePassThrough(world, pos, state, enumdirection, blockposition1, iblockdata1, fluid)) { +@@ -564,11 +569,26 @@ public abstract class FlowingFluid extends Fluid { + public BlockState getBlockState(BlockPos pos) { + return this.getBlockState(pos, this.getCacheKey(pos)); + } ++ // Paper start - Prevent chunk loading from fluid flowing ++ public @javax.annotation.Nullable BlockState getBlockStateIfLoaded(BlockPos pos) { ++ return this.getBlockState(pos, this.getCacheKey(pos), false); ++ } ++ // Paper end - Prevent chunk loading from fluid flowing + + private BlockState getBlockState(BlockPos pos, short packed) { +- return (BlockState) this.stateCache.computeIfAbsent(packed, (short1) -> { +- return this.level.getBlockState(pos); +- }); ++ // Paper start - Prevent chunk loading from fluid flowing ++ return getBlockState(pos, packed, true); ++ } ++ private @javax.annotation.Nullable BlockState getBlockState(BlockPos pos, short packed, boolean load) { ++ BlockState blockState = this.stateCache.get(packed); ++ if (blockState == null) { ++ blockState = load ? level.getBlockState(pos) : level.getBlockStateIfLoaded(pos); ++ if (blockState != null) { ++ this.stateCache.put(packed, blockState); ++ } ++ } ++ return blockState; ++ // Paper end - Prevent chunk loading from fluid flowing + } + + public boolean isHole(BlockPos pos) { diff --git a/patches/unapplied/server/0250-Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/unapplied/server/0250-Prevent-chunk-loading-from-Fluid-Flowing.patch deleted file mode 100644 index 50c82e5d54..0000000000 --- a/patches/unapplied/server/0250-Prevent-chunk-loading-from-Fluid-Flowing.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar <[email protected]> -Date: Mon, 10 Sep 2018 23:36:16 -0400 -Subject: [PATCH] Prevent chunk loading from Fluid Flowing - - -diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index b67bc6d6a02fdac377f32a766fd8cc2c5fc43488..3a2ae2bca410708736da64560e74b8010444f2dc 100644 ---- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -@@ -176,7 +176,8 @@ public abstract class FlowingFluid extends Fluid { - Direction enumdirection = (Direction) entry.getKey(); - FluidState fluid1 = (FluidState) entry.getValue(); - BlockPos blockposition1 = pos.relative(enumdirection); -- BlockState iblockdata1 = world.getBlockState(blockposition1); -+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing -+ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing - - if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) { - // CraftBukkit start -@@ -203,7 +204,8 @@ public abstract class FlowingFluid extends Fluid { - while (iterator.hasNext()) { - Direction enumdirection = (Direction) iterator.next(); - BlockPos blockposition1 = pos.relative(enumdirection); -- BlockState iblockdata1 = world.getBlockState(blockposition1); -+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing -+ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing - FluidState fluid = iblockdata1.getFluidState(); - - if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) { -@@ -320,11 +322,18 @@ public abstract class FlowingFluid extends Fluid { - if (enumdirection1 != direction) { - BlockPos blockposition2 = pos.relative(enumdirection1); - short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2); -- Pair<BlockState, FluidState> pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> { -- BlockState iblockdata1 = world.getBlockState(blockposition2); -+ // Paper start - Prevent chunk loading from fluid flowing -+ Pair<BlockState, FluidState> pair = stateCache.get(short0); -+ if (pair == null) { -+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2); -+ if (iblockdatax == null) { -+ continue; -+ } - -- return Pair.of(iblockdata1, iblockdata1.getFluidState()); -- }); -+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState()); -+ stateCache.put(short0, pair); -+ } -+ // Paper end - Prevent chunk loading from fluid flowing - BlockState iblockdata1 = (BlockState) pair.getFirst(); - FluidState fluid = (FluidState) pair.getSecond(); - -@@ -396,11 +405,16 @@ public abstract class FlowingFluid extends Fluid { - Direction enumdirection = (Direction) iterator.next(); - BlockPos blockposition1 = pos.relative(enumdirection); - short short0 = FlowingFluid.getCacheKey(pos, blockposition1); -- Pair<BlockState, FluidState> pair = (Pair) short2objectmap.computeIfAbsent(short0, (short1) -> { -- BlockState iblockdata1 = world.getBlockState(blockposition1); -- -- return Pair.of(iblockdata1, iblockdata1.getFluidState()); -- }); -+ // Paper start - Prevent chunk loading from fluid flowing -+ Pair pair = (Pair) short2objectmap.get(short0); -+ if (pair == null) { -+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition1); -+ if (iblockdatax == null) continue; -+ -+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState()); -+ short2objectmap.put(short0, pair); -+ } -+ // Paper end - Prevent chunk loading from fluid flowing - BlockState iblockdata1 = (BlockState) pair.getFirst(); - FluidState fluid = (FluidState) pair.getSecond(); - FluidState fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1); |