use of mdc.voodoocraft.items.ItemDoll in project VoodooCraft by Mod-DevCafeTeam.
the class TileDollPedestal method update.
/**
* Should be used to tick the doll inside of it.
*/
@Override
public void update() {
if (world.isRemote)
return;
IItemHandler tileinv = this.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
ItemStack stack = tileinv.getStackInSlot(0);
if (stack != null && stack.getItem() instanceof ItemDoll) {
//TODO Tick the doll inside
}
}
use of mdc.voodoocraft.items.ItemDoll in project VoodooCraft by Mod-DevCafeTeam.
the class DollTrackerObj method updateTileEntry.
/**
* Adds tile & UUID to the list if it should be, and removes them if nothing is in the pedestal.
* Called every time the TileDollPedestal inventory changes, and when it is loaded in.
*/
public static void updateTileEntry(TileDollPedestal tile) {
int dim = tile.getWorld().provider.getDimension();
IItemHandler inv = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
ItemStack stack = inv.getStackInSlot(0);
if (stack != null && stack.getItem() instanceof ItemDoll && stack.getTagCompound() != null && stack.getTagCompound().hasKey(NBTHelper.KEY_OWNER)) {
if (stack.getTagCompound().getBoolean(NBTHelper.KEY_IS_PLAYER) == true) {
addPlayerEntry(NBTUtil.getUUIDFromTag(stack.getTagCompound()), dim, tile.getPos());
} else {
addEntityEntry(NBTUtil.getUUIDFromTag(stack.getTagCompound()), dim, tile.getPos());
}
} else {
for (DollTrackerObj obj : playerList) {
if (obj.Pos == tile.getPos() && obj.Dim == dim)
playerList.remove(obj);
}
for (DollTrackerObj obj : entityList) {
if (obj.Pos == tile.getPos() && obj.Dim == dim)
entityList.remove(obj);
}
}
}
Aggregations