HCRival/Atticus/Atticus-Server/nms-patches/BlockDiodeAbstract.patch

31 lines
1.3 KiB
Diff
Raw Normal View History

--- a/net/minecraft/server/BlockDiodeAbstract.java
+++ b/net/minecraft/server/BlockDiodeAbstract.java
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public abstract class BlockDiodeAbstract extends BlockDirectional {
protected final boolean N;
@@ -31,8 +33,18 @@
boolean flag = this.e(world, blockposition, iblockdata);
if (this.N && !flag) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, this.k(iblockdata), 2);
} else if (!this.N) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, this.e(iblockdata), 2);
if (!flag) {
world.a(blockposition, this.e(iblockdata).getBlock(), this.m(iblockdata), -1);