3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-28 17:10:10 +01:00
Paper/nms-patches/BlockRedstoneComparator.patch

41 Zeilen
2.3 KiB
Diff

--- a/net/minecraft/server/BlockRedstoneComparator.java
+++ b/net/minecraft/server/BlockRedstoneComparator.java
2018-12-25 22:00:00 +01:00
@@ -4,6 +4,8 @@
import java.util.Random;
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
2019-12-10 23:00:00 +01:00
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.az;
@@ -70,7 +72,8 @@
2018-08-10 11:43:15 +02:00
@Nullable
private EntityItemFrame a(World world, EnumDirection enumdirection, BlockPosition blockposition) {
2018-12-25 22:00:00 +01:00
- List<EntityItemFrame> list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (entityitemframe) -> {
2018-08-10 11:43:15 +02:00
+ // CraftBukkit - decompile error
2018-12-25 22:00:00 +01:00
+ List<EntityItemFrame> list = world.a(EntityItemFrame.class, new AxisAlignedBB((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 1), (double) (blockposition.getZ() + 1)), (java.util.function.Predicate<EntityItemFrame>) (entityitemframe) -> {
2018-08-10 11:43:15 +02:00
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
});
2019-12-10 23:00:00 +01:00
@@ -125,8 +128,18 @@
2018-12-06 00:00:00 +01:00
boolean flag1 = (Boolean) iblockdata.get(BlockRedstoneComparator.c);
if (flag1 && !flag) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
2018-12-06 00:00:00 +01:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.c, false), 2);
} else if (!flag1 && flag) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
2018-12-06 00:00:00 +01:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneComparator.c, true), 2);
}