diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LightningRodBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LightningRodBlock.java.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LightningRodBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LightningRodBlock.java.patch new file mode 100644 index 0000000000..41efe02dd4 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LightningRodBlock.java.patch @@ -0,0 +1,53 @@ +--- a/net/minecraft/world/level/block/LightningRodBlock.java ++++ b/net/minecraft/world/level/block/LightningRodBlock.java +@@ -32,6 +32,10 @@ + import net.minecraft.world.level.material.Fluids; + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.Vec3; ++// CraftBukkit start ++import org.bukkit.craftbukkit.block.CraftBlock; ++import org.bukkit.event.block.BlockRedstoneEvent; ++// CraftBukkit end + + public class LightningRodBlock extends RodBlock implements SimpleWaterloggedBlock { + +@@ -90,11 +88,23 @@ + return (Boolean) blockstate.getValue(LightningRodBlock.POWERED) && blockstate.getValue(LightningRodBlock.FACING) == direction ? 15 : 0; + } + +- public void onLightningStrike(BlockState blockstate, Level level, BlockPos blockpos) { +- level.setBlock(blockpos, (BlockState) blockstate.setValue(LightningRodBlock.POWERED, true), 3); +- this.updateNeighbours(blockstate, level, blockpos); +- level.scheduleTick(blockpos, (Block) this, 8); +- level.levelEvent(3002, blockpos, ((Direction) blockstate.getValue(LightningRodBlock.FACING)).getAxis().ordinal()); ++ public void onLightningStrike(IBlockData state, Level level, BlockPos pos) { ++ // CraftBukkit start ++ boolean powered = state.getValue(LightningRodBlock.POWERED); ++ int old = (powered) ? 15 : 0; ++ int current = (!powered) ? 15 : 0; ++ ++ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(level, pos), old, current); ++ level.getCraftServer().getPluginManager().callEvent(eventRedstone); ++ ++ if (eventRedstone.getNewCurrent() <= 0) { ++ return; ++ } ++ // CraftBukkit end ++ level.setBlock(pos, (IBlockData) state.setValue(LightningRodBlock.POWERED, true), 3); ++ this.updateNeighbours(state, level, pos); ++ level.scheduleTick(pos, (Block) this, 8); ++ level.levelEvent(3002, pos, ((Direction) state.getValue(LightningRodBlock.FACING)).getAxis().ordinal()); + } + + private void updateNeighbours(BlockState blockstate, Level level, BlockPos blockpos) { +@@ -152,8 +157,8 @@ + lightningbolt.moveTo(Vec3.atBottomCenterOf(blockpos.above())); + Entity entity = projectile.getOwner(); + +- lightningbolt.setCause(entity instanceof ServerPlayer ? (ServerPlayer) entity : null); +- level.addFreshEntity(lightningbolt); ++ entitylightning.setCause(entity instanceof ServerPlayer ? (ServerPlayer) entity : null); ++ ((ServerLevel) level).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit + } + + level.playSound((Player) null, blockpos, SoundEvents.TRIDENT_THUNDER, SoundSource.WEATHER, 5.0F, 1.0F); |