Removed unneeded ISpecial refs

This commit is contained in:
CovertJaguar 2013-07-04 03:20:28 -07:00
parent 392498ff74
commit d1a39072af
7 changed files with 19 additions and 194 deletions

View file

@ -40,7 +40,7 @@ public class GuiHandler implements IGuiHandler {
switch (ID) {
case GuiIds.PIPE_DIAMOND:
return new ContainerDiamondPipe(player.inventory, (PipeLogicDiamond) pipe.pipe.logic);
return new ContainerDiamondPipe(player.inventory, ((PipeLogicDiamond) pipe.pipe.logic).getFilters());
case GuiIds.PIPE_EMERALD_ITEM:
return new ContainerEmeraldPipe(player.inventory, (IInventory) pipe.pipe);

View file

@ -32,7 +32,7 @@ public class GuiDiamondPipe extends GuiBuildCraft {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
fontRenderer.drawString(filterInventory.getFilters().getInvName(), getCenteredOffset(filterInventory.getFilters().getInvName()), 6, 0x404040);
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
}

View file

@ -32,7 +32,7 @@ public class GuiEmeraldPipe extends GuiBuildCraft {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
fontRenderer.drawString(filterInventory.getFilters().getInvName(), getCenteredOffset(filterInventory.getFilters().getInvName()), 6, 0x404040);
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 93, 0x404040);
}

View file

@ -322,7 +322,7 @@ public class PacketHandlerTransport implements IPacketHandler {
if (!(pipe.pipe.logic instanceof PipeLogicDiamond))
return;
((PipeLogicDiamond) pipe.pipe.logic).setInventorySlotContents(packet.slot, packet.stack);
((PipeLogicDiamond) pipe.pipe.logic).getFilters().setInventorySlotContents(packet.slot, packet.stack);
}
/**
@ -339,7 +339,7 @@ public class PacketHandlerTransport implements IPacketHandler {
if (!(pipe.pipe instanceof PipeItemsEmerald))
return;
((PipeItemsEmerald) pipe.pipe).setInventorySlotContents(packet.slot, packet.stack);
((PipeItemsEmerald) pipe.pipe).getFilters().setInventorySlotContents(packet.slot, packet.stack);
}
/**

View file

@ -70,7 +70,7 @@ public class PipeItemsDiamond extends Pipe implements IPipeTransportItemsHook, I
// no breaks here.
PipeLogicDiamond diamondLogic = (PipeLogicDiamond) logic;
for (int slot = 0; slot < 9; ++slot) {
ItemStack stack = diamondLogic.getStackInSlot(dir.ordinal() * 9 + slot);
ItemStack stack = diamondLogic.getFilters().getStackInSlot(dir.ordinal() * 9 + slot);
if (stack != null) {
foundFilter = true;

View file

@ -32,9 +32,9 @@ import buildcraft.transport.BlockGenericPipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportItems;
public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory, IClientState {
public class PipeItemsEmerald extends PipeItemsWood implements IClientState {
private SimpleInventory filters = new SimpleInventory(9, "items", 1);
private SimpleInventory filters = new SimpleInventory(9, "Filters", 1);
private int currentFilter = 0;
protected PipeItemsEmerald(int itemID, PipeTransportItems transport) {
@ -208,92 +208,8 @@ public class PipeItemsEmerald extends PipeItemsWood implements ISpecialInventory
readFromNBT((NBTTagCompound) nbt);
}
}
/* ISPECIALINVENTORY */
@Override
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
return 0;
}
@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
return new ItemStack[0];
}
/* IINVENTORY IMPLEMENTATION */
@Override
public int getSizeInventory() {
return filters.getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int i) {
return filters.getStackInSlot(i);
}
@Override
public String getInvName() {
return "Filters";
}
@Override
public int getInventoryStackLimit() {
return filters.getInventoryStackLimit();
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return filters.getStackInSlotOnClosing(i);
}
@Override
public void onInventoryChanged() {
filters.onInventoryChanged();
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == container;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack stack = filters.decrStackSize(i, j);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
filters.setInventorySlotContents(i, itemstack);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@Override
public boolean isInvNameLocalized() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack) {
// TODO Auto-generated method stub
return false;
public IInventory getFilters(){
return filters;
}
}

View file

@ -1,29 +1,25 @@
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.transport.pipes;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import buildcraft.BuildCraftTransport;
import buildcraft.api.inventory.ISpecialInventory;
import buildcraft.core.GuiIds;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.transport.BlockGenericPipe;
import net.minecraft.inventory.IInventory;
public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
public class PipeLogicDiamond extends PipeLogic {
private SimpleInventory filters = new SimpleInventory(54, "items", 1);
private SimpleInventory filters = new SimpleInventory(54, "Filters", 1);
/* PIPE LOGIC */
@Override
@ -57,94 +53,7 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory {
filters.writeToNBT(nbttagcompound);
}
/* ISPECIALINVENTORY */
@Override
public int addItem(ItemStack stack, boolean doAdd, ForgeDirection from) {
return 0;
public IInventory getFilters() {
return filters;
}
@Override
public ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount) {
return new ItemStack[0];
}
/* IINVENTORY IMPLEMENTATION */
@Override
public int getSizeInventory() {
return filters.getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int i) {
return filters.getStackInSlot(i);
}
@Override
public String getInvName() {
return "Filters";
}
@Override
public int getInventoryStackLimit() {
return filters.getInventoryStackLimit();
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
return filters.getStackInSlotOnClosing(i);
}
@Override
public void onInventoryChanged() {
filters.onInventoryChanged();
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == container;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack stack = filters.decrStackSize(i, j);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
return stack;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
filters.setInventorySlotContents(i, itemstack);
if (CoreProxy.proxy.isSimulating(worldObj)) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
@Override
public boolean isInvNameLocalized()
{
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isStackValidForSlot(int i, ItemStack itemstack)
{
// TODO Auto-generated method stub
return false;
}
}