Use IItemHandler instead of IInventory internally (#2971)

* Use IItemHandler instead of IInventory internally
This commit is contained in:
fscan
2017-07-28 22:04:32 +02:00
committed by yueh
parent c077840988
commit 52d28fabe3
156 changed files with 2410 additions and 4604 deletions
@@ -25,8 +25,8 @@ import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.ActionItems;
import appeng.api.config.CopyMode;
@@ -137,8 +137,8 @@ public class GuiCellWorkbench extends GuiUpgradeable
this.copyMode.setState( this.workbench.getCopyMode() == CopyMode.CLEAR_ON_REMOVE );
boolean hasFuzzy = false;
final IInventory inv = this.workbench.getCellUpgradeInventory();
for( int x = 0; x < inv.getSizeInventory(); x++ )
final IItemHandler inv = this.workbench.getCellUpgradeInventory();
for( int x = 0; x < inv.getSlots(); x++ )
{
final ItemStack is = inv.getStackInSlot( x );
if( !is.isEmpty() && is.getItem() instanceof IUpgradeModule )
@@ -119,7 +119,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
if( lineObj instanceof ClientDCInternalInv )
{
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for( int z = 0; z < inv.getInventory().getSizeInventory(); z++ )
for( int z = 0; z < inv.getInventory().getSlots(); z++ )
{
this.inventorySlots.inventorySlots.add( new SlotDisconnected( inv, z, z * 18 + 8, 1 + offset ) );
}
@@ -175,7 +175,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GlStateManager.color( 1, 1, 1, 1 );
final int width = inv.getInventory().getSizeInventory() * 18;
final int width = inv.getInventory().getSlots() * 18;
this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 );
}
offset += 18;
@@ -227,12 +227,12 @@ public class GuiInterfaceTerminal extends AEBaseGui
final NBTTagCompound invData = in.getCompoundTag( key );
final ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) );
for( int x = 0; x < current.getInventory().getSizeInventory(); x++ )
for( int x = 0; x < current.getInventory().getSlots(); x++ )
{
final String which = Integer.toString( x );
if( invData.hasKey( which ) )
{
current.getInventory().setInventorySlotContents( x, new ItemStack( invData.getCompoundTag( which ) ) );
current.getInventory().setStackInSlot( x, new ItemStack( invData.getCompoundTag( which ) ) );
}
}
}