public boolean fluidArrow() { return augmentTank() && usingTank; }
@Override public void onContainerClosed(EntityPlayer playerIn) { super.onContainerClosed(playerIn); myTile.clearRecipeChanges(); }
public TileCrafter() { super(); inventory = new ItemStack[18 + 1 + 1 + 9 + 1]; Arrays.fill(inventory, ItemStack.EMPTY); createAllSlots(inventory.length - 9 - 1); }
@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]])) { for (int j = 0; j < 9; j++) { if (!inventory[j + SLOT_CRAFTING_START].isEmpty()) { if (!extractItem(j, ITEM_TRANSFER[level], EnumFacing.VALUES[side])) { extractItem(j + 9, ITEM_TRANSFER[level], EnumFacing.VALUES[side]); } } inputTracker = side; } return; } } }
@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 = (ElementSlotOverlayCrafter) addElement(new ElementSlotOverlayCrafter(this, 8, 77)); slotOutput = addElement(new ElementSlotOverlay(this, 121, 17).setSlotInfo(SlotColor.ORANGE, SlotType.OUTPUT, SlotRender.FULL)); //slotTank = addElement(new ElementSlotOverlay(this, 152, 9).setSlotInfo(SlotColor.BLUE, SlotType.TANK, SlotRender.FULL)); if (!myTile.smallStorage()) { addElement(new ElementEnergyStored(this, 8, 8, myTile.getEnergyStorage())); } progress = (ElementDualScaled) addElement(new ElementDualScaled(this, 92, 21).setMode(1).setSize(24, 16).setTexture(TEX_ARROW_RIGHT, 64, 16)); addElement(new ElementButton(this, 96, 48, "SetRecipe", 176, 0, 176, 16, 176, 32, 16, 16, TEX_PATH).setToolTip("gui.thermalexpansion.machine.crafter.setRecipe")); tank = (ElementFluidTank) addElement(new ElementFluidTank(this, 152, 9, myTile.getTank()).setGauge(1).setAlwaysShow(true)); progressFluid = (ElementFluid) addElement(new ElementFluid(this, 92, 21).setFluid(myTile.getTankFluid()).setSize(24, 16)); progressOverlay = (ElementDualScaled) addElement(new ElementDualScaled(this, 92, 21).setBackground(false).setMode(1).setSize(24, 16).setTexture(TEX_ARROW_FLUID_RIGHT, 64, 16)); tankBackground.setVisible(myTile.augmentTank()); tank.setVisible(myTile.augmentTank()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
@Override protected void updateElementInformation() { super.updateElementInformation(); slotInput.setVisible(baseTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); slotOutput.setVisible(baseTile.hasSideType(OUTPUT_ALL) || baseTile.hasSideType(OMNI)); // slotTank.setVisible(baseTile.hasSideType(INPUT_ALL) || baseTile.hasSideType(OMNI)); progress.setQuantity(baseTile.getScaledProgress(PROGRESS)); progressFluid.setSize(baseTile.getScaledProgress(PROGRESS), 16); progressOverlay.setQuantity(baseTile.getScaledProgress(PROGRESS)); progress.setVisible(!myTile.fluidArrow()); tankBackground.setVisible(myTile.augmentTank()); tank.setVisible(myTile.augmentTank()); progressFluid.setVisible(myTile.fluidArrow()); progressOverlay.setVisible(myTile.fluidArrow()); }
public void setRecipe() { for (int i = 0; i < 9; i++) { craftMatrix.setInventorySlotContents(i, inventory[i + SLOT_CRAFTING_START]); } IRecipe newRecipe = CraftingManager.findMatchingRecipe(craftMatrix, world); ItemStack stack = ItemStack.EMPTY; if (newRecipe != null) { stack = newRecipe.getCraftingResult(craftMatrix); craftRecipe = CrafterRecipe.getRecipe(newRecipe, this); if (craftRecipe == null) { newRecipe = null; stack = ItemStack.EMPTY; usingTank = false; } } else { craftRecipe = null; usingTank = false; } if (craftRecipe == null) { if (isActive) { processOff(); } } inventory[SLOT_CRAFTING_START + 9] = stack; craftResult.setRecipeUsed(newRecipe); craftResult.setInventorySlotContents(0, inventory[SLOT_CRAFTING_START + 9]); clearRecipeChanges(); }
addSlotToContainer(new SlotEnergy(myTile, myTile.getChargeSlot(), 8, 53)); if (ServerHelper.isServerWorld(myTile.getWorld())) { for (int i = 0; i < 9; i++) { craftMatrix.setInventorySlotContents(i, myTile.inventory[TileCrafter.SLOT_CRAFTING_START + i]); IRecipe recipe = CraftingManager.findMatchingRecipe(craftMatrix, myTile.getWorld());
@Override protected void processFinish() { IRecipe recipe = craftResult.getRecipeUsed(); if (recipe == null || !checkIngredients()) { processOff(); return; } craftRecipe.evaluate(); ItemStack output = recipe.getCraftingResult(craftMatrix); NonNullList<ItemStack> remainingItems = recipe.getRemainingItems(craftMatrix); for (int i = 0; i < remainingItems.size(); i++) { ItemStack remaining = remainingItems.get(i); if (!remaining.isEmpty() && !craftRecipe.isFalseBucket(i)) { for (int j = 0; j < SLOT_OUTPUT; j++) { if (inventory[j].isEmpty()) { inventory[j] = remaining; break; } else if (remaining.getMaxStackSize() > 1 && ItemHelper.itemsIdentical(inventory[j], remaining) && inventory[j].getCount() < inventory[j].getMaxStackSize()) { inventory[j].grow(1); break; } } } } if (inventory[SLOT_OUTPUT].isEmpty()) { inventory[SLOT_OUTPUT] = ItemHelper.cloneStack(output); } else { inventory[SLOT_OUTPUT].grow(output.getCount()); } }
public static void initialize() { SIDE_CONFIGS[TYPE] = new SideConfig(); SIDE_CONFIGS[TYPE].numConfig = 5; SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, { 18 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 } }; SIDE_CONFIGS[TYPE].sideTypes = new int[] { NONE, INPUT_ALL, OUTPUT_ALL, 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, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, { 18 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 } }; 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, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false }; SLOT_CONFIGS[TYPE].allowExtractionSlot = new boolean[] { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false }; VALID_AUGMENTS[TYPE] = new HashSet<>(); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_CRAFTER_INPUT); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_CRAFTER_TANK); LIGHT_VALUES[TYPE] = 7; GameRegistry.registerTileEntity(TileCrafter.class, "thermalexpansion:machine_crafter"); config(); }
@Override protected boolean canStart() { if (energyStorage.getEnergyStored() <= 0) { return false; } if (craftResult.getRecipeUsed() == null || hasRecipeChanges) { return false; } if (!checkIngredients()) { return false; } ItemStack output = craftResult.getStackInSlot(0); return inventory[SLOT_OUTPUT].isEmpty() || inventory[SLOT_OUTPUT].isItemEqual(output) && inventory[SLOT_OUTPUT].getCount() + output.getCount() <= output.getMaxStackSize(); }
return new TileCentrifuge(); case CRAFTER: return new TileCrafter(); case BREWER: return new TileBrewer();