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();
}
}
Aggregations