aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/EntityLightning.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/EntityLightning.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/EntityLightning.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/EntityLightning.patch b/patch-remap/og/net/minecraft/world/entity/EntityLightning.patch
new file mode 100644
index 0000000000..a6705430a4
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/EntityLightning.patch
@@ -0,0 +1,63 @@
+--- a/net/minecraft/world/entity/EntityLightning.java
++++ b/net/minecraft/world/entity/EntityLightning.java
+@@ -29,6 +29,10 @@
+ import net.minecraft.world.phys.AxisAlignedBB;
+ import net.minecraft.world.phys.Vec3D;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
++
+ public class EntityLightning extends Entity {
+
+ private static final int START_LIFE = 2;
+@@ -129,7 +133,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) {
+@@ -163,8 +167,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) {
+@@ -172,8 +180,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
+ }
+ }
+
+@@ -237,8 +249,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);