mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-24 09:16:06 +01:00
eed041d629
By: md_5 <git@md-5.net>
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
--- a/net/minecraft/world/level/block/LightningRodBlock.java
|
|
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
|
|
@@ -22,6 +22,11 @@
|
|
import net.minecraft.world.level.material.FluidType;
|
|
import net.minecraft.world.level.material.FluidTypes;
|
|
|
|
+// 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);
|
|
@@ -74,6 +79,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);
|