From 1053a1e29d2aea2045172b2b87ec6631d34f6bc1 Mon Sep 17 00:00:00 2001 From: feildmaster Date: Sun, 27 Jan 2013 14:46:58 -0600 Subject: [PATCH] Update Fireballs to account for ExplosionPower. Fixes BUKKIT-3460 Adds BUKKIT-3516 --- src/main/java/net/minecraft/server/EntityGhast.java | 3 ++- .../net/minecraft/server/EntityLargeFireball.java | 13 +++++++++++++ .../craftbukkit/entity/CraftLargeFireball.java | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java index ac31564002..beed78625a 100644 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -141,7 +141,8 @@ public class EntityGhast extends EntityFlying implements IMonster { this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0); EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7); - entitylargefireball.e = this.explosionPower; + // CraftBukkit - set yield when setting explosionpower + entitylargefireball.yield = entitylargefireball.e = this.explosionPower; double d8 = 4.0D; Vec3D vec3d = this.i(1.0F); diff --git a/src/main/java/net/minecraft/server/EntityLargeFireball.java b/src/main/java/net/minecraft/server/EntityLargeFireball.java index 88b0d84a8f..0aebd90207 100644 --- a/src/main/java/net/minecraft/server/EntityLargeFireball.java +++ b/src/main/java/net/minecraft/server/EntityLargeFireball.java @@ -33,4 +33,17 @@ public class EntityLargeFireball extends EntityFireball { this.die(); } } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setInt("ExplosionPower", this.e); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + if (nbttagcompound.hasKey("ExplosionPower")) { + // CraftBukkit - set yield when setting explosionpower + this.yield = this.e = nbttagcompound.getInt("ExplosionPower"); + } + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java index 1ee4da21ba..f75e74deca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java @@ -10,6 +10,12 @@ public class CraftLargeFireball extends CraftFireball implements LargeFireball { super(server, entity); } + @Override + public void setYield(float yield) { + super.setYield(yield); + getHandle().e = (int) yield; + } + @Override public EntityLargeFireball getHandle() { return (EntityLargeFireball) entity;