Search in sources :

Example 1 with ItemDoll

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
    }
}
Also used : IItemHandler(net.minecraftforge.items.IItemHandler) ItemStack(net.minecraft.item.ItemStack) ItemDoll(mdc.voodoocraft.items.ItemDoll)

Example 2 with ItemDoll

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);
        }
    }
}
Also used : IItemHandler(net.minecraftforge.items.IItemHandler) ItemStack(net.minecraft.item.ItemStack) ItemDoll(mdc.voodoocraft.items.ItemDoll)

Aggregations

ItemDoll (mdc.voodoocraft.items.ItemDoll)2 ItemStack (net.minecraft.item.ItemStack)2 IItemHandler (net.minecraftforge.items.IItemHandler)2