Applied-Energistics-2-tiler.../container/slot/OptionalSlotFake.java

47 lines
834 B
Java
Raw Normal View History

2013-12-30 06:56:08 +01:00
package appeng.container.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
2013-12-30 06:56:08 +01:00
public class OptionalSlotFake extends SlotFake
{
int invSlot;
final int groupNum;
IOptionalSlotHost host;
public int srcX;
public int srcY;
2013-12-30 06:56:08 +01:00
public OptionalSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX, int offY, int groupNum) {
super( inv, idx, x + offX * 18, y + offY * 18 );
srcX = x;
srcY = y;
invSlot = idx;
this.groupNum = groupNum;
host = containerBus;
}
@Override
public ItemStack getStack()
{
if ( !isEnabled() )
{
if ( getDisplayStack() != null )
clearStack();
}
return super.getStack();
2013-12-30 06:56:08 +01:00
}
@Override
public boolean isEnabled()
{
if ( host == null )
return false;
2013-12-30 06:56:08 +01:00
return host.isSlotEnabled( groupNum, this );
}
}