craftbukkit/nms-patches/net/minecraft/world/level/block/BlockCommand.patch

28 lines
1.4 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
2021-06-11 15:00:00 +10:00
@@ -26,6 +26,8 @@
2017-05-14 12:00:00 +10:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
2021-06-11 15:00:00 +10:00
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
2019-04-25 12:00:00 +10:00
private static final Logger LOGGER = LogManager.getLogger();
2021-06-11 15:00:00 +10:00
@@ -56,6 +58,15 @@
2017-05-14 12:00:00 +10:00
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
2019-04-23 12:00:00 +10:00
boolean flag1 = world.isBlockIndirectlyPowered(blockposition);
2019-05-28 06:30:00 +10:00
boolean flag2 = tileentitycommand.f();
2017-05-14 12:00:00 +10:00
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
2019-04-23 12:00:00 +10:00
+ int old = flag2 ? 15 : 0;
+ int current = flag1 ? 15 : 0;
2015-02-26 22:41:06 +00:00
+
2017-05-14 12:00:00 +10:00
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
2019-04-23 12:00:00 +10:00
+ flag1 = eventRedstone.getNewCurrent() > 0;
2017-05-14 12:00:00 +10:00
+ // CraftBukkit end
2016-03-01 08:32:46 +11:00
2019-04-23 12:00:00 +10:00
tileentitycommand.a(flag1);
2021-06-11 15:00:00 +10:00
if (!flag2 && !tileentitycommand.g() && tileentitycommand.t() != TileEntityCommand.Type.SEQUENCE) {