Advertisement
Guest User

BlockRedstoneComparator

a guest
Aug 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1. --- a/minecraft/server/BlockRedstoneComparator.java
  2. +++ b/minecraft/server/BlockRedstoneComparator.java
  3. @@ -5,6 +5,8 @@
  4.  import java.util.Random;
  5.  import javax.annotation.Nullable;
  6.  
  7. +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
  8. +
  9.  public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
  10.  
  11.      public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered");
  12. @@ -164,8 +166,18 @@
  13.              boolean flag1 = this.A(iblockdata);
  14.  
  15.              if (flag1 && !flag) {
  16. +                // CraftBukkit start
  17. +                if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
  18. +                    return;
  19. +                }
  20. +                // CraftBukkit end
  21.                  world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(false)), 2);
  22.              } else if (!flag1 && flag) {
  23. +                // CraftBukkit start
  24. +                if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
  25. +                    return;
  26. +                }
  27. +                // CraftBukkit end
  28.                  world.setTypeAndData(blockposition, iblockdata.set(BlockRedstoneComparator.POWERED, Boolean.valueOf(true)), 2);
  29.              }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement