Search in sources :

Example 1 with ItemPaintbrush_BC8

use of buildcraft.core.item.ItemPaintbrush_BC8 in project BuildCraft by BuildCraft.

the class TileZonePlanner method update.

@Override
public void update() {
    deltaManager.tick();
    if (getWorld().isRemote) {
        return;
    }
    {
        // noinspection ConstantConditions
        if (!invInputPaintbrush.getStackInSlot(0).isEmpty() && invInputPaintbrush.getStackInSlot(0).getItem() instanceof ItemPaintbrush_BC8 && !invInputMapLocation.getStackInSlot(0).isEmpty() && invInputMapLocation.getStackInSlot(0).getItem() instanceof ItemMapLocation && invInputMapLocation.getStackInSlot(0).getTagCompound() != null && invInputMapLocation.getStackInSlot(0).getTagCompound().hasKey("chunkMapping") && invInputResult.getStackInSlot(0).isEmpty()) {
            if (progressInput == 0) {
                deltaProgressInput.addDelta(0, 200, 1);
                deltaProgressInput.addDelta(200, 205, -1);
            }
            if (progressInput < 200) {
                progressInput++;
                return;
            }
            ZonePlan zonePlan = new ZonePlan();
            zonePlan.readFromNBT(invInputMapLocation.getStackInSlot(0).getTagCompound());
            layers[BCCoreItems.paintbrush.getBrushFromStack(invInputPaintbrush.getStackInSlot(0)).colour.getMetadata()] = zonePlan.getWithOffset(-pos.getX(), -pos.getZ());
            invInputMapLocation.setStackInSlot(0, StackUtil.EMPTY);
            invInputResult.setStackInSlot(0, new ItemStack(BCCoreItems.mapLocation));
            this.markDirty();
            this.sendNetworkUpdate(NET_RENDER_DATA);
            progressInput = 0;
        } else if (progressInput != -1) {
            progressInput = -1;
            deltaProgressInput.setValue(0);
        }
    }
    {
        if (!invOutputPaintbrush.getStackInSlot(0).isEmpty() && invOutputPaintbrush.getStackInSlot(0).getItem() instanceof ItemPaintbrush_BC8 && !invOutputMapLocation.getStackInSlot(0).isEmpty() && invOutputMapLocation.getStackInSlot(0).getItem() instanceof ItemMapLocation && invOutputResult.getStackInSlot(0).isEmpty()) {
            if (progressOutput == 0) {
                deltaProgressOutput.addDelta(0, 200, 1);
                deltaProgressOutput.addDelta(200, 205, -1);
            }
            if (progressOutput < 200) {
                progressOutput++;
                return;
            }
            ItemMapLocation.setZone(invOutputMapLocation.getStackInSlot(0), layers[BCCoreItems.paintbrush.getBrushFromStack(invOutputPaintbrush.getStackInSlot(0)).colour.getMetadata()].getWithOffset(pos.getX(), pos.getZ()));
            invOutputResult.setStackInSlot(0, invOutputMapLocation.getStackInSlot(0));
            invOutputMapLocation.setStackInSlot(0, StackUtil.EMPTY);
            progressOutput = 0;
        } else if (progressOutput != -1) {
            progressOutput = -1;
            deltaProgressOutput.setValue(0);
        }
    }
}
Also used : ZonePlan(buildcraft.robotics.zone.ZonePlan) ItemMapLocation(buildcraft.core.item.ItemMapLocation) ItemPaintbrush_BC8(buildcraft.core.item.ItemPaintbrush_BC8) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemMapLocation (buildcraft.core.item.ItemMapLocation)1 ItemPaintbrush_BC8 (buildcraft.core.item.ItemPaintbrush_BC8)1 ZonePlan (buildcraft.robotics.zone.ZonePlan)1 ItemStack (net.minecraft.item.ItemStack)1