v5.5.4 Beta #3
*isStackValidForSlot() for the remaining inventory-based blocks. *Minor cleanup.
This commit is contained in:
parent
75aa60976b
commit
96b4c4ec0b
4 changed files with 52 additions and 2 deletions
|
@ -220,7 +220,7 @@ public class BlockGasTank extends BlockContainer implements IDismantleable
|
|||
}
|
||||
}
|
||||
|
||||
if (tileEntity != null)
|
||||
if(tileEntity != null)
|
||||
{
|
||||
if(!entityplayer.isSneaking())
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ import universalelectricity.core.block.IVoltage;
|
|||
import universalelectricity.core.electricity.ElectricityNetworkHelper;
|
||||
import universalelectricity.core.electricity.IElectricityNetwork;
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
|
@ -162,6 +163,23 @@ public class TileEntityEnergyCube extends TileEntityElectricBlock implements IEn
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return itemstack.getItem() instanceof IElectricItem ||
|
||||
(itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getReceiveRequest(itemstack).amperes != 0);
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).amperes != 0) ||
|
||||
itemstack.itemID == Item.redstone.itemID;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EnumSet<ForgeDirection> getConsumingSides()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package mekanism.common;
|
||||
|
||||
import ic2.api.IElectricItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.EnumGas;
|
||||
|
@ -8,10 +10,12 @@ import mekanism.api.IGasAcceptor;
|
|||
import mekanism.api.IGasStorage;
|
||||
import mekanism.api.IStorageTank;
|
||||
import mekanism.api.ITubeConnection;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
|
||||
|
@ -135,6 +139,20 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasS
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return itemstack.getItem() instanceof IStorageTank && (gasType == EnumGas.NONE || ((IStorageTank)itemstack.getItem()).canReceiveGas(itemstack, gasType));
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
return itemstack.getItem() instanceof IStorageTank && (gasType == EnumGas.NONE || ((IStorageTank)itemstack.getItem()).canProvideGas(itemstack, gasType));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartInventorySide(ForgeDirection side)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import universalelectricity.core.item.ElectricItemHelper;
|
||||
import universalelectricity.core.item.IItemElectric;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
|
@ -109,7 +110,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
|
|||
if(inventory[0].itemID == Item.redstone.itemID && electricityStored+1000 <= MAX_ELECTRICITY)
|
||||
{
|
||||
setJoules(electricityStored + 1000);
|
||||
--inventory[0].stackSize;
|
||||
inventory[0].stackSize--;
|
||||
|
||||
if (inventory[0].stackSize <= 0)
|
||||
{
|
||||
|
@ -119,6 +120,19 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements IEn
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
if(slotID == 0)
|
||||
{
|
||||
return (itemstack.getItem() instanceof IElectricItem && ((IElectricItem)itemstack.getItem()).canProvideEnergy(itemstack)) ||
|
||||
(itemstack.getItem() instanceof IItemElectric && ((IItemElectric)itemstack.getItem()).getProvideRequest(itemstack).amperes != 0) ||
|
||||
itemstack.itemID == Item.redstone.itemID;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1: yes
|
||||
* 2: no frame
|
||||
|
|
Loading…
Reference in a new issue