2013-12-30 06:56:08 +01:00
|
|
|
package appeng.container.slot;
|
|
|
|
|
|
|
|
import net.minecraft.inventory.IInventory;
|
2014-01-01 09:57:16 +01:00
|
|
|
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;
|
|
|
|
|
2014-04-10 06:51:08 +02:00
|
|
|
public boolean renderDisabled = true;
|
|
|
|
|
2014-01-01 09:57:16 +01:00
|
|
|
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;
|
2014-01-01 09:57:16 +01:00
|
|
|
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()
|
|
|
|
{
|
2014-01-01 09:57:16 +01:00
|
|
|
if ( host == null )
|
|
|
|
return false;
|
|
|
|
|
2014-01-20 17:41:37 +01:00
|
|
|
return host.isSlotEnabled( groupNum );
|
2013-12-30 06:56:08 +01:00
|
|
|
}
|
|
|
|
|
2014-04-10 06:51:08 +02:00
|
|
|
public boolean renderDisabled()
|
|
|
|
{
|
|
|
|
return renderDisabled;
|
|
|
|
}
|
|
|
|
|
2013-12-30 06:56:08 +01:00
|
|
|
}
|