2023-11-11 21:09:14 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Tamion <70228790+notTamion@users.noreply.github.com>
|
|
|
|
Date: Sat, 30 Sep 2023 12:36:14 +0200
|
|
|
|
Subject: [PATCH] Fix strikeLightningEffect powers lightning rods and clears
|
|
|
|
copper
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
index 41a3ca4edf4fa662f2af13efd7b78b56e24aa4a7..0a8a53710c693a220e9475f6f3112b91d8209c00 100644
|
2023-11-11 21:09:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -46,6 +46,7 @@ public class LightningBolt extends Entity {
|
2023-11-11 21:09:14 +01:00
|
|
|
private ServerPlayer cause;
|
|
|
|
private final Set<Entity> hitEntities = Sets.newHashSet();
|
|
|
|
private int blocksSetOnFire;
|
2024-01-13 18:34:33 +01:00
|
|
|
+ public boolean isEffect; // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
|
|
|
|
public LightningBolt(EntityType<? extends LightningBolt> type, Level world) {
|
|
|
|
super(type, world);
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -86,7 +87,7 @@ public class LightningBolt extends Entity {
|
2023-11-11 21:09:14 +01:00
|
|
|
@Override
|
|
|
|
public void tick() {
|
|
|
|
super.tick();
|
2024-01-14 10:46:04 +01:00
|
|
|
- if (this.life == 2) {
|
|
|
|
+ if (!this.isEffect && this.life == 2) { // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
if (this.level().isClientSide()) {
|
|
|
|
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false);
|
|
|
|
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false);
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -133,7 +134,7 @@ public class LightningBolt extends Entity {
|
2023-11-11 21:09:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
|
2024-01-13 18:34:33 +01:00
|
|
|
+ if (this.life >= 0 && !this.isEffect) { // CraftBukkit - add !this.visualOnly // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
if (!(this.level() instanceof ServerLevel)) {
|
|
|
|
this.level().setSkyFlashTime(2);
|
|
|
|
} else if (!this.visualOnly) {
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -162,7 +163,7 @@ public class LightningBolt extends Entity {
|
2023-11-11 21:09:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void spawnFire(int spreadAttempts) {
|
|
|
|
- if (!this.visualOnly && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
|
2024-01-13 18:34:33 +01:00
|
|
|
+ if (!this.visualOnly && !this.isEffect && !this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
BlockPos blockposition = this.blockPosition();
|
|
|
|
BlockState iblockdata = BaseFireBlock.getState(this.level(), blockposition);
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2024-04-06 21:53:39 +02:00
|
|
|
index 6b6e5d483adc47a8db177359fbfcd626825c460f..cdcab87bfe2e207ee1f4f8a111682efefbd96511 100644
|
2023-11-11 21:09:14 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2024-04-06 21:53:39 +02:00
|
|
|
@@ -766,7 +766,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2023-11-11 21:09:14 +01:00
|
|
|
|
|
|
|
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(this.world);
|
|
|
|
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());
|
|
|
|
- lightning.setVisualOnly(isVisual);
|
2024-01-13 18:34:33 +01:00
|
|
|
+ lightning.isEffect = isVisual; // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
this.world.strikeLightning(lightning, LightningStrikeEvent.Cause.CUSTOM);
|
|
|
|
return (LightningStrike) lightning.getBukkitEntity();
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
2024-01-14 10:46:04 +01:00
|
|
|
index 6fed8075aa75e3852dc826a45ca44603c0446a56..e9f471e60af0725ec34e2985d63ae9ea9f88590a 100644
|
2023-11-11 21:09:14 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java
|
|
|
|
@@ -13,7 +13,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isEffect() {
|
|
|
|
- return this.getHandle().visualOnly;
|
2024-01-13 18:34:33 +01:00
|
|
|
+ return this.getHandle().isEffect; // Paper - Properly handle lightning effects api
|
2023-11-11 21:09:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getFlashes() {
|