rest of BC commit

This commit is contained in:
thatsIch
2015-06-18 20:10:37 +02:00
parent 97f23cf955
commit 51ed55510c
9 changed files with 219 additions and 217 deletions
+91 -106
View File
@@ -19,109 +19,94 @@
package appeng.util.inv;
import java.util.Iterator;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.FuzzyMode;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.util.InventoryAdaptor;
import appeng.util.iterators.NullIterator;
public class AdaptorBCPipe extends InventoryAdaptor
{
private final IBuildCraftTransport bc;
private final TileEntity i;
private final ForgeDirection d;
public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
if( this.bc.isPipe( s, dd ) )
{
this.i = s;
this.d = dd;
return;
}
}
this.i = null;
this.d = null;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
{
if( this.i == null )
{
return toBeAdded;
}
if( toBeAdded == null )
{
return null;
}
if( toBeAdded.stackSize == 0 )
{
return null;
}
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
{
return null;
}
return toBeAdded;
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
{
if( this.i == null )
{
return toBeSimulated;
}
return null;
}
@Override
public boolean containsItems()
{
return false;
}
@Override
public Iterator<ItemSlot> iterator()
{
return new NullIterator<ItemSlot>();
}
}
//public class AdaptorBCPipe extends InventoryAdaptor
//{
// private final IBuildCraftTransport bc;
// private final TileEntity i;
// private final ForgeDirection d;
//
// public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
// {
// this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
// {
// if( this.bc.isPipe( s, dd ) )
// {
// this.i = s;
// this.d = dd;
// return;
// }
// }
// this.i = null;
// this.d = null;
// }
//
// @Override
// public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack addItems( ItemStack toBeAdded )
// {
// if( this.i == null )
// {
// return toBeAdded;
// }
// if( toBeAdded == null )
// {
// return null;
// }
// if( toBeAdded.stackSize == 0 )
// {
// return null;
// }
//
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
// {
// return null;
// }
// return toBeAdded;
// }
//
// @Override
// public ItemStack simulateAdd( ItemStack toBeSimulated )
// {
// if( this.i == null )
// {
// return toBeSimulated;
// }
// return null;
// }
//
// @Override
// public boolean containsItems()
// {
// return false;
// }
//
// @Override
// public Iterator<ItemSlot> iterator()
// {
// return new NullIterator<ItemSlot>();
// }
//}
@@ -23,7 +23,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
@@ -34,9 +35,9 @@ public class WrapperBCPipe implements IInventory
{
private final IBuildCraftTransport bc;
private final TileEntity ad;
private final ForgeDirection dir;
private final EnumFacing dir;
public WrapperBCPipe( TileEntity te, ForgeDirection d )
public WrapperBCPipe( TileEntity te, EnumFacing d )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
@@ -76,18 +77,6 @@ public class WrapperBCPipe implements IInventory
}
}
@Override
public String getInventoryName()
{
return "BC Pipe Wrapper";
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
@@ -100,27 +89,69 @@ public class WrapperBCPipe implements IInventory
}
@Override
public void openInventory( EntityPlayer player )
{
}
@Override
public void closeInventory( EntityPlayer player )
{
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
{
return false;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
}
@Override
public int getField( int id )
{
return 0;
}
@Override
public void setField( int id, int value )
{
}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clear()
{
}
@Override
public String getName()
{
return null;
}
@Override
public boolean hasCustomName()
{
return false;
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
}