From be9fb19d398a84eebc8281fef63087f1278865a4 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 1 Jan 2016 14:59:49 +0800 Subject: [PATCH] Fix setSize causing drift for some entities --- .../npc/entity/CaveSpiderController.java | 23 +++++++---- .../npc/entity/ChickenController.java | 14 +++---- .../npc/entity/CowController.java | 14 +++---- .../npc/entity/CreeperController.java | 9 +++++ .../npc/entity/EndermanController.java | 23 +++++++---- .../npc/entity/EndermiteController.java | 23 +++++++---- .../npc/entity/GiantController.java | 23 +++++++---- .../npc/entity/GuardianController.java | 9 +++++ .../npc/entity/HorseController.java | 31 +++++++------- .../npc/entity/IronGolemController.java | 23 +++++++---- .../npc/entity/MagmaCubeController.java | 9 +++++ .../npc/entity/MushroomCowController.java | 28 ++++++------- .../npc/entity/OcelotController.java | 14 +++---- .../npc/entity/SilverfishController.java | 37 ++++++++++------- .../npc/entity/SkeletonController.java | 37 ++++++++++------- .../npc/entity/SlimeController.java | 9 +++++ .../npc/entity/SnowmanController.java | 37 ++++++++++------- .../npc/entity/SpiderController.java | 37 ++++++++++------- .../npc/entity/SquidController.java | 23 +++++++---- .../npc/entity/VillagerController.java | 28 ++++++------- .../npc/entity/WitchController.java | 37 ++++++++++------- .../nonliving/ArmorStandController.java | 10 +++++ .../npc/entity/nonliving/BoatController.java | 40 ++++++++++++------- .../nonliving/FallingBlockController.java | 38 +++++++++++------- .../nonliving/LargeFireballController.java | 40 ++++++++++++------- src/main/java/net/citizensnpcs/util/NMS.java | 16 ++++++++ 26 files changed, 412 insertions(+), 220 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java index 5cc665d56..0c0843283 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCaveSpider; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.CaveSpider; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityCaveSpider; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCaveSpider; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.CaveSpider; -import org.bukkit.util.Vector; - public class CaveSpiderController extends MobEntityController { public CaveSpiderController() { super(EntityCaveSpiderNPC.class); @@ -180,6 +180,15 @@ public class CaveSpiderController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java index ed24de659..fbf9e8f82 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.Chicken; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityChicken; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.Chicken; -import org.bukkit.util.Vector; - public class ChickenController extends MobEntityController { public ChickenController() { super(EntityChickenNPC.class); diff --git a/src/main/java/net/citizensnpcs/npc/entity/CowController.java b/src/main/java/net/citizensnpcs/npc/entity/CowController.java index 1dbe89449..f424d9f01 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CowController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CowController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCow; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.Cow; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityCow; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCow; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.Cow; -import org.bukkit.util.Vector; - public class CowController extends MobEntityController { public CowController() { super(EntityCowNPC.class); diff --git a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java index 561ff591b..5faa1df24 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java @@ -196,6 +196,15 @@ public class CreeperController extends MobEntityController { this.allowPowered = allowPowered; } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java index 4e11d7ac6..e783ac599 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderman; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.Enderman; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityEnderman; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderman; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.Enderman; -import org.bukkit.util.Vector; - public class EndermanController extends MobEntityController { public EndermanController() { super(EntityEndermanNPC.class); @@ -184,6 +184,15 @@ public class EndermanController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java b/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java index d035d74e1..db7470b77 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EndermiteController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEndermite; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.entity.Endermite; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityEndermite; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEndermite; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.entity.Endermite; -import org.bukkit.util.Vector; - public class EndermiteController extends MobEntityController { public EndermiteController() { super(EntityEndermiteNPC.class); @@ -176,6 +176,15 @@ public class EndermiteController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java index 753cc6091..f20d74bf0 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGiant; +import org.bukkit.entity.Giant; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityGiantZombie; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftGiant; -import org.bukkit.entity.Giant; -import org.bukkit.util.Vector; - public class GiantController extends MobEntityController { public GiantController() { super(EntityGiantNPC.class); @@ -155,6 +155,15 @@ public class GiantController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java b/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java index 268f1f42c..0d3c9c7b4 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/GuardianController.java @@ -176,6 +176,15 @@ public class GuardianController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java index 20b07b6fe..4ded13b18 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java @@ -1,5 +1,13 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse; +import org.bukkit.entity.Horse; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -14,14 +22,6 @@ import net.minecraft.server.v1_8_R3.EntityHorse; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse; -import org.bukkit.entity.Horse; -import org.bukkit.util.Vector; - public class HorseController extends MobEntityController { public HorseController() { super(EntityHorseNPC.class); @@ -65,13 +65,6 @@ public class HorseController extends MobEntityController { } } - @Override - public boolean cp() { - if (npc == null) return super.cp(); - boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true); - return super.cp() && !protectedDefault; - } - @Override protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) { if (npc == null || !npc.isFlyable()) { @@ -112,6 +105,14 @@ public class HorseController extends MobEntityController { } } + @Override + public boolean cp() { + if (npc == null) + return super.cp(); + boolean protectedDefault = npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true); + return super.cp() && !protectedDefault; + } + @Override public boolean d(NBTTagCompound save) { return npc == null ? super.d(save) : false; diff --git a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java index 47e2f829c..e302fbecc 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftIronGolem; +import org.bukkit.entity.IronGolem; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityIronGolem; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftIronGolem; -import org.bukkit.entity.IronGolem; -import org.bukkit.util.Vector; - public class IronGolemController extends MobEntityController { public IronGolemController() { super(EntityIronGolemNPC.class); @@ -162,6 +162,15 @@ public class IronGolemController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java index 95430a839..d06768af9 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java @@ -172,6 +172,15 @@ public class MagmaCubeController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java index fd07c1024..c760dc304 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMushroomCow; +import org.bukkit.entity.MushroomCow; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityMushroomCow; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMushroomCow; -import org.bukkit.entity.MushroomCow; -import org.bukkit.util.Vector; - public class MushroomCowController extends MobEntityController { public MushroomCowController() { @@ -108,13 +108,6 @@ public class MushroomCowController extends MobEntityController { } } - @Override - public void E() { - super.E(); - if (npc != null) - npc.update(); - } - @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) { @@ -122,6 +115,13 @@ public class MushroomCowController extends MobEntityController { } } + @Override + public void E() { + super.E(); + if (npc != null) + npc.update(); + } + @Override public void g(double x, double y, double z) { if (npc == null) { diff --git a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java index 31bcc360c..b9773f0cf 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftOcelot; +import org.bukkit.entity.Ocelot; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityOcelot; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftOcelot; -import org.bukkit.entity.Ocelot; -import org.bukkit.util.Vector; - public class OcelotController extends MobEntityController { public OcelotController() { super(EntityOcelotNPC.class); diff --git a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java index c0ac8bd8e..2265fd67f 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSilverfish; +import org.bukkit.entity.Silverfish; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntitySilverfish; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSilverfish; -import org.bukkit.entity.Silverfish; -import org.bukkit.util.Vector; - public class SilverfishController extends MobEntityController { public SilverfishController() { super(EntitySilverfishNPC.class); @@ -96,13 +96,6 @@ public class SilverfishController extends MobEntityController { } } - @Override - public void E() { - super.E(); - if (npc != null) - npc.update(); - } - @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) { @@ -110,6 +103,13 @@ public class SilverfishController extends MobEntityController { } } + @Override + public void E() { + super.E(); + if (npc != null) + npc.update(); + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -162,6 +162,15 @@ public class SilverfishController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java index e9c2d6650..ddcdc806b 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSkeleton; +import org.bukkit.entity.Skeleton; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntitySkeleton; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSkeleton; -import org.bukkit.entity.Skeleton; -import org.bukkit.util.Vector; - public class SkeletonController extends MobEntityController { public SkeletonController() { super(EntitySkeletonNPC.class); @@ -97,17 +97,17 @@ public class SkeletonController extends MobEntityController { } @Override - public void E() { - super.E(); - if (npc != null) { - npc.update(); + public void e(float f, float f1) { + if (npc == null || !npc.isFlyable()) { + super.e(f, f1); } } @Override - public void e(float f, float f1) { - if (npc == null || !npc.isFlyable()) { - super.e(f, f1); + public void E() { + super.E(); + if (npc != null) { + npc.update(); } } @@ -163,6 +163,15 @@ public class SkeletonController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java index 352bac4c8..d6793ca4c 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java @@ -183,6 +183,15 @@ public class SlimeController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java index 2dc95fccc..91ef7c0e2 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowman; +import org.bukkit.entity.Snowman; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntitySnowman; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSnowman; -import org.bukkit.entity.Snowman; -import org.bukkit.util.Vector; - public class SnowmanController extends MobEntityController { public SnowmanController() { super(EntitySnowmanNPC.class); @@ -96,13 +96,6 @@ public class SnowmanController extends MobEntityController { } } - @Override - public void E() { - super.E(); - if (npc != null) - npc.update(); - } - @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) { @@ -110,6 +103,13 @@ public class SnowmanController extends MobEntityController { } } + @Override + public void E() { + super.E(); + if (npc != null) + npc.update(); + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -162,6 +162,15 @@ public class SnowmanController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java index e1f804e3f..58cb4ffad 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSpider; +import org.bukkit.entity.Spider; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntitySpider; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSpider; -import org.bukkit.entity.Spider; -import org.bukkit.util.Vector; - public class SpiderController extends MobEntityController { public SpiderController() { super(EntitySpiderNPC.class); @@ -96,13 +96,6 @@ public class SpiderController extends MobEntityController { } } - @Override - public void E() { - super.E(); - if (npc != null) - npc.update(); - } - @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) { @@ -110,6 +103,13 @@ public class SpiderController extends MobEntityController { } } + @Override + public void E() { + super.E(); + if (npc != null) + npc.update(); + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -162,6 +162,15 @@ public class SpiderController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java index 34e08f94e..b64d3f45e 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSquid; +import org.bukkit.entity.Squid; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntitySquid; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftSquid; -import org.bukkit.entity.Squid; -import org.bukkit.util.Vector; - public class SquidController extends MobEntityController { public SquidController() { super(EntitySquidNPC.class); @@ -155,6 +155,15 @@ public class SquidController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java index 0342647f0..bb0a519de 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftVillager; +import org.bukkit.entity.Villager; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -14,13 +21,6 @@ import net.minecraft.server.v1_8_R3.EntityVillager; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftVillager; -import org.bukkit.entity.Villager; -import org.bukkit.util.Vector; - public class VillagerController extends MobEntityController { public VillagerController() { super(EntityVillagerNPC.class); @@ -117,17 +117,17 @@ public class VillagerController extends MobEntityController { } @Override - public void E() { - super.E(); - if (npc != null) { - npc.update(); + public void e(float f, float f1) { + if (npc == null || !npc.isFlyable()) { + super.e(f, f1); } } @Override - public void e(float f, float f1) { - if (npc == null || !npc.isFlyable()) { - super.e(f, f1); + public void E() { + super.E(); + if (npc != null) { + npc.update(); } } diff --git a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java index cb7b0fbd9..7fb92bd74 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java @@ -1,5 +1,12 @@ package net.citizensnpcs.npc.entity; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_8_R3.CraftServer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitch; +import org.bukkit.entity.Witch; +import org.bukkit.util.Vector; + import net.citizensnpcs.api.event.NPCPushEvent; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; @@ -13,13 +20,6 @@ import net.minecraft.server.v1_8_R3.EntityWitch; import net.minecraft.server.v1_8_R3.NBTTagCompound; import net.minecraft.server.v1_8_R3.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_8_R3.CraftServer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftWitch; -import org.bukkit.entity.Witch; -import org.bukkit.util.Vector; - public class WitchController extends MobEntityController { public WitchController() { super(EntityWitchNPC.class); @@ -96,13 +96,6 @@ public class WitchController extends MobEntityController { } } - @Override - public void E() { - super.E(); - if (npc != null) - npc.update(); - } - @Override public void e(float f, float f1) { if (npc == null || !npc.isFlyable()) { @@ -110,6 +103,13 @@ public class WitchController extends MobEntityController { } } + @Override + public void E() { + super.E(); + if (npc != null) + npc.update(); + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -162,6 +162,15 @@ public class WitchController extends MobEntityController { } } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override protected String z() { return npc == null || !npc.data().has(NPC.AMBIENT_SOUND_METADATA) ? super.z() diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java index e085b8d23..d53101174 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/ArmorStandController.java @@ -14,6 +14,7 @@ import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.npc.CitizensNPC; import net.citizensnpcs.npc.MobEntityController; import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.Util; import net.minecraft.server.v1_8_R3.EntityArmorStand; import net.minecraft.server.v1_8_R3.EntityHuman; @@ -118,6 +119,15 @@ public class ArmorStandController extends MobEntityController { return npc; } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override public void t_() { super.t_(); diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java index 1ff80051e..16d958674 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/BoatController.java @@ -1,15 +1,5 @@ package net.citizensnpcs.npc.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.MobEntityController; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_8_R3.EntityBoat; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftBoat; @@ -17,6 +7,17 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.entity.Boat; import org.bukkit.util.Vector; +import net.citizensnpcs.api.event.NPCPushEvent; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.MobEntityController; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.NMS; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_8_R3.EntityBoat; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; + public class BoatController extends MobEntityController { public BoatController() { super(EntityBoatNPC.class); @@ -48,11 +49,6 @@ public class BoatController extends MobEntityController { this(world, null); } - @Override - public boolean d(NBTTagCompound save) { - return npc == null ? super.d(save) : false; - } - public EntityBoatNPC(World world, NPC npc) { super(world); this.npc = (CitizensNPC) npc; @@ -68,6 +64,11 @@ public class BoatController extends MobEntityController { } } + @Override + public boolean d(NBTTagCompound save) { + return npc == null ? super.d(save) : false; + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -103,6 +104,15 @@ public class BoatController extends MobEntityController { return npc; } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override public void t_() { if (npc != null) { diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java index 833b64579..9d57c7974 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/FallingBlockController.java @@ -1,19 +1,5 @@ package net.citizensnpcs.npc.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.AbstractEntityController; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_8_R3.Block; -import net.minecraft.server.v1_8_R3.Blocks; -import net.minecraft.server.v1_8_R3.EntityFallingBlock; -import net.minecraft.server.v1_8_R3.IBlockData; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; -import net.minecraft.server.v1_8_R3.WorldServer; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -26,6 +12,21 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; import org.bukkit.util.Vector; +import net.citizensnpcs.api.event.NPCPushEvent; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.AbstractEntityController; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.NMS; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_8_R3.Block; +import net.minecraft.server.v1_8_R3.Blocks; +import net.minecraft.server.v1_8_R3.EntityFallingBlock; +import net.minecraft.server.v1_8_R3.IBlockData; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; +import net.minecraft.server.v1_8_R3.WorldServer; + public class FallingBlockController extends AbstractEntityController { public FallingBlockController() { super(EntityFallingBlockNPC.class); @@ -117,6 +118,15 @@ public class FallingBlockController extends AbstractEntityController { return npc; } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override public void t_() { if (npc != null) { diff --git a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java index 956a164f1..135d7256d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/nonliving/LargeFireballController.java @@ -1,15 +1,5 @@ package net.citizensnpcs.npc.entity.nonliving; -import net.citizensnpcs.api.event.NPCPushEvent; -import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.npc.CitizensNPC; -import net.citizensnpcs.npc.MobEntityController; -import net.citizensnpcs.npc.ai.NPCHolder; -import net.citizensnpcs.util.Util; -import net.minecraft.server.v1_8_R3.EntityLargeFireball; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; - import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.CraftServer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; @@ -17,6 +7,17 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLargeFireball; import org.bukkit.entity.LargeFireball; import org.bukkit.util.Vector; +import net.citizensnpcs.api.event.NPCPushEvent; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.npc.CitizensNPC; +import net.citizensnpcs.npc.MobEntityController; +import net.citizensnpcs.npc.ai.NPCHolder; +import net.citizensnpcs.util.NMS; +import net.citizensnpcs.util.Util; +import net.minecraft.server.v1_8_R3.EntityLargeFireball; +import net.minecraft.server.v1_8_R3.NBTTagCompound; +import net.minecraft.server.v1_8_R3.World; + public class LargeFireballController extends MobEntityController { public LargeFireballController() { super(EntityLargeFireballNPC.class); @@ -39,11 +40,6 @@ public class LargeFireballController extends MobEntityController { this.npc = (CitizensNPC) npc; } - @Override - public boolean d(NBTTagCompound save) { - return npc == null ? super.d(save) : false; - } - @Override public void collide(net.minecraft.server.v1_8_R3.Entity entity) { // this method is called by both the entities involved - cancelling @@ -54,6 +50,11 @@ public class LargeFireballController extends MobEntityController { } } + @Override + public boolean d(NBTTagCompound save) { + return npc == null ? super.d(save) : false; + } + @Override public void g(double x, double y, double z) { if (npc == null) { @@ -89,6 +90,15 @@ public class LargeFireballController extends MobEntityController { return npc; } + @Override + public void setSize(float f, float f1) { + if (npc == null) { + super.setSize(f, f1); + } else { + NMS.setSize(this, f, f1, justCreated); + } + } + @Override public void t_() { if (npc != null) { diff --git a/src/main/java/net/citizensnpcs/util/NMS.java b/src/main/java/net/citizensnpcs/util/NMS.java index 25e4d375b..3ac26ea83 100644 --- a/src/main/java/net/citizensnpcs/util/NMS.java +++ b/src/main/java/net/citizensnpcs/util/NMS.java @@ -53,6 +53,7 @@ import net.citizensnpcs.npc.network.EmptyChannel; import net.citizensnpcs.npc.skin.SkinnableEntity; import net.citizensnpcs.util.nms.PlayerlistTrackerEntry; import net.minecraft.server.v1_8_R3.AttributeInstance; +import net.minecraft.server.v1_8_R3.AxisAlignedBB; import net.minecraft.server.v1_8_R3.Block; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.ControllerJump; @@ -683,6 +684,20 @@ public class NMS { ((EntityTameableAnimal) getHandle((LivingEntity) tameable)).setSitting(sitting); } + public static void setSize(Entity entity, float f, float f1, boolean justCreated) { + if ((f != entity.width) || (f1 != entity.length)) { + float f2 = entity.width; + + entity.width = f; + entity.length = f1; + entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, + entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, + entity.getBoundingBox().c + entity.width)); + if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide)) + entity.move((f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2); + } + } + public static void setStepHeight(EntityLiving entity, float height) { entity.S = height; } @@ -809,6 +824,7 @@ public class NMS { private static Field PATHFINDING_RANGE = getField(NavigationAbstract.class, "a"); private static final Random RANDOM = Util.getFastRandom(); private static Field SKULL_PROFILE_FIELD; + private static Field TRACKED_ENTITY_SET = NMS.getField(EntityTracker.class, "c"); static {