Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
62 Zeilen
2.6 KiB
Diff
62 Zeilen
2.6 KiB
Diff
--- a/net/minecraft/server/BlockRedstoneTorch.java
|
|
+++ b/net/minecraft/server/BlockRedstoneTorch.java
|
|
@@ -6,6 +6,8 @@
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockRedstoneTorch extends BlockTorch {
|
|
|
|
public static final BlockStateBoolean LIT = BlockProperties.o;
|
|
@@ -65,8 +67,24 @@
|
|
list.remove(0);
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
|
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
+ int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
|
+ // CraftBukkit end
|
|
if (((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue()) {
|
|
if (flag) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 0) {
|
|
+ event.setNewCurrent(0);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 0) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, Boolean.valueOf(false)), 3);
|
|
if (a(world, blockposition, true)) {
|
|
world.a((EntityHuman) null, blockposition, SoundEffects.BLOCK_REDSTONE_TORCH_BURNOUT, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
|
@@ -83,6 +101,15 @@
|
|
}
|
|
}
|
|
} else if (!flag && !a(world, blockposition, false)) {
|
|
+ // CraftBukkit start
|
|
+ if (oldCurrent != 15) {
|
|
+ event.setNewCurrent(15);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 15) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockRedstoneTorch.LIT, Boolean.valueOf(true)), 3);
|
|
}
|
|
|
|
@@ -112,7 +139,7 @@
|
|
}
|
|
|
|
private static boolean a(World world, BlockPosition blockposition, boolean flag) {
|
|
- Object object = (List) BlockRedstoneTorch.b.get(world);
|
|
+ List<RedstoneUpdateInfo> object = (List) BlockRedstoneTorch.b.get(world); // CraftBukkit - decompile error
|
|
|
|
if (object == null) {
|
|
object = Lists.newArrayList();
|