mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-22 05:26:17 +00:00
74 lines
3.4 KiB
Diff
74 lines
3.4 KiB
Diff
--- a/net/minecraft/world/entity/EntityLightning.java
|
|
+++ b/net/minecraft/world/entity/EntityLightning.java
|
|
@@ -31,6 +31,11 @@
|
|
import net.minecraft.world.phys.AxisAlignedBB;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityLightning extends Entity {
|
|
|
|
private static final int START_LIFE = 2;
|
|
@@ -120,7 +125,7 @@
|
|
}
|
|
}
|
|
|
|
- this.discard();
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
} else if (this.life < -this.random.nextInt(10)) {
|
|
--this.flashes;
|
|
this.life = 1;
|
|
@@ -129,7 +134,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.life >= 0) {
|
|
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
|
|
if (!(this.level() instanceof WorldServer)) {
|
|
this.level().setSkyFlashTime(2);
|
|
} else if (!this.visualOnly) {
|
|
@@ -169,8 +174,12 @@
|
|
IBlockData iblockdata = BlockFireAbstract.getState(this.level(), blockposition);
|
|
|
|
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
|
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
|
- ++this.blocksSetOnFire;
|
|
+ // CraftBukkit start - add "!visualOnly"
|
|
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) {
|
|
+ this.level().setBlockAndUpdate(blockposition, iblockdata);
|
|
+ ++this.blocksSetOnFire;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
for (int j = 0; j < i; ++j) {
|
|
@@ -178,8 +187,12 @@
|
|
|
|
iblockdata = BlockFireAbstract.getState(this.level(), blockposition1);
|
|
if (this.level().getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level(), blockposition1)) {
|
|
- this.level().setBlockAndUpdate(blockposition1, iblockdata);
|
|
- ++this.blocksSetOnFire;
|
|
+ // CraftBukkit start - add "!visualOnly"
|
|
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition1, this).isCancelled()) {
|
|
+ this.level().setBlockAndUpdate(blockposition1, iblockdata);
|
|
+ ++this.blocksSetOnFire;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
@@ -247,8 +260,9 @@
|
|
iblockdata = world.getBlockState(blockposition1);
|
|
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
|
|
|
+ BlockPosition blockposition1Final = blockposition1; // CraftBukkit - decompile error
|
|
WeatheringCopper.getPrevious(iblockdata).ifPresent((iblockdata1) -> {
|
|
- world.setBlockAndUpdate(blockposition1, iblockdata1);
|
|
+ world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
|
});
|
|
world.levelEvent(3002, blockposition1, -1);
|
|
return Optional.of(blockposition1);
|