public TileCompactor() { super(); inventory = new ItemStack[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 protected void transferOutput() { if (!getTransferOut()) { return; } if (inventory[1].isEmpty()) { return; } int side; for (int i = outputTracker + 1; i <= outputTracker + 6; i++) { side = i % 6; if (isPrimaryOutput(sideConfig.sideTypes[sideCache[side]])) { if (transferItem(1, ITEM_TRANSFER[level], EnumFacing.VALUES[side])) { outputTracker = side; break; } } } }
@Override public void initGui() { super.initGui(); slotInput = addElement(new ElementSlotOverlay(this, 53, 26).setSlotInfo(SlotColor.BLUE, SlotType.STANDARD, SlotRender.FULL)); slotOutput = addElement(new ElementSlotOverlay(this, 112, 31).setSlotInfo(SlotColor.ORANGE, SlotType.OUTPUT, SlotRender.FULL)); 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_COMPACT, 32, 16)); }
@Override protected void postAugmentInstall() { super.postAugmentInstall(); if (!augmentMint && !augmentGear) { if (mode != Mode.PLATE && isActive && !inventory[1].isEmpty()) { processOff(); } mode = Mode.PLATE; } }
public static void initialize() { SIDE_CONFIGS[TYPE] = new SideConfig(); SIDE_CONFIGS[TYPE].numConfig = 5; SIDE_CONFIGS[TYPE].slotGroups = new int[][] { {}, { 0 }, { 1 }, { 0, 1 }, { 0, 1 } }; 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 }, { 0, 1 }, { 0, 1 } }; 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 }; SLOT_CONFIGS[TYPE].allowExtractionSlot = new boolean[] { false, true, false }; VALID_AUGMENTS[TYPE] = new HashSet<>(); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_COMPACTOR_COIN); VALID_AUGMENTS[TYPE].add(TEProps.MACHINE_COMPACTOR_GEAR); GameRegistry.registerTileEntity(TileCompactor.class, "thermalexpansion:machine_compactor"); config(); }
public ContainerCompactor(InventoryPlayer inventory, TileEntity tile) { super(inventory, tile); myTile = (TileCompactor) tile; addSlotToContainer(new SlotValidated(this, myTile, 0, 53, 26)); addSlotToContainer(new SlotRemoveOnly(myTile, 1, 116, 35)); addSlotToContainer(new SlotEnergy(myTile, myTile.getChargeSlot(), 8, 53)); }
return new TileInsolator(); case COMPACTOR: return new TileCompactor(); case CRUCIBLE: return new TileCrucible();
@Override public boolean preInit() { this.setRegistryName("machine"); ForgeRegistries.BLOCKS.register(this); itemBlock = new ItemBlockMachine(this); itemBlock.setRegistryName(this.getRegistryName()); ForgeRegistries.ITEMS.register(itemBlock); TileMachineBase.config(); TileFurnace.initialize(); TilePulverizer.initialize(); TileSawmill.initialize(); TileSmelter.initialize(); TileInsolator.initialize(); TileCompactor.initialize(); TileCrucible.initialize(); TileRefinery.initialize(); TileTransposer.initialize(); TileCharger.initialize(); TileCentrifuge.initialize(); TileCrafter.initialize(); TileBrewer.initialize(); TileEnchanter.initialize(); TilePrecipitator.initialize(); TileExtruder.initialize(); ThermalExpansion.proxy.addIModelRegister(this); return true; }
@Override protected boolean installAugmentToSlot(int slot) { String id = AugmentHelper.getAugmentIdentifier(augments[slot]); if (!augmentMint && TEProps.MACHINE_COMPACTOR_COIN.equals(id)) { augmentMint = true; if (mode != Mode.COIN && isActive && !inventory[1].isEmpty()) { processOff(); } mode = Mode.COIN; hasModeAugment = true; return true; } if (!augmentGear && TEProps.MACHINE_COMPACTOR_GEAR.equals(id)) { augmentGear = true; if (mode != Mode.GEAR && isActive && !inventory[1].isEmpty()) { processOff(); } mode = Mode.GEAR; hasModeAugment = true; return true; } return super.installAugmentToSlot(slot); }
@Override protected void processFinish() { CompactorRecipe recipe = CompactorManager.getRecipe(inventory[0], mode); if (recipe == null) { processOff(); return; } ItemStack output = recipe.getOutput(); if (inventory[1].isEmpty()) { inventory[1] = ItemHelper.cloneStack(output); } else { inventory[1].grow(output.getCount()); } inventory[0].shrink(recipe.getInput().getCount()); if (inventory[0].getCount() <= 0) { inventory[0] = ItemStack.EMPTY; } }