Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
SPIGOT-4372: LightningStrikeEvent cause API
Dieser Commit ist enthalten in:
Ursprung
34caaf6d68
Commit
a4bdecff65
11
nms-patches/CommandSummon.patch
Normale Datei
11
nms-patches/CommandSummon.patch
Normale Datei
@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/server/CommandSummon.java
|
||||||
|
+++ b/net/minecraft/server/CommandSummon.java
|
||||||
|
@@ -32,7 +32,7 @@
|
||||||
|
if (EntityTypes.getName(EntityTypes.LIGHTNING_BOLT).equals(minecraftkey)) {
|
||||||
|
EntityLightning entitylightning = new EntityLightning(commandlistenerwrapper.getWorld(), vec3d.x, vec3d.y, vec3d.z, false);
|
||||||
|
|
||||||
|
- commandlistenerwrapper.getWorld().strikeLightning(entitylightning);
|
||||||
|
+ commandlistenerwrapper.getWorld().strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.COMMAND); // CraftBukkit
|
||||||
|
commandlistenerwrapper.sendMessage(new ChatMessage("commands.summon.success", new Object[] { entitylightning.getScoreboardDisplayName()}), true);
|
||||||
|
return 1;
|
||||||
|
} else {
|
11
nms-patches/EntityThrownTrident.patch
Normale Datei
11
nms-patches/EntityThrownTrident.patch
Normale Datei
@ -0,0 +1,11 @@
|
|||||||
|
--- a/net/minecraft/server/EntityThrownTrident.java
|
||||||
|
+++ b/net/minecraft/server/EntityThrownTrident.java
|
||||||
|
@@ -122,7 +122,7 @@
|
||||||
|
EntityLightning entitylightning = new EntityLightning(this.world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, false);
|
||||||
|
|
||||||
|
entitylightning.d(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);
|
||||||
|
- this.world.strikeLightning(entitylightning);
|
||||||
|
+ ((WorldServer) this.world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||||
|
soundeffect = SoundEffects.ITEM_TRIDENT_THUNDER;
|
||||||
|
f1 = 5.0F;
|
||||||
|
}
|
@ -1,7 +1,11 @@
|
|||||||
--- a/net/minecraft/server/PathfinderGoalHorseTrap.java
|
--- a/net/minecraft/server/PathfinderGoalHorseTrap.java
|
||||||
+++ b/net/minecraft/server/PathfinderGoalHorseTrap.java
|
+++ b/net/minecraft/server/PathfinderGoalHorseTrap.java
|
||||||
@@ -21,13 +21,14 @@
|
@@ -18,16 +18,17 @@
|
||||||
this.a.world.strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true));
|
this.a.s(false);
|
||||||
|
this.a.setTamed(true);
|
||||||
|
this.a.setAgeRaw(0);
|
||||||
|
- this.a.world.strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true));
|
||||||
|
+ ((WorldServer) this.a.world).strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true), org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||||
EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.a);
|
EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.a);
|
||||||
|
|
||||||
- entityskeleton.startRiding(this.a);
|
- entityskeleton.startRiding(this.a);
|
||||||
|
@ -305,7 +305,7 @@
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -316,7 +485,7 @@
|
@@ -316,10 +485,10 @@
|
||||||
entityhorseskeleton.s(true);
|
entityhorseskeleton.s(true);
|
||||||
entityhorseskeleton.setAgeRaw(0);
|
entityhorseskeleton.setAgeRaw(0);
|
||||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||||
@ -313,7 +313,11 @@
|
|||||||
+ this.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
+ this.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2));
|
- this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2));
|
||||||
|
+ this.strikeLightning(new EntityLightning(this, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, flag2), org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -332,11 +501,11 @@
|
@@ -332,11 +501,11 @@
|
||||||
BiomeBase biomebase = this.getBiome(blockposition);
|
BiomeBase biomebase = this.getBiome(blockposition);
|
||||||
|
|
||||||
@ -473,12 +477,17 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,8 +999,16 @@
|
@@ -785,9 +998,21 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ // CraftBukkit start
|
||||||
public boolean strikeLightning(Entity entity) {
|
public boolean strikeLightning(Entity entity) {
|
||||||
+ // CraftBukkit start
|
+ return this.strikeLightning(entity, LightningStrikeEvent.Cause.UNKNOWN);
|
||||||
+ LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity());
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean strikeLightning(Entity entity, LightningStrikeEvent.Cause cause) {
|
||||||
|
+ LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity(), cause);
|
||||||
+ this.getServer().getPluginManager().callEvent(lightning);
|
+ this.getServer().getPluginManager().callEvent(lightning);
|
||||||
+
|
+
|
||||||
+ if (lightning.isCancelled()) {
|
+ if (lightning.isCancelled()) {
|
||||||
@ -491,7 +500,7 @@
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -803,6 +1024,14 @@
|
@@ -803,6 +1028,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
|
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
|
||||||
@ -506,7 +515,7 @@
|
|||||||
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
|
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
|
||||||
|
|
||||||
if (damagesource != null) {
|
if (damagesource != null) {
|
||||||
@@ -811,6 +1040,8 @@
|
@@ -811,6 +1044,8 @@
|
||||||
|
|
||||||
explosion.a();
|
explosion.a();
|
||||||
explosion.a(false);
|
explosion.a(false);
|
||||||
@ -515,7 +524,7 @@
|
|||||||
if (!flag1) {
|
if (!flag1) {
|
||||||
explosion.clearBlocks();
|
explosion.clearBlocks();
|
||||||
}
|
}
|
||||||
@@ -837,7 +1068,8 @@
|
@@ -837,7 +1072,8 @@
|
||||||
BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst();
|
BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst();
|
||||||
|
|
||||||
if (this.a(blockactiondata)) {
|
if (this.a(blockactiondata)) {
|
||||||
@ -525,7 +534,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,6 +1090,7 @@
|
@@ -858,6 +1094,7 @@
|
||||||
boolean flag = this.isRaining();
|
boolean flag = this.isRaining();
|
||||||
|
|
||||||
super.w();
|
super.w();
|
||||||
@ -533,7 +542,7 @@
|
|||||||
if (this.o != this.p) {
|
if (this.o != this.p) {
|
||||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager());
|
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.p)), this.worldProvider.getDimensionManager());
|
||||||
}
|
}
|
||||||
@@ -876,6 +1109,21 @@
|
@@ -876,6 +1113,21 @@
|
||||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
|
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
|
||||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
|
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
|
||||||
}
|
}
|
||||||
@ -555,7 +564,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,13 +1157,20 @@
|
@@ -909,13 +1161,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren