-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor
-
None
-
Affects Version/s: None
-
Environment:
Windows 11 Pro x64 (22H2)
OpenJDK Runtime Environment Temurin-19.0.1+10 (build 19.0.1+10)
-
This server is running CraftBukkit version 3630-Spigot-d90018e-ae8f5fc (MC: 1.19.3) (Implementing API version 1.19.3-R0.1-SNAPSHOT)
-
CarpetLikeAutoCrafting
-
Yes
When you try to use the BlockRedstoneEvent the getNewCurrent or getOldCurrent method returns zero or 15 and not the current level.
Also is it not possible to set the new value with the setNewCurrent method.
Example code:
@EventHandler public void onBlockRedstone(BlockRedstoneEvent event) { Block block = event.getBlock(); if (!NMSInstance.isComparator(block)) { return; } Block blockFacing = NMSInstance.getBlockFacing(block); if (NMSInstance.isAutocraftingDispenser(blockFacing)) { Bukkit.broadcastMessage("Before" + event.getOldCurrent()); Bukkit.broadcastMessage("After" + event.getNewCurrent()); } } @Override public boolean isComparator(Block block) { return block != null && block.getType() == Material.COMPARATOR; } @Override public boolean isAutocraftingDispenser(Block block) { if (block != null && block.getBlockData() instanceof Dispenser dispenser) { org.bukkit.block.Dispenser bukkitDispenser = (org.bukkit.block.Dispenser) block.getState(); if (!bukkitDispenser.isPlaced()) { return false; } Block blockFacing = block.getRelative(dispenser.getFacing()); return blockFacing != null && blockFacing.getType() == Material.CRAFTING_TABLE; } return false; } @Override public BlockFace getBlockFace(Block block) { if (block != null && block.getBlockData() instanceof Directional directional) { return directional.getFacing(); } return null; } @Override public Block getBlockFacing(Block block) { BlockFace face = this.getBlockFace(block); return face != null ? block.getRelative(face) : null; }
My test setup: