Search in sources :

Example 1 with INamedItem

use of buildcraft.api.items.INamedItem in project BuildCraft by BuildCraft.

the class TileZonePlan method update.

@Override
public void update() {
    super.update();
    if (worldObj.isRemote) {
        return;
    }
    if (previewRecalcTimer.markTimeIfDelay(worldObj)) {
        recalculatePreview();
    }
    if (inv.getStackInSlot(0) != null && inv.getStackInSlot(1) == null && inv.getStackInSlot(0).getItem() instanceof ItemMapLocation) {
        if (progress < CRAFT_TIME) {
            progress++;
            if (worldObj.getTotalWorldTime() % 5 == 0) {
                sendNetworkUpdate();
            }
        } else {
            ItemStack stack = inv.decrStackSize(0, 1);
            if (selectedAreas[currentSelectedArea] != null) {
                ItemMapLocation.setZone(stack, selectedAreas[currentSelectedArea]);
                ((INamedItem) stack.getItem()).setName(stack, mapName);
            }
            inv.setInventorySlotContents(1, stack);
        }
    } else if (progress != 0) {
        progress = 0;
        sendNetworkUpdate();
    }
}
Also used : INamedItem(buildcraft.api.items.INamedItem) ItemMapLocation(buildcraft.core.item.ItemMapLocation) ItemStack(net.minecraft.item.ItemStack)

Aggregations

INamedItem (buildcraft.api.items.INamedItem)1 ItemMapLocation (buildcraft.core.item.ItemMapLocation)1 ItemStack (net.minecraft.item.ItemStack)1