@Override protected void handleFluidPacket(PacketBase payload) { super.handleFluidPacket(payload); renderFluid = payload.getFluidStack(); callBlockUpdate(); }
public TileRefinery() { super(); inventory = new ItemStack[1 + 1]; Arrays.fill(inventory, ItemStack.EMPTY); createAllSlots(inventory.length); }
@Override protected boolean hasValidInput() { if (curRecipe == null) { getRecipe(); } return curRecipe != null; }
@Override protected void transferOutput() { if (!getTransferOut()) { return; } transferOutputFluid(); if (inventory[0].isEmpty()) { return; } int side; for (int i = outputTracker + 1; i <= outputTracker + 6; i++) { side = i % 6; if (isSecondaryOutput(sideConfig.sideTypes[sideCache[side]])) { if (transferItem(0, ITEM_TRANSFER[level], EnumFacing.VALUES[side])) { outputTracker = side; break; } } } }
@Override public void initGui() { super.initGui(); slotInput = addElement(new ElementSlotOverlay(this, 44, 19).setSlotInfo(SlotColor.BLUE, SlotType.TANK_SHORT, SlotRender.FULL)); slotOutput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 112, 31).setSlotInfo(SlotColor.ORANGE, SlotType.OUTPUT, SlotRender.FULL)); slotOutput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 112, 31).setSlotInfo(SlotColor.YELLOW, SlotType.OUTPUT, SlotRender.BOTTOM)); slotTankOutput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.ORANGE, SlotType.TANK, SlotRender.FULL).setVisible(false)); slotTankOutput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.RED, SlotType.TANK, SlotRender.BOTTOM).setVisible(false)); if (!myTile.smallStorage()) { addElement(new ElementEnergyStored(this, 8, 8, myTile.getEnergyStorage())); } addElement(new ElementFluidTank(this, 44, 19, myTile.getTank(0)).setGauge(0).setAlwaysShow(true).setSmall()); addElement(new ElementFluidTank(this, 152, 9, myTile.getTank(1)).setGauge(1).setAlwaysShow(true)); progressFluid = (ElementFluid) addElement(new ElementFluid(this, 76, 34).setFluid(myTile.getTankFluid(0)).setSize(24, 16)); progressOverlay = (ElementDualScaled) addElement(new ElementDualScaled(this, 76, 34).setMode(1).setBackground(false).setSize(24, 16).setTexture(TEX_DROP_RIGHT, 64, 16)); speed = (ElementDualScaled) addElement(new ElementDualScaled(this, 44, 52).setSize(16, 16).setTexture(TEX_FLAME, 32, 16)); }
getRecipe(); processOff(); return;
public static void initialize() { SIDE_CONFIGS[TYPE] = new SideConfig(); SIDE_CONFIGS[TYPE].numConfig = 7; SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, {}, {}, { 0 }, { 0 }, { 0 }, { 0 } }; SIDE_CONFIGS[TYPE].sideTypes = new int[] { NONE, INPUT_ALL, OUTPUT_PRIMARY, OUTPUT_SECONDARY, OUTPUT_ALL, OPEN, OMNI }; SIDE_CONFIGS[TYPE].defaultSides = new byte[] { 1, 2, 3, 3, 3, 3 }; ALT_SIDE_CONFIGS[TYPE] = new SideConfig(); ALT_SIDE_CONFIGS[TYPE].numConfig = 2; ALT_SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, {}, {}, { 0 }, { 0 }, { 0 }, { 0 } }; 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[] { false, false }; SLOT_CONFIGS[TYPE].allowExtractionSlot = new boolean[] { true, false }; VALID_AUGMENTS[TYPE] = new HashSet<>(); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_REFINERY_FOSSIL); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_REFINERY_POTION); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY_NULL); GameRegistry.registerTileEntity(TileRefinery.class, "thermalexpansion:machine_refinery"); config(); }
public ContainerRefinery(InventoryPlayer inventory, TileEntity tile) { super(inventory, tile); myTile = (TileRefinery) tile; addSlotToContainer(new SlotRemoveOnly(myTile, 0, 116, 35)); addSlotToContainer(new SlotEnergy(myTile, myTile.getChargeSlot(), 8, 53)); }
private void transferOutputFluid() { if (!getTransferOut()) { return; } if (outputTank.getFluidAmount() <= 0) { return; } int side; FluidStack output = new FluidStack(outputTank.getFluid(), Math.min(outputTank.getFluidAmount(), FLUID_TRANSFER[level])); for (int i = outputTrackerFluid + 1; i <= outputTrackerFluid + 6; i++) { side = i % 6; if (isPrimaryOutput(sideConfig.sideTypes[sideCache[side]])) { int toDrain = FluidHelper.insertFluidIntoAdjacentFluidHandler(this, EnumFacing.VALUES[side], output, true); if (toDrain > 0) { outputTank.drain(toDrain, true); outputTrackerFluid = side; break; } } } }
return new TileCrucible(); case REFINERY: return new TileRefinery(); case TRANSPOSER: return new TileTransposer();
@Override protected void updateElementInformation() { super.updateElementInformation(); slotInput.setVisible(baseTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); slotOutput[0].setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); slotOutput[1].setVisible(baseTile.hasSideType(OUTPUT_SECONDARY)); slotTankOutput[0].setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); slotTankOutput[1].setVisible(baseTile.hasSideType(OUTPUT_PRIMARY)); if (!baseTile.hasSideType(OUTPUT_ALL) && !baseTile.hasSideType(OMNI)) { slotOutput[1].setSlotRender(SlotRender.FULL); slotTankOutput[1].setSlotRender(SlotRender.FULL); } else { slotOutput[1].setSlotRender(SlotRender.BOTTOM); slotTankOutput[1].setSlotRender(SlotRender.BOTTOM); } progressFluid.setFluid(myTile.getTankFluid(0)); progressFluid.setSize(baseTile.getScaledProgress(PROGRESS), 16); progressOverlay.setQuantity(baseTile.getScaledProgress(PROGRESS)); speed.setQuantity(baseTile.getScaledSpeed(SPEED)); }
@Override protected boolean canStart() { if (energyStorage.getEnergyStored() <= 0 || outputTank.getSpace() <= 0) { return false; } getRecipe(); if (curRecipe == null) { return false; } if (inputTank.getFluidAmount() < curRecipe.getInput().amount) { return false; } FluidStack outputFluid = curRecipe.getOutputFluid(); ItemStack outputItem = curRecipe.getOutputItem(); if (!outputItem.isEmpty() && !inventory[0].isEmpty()) { if (!augmentSecondaryNull) { if (!inventory[0].isItemEqual(outputItem)) { return false; } if (inventory[0].getCount() + outputItem.getCount() > outputItem.getMaxStackSize()) { return false; } } } return outputTank.fill(outputFluid, false) == outputFluid.amount; }