public int onCoverScrewdriverclick( byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { aCoverVariable = (aCoverVariable + 1) % 4; switch (aCoverVariable) { case 0: GT_Utility.sendChatToPlayer(aPlayer, "Normal"); break; case 1: GT_Utility.sendChatToPlayer(aPlayer, "Inverted"); break; case 2: GT_Utility.sendChatToPlayer(aPlayer, "Ready to work"); break; case 3: GT_Utility.sendChatToPlayer(aPlayer, "Not ready to work"); break; } return aCoverVariable; }
public List<String> getAdditionalToolTips( GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { if (GT_Utility.isStringValid(getTitle(aStack))) { aList.add(getTitle(aStack)); } if (GT_Utility.isStringValid(getAuthor(aStack))) { aList.add("by " + getAuthor(aStack)); } return aList; }
public ItemStack slotClick( int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { if (aSlotIndex < 9) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (tSlot != null) { if (this.mTileEntity.getMetaTileEntity() == null) { return null; } if (aSlotIndex == 27) { ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput); if (((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput) { GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside"); } else { GT_Utility.sendChatToPlayer(aPlayer, "Don't emit Energy"); } return null; } if ((aSlotIndex >= 9) && (aSlotIndex < 18)) { ItemStack tStack = aPlayer.inventory.getItemStack(); if (tStack != null) { tSlot.putStack(GT_Utility.copy(new Object[] {tStack})); } else if (tSlot.getStack() != null) { if (aMouseclick == 0) { tSlot.getStack().stackSize -= (aShifthold == 1 ? 8 : 1); if (tSlot.getStack().stackSize <= 0) { tSlot.putStack(null); } } else { tSlot.getStack().stackSize += (aShifthold == 1 ? 8 : 1); if (tSlot.getStack().stackSize > tSlot.getStack().getMaxStackSize()) { tSlot.getStack().stackSize = tSlot.getStack().getMaxStackSize(); } } } return null; } if ((aSlotIndex >= 18) && (aSlotIndex < 27)) { ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()) .mTargetSlots[(aSlotIndex - 18)] = Math.min( 99, Math.max( 0, ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()) .mTargetSlots[(aSlotIndex - 18)] + (aMouseclick == 0 ? -1 : 1) * (aShifthold == 0 ? 1 : 16))); return null; } } return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); }
public boolean onItemUseFirst( GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } Block aBlock = aWorld.getBlock(aX, aY, aZ); if (aBlock == null) { return false; } byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); if ((aBlock == Blocks.unpowered_repeater) || (aBlock == Blocks.powered_repeater)) { if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); GT_Utility.sendSoundToPlayers( aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if ((aBlock == Blocks.unpowered_comparator) || (aBlock == Blocks.powered_comparator)) { if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aMeta / 4 * 4 + (aMeta % 4 + 1) % 4, 3); GT_Utility.sendSoundToPlayers( aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } return false; }
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { GT_Utility.doSoundAtClient( (String) GregTech_API.sSoundList.get(Integer.valueOf(200)), 10, 1.0F, aX, aY, aZ); } }
public boolean onItemUseFirst( GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { if ((aPlayer instanceof EntityPlayerMP)) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (((tTileEntity instanceof IInventory)) && (!((IInventory) tTileEntity).isUseableByPlayer(aPlayer))) { return false; } if (((tTileEntity instanceof IGregTechDeviceInformation)) && (((IGregTechDeviceInformation) tTileEntity).isGivingInformation())) { GT_Utility.setStack(aStack, ItemList.NC_SensorCard.get(aStack.stackSize, new Object[0])); NBTTagCompound tNBT = aStack.getTagCompound(); if (tNBT == null) { tNBT = new NBTTagCompound(); } tNBT.setInteger("x", aX); tNBT.setInteger("y", aY); tNBT.setInteger("z", aZ); aStack.setTagCompound(tNBT); } return true; } return false; }
public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { int i = 0; for (int tCosts = 0; i < 9; i++) { if (this.mInventory[(i + 9)] != null) { tCosts = GT_Utility.moveOneItemStackIntoSlot( getBaseMetaTileEntity(), getBaseMetaTileEntity() .getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[] {this.mInventory[(i + 9)]}), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3; if (tCosts > 0) { this.mSuccess = 50; getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true); break; } } } }
public boolean handleRenderType(ItemStack aStack, IItemRenderer.ItemRenderType aType) { if ((GT_Utility.isStackInvalid(aStack)) || (aStack.getItemDamage() < 0)) { return false; } return (aType == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) || (aType == IItemRenderer.ItemRenderType.INVENTORY) || (aType == IItemRenderer.ItemRenderType.EQUIPPED) || (aType == IItemRenderer.ItemRenderType.ENTITY); }
public boolean shouldUseRenderHelper( IItemRenderer.ItemRenderType aType, ItemStack aStack, IItemRenderer.ItemRendererHelper aHelper) { if (GT_Utility.isStackInvalid(aStack)) { return false; } return aType == IItemRenderer.ItemRenderType.ENTITY; }
public List<String> getAdditionalToolTips( GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { String tTitle = GT_Utility.ItemNBT.getBookTitle(aStack); if (GT_Utility.isStringValid(tTitle)) { aList.add(tTitle); aList.add("by " + GT_Utility.ItemNBT.getBookAuthor(aStack)); } return aList; }
public boolean allowPutStack( IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { return false; } return GT_ModHandler.getExtractorOutput( GT_Utility.copyAmount(64L, new Object[] {aStack}), false, null) != null; }
public void registerOre( OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { GT_ModHandler.addPulverisationRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Wood, 2L), null, 0, false); GT_Values.RA.addLatheRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Wood, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Wood, 1L), 16, 8); }
public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { if ((aSide < 0) || (aSide > 5)) { return 0; } TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) { return ((IGregTechTileEntity) tTileEntity) .getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide)); } return 0; }
public void registerOre( OrePrefixes aPrefix, gregtech.api.enums.Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aPrefix == OrePrefixes.stoneSmooth) { GT_Values.RA.addAssemblerRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), ItemList.Circuit_Integrated.getWithDamage(0L, 1L, new Object[0]), new ItemStack(Blocks.stone_button, 1), 100, 4); GT_Values.RA.addAssemblerRecipe( GT_Utility.copyAmount(2L, new Object[] {aStack}), ItemList.Circuit_Integrated.getWithDamage(0L, 2L, new Object[0]), new ItemStack(Blocks.stone_pressure_plate, 1), 200, 4); } }
public void registerOre( OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aMaterial.mFuelPower > 0) GT_Values.RA.addFuel( GT_Utility.copyAmount(1L, new Object[] {aStack}), null, aMaterial.mFuelPower * 4, aMaterial.mFuelType); if (!aMaterial.contains(gregtech.api.enums.SubTag.NO_WORKING)) GT_Values.RA.addLatheRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L), GT_OreDictUnificator.getDust( aMaterial, aPrefix.mMaterialAmount - OrePrefixes.stickLong.mMaterialAmount), (int) Math.max(aMaterial.getMass() * 5L, 1L), 16); GT_Values.RA.addForgeHammerRecipe( aStack, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 2L), 64, 16); }
public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID) { aItem.addItemBehavior(aID, new Behaviour_Plunger_Item(getToolDamagePerDropConversion())); aItem.addItemBehavior(aID, new Behaviour_Plunger_Fluid(getToolDamagePerDropConversion())); try { Object tObject = GT_Utility.callConstructor( "gregtech.common.items.behaviors.Behaviour_Plunger_Essentia", 0, null, false, new Object[] {Integer.valueOf(getToolDamagePerDropConversion())}); if ((tObject instanceof IItemBehaviour)) { aItem.addItemBehavior(aID, (IItemBehaviour) tObject); } } catch (Throwable e) { } }
public boolean allowPutStack( IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return getInputSlot() != aIndex && ItemList.Crate_Empty.isStackEqual(aStack) || ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) || ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) || ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) || gregtech.api.util.GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe( getBaseMetaTileEntity(), true, GT_Values.V[mTier], null, new ItemStack[] { GT_Utility.copyAmount(64L, new Object[] {aStack}), getInputAt(1) }) != null; else return false; }
@SideOnly(Side.CLIENT) public boolean onItemUse( GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { if ((GT_Utility.isStringValid(GT_Utility.ItemNBT.getBookTitle(aStack))) && ((aPlayer instanceof EntityPlayerSP))) { Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(aPlayer, aStack, false)); } return true; }
@Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); for (ItemStack tInput : tInputList) { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sWiremillRecipes.findRecipe( getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[] {tInput}); if (tRecipe != null) { if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[] {tInput})) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; if (tRecipe.mEUt <= 16) { this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; this.mMaxProgresstime /= 2; } } if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = new ItemStack[] {tRecipe.getOutput(0)}; updateSlots(); return true; } } } return false; }
public boolean onItemUseFirst( GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { if (aWorld.isRemote) { return false; } TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ); if ((aTileEntity instanceof IFluidHandler)) { for (ForgeDirection tDirection : ForgeDirection.VALID_DIRECTIONS) { if (((IFluidHandler) aTileEntity).drain(tDirection, 1000, false) != null) { if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IFluidHandler) aTileEntity).drain(tDirection, 1000, true); GT_Utility.sendSoundToPlayers( aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(101)), 1.0F, -1.0F, aX, aY, aZ); return true; } } } } return false; }
public boolean allowPutStack( IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); }
public void registerOre( OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aMaterial.mFuelPower > 0) GT_Values.RA.addFuel( GT_Utility.copyAmount(1L, new Object[] {aStack}), null, aMaterial.mFuelPower, aMaterial.mFuelType); if (GT_Utility.getFluidForFilledItem( GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), true) == null) GT_Values.RA.addCannerRecipe( aStack, ItemList.Cell_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.cell, aMaterial, 1L), null, 100, 1); GT_Values.RA.addBoxingRecipe( GT_Utility.copyAmount(16L, new Object[] {aStack}), ItemList.Crate_Empty.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.crateGtDust, aMaterial, 1L), 100, 8); GT_Values.RA.addUnboxingRecipe( GT_OreDictUnificator.get(OrePrefixes.crateGtDust, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 16L), ItemList.Crate_Empty.get(1L, new Object[0]), 800, 1); if (!aMaterial.mBlastFurnaceRequired) { GT_RecipeRegistrator.registerReverseFluidSmelting( aStack, aMaterial, aPrefix.mMaterialAmount, null); if (aMaterial.mSmeltInto.mArcSmeltInto != aMaterial) { GT_RecipeRegistrator.registerReverseArcSmelting( GT_Utility.copyAmount(1L, new Object[] {aStack}), aMaterial, aPrefix.mMaterialAmount, null, null, null); } } ItemStack tStack; if ((null != (tStack = GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial.mSmeltInto, 1L))) && (!aMaterial.contains(SubTag.NO_SMELTING))) { if (aMaterial.mBlastFurnaceRequired) { GT_ModHandler.removeFurnaceSmelting(aStack); GT_Values.RA.addBlastRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), null, null, null, aMaterial.mBlastFurnaceTemp > 1750 ? GT_OreDictUnificator.get(OrePrefixes.ingotHot, aMaterial.mSmeltInto, tStack, 1L) : GT_Utility.copyAmount(1L, new Object[] {tStack}), null, (int) Math.max(aMaterial.getMass() / 40L, 1L) * aMaterial.mBlastFurnaceTemp, 120, aMaterial.mBlastFurnaceTemp); if (aMaterial.mBlastFurnaceTemp <= 1000) { GT_ModHandler.addRCBlastFurnaceRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_Utility.copyAmount(1L, new Object[] {tStack}), aMaterial.mBlastFurnaceTemp); } } else { GT_ModHandler.addSmeltingRecipe(aStack, tStack); } } else if (!aMaterial.contains(SubTag.NO_WORKING)) { if ((!OrePrefixes.block.isIgnored(aMaterial)) && (null == GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L))) { GT_ModHandler.addCompressionRecipe( GT_Utility.copyAmount(9L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)); } if (((OrePrefixes.block.isIgnored(aMaterial)) || (null == GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L))) && (aMaterial != Materials.GraniteRed) && (aMaterial != Materials.GraniteBlack) && (aMaterial != Materials.Glass) && (aMaterial != Materials.Obsidian) && (aMaterial != Materials.Glowstone) && (aMaterial != Materials.Paper)) { GT_ModHandler.addCompressionRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L)); } } if ((aMaterial.mMaterialList.size() > 0) && ((aMaterial.mExtraData & 0x3) != 0)) { long tItemAmount = 0L; long tCapsuleCount = 0L; long tDensityMultiplier = aMaterial.getDensity() > 3628800L ? aMaterial.getDensity() / 3628800L : 1L; ArrayList<ItemStack> tList = new ArrayList(); for (MaterialStack tMat : aMaterial.mMaterialList) if (tMat.mAmount > 0L) { if (tMat.mMaterial == Materials.Air) { tStack = ItemList.Cell_Air.get(tMat.mAmount / 2L, new Object[0]); } else { tStack = GT_OreDictUnificator.get(OrePrefixes.dust, tMat.mMaterial, tMat.mAmount); if (tStack == null) tStack = GT_OreDictUnificator.get(OrePrefixes.cell, tMat.mMaterial, tMat.mAmount); } if (tItemAmount + tMat.mAmount * 3628800L <= aStack.getMaxStackSize() * aMaterial.getDensity()) { tItemAmount += tMat.mAmount * 3628800L; if (tStack != null) { ItemStack tmp793_791 = tStack; tmp793_791.stackSize = ((int) (tmp793_791.stackSize * tDensityMultiplier)); while ((tStack.stackSize > 64) && (tList.size() < 6) && (tCapsuleCount + GT_ModHandler.getCapsuleCellContainerCount(tStack) * 64 <= 64L)) { tCapsuleCount += GT_ModHandler.getCapsuleCellContainerCount(tStack) * 64; tList.add(GT_Utility.copyAmount(64L, new Object[] {tStack})); tStack.stackSize -= 64; } if ((tStack.stackSize > 0) && (tList.size() < 6)) { if (tCapsuleCount + GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize( new ItemStack[] {tStack}) <= 64L) { tCapsuleCount += GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize( new ItemStack[] {tStack}); tList.add(tStack); } } } } } tItemAmount = (tItemAmount * tDensityMultiplier % aMaterial.getDensity() > 0L ? 1 : 0) + tItemAmount * tDensityMultiplier / aMaterial.getDensity(); if (tList.size() > 0) { FluidStack tFluid = null; for (int i = 0; i < tList.size(); i++) { if ((!ItemList.Cell_Air.isStackEqual(tList.get(i))) && ((tFluid = GT_Utility.getFluidForFilledItem((ItemStack) tList.get(i), true)) != null)) { tFluid.amount *= ((ItemStack) tList.get(i)).stackSize; tCapsuleCount -= GT_ModHandler.getCapsuleCellContainerCountMultipliedWithStackSize( new ItemStack[] {(ItemStack) tList.get(i)}); tList.remove(i); break; } } if ((aMaterial.mExtraData & 0x1) != 0) GT_Values.RA.addElectrolyzerRecipe( GT_Utility.copyAmount(tItemAmount, new Object[] {aStack}), tCapsuleCount > 0L ? ItemList.Cell_Empty.get(tCapsuleCount, new Object[0]) : null, null, tFluid, (ItemStack) tList.get(0), tList.size() < 2 ? null : (ItemStack) tList.get(1), tList.size() < 3 ? null : (ItemStack) tList.get(2), tList.size() < 4 ? null : (ItemStack) tList.get(3), tList.size() < 5 ? null : (ItemStack) tList.get(4), tList.size() < 6 ? null : (ItemStack) tList.get(5), null, (int) Math.max(1L, Math.abs(aMaterial.getProtons() * 2L * tItemAmount)), Math.min(4, tList.size()) * 30); if ((aMaterial.mExtraData & 0x2) != 0) { GT_Values.RA.addCentrifugeRecipe( GT_Utility.copyAmount(tItemAmount, new Object[] {aStack}), tCapsuleCount > 0L ? ItemList.Cell_Empty.get(tCapsuleCount, new Object[0]) : null, null, tFluid, (ItemStack) tList.get(0), tList.size() < 2 ? null : (ItemStack) tList.get(1), tList.size() < 3 ? null : (ItemStack) tList.get(2), tList.size() < 4 ? null : (ItemStack) tList.get(3), tList.size() < 5 ? null : (ItemStack) tList.get(4), tList.size() < 6 ? null : (ItemStack) tList.get(5), null, (int) Math.max(1L, Math.abs(aMaterial.getMass() * 4L * tItemAmount)), Math.min(4, tList.size()) * 5); } } } if (aMaterial.contains(SubTag.CRYSTALLISABLE)) { GT_Values.RA.addAutoclaveRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Water.getFluid(200L), GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 7000, 2000, 24); GT_Values.RA.addAutoclaveRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_ModHandler.getDistilledWater(200L), GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 9000, 1500, 24); } switch (aMaterial) { case _NULL: break; case Glass: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), new ItemStack(net.minecraft.init.Blocks.glass)); break; case NetherQuartz: case Quartz: case CertusQuartz: if (gregtech.api.GregTech_API.sRecipeFile.get( gregtech.api.enums.ConfigCategories.Recipes.disabledrecipes, "QuartzDustSmeltingIntoAESilicon", true)) GT_ModHandler.removeFurnaceSmelting(aStack); break; case MeatRaw: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.MeatCooked, 1L)); break; case Mercury: System.err.println("Quicksilver Dust?, To melt that, you don't even need a Furnace..."); break; case Tetrahedrite: case Chalcopyrite: case Malachite: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Copper, 6L)); break; case Pentlandite: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Nickel, 6L)); break; case Garnierite: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Nickel, 1L)); break; case Cassiterite: case CassiteriteSand: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Tin, 1L)); break; case Magnetite: case VanadiumMagnetite: case BasalticMineralSand: case GraniticMineralSand: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.nugget, Materials.Iron, 3L)); break; case YellowLimonite: case BrownLimonite: case BandedIron: GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Iron, 1L)); break; case Coal: GT_ModHandler.addLiquidTransposerFillRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Water.getFluid(125L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.HydratedCoal, 1L), 125); break; case HydratedCoal: GT_ModHandler.addLiquidTransposerEmptyRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Water.getFluid(125L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1L), 125); GT_ModHandler.addSmeltingRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Coal, 1L)); break; case Diamond: GT_Values.RA.addImplosionRecipe( GT_Utility.copyAmount(4L, new Object[] {aStack}), 32, ItemList.IC2_Industrial_Diamond.get(3L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 16L)); break; case Opal: case Olivine: case Emerald: case Ruby: case Sapphire: case GreenSapphire: case Topaz: case BlueTopaz: case Tanzanite: GT_Values.RA.addImplosionRecipe( GT_Utility.copyAmount(4L, new Object[] {aStack}), 24, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 3L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 12L)); break; case FoolsRuby: case GarnetRed: case GarnetYellow: case Jasper: case Amber: case Monazite: case Forcicium: case Forcillium: case Force: GT_Values.RA.addImplosionRecipe( GT_Utility.copyAmount(4L, new Object[] {aStack}), 16, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 3L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 8L)); } }
public void registerOre( OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { ItemStack tOutput = GT_Utility.copyAmount(1L, new Object[] {aStack}); GT_Utility.updateItemStack(tOutput); GT_Utility.ItemNBT.addEnchantment( tOutput, Enchantment.smite, EnchantmentHelper.getEnchantmentLevel(Enchantment.smite.effectId, tOutput) + 3); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.HolyWater.getFluid(25L), tOutput, null, null, null, 100, 2); tOutput = GT_Utility.copyAmount(1L, new Object[] {aStack}); GT_Utility.updateItemStack(tOutput); GT_Utility.ItemNBT.addEnchantment( tOutput, Enchantment.fireAspect, EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, tOutput) + 3); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.FierySteel.getFluid(25L), tOutput, null, null, null, 100, 2); tOutput = GT_Utility.copyAmount(1L, new Object[] {aStack}); GT_Utility.updateItemStack(tOutput); GT_Utility.ItemNBT.addEnchantment( tOutput, Enchantment.fireAspect, EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, tOutput) + 1); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Blaze.getMolten(18L), tOutput, null, null, null, 100, 2); tOutput = GT_Utility.copyAmount(1L, new Object[] {aStack}); GT_Utility.updateItemStack(tOutput); GT_Utility.ItemNBT.addEnchantment( tOutput, Enchantment.knockback, EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, tOutput) + 1); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Rubber.getMolten(18L), tOutput, null, null, null, 100, 2); tOutput = GT_Utility.copyAmount(1L, new Object[] {aStack}); GT_Utility.updateItemStack(tOutput); GT_Utility.ItemNBT.addEnchantment( tOutput, gregtech.api.enchants.Enchantment_EnderDamage.INSTANCE, EnchantmentHelper.getEnchantmentLevel( gregtech.api.enchants.Enchantment_EnderDamage.INSTANCE.effectId, tOutput) + 1); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Mercury.getFluid(25L), tOutput, null, null, null, 100, 2); }
public int checkRecipe() { int tCheck = super.checkRecipe(); if (tCheck != 0) { return tCheck; } if ((GT_Utility.isStackValid(getInputAt(0))) && (GT_Utility.isStackValid(getInputAt(1))) && (GT_Utility.getContainerItem(getInputAt(0), true) == null)) { if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 1)) { this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[] {getInputAt(0)}); if (this.mOutputItems[0] != null) { if (canOutput(new ItemStack[] {this.mOutputItems[0]})) { getInputAt(0).stackSize -= 1; this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1)); this.mMaxProgresstime = (16 / (1 << this.mTier - 1)); return 2; } } return 0; } if ((ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 4)) { this.mOutputItems[0] = GT_ModHandler.getRecipeOutput( new ItemStack[] {getInputAt(0), getInputAt(0), null, getInputAt(0), getInputAt(0)}); if (this.mOutputItems[0] != null) { if (canOutput(new ItemStack[] {this.mOutputItems[0]})) { getInputAt(0).stackSize -= 4; this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1)); this.mMaxProgresstime = (32 / (1 << this.mTier - 1)); return 2; } } return 0; } if ((ItemList.Schematic_3by3.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 9)) { this.mOutputItems[0] = GT_ModHandler.getRecipeOutput( new ItemStack[] { getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0) }); if (this.mOutputItems[0] != null) { if (canOutput(new ItemStack[] {this.mOutputItems[0]})) { getInputAt(0).stackSize -= 9; this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1)); this.mMaxProgresstime = (64 / (1 << this.mTier - 1)); return 2; } } return 0; } } return 0; }
public void registerOre( OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (aOreDictName.equals("logRubber")) { GT_Values.RA.addCentrifugeRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), null, null, new int[] {5000, 3750, 2500, 2500}, 200, 20); GT_ModHandler.addSawmillRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), ItemList.IC2_Resin.get(1L, new Object[0]), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 16L)); GT_ModHandler.addExtractionRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Rubber, 1L)); GT_ModHandler.addPulverisationRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 6L), ItemList.IC2_Resin.get(1L, new Object[0]), 33, false); } else { GT_ModHandler.addPulverisationRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 6L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 80, false); } GT_ModHandler.addCraftingRecipe( GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 2L), gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "sLf", Character.valueOf('L'), GT_Utility.copyAmount(1L, new Object[] {aStack}) }); GT_Values.RA.addLatheRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 4L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 160, 8); GT_Values.RA.addAssemblerRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), ItemList.Circuit_Integrated.getWithDamage(0L, 2L, new Object[0]), Materials.SeedOil.getFluid(50L), ItemList.FR_Stick.get(1L, new Object[0]), 16, 8); GT_Values.RA.addAssemblerRecipe( GT_Utility.copyAmount(8L, new Object[] {aStack}), ItemList.Circuit_Integrated.getWithDamage(0L, 8L, new Object[0]), Materials.SeedOil.getFluid(250L), ItemList.FR_Casing_Impregnated.get(1L, new Object[0]), 64, 16); GT_Values.RA.addChemicalBathRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Creosote.getFluid(1000L), GT_ModHandler.getModItem("Railcraft", "tile.railcraft.cube", 1L, 8), null, null, null, 16, 16); short aMeta = (short) aStack.getItemDamage(); if (aMeta == Short.MAX_VALUE) { if ((GT_Utility.areStacksEqual( GT_ModHandler.getSmeltingOutput( GT_Utility.copyAmount(1L, new Object[] {aStack}), false, null), new ItemStack(Items.coal, 1, 1)))) { if (GregTech_API.sRecipeFile.get( ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, new Object[] {aStack})); } } for (int i = 0; i < 32767; i++) { if ((GT_Utility.areStacksEqual( GT_ModHandler.getSmeltingOutput(new ItemStack(aStack.getItem(), 1, i), false, null), new ItemStack(Items.coal, 1, 1)))) { if (GregTech_API.sRecipeFile.get( ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { GT_ModHandler.removeFurnaceSmelting(new ItemStack(aStack.getItem(), 1, i)); } } ItemStack tStack = GT_ModHandler.getRecipeOutput(new ItemStack[] {new ItemStack(aStack.getItem(), 1, i)}); if (tStack == null) { if (i >= 16) { break; } } else { ItemStack tPlanks = GT_Utility.copy(new Object[] {tStack}); tPlanks.stackSize = (tPlanks.stackSize * 3 / 2); GT_Values.RA.addCutterRecipe( new ItemStack(aStack.getItem(), 1, i), Materials.Lubricant.getFluid(1L), GT_Utility.copy(new Object[] {tPlanks}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8); GT_Values.RA.addCutterRecipe( new ItemStack(aStack.getItem(), 1, i), GT_Utility.copyAmount( GT_Mod.gregtechproxy.mNerfedWoodPlank ? tStack.stackSize : tStack.stackSize * 5 / 4, new Object[] {tStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8); GT_ModHandler.addSawmillRecipe( new ItemStack(aStack.getItem(), 1, i), tPlanks, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L)); GT_ModHandler.removeRecipe(new ItemStack[] {new ItemStack(aStack.getItem(), 1, i)}); GT_ModHandler.addCraftingRecipe( GT_Utility.copyAmount( GT_Mod.gregtechproxy.mNerfedWoodPlank ? tStack.stackSize : tStack.stackSize * 5 / 4, new Object[] {tStack}), new Object[] { "s", "L", Character.valueOf('L'), new ItemStack(aStack.getItem(), 1, i) }); GT_ModHandler.addShapelessCraftingRecipe( GT_Utility.copyAmount( tStack.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), new Object[] {tStack}), new Object[] {new ItemStack(aStack.getItem(), 1, i)}); } } } else { if ((GT_Utility.areStacksEqual( GT_ModHandler.getSmeltingOutput( GT_Utility.copyAmount(1L, new Object[] {aStack}), false, null), new ItemStack(Items.coal, 1, 1)))) { if (GregTech_API.sRecipeFile.get( ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, new Object[] {aStack})); } } ItemStack tStack = GT_ModHandler.getRecipeOutput( new ItemStack[] {GT_Utility.copyAmount(1L, new Object[] {aStack})}); if (tStack != null) { ItemStack tPlanks = GT_Utility.copy(new Object[] {tStack}); tPlanks.stackSize = (tPlanks.stackSize * 3 / 2); GT_Values.RA.addCutterRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), Materials.Lubricant.getFluid(1L), GT_Utility.copy(new Object[] {tPlanks}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8); GT_Values.RA.addCutterRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), GT_Utility.copyAmount( GT_Mod.gregtechproxy.mNerfedWoodPlank ? tStack.stackSize : tStack.stackSize * 5 / 4, new Object[] {tStack}), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8); GT_ModHandler.addSawmillRecipe( GT_Utility.copyAmount(1L, new Object[] {aStack}), tPlanks, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L)); GT_ModHandler.removeRecipe( new ItemStack[] {GT_Utility.copyAmount(1L, new Object[] {aStack})}); GT_ModHandler.addCraftingRecipe( GT_Utility.copyAmount( GT_Mod.gregtechproxy.mNerfedWoodPlank ? tStack.stackSize : tStack.stackSize * 5 / 4, new Object[] {tStack}), new Object[] { "s", "L", Character.valueOf('L'), GT_Utility.copyAmount(1L, new Object[] {aStack}) }); GT_ModHandler.addShapelessCraftingRecipe( GT_Utility.copyAmount( tStack.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), new Object[] {tStack}), new Object[] {GT_Utility.copyAmount(1L, new Object[] {aStack})}); } } if ((GT_Utility.areStacksEqual( GT_ModHandler.getSmeltingOutput( GT_Utility.copyAmount(1L, new Object[] {aStack}), false, null), new ItemStack(Items.coal, 1, 1)))) { if (GregTech_API.sRecipeFile.get( ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, new Object[] {aStack})); } }
public void renderItem(IItemRenderer.ItemRenderType aType, ItemStack aStack, Object... data) { if (GT_Utility.isStackInvalid(aStack)) { return; } GT_MetaGenerated_Tool aItem = (GT_MetaGenerated_Tool) aStack.getItem(); GL11.glEnable(3042); if (aType == IItemRenderer.ItemRenderType.ENTITY) { if (RenderItem.renderInFrame) { GL11.glScalef(0.85F, 0.85F, 0.85F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-0.5D, -0.42D, 0.0D); } else { GL11.glTranslated(-0.5D, -0.42D, 0.0D); } } GL11.glColor3f(1.0F, 1.0F, 1.0F); IToolStats tToolStats = aItem.getToolStats(aStack); if (tToolStats != null) { IIconContainer aIcon = tToolStats.getIcon(false, aStack); if (aIcon != null) { IIcon tIcon = aIcon.getIcon(); IIcon tOverlay = aIcon.getOverlayIcon(); if (tIcon != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); short[] tModulation = tToolStats.getRGBa(false, aStack); GL11.glColor3f(tModulation[0] / 255.0F, tModulation[1] / 255.0F, tModulation[2] / 255.0F); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); } GL11.glColor3f(1.0F, 1.0F, 1.0F); } if (tOverlay != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F); } } } aIcon = tToolStats.getIcon(true, aStack); if (aIcon != null) { IIcon tIcon = aIcon.getIcon(); IIcon tOverlay = aIcon.getOverlayIcon(); if (tIcon != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); short[] tModulation = tToolStats.getRGBa(true, aStack); GL11.glColor3f(tModulation[0] / 255.0F, tModulation[1] / 255.0F, tModulation[2] / 255.0F); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); } GL11.glColor3f(1.0F, 1.0F, 1.0F); } if (tOverlay != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F); } } } if ((aType == IItemRenderer.ItemRenderType.INVENTORY) && (GT_MetaGenerated_Tool.getPrimaryMaterial(aStack) != Materials._NULL)) { long tDamage = GT_MetaGenerated_Tool.getToolDamage(aStack); long tMaxDamage = GT_MetaGenerated_Tool.getToolMaxDamage(aStack); if (tDamage <= 0L) { aIcon = gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[8]; } else if (tDamage >= tMaxDamage) { aIcon = gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[0]; } else { aIcon = gregtech.api.enums.Textures.ItemIcons.DURABILITY_BAR[ ((int) java.lang.Math.max( 0L, java.lang.Math.min(7L, (tMaxDamage - tDamage) * 8L / tMaxDamage)))]; } if (aIcon != null) { IIcon tIcon = aIcon.getIcon(); IIcon tOverlay = aIcon.getOverlayIcon(); if (tIcon != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); } } if (tOverlay != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F); } } } Long[] tStats = aItem.getElectricStats(aStack); if ((tStats != null) && (tStats[3].longValue() < 0L)) { long tCharge = aItem.getRealCharge(aStack); if (tCharge <= 0L) { aIcon = gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[0]; } else if (tCharge >= tStats[0].longValue()) { aIcon = gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[8]; } else { aIcon = gregtech.api.enums.Textures.ItemIcons.ENERGY_BAR[ (7 - (int) java.lang.Math.max( 0L, java.lang.Math.min( 6L, (tStats[0].longValue() - tCharge) * 7L / tStats[0].longValue())))]; } } else { aIcon = null; } if (aIcon != null) { IIcon tIcon = aIcon.getIcon(); IIcon tOverlay = aIcon.getOverlayIcon(); if (tIcon != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tIcon, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tIcon.getMaxU(), tIcon.getMinV(), tIcon.getMinU(), tIcon.getMaxV(), tIcon.getIconWidth(), tIcon.getIconHeight(), 0.0625F); } } if (tOverlay != null) { Minecraft.getMinecraft().renderEngine.bindTexture(aIcon.getTextureFile()); GL11.glBlendFunc(770, 771); if (aType.equals(IItemRenderer.ItemRenderType.INVENTORY)) { GT_RenderUtil.renderItemIcon(tOverlay, 16.0D, 0.001D, 0.0F, 0.0F, -1.0F); } else { ItemRenderer.renderItemIn2D( Tessellator.instance, tOverlay.getMaxU(), tOverlay.getMinV(), tOverlay.getMinU(), tOverlay.getMaxV(), tOverlay.getIconWidth(), tOverlay.getIconHeight(), 0.0625F); } } } } } GL11.glDisable(3042); }
public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(mInventory[1])) { return false; } GT_Recipe.GT_Recipe_Map map = getRecipeMap(); if (map == null) { return false; } ArrayList<ItemStack> tInputList = getStoredInputs(); int tTier = 0; if (mInventory[1].getUnlocalizedName().endsWith("1")) { tTier = 1; } if (mInventory[1].getUnlocalizedName().endsWith("2")) { tTier = 2; } if (mInventory[1].getUnlocalizedName().endsWith("3")) { tTier = 3; } if (mInventory[1].getUnlocalizedName().endsWith("4")) { tTier = 4; } if (mInventory[1].getUnlocalizedName().endsWith("5")) { tTier = 5; } for (int i = 0; i < tInputList.size() - 1; i++) { for (int j = i + 1; j < tInputList.size(); j++) { if (GT_Utility.areStacksEqual( (ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { tInputList.remove(j--); } else { tInputList.remove(i--); break; } } } } ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); ArrayList<FluidStack> tFluidList = getStoredFluids(); for (int i = 0; i < tFluidList.size() - 1; i++) { for (int j = i + 1; j < tFluidList.size(); j++) { if (GT_Utility.areFluidsEqual( (FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); break; } } } } FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); if (tInputList.size() > 0 || tFluids.length > 0) { GT_Recipe tRecipe = map.findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null; this.mOutputFluids = null; this.mMaxProgresstime = tRecipe.mDuration; int machines = Math.min(16, mInventory[1].stackSize); this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; int i = 0; for (; i < machines; i++) { if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) break; } // System.out.println("recipe:"+i+" "+tRecipe.mDuration+" "+tRecipe.mEUt); // if(tRecipe.mOutputs.length>0){ // System.out.println(tRecipe.mOutputs[0].getUnlocalizedName()); // } // if(tRecipe.mFluidOutputs.length>0){ // System.out.println(tRecipe.mFluidOutputs[0].getUnlocalizedName()); // } if (tRecipe.mEUt <= 16) { this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); } else { this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; this.mMaxProgresstime /= 2; } } this.mEUt *= i; if (this.mEUt > 0) { this.mEUt = (-this.mEUt); } ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { tOut[h] = tRecipe.getOutput(h).copy(); tOut[h].stackSize = 0; } FluidStack tFOut = null; if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); for (int f = 0; f < tOut.length; f++) { if (tRecipe.mOutputs[f] != null && tOut[f] != null) { for (int g = 0; g < i; g++) { if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; } } } if (tFOut != null) { int tSize = tFOut.amount; tFOut.amount = tSize * i; } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputItems = tOut; this.mOutputFluids = new FluidStack[] {tFOut}; // System.out.println("ArrayOut"+mOutputItems.length+" "+mOutputFluids.length+" // "+(mOutputItems.length>0?mOutputItems[0].getUnlocalizedName():"")+" // "+(mOutputFluids.length>0?mOutputFluids[0].getUnlocalizedName():" ")); updateSlots(); return true; } } return false; }