Fix setSize causing drift for some entities

This commit is contained in:
fullwall 2016-01-01 14:59:49 +08:00
parent 14081192c3
commit be9fb19d39
26 changed files with 412 additions and 220 deletions

View File

@ -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()

View File

@ -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);

View File

@ -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);

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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;

View File

@ -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()

View File

@ -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()

View File

@ -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) {

View File

@ -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);

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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();
}
}

View File

@ -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()

View File

@ -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_();

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {