mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-22 10:06:16 +00:00
34 lines
1.4 KiB
Diff
34 lines
1.4 KiB
Diff
--- a/net/minecraft/world/level/block/LightningRodBlock.java
|
|
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
|
|
@@ -24,6 +24,11 @@
|
|
import net.minecraft.world.level.material.FluidTypes;
|
|
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
|
|
|
|
public static final MapCodec<LightningRodBlock> CODEC = simpleCodec(LightningRodBlock::new);
|
|
@@ -76,6 +81,18 @@
|
|
}
|
|
|
|
public void onLightningStrike(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
+ // CraftBukkit start
|
|
+ boolean powered = iblockdata.getValue(LightningRodBlock.POWERED);
|
|
+ int old = (powered) ? 15 : 0;
|
|
+ int current = (!powered) ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), old, current);
|
|
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
|
+
|
|
+ if (eventRedstone.getNewCurrent() <= 0) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(LightningRodBlock.POWERED, true), 3);
|
|
this.updateNeighbours(iblockdata, world, blockposition);
|
|
world.scheduleTick(blockposition, (Block) this, 8);
|