From a5b1875b2d22015cef507eeb7717b9fd3ec70cf8 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 15 Dec 2024 18:47:15 +0100 Subject: [PATCH] readd conduit effect cause --- .../level/biome/MobSpawnSettings.java.patch | 2 +- .../block/LayeredCauldronBlock.java.patch | 17 ++++++----- .../block/PointedDripstoneBlock.java.patch | 6 ++-- .../world/level/block/SaplingBlock.java.patch | 2 +- .../level/block/ScaffoldingBlock.java.patch | 2 +- .../level/block/SculkSpreader.java.patch | 13 ++------- .../level/block/ShulkerBoxBlock.java.patch | 2 +- .../world/level/block/SpongeBlock.java.patch | 28 +++++++++---------- .../level/block/TripWireHookBlock.java.patch | 2 +- .../AbstractFurnaceBlockEntity.java.patch | 10 +------ .../entity/BeehiveBlockEntity.java.patch | 2 +- .../block/entity/BellBlockEntity.java.patch | 2 +- .../level/block/entity/BlockEntity.java.patch | 7 +---- .../entity/BrewingStandBlockEntity.java.patch | 14 ++-------- .../entity/CampfireBlockEntity.java.patch | 4 ++- .../entity/ConduitBlockEntity.java.patch | 10 ++++++- 16 files changed, 49 insertions(+), 74 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/biome/MobSpawnSettings.java.patch b/paper-server/patches/sources/net/minecraft/world/level/biome/MobSpawnSettings.java.patch index eaf222a4f8..1033724319 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/biome/MobSpawnSettings.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/biome/MobSpawnSettings.java.patch @@ -38,7 +38,7 @@ private final Map> spawners = Stream.of(MobCategory.values()) - .collect(ImmutableMap.toImmutableMap(key -> (MobCategory)key, value -> Lists.newArrayList())); + .collect(Maps.toImmutableEnumMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> new MobList())); // Use MobList instead of ArrayList -+ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls ++ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls private final Map, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap(); private float creatureGenerationProbability = 0.1F; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch index b676bda200..f4af9face8 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/LayeredCauldronBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/LayeredCauldronBlock.java +++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java -@@ -61,35 +_,69 @@ +@@ -61,35 +_,68 @@ @Override protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { @@ -50,25 +50,24 @@ + + // CraftBukkit start + // Paper start - Call CauldronLevelChangeEvent -+ public static boolean changeLevel(Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable -+ return changeLevel(world, blockposition, newBlock, entity, reason, true); ++ public static boolean changeLevel(Level world, BlockPos pos, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable ++ return changeLevel(world, pos, newBlock, entity, reason, true); + } + -+ public static boolean changeLevel(Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable ++ public static boolean changeLevel(Level world, BlockPos pos, BlockState newBlock, @javax.annotation.Nullable Entity entity, org.bukkit.event.block.CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable + // Paper end - Call CauldronLevelChangeEvent -+ org.bukkit.craftbukkit.block.CraftBlockState newState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(world, blockposition); ++ org.bukkit.craftbukkit.block.CraftBlockState newState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(world, pos); + newState.setData(newBlock); + + org.bukkit.event.block.CauldronLevelChangeEvent event = new org.bukkit.event.block.CauldronLevelChangeEvent( -+ world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), ++ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), + (entity == null) ? null : entity.getBukkitEntity(), reason, newState + ); -+ world.getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { ++ if (!event.callEvent()) { + return false; + } + newState.update(true); -+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent ++ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent + return true; + } + // CraftBukkit end diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch index b998179c3b..98e5a6861e 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/PointedDripstoneBlock.java.patch @@ -21,12 +21,12 @@ } else { super.fallOn(level, state, pos, entity, fallDistance); } -@@ -213,10 +_,12 @@ +@@ -213,10 +_,11 @@ if (blockPos != null) { if (fluidAboveStalactite.get().sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { BlockState blockState = Blocks.CLAY.defaultBlockState(); +- level.setBlockAndUpdate(fluidAboveStalactite.get().pos, blockState); + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, fluidAboveStalactite.get().pos, blockState)) { // Paper - Call BlockFormEvent - level.setBlockAndUpdate(fluidAboveStalactite.get().pos, blockState); Block.pushEntitiesUp(fluidAboveStalactite.get().sourceState, blockState, level, fluidAboveStalactite.get().pos); level.gameEvent(GameEvent.BLOCK_CHANGE, fluidAboveStalactite.get().pos, GameEvent.Context.of(blockState)); level.levelEvent(1504, blockPos, 0); @@ -39,7 +39,7 @@ createMergedTips(blockState, server, blockPos); } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { - createDripstone(server, blockPos, direction, DripstoneThickness.TIP); -+ createDripstone(server, blockPos, direction, DripstoneThickness.TIP, pos); // CraftBukkit; ++ createDripstone(server, blockPos, direction, DripstoneThickness.TIP, pos); // CraftBukkit } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SaplingBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SaplingBlock.java.patch index 9cb7276a2c..e165ace2fb 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/SaplingBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -29,7 +29,7 @@ + level.captureTreeGeneration = true; + this.treeGrower.growTree(level, level.getChunkSource().getGenerator(), pos, state, random); + level.captureTreeGeneration = false; -+ if (level.capturedBlockStates.size() > 0) { ++ if (!level.capturedBlockStates.isEmpty()) { + org.bukkit.TreeType treeType = SaplingBlock.treeType; + SaplingBlock.treeType = null; + org.bukkit.Location location = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(pos, level.getWorld()); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ScaffoldingBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ScaffoldingBlock.java.patch index 8ad4e9b5f3..fceeff2d27 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ScaffoldingBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ScaffoldingBlock.java.patch @@ -5,7 +5,7 @@ int distance = getDistance(level, pos); BlockState blockState = state.setValue(DISTANCE, Integer.valueOf(distance)).setValue(BOTTOM, Boolean.valueOf(this.isBottom(level, pos, distance))); - if (blockState.getValue(DISTANCE) == 7) { -+ if (blockState.getValue(DISTANCE) == 7&& !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, blockState.getFluidState().createLegacyBlock()).isCancelled()) { // CraftBukkit - BlockFadeEvent // Paper - fix wrong block state ++ if (blockState.getValue(DISTANCE) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, blockState.getFluidState().createLegacyBlock()).isCancelled()) { // CraftBukkit - BlockFadeEvent // Paper - fix wrong block state if (state.getValue(DISTANCE) == 7) { FallingBlockEntity.fall(level, pos, blockState); } else { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SculkSpreader.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SculkSpreader.java.patch index 07f35283e7..1d958f6ac9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/SculkSpreader.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/SculkSpreader.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/world/level/block/SculkSpreader.java +++ b/net/minecraft/world/level/block/SculkSpreader.java -@@ -25,6 +_,7 @@ - import net.minecraft.core.Vec3i; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.NbtOps; -+import net.minecraft.nbt.Tag; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; @@ -50,6 +_,7 @@ private final int additionalDecayRate; private List cursors = new ArrayList<>(); @@ -25,7 +17,7 @@ } } } -@@ -130,13 +_,25 @@ +@@ -130,13 +_,24 @@ public void addCursors(BlockPos pos, int charge) { while (charge > 0) { int min = Math.min(charge, 1000); @@ -42,8 +34,7 @@ + if (!this.isWorldGeneration() && fireEvent) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation // Paper - add boolean to conditionally fire SculkBloomEvent + org.bukkit.craftbukkit.block.CraftBlock bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, cursor.pos); + org.bukkit.event.block.SculkBloomEvent event = new org.bukkit.event.block.SculkBloomEvent(bukkitBlock, cursor.getCharge()); -+ org.bukkit.Bukkit.getPluginManager().callEvent(event); -+ if (event.isCancelled()) { ++ if (!event.callEvent()) { + return; + } + diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch index ebbcb447db..44b9126421 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ShulkerBoxBlock.java.patch @@ -7,7 +7,7 @@ - && canOpen(state, level, pos, shulkerBoxBlockEntity)) { - player.openMenu(shulkerBoxBlockEntity); + && canOpen(state, level, pos, shulkerBoxBlockEntity) // Paper - Fix InventoryOpenEvent cancellation - expand if for belows check -+ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation) { ++ && player.openMenu(shulkerBoxBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.OPEN_SHULKER_BOX); PiglinAi.angerNearbyPiglins(serverLevel, player, true); } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/SpongeBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/SpongeBlock.java.patch index f39e9bfdf1..cba02b7710 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/SpongeBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/SpongeBlock.java.patch @@ -33,7 +33,7 @@ } else { if (!blockState.is(Blocks.KELP) && !blockState.is(Blocks.KELP_PLANT) -@@ -81,16 +_,57 @@ +@@ -81,16 +_,55 @@ return BlockPos.TraversalNodeStatus.SKIP; } @@ -58,36 +58,34 @@ + // CraftBukkit start + java.util.List blocks = blockList.getList(); // Is a clone + if (!blocks.isEmpty()) { -+ final org.bukkit.block.Block bblock = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); ++ final org.bukkit.block.Block sponge = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); + -+ org.bukkit.event.block.SpongeAbsorbEvent event = new org.bukkit.event.block.SpongeAbsorbEvent(bblock, (java.util.List) (java.util.List) blocks); -+ level.getCraftServer().getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) { ++ org.bukkit.event.block.SpongeAbsorbEvent event = new org.bukkit.event.block.SpongeAbsorbEvent(sponge, (java.util.List) (java.util.List) blocks); ++ if (!event.callEvent()) { + return false; + } + + for (org.bukkit.craftbukkit.block.CraftBlockState block : blocks) { -+ BlockPos blockposition1 = block.getPosition(); -+ BlockState iblockdata = level.getBlockState(blockposition1); -+ FluidState fluid = level.getFluidState(blockposition1); ++ BlockPos blockPos = block.getPosition(); ++ BlockState state = level.getBlockState(blockPos); ++ FluidState fluid = level.getFluidState(blockPos); + + if (fluid.is(FluidTags.WATER)) { -+ if (iblockdata.getBlock() instanceof BucketPickup && !((BucketPickup) iblockdata.getBlock()).pickupBlock(null, blockList, blockposition1, iblockdata).isEmpty()) { ++ if (state.getBlock() instanceof BucketPickup bucketPickup && !bucketPickup.pickupBlock(null, blockList, blockPos, state).isEmpty()) { + // NOP -+ } else if (iblockdata.getBlock() instanceof LiquidBlock) { ++ } else if (state.getBlock() instanceof LiquidBlock) { + // NOP -+ } else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) { -+ BlockEntity tileentity = iblockdata.hasBlockEntity() ? level.getBlockEntity(blockposition1) : null; ++ } else if (state.is(Blocks.KELP) || state.is(Blocks.KELP_PLANT) || state.is(Blocks.SEAGRASS) || state.is(Blocks.TALL_SEAGRASS)) { ++ BlockEntity blockEntity = state.hasBlockEntity() ? level.getBlockEntity(blockPos) : null; + + // Paper start - Fix SpongeAbsortEvent handling + if (block.getHandle().isAir()) { -+ dropResources(iblockdata, level, blockposition1, tileentity); ++ dropResources(state, level, blockPos, blockEntity); + } + // Paper end - Fix SpongeAbsortEvent handling + } + } -+ level.setBlock(blockposition1, block.getHandle(), block.getFlag()); ++ level.setBlock(blockPos, block.getHandle(), block.getFlag()); + } + + return true; diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch index 8a437b9c80..661176a03d 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch @@ -15,7 +15,7 @@ emitState(level, pos, flag2, flag3, flag, flag1); if (!attaching) { -+ if (level.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update ++ if (level.getBlockState(pos).is(Blocks.TRIPWIRE_HOOK)) // Paper - Validate tripwire hook placement before update level.setBlock(pos, blockState1.setValue(FACING, direction), 3); if (shouldNotifyNeighbours) { notifyNeighbors(block, level, pos, direction); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 622ee5f7ef..1359ae7732 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -20,7 +_,6 @@ - import net.minecraft.world.ContainerHelper; - import net.minecraft.world.WorldlyContainer; - import net.minecraft.world.entity.ExperienceOrb; --import net.minecraft.world.entity.player.Player; - import net.minecraft.world.entity.player.StackedItemContents; - import net.minecraft.world.inventory.ContainerData; - import net.minecraft.world.inventory.RecipeCraftingHolder; @@ -99,11 +_,44 @@ }; public final Reference2IntOpenHashMap>> recipesUsed = new Reference2IntOpenHashMap<>(); @@ -209,7 +201,7 @@ + /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */ + : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, singleRecipeInput, level).map(holder -> holder.value().cookingTime()).orElse(200)); + return (int) Math.ceil (cookTime / cookSpeedMultiplier); -+ // Paper end - cook speed multiplier AP ++ // Paper end - cook speed multiplier API } @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch index 2ab50074f8..4826839013 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java.patch @@ -238,7 +238,7 @@ } bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticksInHive)); -+ } // Paper - Honor ageLock ++ } // Paper - Honor ageLock } } } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch index 0f09f0acaf..810b2c47e5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BellBlockEntity.java.patch @@ -45,7 +45,7 @@ return raider.isAlive() && !raider.isRemoved() && pos.closerToCenterThan(raider.position(), 48.0) && raider.getType().is(EntityTypeTags.RAIDERS); } -+ @io.papermc.paper.annotation.DoNotUse // Paper - Add BellRevealRaiderEvent ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add BellRevealRaiderEvent private static void glow(LivingEntity entity) { + // Paper start - Add BellRevealRaiderEvent + glow(entity, null); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BlockEntity.java.patch index 8ed4390459..c54e142ea3 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -71,7 +71,7 @@ CrashReportCategory.populateBlockDetails(reportCategory, this.level, this.worldPosition, this.level.getBlockState(this.worldPosition)); } } -@@ -247,10 +_,16 @@ +@@ -247,6 +_,12 @@ } public final void applyComponents(DataComponentMap components, DataComponentPatch patch) { @@ -84,11 +84,6 @@ final Set> set = new HashSet<>(); set.add(DataComponents.BLOCK_ENTITY_DATA); set.add(DataComponents.BLOCK_STATE); -- final DataComponentMap dataComponentMap = PatchedDataComponentMap.fromPatch(components, patch); -+ final PatchedDataComponentMap dataComponentMap = PatchedDataComponentMap.fromPatch(components, patch); - this.applyImplicitComponents(new BlockEntity.DataComponentInput() { - @Nullable - @Override @@ -267,6 +_,10 @@ }); DataComponentPatch dataComponentPatch = patch.forget(set::contains); diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch index c96cf8d8fd..f3cb6d6470 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -8,7 +_,6 @@ - import net.minecraft.core.NonNullList; - import net.minecraft.nbt.CompoundTag; - import net.minecraft.network.chat.Component; --import net.minecraft.tags.ItemTags; - import net.minecraft.world.ContainerHelper; - import net.minecraft.world.Containers; - import net.minecraft.world.WorldlyContainer; @@ -36,6 +_,7 @@ public static final int NUM_DATA_VALUES = 2; private NonNullList items = NonNullList.withSize(5, ItemStack.EMPTY); @@ -76,14 +68,12 @@ public BrewingStandBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.BREWING_STAND, pos, state); -@@ -92,9 +_,22 @@ - +@@ -93,8 +_,21 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, BrewingStandBlockEntity blockEntity) { ItemStack itemStack = blockEntity.items.get(4); -- if (blockEntity.fuel <= 0 && itemStack.is(ItemTags.BREWING_FUEL)) { + if (blockEntity.fuel <= 0 && itemStack.is(ItemTags.BREWING_FUEL)) { - blockEntity.fuel = 20; - itemStack.shrink(1); -+ if (blockEntity.fuel <= 0 && itemStack.is(net.minecraft.tags.ItemTags.BREWING_FUEL)) { + // CraftBukkit start + org.bukkit.event.inventory.BrewingStandFuelEvent event = new org.bukkit.event.inventory.BrewingStandFuelEvent( + org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CampfireBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CampfireBlockEntity.java.patch index 3d53a28694..f9fd2a5136 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/CampfireBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/CampfireBlockEntity.java.patch @@ -8,7 +8,7 @@ public CampfireBlockEntity(BlockPos pos, BlockState blockState) { super(BlockEntityType.CAMPFIRE, pos, blockState); -@@ -54,14 +_,42 @@ +@@ -54,14 +_,44 @@ ItemStack itemStack = campfire.items.get(i); if (!itemStack.isEmpty()) { flag = true; @@ -18,10 +18,12 @@ if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SingleRecipeInput singleRecipeInput = new SingleRecipeInput(itemStack); - ItemStack itemStack1 = check.getRecipeFor(singleRecipeInput, level) ++ // Paper start - add recipe to cook events + final var optionalCookingRecipe = check.getRecipeFor(singleRecipeInput, level); + ItemStack itemStack1 = optionalCookingRecipe .map(recipe -> recipe.value().assemble(singleRecipeInput, level.registryAccess())) .orElse(itemStack); ++ // Paper end - add recipe to cook events if (itemStack1.isItemEnabled(level.enabledFeatures())) { - Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), itemStack1); + // CraftBukkit start - fire BlockCookEvent diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch index 2ca6be14cc..72506d9166 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/entity/ConduitBlockEntity.java.patch @@ -29,7 +29,15 @@ int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); -@@ -185,6 +_,12 @@ +@@ -178,13 +_,19 @@ + if (!entitiesOfClass.isEmpty()) { + for (Player player : entitiesOfClass) { + if (pos.closerThan(player.blockPosition(), i) && player.isInWaterOrRain()) { +- player.addEffect(new MobEffectInstance(MobEffects.CONDUIT_POWER, 260, 0, true, true)); ++ player.addEffect(new MobEffectInstance(MobEffects.CONDUIT_POWER, 260, 0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONDUIT); // CraftBukkit + } + } + } } private static void updateDestroyTarget(Level level, BlockPos pos, BlockState state, List positions, ConduitBlockEntity blockEntity) {