New Util Methods.

This commit is contained in:
AlgorithmX2 2013-12-28 15:05:58 -06:00
parent d3ab932371
commit 9885420b28

View file

@ -17,6 +17,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.InventoryLargeChest;
import net.minecraft.item.Item;
@ -1126,9 +1127,9 @@ public class Platform
return 0;
}
public static IAEItemStack poweredExtraction(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input)
public static IAEItemStack poweredExtraction(IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request)
{
IAEItemStack possible = cell.extractItems( input.copy(), Actionable.SIMULATE );
IAEItemStack possible = cell.extractItems( request.copy(), Actionable.SIMULATE );
long retrieved = 0;
if ( possible != null )
@ -1247,4 +1248,29 @@ public class Platform
}
}
public static int generateTileHash(TileEntity target)
{
if ( target == null )
return 0;
int hash = target.hashCode();
if ( target instanceof IInventory )
hash ^= ((IInventory) target).getSizeInventory();
if ( target instanceof ISidedInventory )
{
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
int offset = 0;
for (Integer Side : ((ISidedInventory) target).getAccessibleSlotsFromSide( dir.ordinal() ))
{
hash ^= Side << (offset++ % 20);
}
}
}
return hash;
}
}