mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 13:09:11 +00:00
IWorld:
-Implemented spawnClone() with a boolean parameter to check entity protection from mods & plugins correctly (for real this time). ICloneHandler: -Implemented ignoreProtection boolean value for the spawn() function.
This commit is contained in:
1 parent
a4585fdf4d
commit
a3b5f5993e
5 files changed
+51
-8
No files matched your search
@@ -636,9 +636,29 @@ public class NoppesUtilServer {
|
||||
Server.sendData(player, EnumPacketClient.GUI_CLOSE, i, comp);
|
||||
}
|
||||
|
||||
public static Entity spawnClone(NBTTagCompound compound, int x, int y,
|
||||
public static Entity spawnCloneWithProtection(NBTTagCompound compound, int x, int y,
|
||||
int z, World worldObj) {
|
||||
ServerCloneController.Instance.cleanTags(compound);
|
||||
compound.setTag("Pos", NBTTags.nbtDoubleList(x + 0.5, y, z + 0.5));
|
||||
Entity entity = EntityList.createEntityFromNBT(compound, worldObj);
|
||||
if(entity == null){
|
||||
return null;
|
||||
}
|
||||
entity.setPosition((double) x + 0.5, (double) y, (double) z + 0.5);
|
||||
if(entity instanceof EntityNPCInterface){
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
npc.ai.startPos = new int[]{MathHelper.floor_double(npc.posX),MathHelper.floor_double(npc.posY),MathHelper.floor_double(npc.posZ)};
|
||||
npc.ticksExisted = 0;
|
||||
npc.totalTicksAlive = 0;
|
||||
}
|
||||
worldObj.spawnEntityInWorld(entity);
|
||||
entity.prevPosY = entity.lastTickPosY = entity.posY = y + 1;
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static Entity spawnClone(NBTTagCompound compound, int x, int y,
|
||||
int z, World worldObj) {
|
||||
ServerCloneController.Instance.cleanTags(compound);
|
||||
compound.setTag("Pos", NBTTags.nbtDoubleList(x + 0.5, y + 1, z + 0.5));
|
||||
Entity entity = EntityList.createEntityFromNBT(compound, worldObj);
|
||||
if(entity == null){
|
||||
@@ -653,6 +673,7 @@ public class NoppesUtilServer {
|
||||
worldObj.spawnEntityInWorld(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static boolean isOp(EntityPlayer player) {
|
||||
return MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user