equivalent-exchange-3/src/main/java/com/pahimar/ee3/util/EntityHelper.java

33 lines
1 KiB
Java
Raw Normal View History

2014-10-07 22:20:41 +02:00
package com.pahimar.ee3.util;
import com.pahimar.ee3.reference.Reference;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
2014-10-07 22:20:41 +02:00
import net.minecraft.nbt.NBTTagCompound;
public class EntityHelper
{
public static NBTTagCompound getCustomEntityData(Entity entity)
{
if (entity != null && entity.getEntityData().hasKey(Reference.LOWERCASE_MOD_ID) && entity.getEntityData().getTag(Reference.LOWERCASE_MOD_ID) instanceof NBTTagCompound)
2014-10-07 22:20:41 +02:00
{
return entity.getEntityData().getCompoundTag(Reference.LOWERCASE_MOD_ID);
2014-10-07 22:20:41 +02:00
}
2014-10-08 05:11:54 +02:00
return new NBTTagCompound();
2014-10-07 22:20:41 +02:00
}
public static void saveCustomEntityData(Entity entity, NBTTagCompound nbtTagCompound)
{
if (entity != null)
{
entity.getEntityData().setTag(Reference.LOWERCASE_MOD_ID, nbtTagCompound);
2014-10-07 22:20:41 +02:00
}
}
public static boolean isHostileEntity(final EntityLivingBase entity) {
return entity instanceof IMob;
}
2014-10-07 22:20:41 +02:00
}