From 5f8b7c1634920acce81461a827871e88720e8b3c Mon Sep 17 00:00:00 2001 From: Cryptite Date: Mon, 28 Feb 2022 09:04:01 -0600 Subject: [PATCH] Patch Work 2 --- ...03-Add-BlockDestroyedByNeighborEvent.patch | 79 ++++++++++ ...0004-Add-Player-to-SpongeAbsorbEvent.patch | 52 +++++++ ...05-Add-provided-Material-to-getDrops.patch | 31 ++++ ...rack-Player-throughout-block-destroy.patch | 139 ++++++++++++++++++ ...08-Add-BlockDestroyedByNeighborEvent.patch | 46 ++++++ ...0009-Add-Player-to-SpongeAbsorbEvent.patch | 20 +++ ...10-Add-provided-Material-to-getDrops.patch | 38 +++++ .../0011-Allow-access-to-LightEngine.patch | 19 +++ 8 files changed, 424 insertions(+) create mode 100644 patches/api/0003-Add-BlockDestroyedByNeighborEvent.patch create mode 100644 patches/api/0004-Add-Player-to-SpongeAbsorbEvent.patch create mode 100644 patches/api/0005-Add-provided-Material-to-getDrops.patch create mode 100644 patches/server/0007-Track-Player-throughout-block-destroy.patch create mode 100644 patches/server/0008-Add-BlockDestroyedByNeighborEvent.patch create mode 100644 patches/server/0009-Add-Player-to-SpongeAbsorbEvent.patch create mode 100644 patches/server/0010-Add-provided-Material-to-getDrops.patch create mode 100644 patches/server/0011-Allow-access-to-LightEngine.patch diff --git a/patches/api/0003-Add-BlockDestroyedByNeighborEvent.patch b/patches/api/0003-Add-BlockDestroyedByNeighborEvent.patch new file mode 100644 index 000000000..55ad4079a --- /dev/null +++ b/patches/api/0003-Add-BlockDestroyedByNeighborEvent.patch @@ -0,0 +1,79 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:54:52 -0600 +Subject: [PATCH] Add BlockDestroyedByNeighborEvent + + +diff --git a/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7db2789d54a609b023ea6deff87b45d717aabbf0 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java +@@ -0,0 +1,67 @@ ++package io.papermc.paper.event.block; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.block.BlockEvent; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called when a block is broken another block. This is generally the result of BlockPhysicsEvent propagation ++ */ ++public class BlockDestroyedByNeighborEvent extends BlockEvent implements Cancellable { ++ private static final HandlerList handlers = new HandlerList(); ++ private final Player player; ++ private final Block sourceBlock; ++ private boolean cancel; ++ ++ public BlockDestroyedByNeighborEvent(@NotNull final Block theBlock, @Nullable Player player, @NotNull final Block sourceBlock) { ++ super(theBlock); ++ ++ this.player = player; ++ this.sourceBlock = sourceBlock; ++ } ++ ++ /** ++ * Gets the Player that caused this ++ * ++ * @return The Player that is breaking the block involved in this event ++ */ ++ @Nullable ++ public Player getPlayer() { ++ return player; ++ } ++ ++ /** ++ * Gets the source block that caused this block break ++ * ++ * @return The Source Block which block is involved in this event ++ */ ++ @NotNull ++ public final Block getSourceBlock() { ++ return sourceBlock; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return cancel; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancel = cancel; ++ } ++ ++ @Override ++ @NotNull ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} diff --git a/patches/api/0004-Add-Player-to-SpongeAbsorbEvent.patch b/patches/api/0004-Add-Player-to-SpongeAbsorbEvent.patch new file mode 100644 index 000000000..9731072c9 --- /dev/null +++ b/patches/api/0004-Add-Player-to-SpongeAbsorbEvent.patch @@ -0,0 +1,52 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:55:29 -0600 +Subject: [PATCH] Add Player to SpongeAbsorbEvent + + +diff --git a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java +index 7029cfcd00ed5d9c7f06898ec2b81238ec775a70..0e2f21e0f1983d2e8b67deebf4d12d25107d1582 100644 +--- a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java ++++ b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java +@@ -7,6 +7,7 @@ import org.bukkit.block.BlockState; + import org.bukkit.event.Cancellable; + import org.bukkit.event.HandlerList; + import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; // Paper + + /** + * Called when a sponge absorbs water from the world. +@@ -21,11 +22,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + private boolean cancelled; ++ private final org.bukkit.entity.Player player; // Paper + private final List blocks; + +- public SpongeAbsorbEvent(@NotNull Block block, @NotNull List waterblocks) { ++ public SpongeAbsorbEvent(@NotNull Block block, @Nullable org.bukkit.entity.Player player, @NotNull List waterblocks) { // Paper + super(block); + this.blocks = waterblocks; ++ this.player = player; // Paper + } + + /** +@@ -41,6 +44,18 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable { + return blocks; + } + ++ // Paper start ++ /** ++ * Gets the Player that placed the Sponge Block ++ * ++ * @return The Player that placed the sponge block causing the absorb event, or null if no Player was involved ++ */ ++ @Nullable ++ public org.bukkit.entity.Player getPlayer() { ++ return player; ++ } ++ // Paper end ++ + @Override + public boolean isCancelled() { + return cancelled; diff --git a/patches/api/0005-Add-provided-Material-to-getDrops.patch b/patches/api/0005-Add-provided-Material-to-getDrops.patch new file mode 100644 index 000000000..f492ec642 --- /dev/null +++ b/patches/api/0005-Add-provided-Material-to-getDrops.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:56:16 -0600 +Subject: [PATCH] Add provided Material to getDrops + + +diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java +index fe23d144175b3bd55564a4a266b98cd2fc70a08a..dfa5762c500bd3798fc6e40bd786fd61c88f9e3a 100644 +--- a/src/main/java/org/bukkit/block/Block.java ++++ b/src/main/java/org/bukkit/block/Block.java +@@ -612,6 +612,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran + @NotNull + Collection getDrops(@NotNull ItemStack tool, @Nullable Entity entity); + ++ // Slice start ++ /** ++ * Returns a list of items which would drop by the entity destroying this ++ * block as though it were a given Material with a specific tool ++ * ++ * @param blockType The block type to use as the source loot ++ * @param tool The tool or item in hand used for digging ++ * @param entity the entity destroying the block ++ * @return a list of dropped items for this type of block ++ */ ++ @NotNull ++ Collection getDrops(@NotNull Material blockType, @NotNull ItemStack tool, @Nullable Entity entity); ++ // Slice end ++ + /** + * Returns if the given item is a preferred choice to break this Block. + * diff --git a/patches/server/0007-Track-Player-throughout-block-destroy.patch b/patches/server/0007-Track-Player-throughout-block-destroy.patch new file mode 100644 index 000000000..3218e7b8b --- /dev/null +++ b/patches/server/0007-Track-Player-throughout-block-destroy.patch @@ -0,0 +1,139 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:53:55 -0600 +Subject: [PATCH] Track Player throughout block destroy + + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index cc5dbc86c8265540948e6b1445d84ecf0b7762aa..170f58e56c6a6cae26f7c9e55c74c3c3074500da 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -441,6 +441,7 @@ public class ServerPlayerGameMode { + org.bukkit.block.BlockState state = bblock.getState(); + level.captureDrops = new ArrayList<>(); + // CraftBukkit end ++ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper + block.playerWillDestroy(this.level, pos, iblockdata, this.player); + boolean flag = this.level.removeBlock(pos, false); + +@@ -465,6 +466,7 @@ public class ServerPlayerGameMode { + // CraftBukkit start + java.util.List itemsToDrop = level.captureDrops; // Paper - store current list + level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff ++ level.pendingPlayerBlockEvents.remove(pos); // Paper + if (event.isDropItems()) { + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref + } +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 8bd12326e591213f0a093b96a5af3f04e19dc980..aeff3a9cc6b3531cb0d690bf574094cb525f57eb 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -323,6 +323,7 @@ public final class ItemStack { + } + } + Item item = this.getItem(); ++ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper + InteractionResult enuminteractionresult = item.useOn(itemactioncontext); + CompoundTag newData = this.getTagClone(); + int newCount = this.getCount(); +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index fb283572b11ed6e482ada401c44d40c9c5e37367..d8ef17bc72388046e3f428c108aaaecd02d4eed3 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -174,6 +174,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions + public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here + ++ // Paper start - Holder class used to track what Player is responsible the last block event ++ public static class PendingBlockEvent { ++ ++ public final BlockPos block; ++ public final Player player; ++ public @Nullable BlockPos sourceBlock; ++ ++ public PendingBlockEvent(BlockPos block, Player player) { ++ this(block, player, null); ++ } ++ ++ public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) { ++ this.block = block; ++ this.player = player; ++ this.sourceBlock = sourceBlock; ++ } ++ ++ } ++ public final Map pendingPlayerBlockEvents = new HashMap<>(); ++ // Paper end ++ + // Paper start - fix and optimise world upgrading + // copied from below + public static ResourceKey getDimensionKey(DimensionType manager) { +@@ -692,6 +713,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + if (!this.preventPoiUpdated) { + this.onBlockStateChange(blockposition, iblockdata1, iblockdata2); + } ++ pendingPlayerBlockEvents.remove(blockposition); // Paper + // CraftBukkit end + } + } +@@ -797,8 +819,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) { + if (!this.isClientSide) { + BlockState iblockdata = this.getBlockState(pos); ++ org.bukkit.block.Block blockAt = world.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // Paper + + try { ++ // Paper start - If this is a non-air block being set to an air block, get (remove, if exists) ++ // our PendingBlockEvent ++ if (blockAt.getType() != org.bukkit.Material.AIR && iblockdata.getMaterial() == net.minecraft.world.level.material.Material.AIR) { ++ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.remove(pos); ++ if (blockEvent != null) { ++ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block ++ //because it's important to remove from pendingPlayerBlockEvents ++ } ++ } ++ // Paper end ++ + // CraftBukkit start + CraftWorld world = ((ServerLevel) this).getWorld(); + if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper +diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +index e12b76238cb52a1007f2102473b7f892f8521b62..301dfb74fec49b7f6f0452e4c49c8f1df43c0180 100644 +--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +@@ -104,6 +104,12 @@ public class DoublePlantBlock extends BushBlock { + BlockPos blockposition1 = pos.below(); + BlockState iblockdata1 = world.getBlockState(blockposition1); + ++ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); ++ if (blockEvent != null) { ++ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block ++ //because it's important to remove from pendingPlayerBlockEvents ++ } ++ + if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) { + BlockState iblockdata2 = iblockdata1.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata1.getValue(BlockStateProperties.WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState(); + +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +index eac017fc521bfd1391e75db8628f42b28329d681..b19164ca156f76e61cac17c4d924f14845d49148 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +@@ -966,6 +966,18 @@ public abstract class BlockBehaviour { + + blockposition_mutableblockposition.setWithOffset(pos, enumdirection); + BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition); ++ ++ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block ++ // if it will break (!canSurvive) ++ if (this.getMaterial() == Material.AIR && !iblockdata.canSurvive(world, blockposition_mutableblockposition)) { ++ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos); ++ if (blockEvent != null) { ++ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable(); ++ ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos)); ++ } ++ } ++ // Paper end ++ + BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos); + + Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth); diff --git a/patches/server/0008-Add-BlockDestroyedByNeighborEvent.patch b/patches/server/0008-Add-BlockDestroyedByNeighborEvent.patch new file mode 100644 index 000000000..b5439c777 --- /dev/null +++ b/patches/server/0008-Add-BlockDestroyedByNeighborEvent.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:54:52 -0600 +Subject: [PATCH] Add BlockDestroyedByNeighborEvent + + +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index d8ef17bc72388046e3f428c108aaaecd02d4eed3..f2a9da819243a140550a37b2b17182f70c01fddd 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -735,6 +735,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + if (iblockdata.isAir()) { + return false; + } else { ++ // Paper start ++ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos); ++ if (blockEvent != null && blockEvent.sourceBlock != null) { ++ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event = ++ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos), ++ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(), ++ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock)); ++ event.callEvent(); ++ } ++ // Paper end ++ + FluidState fluid = this.getFluidState(pos); + // Paper start - while the above setAir method is named same and looks very similar + // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent, +diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +index 301dfb74fec49b7f6f0452e4c49c8f1df43c0180..6b63bc56bfa757a17f9a6f98b31861a7f350be80 100644 +--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +@@ -106,8 +106,11 @@ public class DoublePlantBlock extends BushBlock { + + Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); + if (blockEvent != null) { +- //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block +- //because it's important to remove from pendingPlayerBlockEvents ++ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event = ++ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1), ++ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(), ++ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)); ++ if (!event.callEvent()) return; + } + + if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) { diff --git a/patches/server/0009-Add-Player-to-SpongeAbsorbEvent.patch b/patches/server/0009-Add-Player-to-SpongeAbsorbEvent.patch new file mode 100644 index 000000000..926f84345 --- /dev/null +++ b/patches/server/0009-Add-Player-to-SpongeAbsorbEvent.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:55:29 -0600 +Subject: [PATCH] Add Player to SpongeAbsorbEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java +index 842997ea9f25a05d74a2e8300e44cc39a7e9cd96..e3cd6125a0248f6f68cbb126fedcdb1f6447bef0 100644 +--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java +@@ -110,7 +110,8 @@ public class SpongeBlock extends Block { + if (!blocks.isEmpty()) { + final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); + +- SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List) (List) blocks); ++ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); // Paper ++ SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, blockEvent != null ? (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity() : null, (List) (List) blocks); // Paper + world.getCraftServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { diff --git a/patches/server/0010-Add-provided-Material-to-getDrops.patch b/patches/server/0010-Add-provided-Material-to-getDrops.patch new file mode 100644 index 000000000..f6d905d26 --- /dev/null +++ b/patches/server/0010-Add-provided-Material-to-getDrops.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:56:16 -0600 +Subject: [PATCH] Add provided Material to getDrops + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +index 01b904b8cc32bcb1e665db773dafa0adfb4c5b55..cacad8df8bc158f3434acea94f6b36b01a096aa2 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +@@ -541,7 +541,18 @@ public class CraftBlock implements Block { + + @Override + public Collection getDrops(ItemStack item, Entity entity) { +- net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS(); ++ return getDrops(null, item, entity); // Slice start ++ } ++ ++ @Override ++ public Collection getDrops(Material blockType, ItemStack item, Entity entity) { ++ net.minecraft.world.level.block.state.BlockState iblockdata; ++ if (blockType == null) { ++ iblockdata = this.getNMS(); ++ } else { ++ iblockdata = ((CraftBlockData) blockType.createBlockData()).getState(); ++ } ++ + net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item); + + // Modelled off EntityHuman#hasBlock +@@ -552,6 +563,7 @@ public class CraftBlock implements Block { + return Collections.emptyList(); + } + } ++ // Slice end + + @Override + public boolean isPreferredTool(ItemStack item) { diff --git a/patches/server/0011-Allow-access-to-LightEngine.patch b/patches/server/0011-Allow-access-to-LightEngine.patch new file mode 100644 index 000000000..a51f4e641 --- /dev/null +++ b/patches/server/0011-Allow-access-to-LightEngine.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Cryptite +Date: Mon, 28 Feb 2022 08:56:44 -0600 +Subject: [PATCH] Allow access to LightEngine + + +diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java +index afef3ea6d1ae5f145261eaae3da720fdf9e923a8..ca81340ad3dec12e1551d47a87a89a3d0207bd46 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +@@ -641,7 +641,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + return !ChunkMap.isChunkInRange(x1, z1, x2, z2, distance) ? false : (!ChunkMap.isChunkInRange(x1 + 1, z1, x2, z2, distance) ? true : (!ChunkMap.isChunkInRange(x1, z1 + 1, x2, z2, distance) ? true : (!ChunkMap.isChunkInRange(x1 - 1, z1, x2, z2, distance) ? true : !ChunkMap.isChunkInRange(x1, z1 - 1, x2, z2, distance)))); + } + +- protected ThreadedLevelLightEngine getLightEngine() { ++ public ThreadedLevelLightEngine getLightEngine() { // Slice (public) + return this.lightEngine; + } +