2013-12-27 23:59:59 +01:00
|
|
|
package appeng.parts.reporting;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.Vec3;
|
|
|
|
import appeng.api.storage.IMEMonitor;
|
2014-01-03 19:28:52 +01:00
|
|
|
import appeng.api.storage.IStorageMonitorable;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.client.texture.CableBusTextures;
|
2014-02-03 03:30:52 +01:00
|
|
|
import appeng.core.localization.PlayerMessages;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.sync.GuiBridge;
|
|
|
|
import appeng.me.GridAccessException;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
|
|
|
public class PartTerminal extends PartMonitor implements IStorageMonitorable
|
|
|
|
{
|
|
|
|
|
2014-02-05 03:44:54 +01:00
|
|
|
public PartTerminal(Class clz, ItemStack is) {
|
|
|
|
super( clz, is );
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
public PartTerminal(ItemStack is) {
|
|
|
|
super( PartTerminal.class, is );
|
|
|
|
frontBright = CableBusTextures.PartTerminal_Bright;
|
|
|
|
frontColored = CableBusTextures.PartTerminal_Colored;
|
|
|
|
frontDark = CableBusTextures.PartTerminal_Dark;
|
|
|
|
frontSolid = CableBusTextures.PartTerminal_Solid;
|
|
|
|
}
|
|
|
|
|
2014-02-05 03:44:54 +01:00
|
|
|
public GuiBridge getGui()
|
|
|
|
{
|
|
|
|
return GuiBridge.GUI_ME;
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
|
|
|
public boolean onActivate(EntityPlayer player, Vec3 pos)
|
|
|
|
{
|
|
|
|
if ( !player.isSneaking() )
|
|
|
|
{
|
|
|
|
if ( Platform.isClient() )
|
|
|
|
return true;
|
|
|
|
|
2014-02-03 03:30:52 +01:00
|
|
|
if ( proxy.isActive() )
|
2014-02-05 03:44:54 +01:00
|
|
|
Platform.openGUI( player, getHost().getTile(), side, getGui() );
|
2014-02-03 03:30:52 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( proxy.isPowered() )
|
2014-02-09 02:34:52 +01:00
|
|
|
player.addChatMessage( PlayerMessages.CommunicationError.get() );
|
2014-02-03 03:30:52 +01:00
|
|
|
else
|
2014-02-09 02:34:52 +01:00
|
|
|
player.addChatMessage( PlayerMessages.MachineNotPowered.get() );
|
2014-02-03 03:30:52 +01:00
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IMEMonitor getFluidInventory()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return proxy.getStorage().getFluidInventory();
|
|
|
|
}
|
|
|
|
catch (GridAccessException e)
|
|
|
|
{
|
|
|
|
// err nope?
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IMEMonitor getItemInventory()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return proxy.getStorage().getItemInventory();
|
|
|
|
}
|
|
|
|
catch (GridAccessException e)
|
|
|
|
{
|
|
|
|
// err nope?
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|