mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
b3a8254758
By: md_5 <git@md-5.net>
64 lines
2.8 KiB
Diff
64 lines
2.8 KiB
Diff
--- a/net/minecraft/world/entity/EntityLightning.java
|
|
+++ b/net/minecraft/world/entity/EntityLightning.java
|
|
@@ -32,6 +32,11 @@
|
|
import net.minecraft.world.phys.AxisAlignedBB;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityLightning extends Entity {
|
|
|
|
private static final int START_LIFE = 2;
|
|
@@ -132,7 +137,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.life >= 0) {
|
|
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.isEffect
|
|
if (!(this.level instanceof WorldServer)) {
|
|
this.level.c(2);
|
|
} else if (!this.visualOnly) {
|
|
@@ -166,8 +171,12 @@
|
|
IBlockData iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition);
|
|
|
|
if (this.level.getType(blockposition).isAir() && iblockdata.canPlace(this.level, blockposition)) {
|
|
- this.level.setTypeUpdate(blockposition, iblockdata);
|
|
- ++this.blocksSetOnFire;
|
|
+ // CraftBukkit start - add "!isEffect"
|
|
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) {
|
|
+ this.level.setTypeUpdate(blockposition, iblockdata);
|
|
+ ++this.blocksSetOnFire;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
@@ -175,8 +184,12 @@
|
|
|
|
iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition1);
|
|
if (this.level.getType(blockposition1).isAir() && iblockdata.canPlace(this.level, blockposition1)) {
|
|
- this.level.setTypeUpdate(blockposition1, iblockdata);
|
|
- ++this.blocksSetOnFire;
|
|
+ // CraftBukkit start - add "!isEffect"
|
|
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition1, this).isCancelled()) {
|
|
+ this.level.setTypeUpdate(blockposition1, iblockdata);
|
|
+ ++this.blocksSetOnFire;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -240,8 +253,9 @@
|
|
iblockdata = world.getType(blockposition1);
|
|
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
|
|
|
+ BlockPosition blockposition1Final = blockposition1; // CraftBukkit - decompile error
|
|
WeatheringCopper.b(iblockdata).ifPresent((iblockdata1) -> {
|
|
- world.setTypeUpdate(blockposition1, iblockdata1);
|
|
+ world.setTypeUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
|
});
|
|
world.triggerEffect(3002, blockposition1, -1);
|
|
return Optional.of(blockposition1);
|