summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-09-15 19:16:42 +1000
committermd_5 <git@md-5.net>2018-09-15 19:16:42 +1000
commita4bdecff654c72281fbce4cebf1ff55d86470d07 (patch)
treebc74d31e95cbbcc64b7e7c8cca84d80ea84b80d4 /nms-patches
parent34caaf6d680ea1f1fa918bbd12daee09ca7a6fc8 (diff)
downloadcraftbukkit-a4bdecff654c72281fbce4cebf1ff55d86470d07.tar
craftbukkit-a4bdecff654c72281fbce4cebf1ff55d86470d07.tar.gz
craftbukkit-a4bdecff654c72281fbce4cebf1ff55d86470d07.tar.lz
craftbukkit-a4bdecff654c72281fbce4cebf1ff55d86470d07.tar.xz
craftbukkit-a4bdecff654c72281fbce4cebf1ff55d86470d07.zip
SPIGOT-4372: LightningStrikeEvent cause API
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/CommandSummon.patch11
-rw-r--r--nms-patches/EntityThrownTrident.patch11
-rw-r--r--nms-patches/PathfinderGoalHorseTrap.patch8
-rw-r--r--nms-patches/WorldServer.patch31
4 files changed, 48 insertions, 13 deletions
diff --git a/nms-patches/CommandSummon.patch b/nms-patches/CommandSummon.patch
new file mode 100644
index 00000000..780b945a
--- /dev/null
+++ b/nms-patches/CommandSummon.patch
@@ -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 {
diff --git a/nms-patches/EntityThrownTrident.patch b/nms-patches/EntityThrownTrident.patch
new file mode 100644
index 00000000..8e2d4415
--- /dev/null
+++ b/nms-patches/EntityThrownTrident.patch
@@ -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;
+ }
diff --git a/nms-patches/PathfinderGoalHorseTrap.patch b/nms-patches/PathfinderGoalHorseTrap.patch
index 47730fe0..35e41e6a 100644
--- a/nms-patches/PathfinderGoalHorseTrap.patch
+++ b/nms-patches/PathfinderGoalHorseTrap.patch
@@ -1,7 +1,11 @@
--- a/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/net/minecraft/server/PathfinderGoalHorseTrap.java
-@@ -21,13 +21,14 @@
- this.a.world.strikeLightning(new EntityLightning(this.a.world, this.a.locX, this.a.locY, this.a.locZ, true));
+@@ -18,16 +18,17 @@
+ 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.startRiding(this.a);
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 79fa8696..bde040ab 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -305,7 +305,7 @@
return false;
} else {
-@@ -316,7 +485,7 @@
+@@ -316,10 +485,10 @@
entityhorseskeleton.s(true);
entityhorseskeleton.setAgeRaw(0);
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.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 @@
BiomeBase biomebase = this.getBiome(blockposition);
@@ -473,12 +477,17 @@
return false;
}
-@@ -786,8 +999,16 @@
+@@ -785,9 +998,21 @@
+
}
++ // CraftBukkit start
public boolean strikeLightning(Entity entity) {
-+ // CraftBukkit start
-+ LightningStrikeEvent lightning = new LightningStrikeEvent(this.getWorld(), (org.bukkit.entity.LightningStrike) entity.getBukkitEntity());
++ return this.strikeLightning(entity, LightningStrikeEvent.Cause.UNKNOWN);
++ }
++
++ 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);
+
+ if (lightning.isCancelled()) {
@@ -491,7 +500,7 @@
return true;
} else {
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) {
@@ -506,7 +515,7 @@
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1);
if (damagesource != null) {
-@@ -811,6 +1040,8 @@
+@@ -811,6 +1044,8 @@
explosion.a();
explosion.a(false);
@@ -515,7 +524,7 @@
if (!flag1) {
explosion.clearBlocks();
}
-@@ -837,7 +1068,8 @@
+@@ -837,7 +1072,8 @@
BlockActionData blockactiondata = (BlockActionData) this.d.removeFirst();
if (this.a(blockactiondata)) {
@@ -525,7 +534,7 @@
}
}
-@@ -858,6 +1090,7 @@
+@@ -858,6 +1094,7 @@
boolean flag = this.isRaining();
super.w();
@@ -533,7 +542,7 @@
if (this.o != this.p) {
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(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) {