craftbukkit/nms-patches/net/minecraft/world/entity/EntityLightning.patch

64 lines
2.8 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/EntityLightning.java
+++ b/net/minecraft/world/entity/EntityLightning.java
2022-12-08 03:00:00 +11:00
@@ -29,6 +29,10 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.phys.AxisAlignedBB;
2021-06-11 15:00:00 +10:00
import net.minecraft.world.phys.Vec3D;
2021-03-16 09:00:00 +11:00
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
2019-04-23 12:00:00 +10:00
public class EntityLightning extends Entity {
2021-06-11 15:00:00 +10:00
private static final int START_LIFE = 2;
2022-12-08 03:00:00 +11:00
@@ -129,7 +133,7 @@
}
}
2021-06-11 15:00:00 +10:00
- if (this.life >= 0) {
2021-11-22 09:00:00 +11:00
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
2021-06-11 15:00:00 +10:00
if (!(this.level instanceof WorldServer)) {
2021-11-22 09:00:00 +11:00
this.level.setSkyFlashTime(2);
2021-06-11 15:00:00 +10:00
} else if (!this.visualOnly) {
2022-12-08 03:00:00 +11:00
@@ -163,8 +167,12 @@
2021-11-22 09:00:00 +11:00
IBlockData iblockdata = BlockFireAbstract.getState(this.level, blockposition);
2018-07-15 10:00:00 +10:00
2021-11-22 09:00:00 +11:00
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
- this.level.setBlockAndUpdate(blockposition, iblockdata);
2021-06-11 15:00:00 +10:00
- ++this.blocksSetOnFire;
2021-11-22 09:00:00 +11:00
+ // CraftBukkit start - add "!visualOnly"
2021-06-11 15:00:00 +10:00
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) {
2021-11-22 09:00:00 +11:00
+ this.level.setBlockAndUpdate(blockposition, iblockdata);
2021-06-11 15:00:00 +10:00
+ ++this.blocksSetOnFire;
2018-07-15 10:00:00 +10:00
+ }
+ // CraftBukkit end
}
for (int j = 0; j < i; ++j) {
2022-12-08 03:00:00 +11:00
@@ -172,8 +180,12 @@
2018-07-15 10:00:00 +10:00
2021-11-22 09:00:00 +11:00
iblockdata = BlockFireAbstract.getState(this.level, blockposition1);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
2021-06-11 15:00:00 +10:00
- ++this.blocksSetOnFire;
2021-11-22 09:00:00 +11:00
+ // CraftBukkit start - add "!visualOnly"
2021-06-11 15:00:00 +10:00
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition1, this).isCancelled()) {
2021-11-22 09:00:00 +11:00
+ this.level.setBlockAndUpdate(blockposition1, iblockdata);
2021-06-11 15:00:00 +10:00
+ ++this.blocksSetOnFire;
2018-07-15 10:00:00 +10:00
+ }
+ // CraftBukkit end
}
}
2022-12-08 03:00:00 +11:00
@@ -237,8 +249,9 @@
2021-11-22 09:00:00 +11:00
iblockdata = world.getBlockState(blockposition1);
2021-06-11 15:00:00 +10:00
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
+ BlockPosition blockposition1Final = blockposition1; // CraftBukkit - decompile error
2021-11-22 09:00:00 +11:00
WeatheringCopper.getPrevious(iblockdata).ifPresent((iblockdata1) -> {
- world.setBlockAndUpdate(blockposition1, iblockdata1);
+ world.setBlockAndUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
2021-06-11 15:00:00 +10:00
});
2021-11-22 09:00:00 +11:00
world.levelEvent(3002, blockposition1, -1);
2021-06-11 15:00:00 +10:00
return Optional.of(blockposition1);