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_PULVERIZER_GEODE); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_PULVERIZER_PETROTHEUM); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_SECONDARY_NULL); LIGHT_VALUES[TYPE] = 4; GameRegistry.registerTileEntity(TilePulverizer.class, "thermalexpansion:machine_pulverizer"); config(); }
public TilePulverizer() { super(); inventory = new ItemStack[1 + 1 + 1 + 1]; Arrays.fill(inventory, ItemStack.EMPTY); createAllSlots(inventory.length); tank.setLock(TFFluids.fluidPetrotheum); }
@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)); 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_CRUSH, 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.getTankFluid()).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)); tankBackground.setVisible(myTile.augmentPetrotheum()); tank.setVisible(myTile.augmentPetrotheum()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
getRecipe(); processOff(); return; inventory[1] = ItemHelper.cloneStack(primaryItem, getPetrotheumOutputAmount(primaryItem)); } else { inventory[1].grow(getPetrotheumOutputAmount(primaryItem));
@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)); if (!baseTile.hasSideType(OUTPUT_ALL) && !baseTile.hasSideType(OMNI)) { slotPrimaryOutput[1].setSlotRender(SlotRender.FULL); slotSecondaryOutput[1].setSlotRender(SlotRender.FULL); } else { slotPrimaryOutput[1].setSlotRender(SlotRender.BOTTOM); slotSecondaryOutput[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.augmentPetrotheum()); tank.setVisible(myTile.augmentPetrotheum()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
@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; } boolean augmentPetrotheumCheck = augmentPetrotheum && PulverizerManager.isOre(inventory[0]); if (augmentPetrotheumCheck && tank.getFluidAmount() < FLUID_AMOUNT) { 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() + (augmentPetrotheumCheck ? getPetrotheumOutputAmount(primaryItem) : primaryItem.getCount()) <= primaryItem.getMaxStackSize(); }
@Override protected boolean hasValidInput() { if (curRecipe == null) { getRecipe(); } if (curRecipe == null) { return false; } if (augmentPetrotheum && PulverizerManager.isOre(inventory[0]) && tank.getFluidAmount() < FLUID_AMOUNT) { return false; } return curRecipe.getInput().getCount() <= inventory[0].getCount(); }
recipeInputFluids.add(new FluidStack(TFFluids.fluidPetrotheum, TilePulverizer.FLUID_AMOUNT)); inputFluids = recipeInputFluids; recipeOutputs.add(ItemHelper.cloneStack(recipe.getPrimaryOutput(), TilePulverizer.getPetrotheumOutputAmount(recipe.getPrimaryOutput()))); energy = recipe.getEnergy() * (100 + TilePulverizer.PETROTHEUM_ENERGY_MOD) / 100; } else {
public ContainerPulverizer(InventoryPlayer inventory, TileEntity tile) { super(inventory, tile); myTile = (TilePulverizer) 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 TileFurnace(); case PULVERIZER: return new TilePulverizer(); case SAWMILL: return new TileSawmill();