@Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { return isValidSlot(aIndex) && aStack != null && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(aIndex, (byte) aSide, aStack); }
@Override public boolean onItemUseFirst( ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { super.onItemUseFirst(aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ); if (aWorld.isRemote) { return false; } short aBlockID = (short) aWorld.getBlockId(aX, aY, aZ); if (aBlockID < 0 || aBlockID >= Block.blocksList.length) return false; Block aBlock = Block.blocksList[aBlockID]; if (aBlock == null) return false; byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ); TileEntity aTileEntity = aWorld.getBlockTileEntity(aX, aY, aZ); try { if (aTileEntity instanceof ic2.api.crops.ICropTile) { int tCropBefore = ((ic2.api.crops.ICropTile) aTileEntity).getHydrationStorage(); if (tCropBefore <= 100 && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) { ((ic2.api.crops.ICropTile) aTileEntity).setHydrationStorage(tCropBefore + 100); GT_Utility.sendSoundToPlayers( aWorld, GregTech_API.sSoundList.get(102), 1.0F, -1, aX, aY, aZ); return true; } } } catch (Throwable e) { } return false; }
/** Determines the Tier of the Machine, used for charging Tools. */ public int getOutputTier() { return GT_Utility.getTier(getBaseMetaTileEntity().getOutputVoltage()); }