diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/LightningRodBlock.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/level/block/LightningRodBlock.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/LightningRodBlock.patch b/patch-remap/og/net/minecraft/world/level/block/LightningRodBlock.patch new file mode 100644 index 0000000000..c67e7fcb32 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/level/block/LightningRodBlock.patch @@ -0,0 +1,42 @@ +--- a/net/minecraft/world/level/block/LightningRodBlock.java ++++ b/net/minecraft/world/level/block/LightningRodBlock.java +@@ -33,6 +33,11 @@ + import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.Vec3D; + ++// 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); +@@ -85,6 +90,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); +@@ -142,7 +159,7 @@ + Entity entity = iprojectile.getOwner(); + + entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null); +- world.addFreshEntity(entitylightning); ++ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit + } + + world.playSound((EntityHuman) null, blockposition, SoundEffects.TRIDENT_THUNDER, SoundCategory.WEATHER, 5.0F, 1.0F); |