@Override protected void handleFluidPacket(PacketBase payload) { super.handleFluidPacket(payload); renderFluid = payload.getFluidStack(); callBlockUpdate(); }
public TileBrewer() { super(); inventory = new ItemStack[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(); slotInput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 80, 34).setSlotInfo(SlotColor.BLUE, SlotType.STANDARD, SlotRender.FULL)); slotInput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 80, 34).setSlotInfo(SlotColor.GREEN, SlotType.STANDARD, SlotRender.BOTTOM)); slotTankInput[0] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 32, 27).setSlotInfo(SlotColor.BLUE, SlotType.TANK_SHORT, SlotRender.FULL)); slotTankInput[1] = (ElementSlotOverlay) addElement(new ElementSlotOverlay(this, 32, 27).setSlotInfo(SlotColor.PURPLE, SlotType.TANK_SHORT, SlotRender.BOTTOM)); slotTankOutput = addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.ORANGE, SlotType.TANK, SlotRender.FULL)); if (!myTile.smallStorage()) { addElement(new ElementEnergyStored(this, 8, 8, myTile.getEnergyStorage())); } addElement(new ElementFluidTank(this, 32, 27, 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, 112, 34).setFluid(myTile.getTankFluid(1)).setSize(24, 16)); progressOverlay = (ElementDualScaled) addElement(new ElementDualScaled(this, 112, 34).setMode(1).setBackground(false).setSize(24, 16).setTexture(TEX_DROP_RIGHT, 64, 16)); speed = (ElementDualScaled) addElement(new ElementDualScaled(this, 57, 34).setSize(16, 16).setTexture(TEX_ALCHEMY, 32, 16)); }
@Override protected void processFinish() { if (curRecipe == null) { getRecipe(); } if (curRecipe == null) { processOff(); return; } outputTank.fill(curRecipe.getOutputFluid(), true); inputTank.drain(curRecipe.getInputFluid().amount, true); int count = curRecipe.getInput().getCount(); if (reuseChance > 0) { if (world.rand.nextInt(SECONDARY_BASE) >= reuseChance) { inventory[0].shrink(count); } } else { inventory[0].shrink(count); } if (inventory[0].getCount() <= 0) { inventory[0] = ItemStack.EMPTY; } }
@Override protected void updateElementInformation() { super.updateElementInformation(); slotInput[0].setVisible(myTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); slotInput[1].setVisible(myTile.hasSideType(INPUT_PRIMARY)); slotTankInput[0].setVisible(myTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); slotTankInput[1].setVisible(myTile.hasSideType(INPUT_SECONDARY)); slotTankOutput.setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); if (!baseTile.hasSideType(INPUT_ALL) && !baseTile.hasSideType(OMNI)) { slotInput[1].setSlotRender(SlotRender.FULL); slotTankInput[1].setSlotRender(SlotRender.FULL); } else { slotInput[1].setSlotRender(SlotRender.BOTTOM); slotTankInput[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 hasValidInput() { if (curRecipe == null) { getRecipe(); } if (curRecipe == null) { return false; } return curRecipe.getInput().getCount() <= inventory[0].getCount(); }
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_ALL, INPUT_PRIMARY, INPUT_SECONDARY, OPEN, OMNI }; SIDE_CONFIGS[TYPE].defaultSides = new byte[] { 1, 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 }, {}, { 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[] { true, false }; SLOT_CONFIGS[TYPE].allowExtractionSlot = new boolean[] { false, false }; VALID_AUGMENTS[TYPE] = new HashSet<>(); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_BREWER_REAGENT); LIGHT_VALUES[TYPE] = 12; GameRegistry.registerTileEntity(TileBrewer.class, "thermalexpansion:machine_brewer"); config(); }
public ContainerBrewer(InventoryPlayer inventory, TileEntity tile) { super(inventory, tile); myTile = (TileBrewer) tile; addSlotToContainer(new SlotValidated(this, myTile, 0, 80, 34)); addSlotToContainer(new SlotEnergy(myTile, myTile.getChargeSlot(), 8, 53)); }
return new TileCrafter(); case BREWER: return new TileBrewer(); case ENCHANTER: return new TileEnchanter();
@Override protected boolean canStart() { if (inventory[0].isEmpty() || energyStorage.getEnergyStored() <= 0 || outputTank.getSpace() <= 0) { return false; } getRecipe(); if (curRecipe == null) { return false; } if (inventory[0].getCount() < curRecipe.getInput().getCount()) { return false; } if (inputTank.getFluidAmount() < curRecipe.getInputFluid().amount) { return false; } FluidStack outputFluid = curRecipe.getOutputFluid(); return outputTank.fill(outputFluid, false) == outputFluid.amount; }