mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 19:55:06 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,45 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class ModelData extends ModelDataShared{
|
||||
|
||||
public EntityLivingBase getEntity(EntityNPCInterface npc){
|
||||
if(entityClass == null)
|
||||
return null;
|
||||
if(entity == null){
|
||||
try {
|
||||
entity = entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {npc.worldObj});
|
||||
|
||||
entity.readEntityFromNBT(extra);
|
||||
|
||||
if(entity instanceof EntityLiving){
|
||||
EntityLiving living = (EntityLiving)entity;
|
||||
living.setCurrentItemOrArmor(0, npc.getHeldItem() != null?npc.getHeldItem():npc.getOffHand());
|
||||
living.setCurrentItemOrArmor(1, npc.inventory.armorItemInSlot(3));
|
||||
living.setCurrentItemOrArmor(2, npc.inventory.armorItemInSlot(2));
|
||||
living.setCurrentItemOrArmor(3, npc.inventory.armorItemInSlot(1));
|
||||
living.setCurrentItemOrArmor(4, npc.inventory.armorItemInSlot(0));
|
||||
}
|
||||
if(PixelmonHelper.isPixelmon(entity) && npc.worldObj.isRemote){
|
||||
if(extra.hasKey("Name"))
|
||||
PixelmonHelper.setName(entity, extra.getString("Name"));
|
||||
else
|
||||
PixelmonHelper.setName(entity, "Abra");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public ModelData copy(){
|
||||
ModelData data = new ModelData();
|
||||
data.readFromNBT(this.writeToNBT());
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user