public static void initialize() { SIDE_CONFIGS[TYPE] = new SideConfig(); SIDE_CONFIGS[TYPE].numConfig = 7; SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, { 0 }, { 1 }, { 2 }, { 1, 2 }, { 0, 1, 2 }, { 0, 1, 2 } }; SIDE_CONFIGS[TYPE].sideTypes = new int[] { NONE, INPUT_ALL, OUTPUT_PRIMARY, OUTPUT_SECONDARY, OUTPUT_ALL, OPEN, OMNI }; SIDE_CONFIGS[TYPE].defaultSides = new byte[] { 3, 1, 2, 2, 2, 2 }; ALT_SIDE_CONFIGS[TYPE] = new SideConfig(); ALT_SIDE_CONFIGS[TYPE].numConfig = 2; ALT_SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, { 0 }, { 1 }, { 2 }, { 1, 2 }, { 0, 1, 2 }, { 0, 1, 2 } }; ALT_SIDE_CONFIGS[TYPE].sideTypes = new int[] { NONE, OPEN }; ALT_SIDE_CONFIGS[TYPE].defaultSides = new byte[] { 1, 1, 1, 1, 1, 1 }; SLOT_CONFIGS[TYPE] = new SlotConfig(); SLOT_CONFIGS[TYPE].allowInsertionSlot = new boolean[] { true, false, false, false }; SLOT_CONFIGS[TYPE].allowExtractionSlot = new boolean[] { false, true, true, false }; VALID_AUGMENTS[TYPE] = new HashSet<>(); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SAWMILL_TAPPER); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY_NULL); GameRegistry.registerTileEntity(TileSawmill.class, "thermalexpansion:machine_sawmill"); config(); }
public TileSawmill() { super(); inventory = new ItemStack[1 + 1 + 1 + 1]; Arrays.fill(inventory, ItemStack.EMPTY); createAllSlots(inventory.length); }
@Override protected void transferInput() { if (!getTransferIn()) { return; } int side; for (int i = inputTracker + 1; i <= inputTracker + 6; i++) { side = i % 6; if (isPrimaryInput(sideConfig.sideTypes[sideCache[side]])) { if (extractItem(0, ITEM_TRANSFER[level], EnumFacing.VALUES[side])) { inputTracker = side; break; } } } }
@Override public void initGui() { super.initGui(); tankBackground = (ElementSimple) addElement(new ElementSimple(this, 151, 8).setTextureOffsets(176, 104).setSize(18, 62).setTexture(TEX_PATH, 256, 256)); slotInput = addElement(new ElementSlotOverlay(this, 53, 26).setSlotInfo(SlotColor.BLUE, SlotType.STANDARD, SlotRender.FULL)); slotPrimaryOutput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 112, 22).setSlotInfo(SlotColor.ORANGE, SlotType.OUTPUT, SlotRender.FULL)); slotPrimaryOutput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 112, 22).setSlotInfo(SlotColor.RED, SlotType.OUTPUT, SlotRender.BOTTOM)); slotSecondaryOutput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 116, 53).setSlotInfo(SlotColor.ORANGE, SlotType.STANDARD, SlotRender.FULL)); slotSecondaryOutput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 116, 53).setSlotInfo(SlotColor.YELLOW, SlotType.STANDARD, SlotRender.BOTTOM)); slotTank[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.ORANGE, SlotType.TANK, SlotRender.FULL).setVisible(false)); slotTank[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.YELLOW, SlotType.TANK, SlotRender.BOTTOM).setVisible(false)); if (!myTile.smallStorage()) { addElement(new ElementEnergyStored(this, 8, 8, myTile.getEnergyStorage())); } progress = (ElementDualScaled) addElement(new ElementDualScaled(this, 79, 34).setMode(1).setSize(24, 16).setTexture(TEX_ARROW_RIGHT, 64, 16)); speed = (ElementDualScaled) addElement(new ElementDualScaled(this, 53, 44).setSize(16, 16).setTexture(TEX_SAW, 32, 16)); tank = (ElementFluidTank) addElement(new ElementFluidTank(this, 152, 9, myTile.getTank()).setGauge(0).setAlwaysShow(true)); progressFluid = (ElementFluid) addElement(new ElementFluid(this, 79, 34).setFluid(myTile.getRenderFluid()).setSize(24, 16)); progressOverlay = (ElementDualScaled) addElement(new ElementDualScaled(this, 79, 34).setBackground(false).setMode(1).setSize(24, 16).setTexture(TEX_ARROW_FLUID_RIGHT, 64, 16)); slotTank[0].setVisible(myTile.augmentTapper()); slotTank[1].setVisible(myTile.augmentTapper()); tankBackground.setVisible(myTile.augmentTapper()); tank.setVisible(myTile.augmentTapper()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
@Override protected void updateElementInformation() { super.updateElementInformation(); slotInput.setVisible(baseTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); slotPrimaryOutput[0].setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); slotPrimaryOutput[1].setVisible(baseTile.hasSideType(OUTPUT_PRIMARY)); slotSecondaryOutput[0].setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); slotSecondaryOutput[1].setVisible(baseTile.hasSideType(OUTPUT_SECONDARY)); slotTank[0].setVisible(myTile.augmentTapper() && (baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI))); slotTank[1].setVisible(myTile.augmentTapper() && baseTile.hasSideType(OUTPUT_SECONDARY)); if (!baseTile.hasSideType(OUTPUT_ALL) && !baseTile.hasSideType(OMNI)) { slotPrimaryOutput[1].setSlotRender(SlotRender.FULL); slotSecondaryOutput[1].setSlotRender(SlotRender.FULL); slotTank[1].setSlotRender(SlotRender.FULL); } else { slotPrimaryOutput[1].setSlotRender(SlotRender.BOTTOM); slotSecondaryOutput[1].setSlotRender(SlotRender.BOTTOM); slotTank[1].setSlotRender(SlotRender.BOTTOM); } progress.setQuantity(baseTile.getScaledProgress(PROGRESS)); speed.setQuantity(baseTile.getScaledSpeed(SPEED)); progressFluid.setSize(baseTile.getScaledProgress(PROGRESS), 16); progressOverlay.setQuantity(baseTile.getScaledProgress(PROGRESS)); progress.setVisible(!myTile.fluidArrow()); tankBackground.setVisible(myTile.augmentTapper()); tank.setVisible(myTile.augmentTapper()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
getRecipe(); processOff(); return;
@Override protected boolean hasValidInput() { if (curRecipe == null) { getRecipe(); } if (curRecipe == null) { return false; } return curRecipe.getInput().getCount() <= inventory[0].getCount(); }
public ContainerSawmill(InventoryPlayer inventory, TileEntity tile) { super(inventory, tile); myTile = (TileSawmill) tile; addSlotToContainer(new SlotValidated(this, myTile, 0, 53, 26)); addSlotToContainer(new SlotRemoveOnly(myTile, 1, 116, 26)); addSlotToContainer(new SlotRemoveOnly(myTile, 2, 116, 53)); addSlotToContainer(new SlotEnergy(myTile, myTile.getChargeSlot(), 8, 53)); }
return new TilePulverizer(); case SAWMILL: return new TileSawmill(); case SMELTER: return new TileSmelter();
@Override protected boolean canStart() { if (inventory[0].isEmpty() || energyStorage.getEnergyStored() <= 0) { return false; } getRecipe(); if (curRecipe == null) { return false; } if (inventory[0].getCount() < curRecipe.getInput().getCount()) { return false; } ItemStack primaryItem = curRecipe.getPrimaryOutput(); ItemStack secondaryItem = curRecipe.getSecondaryOutput(); if (!secondaryItem.isEmpty() && !inventory[2].isEmpty()) { if (!augmentSecondaryNull) { if (!inventory[2].isItemEqual(secondaryItem)) { return false; } if (inventory[2].getCount() + secondaryItem.getCount() > secondaryItem.getMaxStackSize()) { return false; } } } return inventory[1].isEmpty() || inventory[1].isItemEqual(primaryItem) && inventory[1].getCount() + primaryItem.getCount() <= primaryItem.getMaxStackSize(); }