2013-12-27 23:59:59 +01:00
|
|
|
package appeng.parts.automation;
|
|
|
|
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
2013-12-30 06:55:02 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-12-27 23:59:59 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2013-12-30 06:55:02 +01:00
|
|
|
import net.minecraft.util.Vec3;
|
|
|
|
import appeng.api.config.FuzzyMode;
|
|
|
|
import appeng.api.config.RedstoneMode;
|
|
|
|
import appeng.api.config.Settings;
|
|
|
|
import appeng.api.networking.IGridNode;
|
|
|
|
import appeng.api.networking.ticking.IGridTickable;
|
|
|
|
import appeng.api.networking.ticking.TickRateModulation;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.parts.IPartCollsionHelper;
|
|
|
|
import appeng.api.parts.IPartRenderHelper;
|
|
|
|
import appeng.client.texture.CableBusTextures;
|
2013-12-30 06:55:02 +01:00
|
|
|
import appeng.core.sync.GuiBridge;
|
|
|
|
import appeng.util.Platform;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2013-12-30 06:55:02 +01:00
|
|
|
public class PartExportBus extends PartSharedItemBus implements IGridTickable
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
public PartExportBus(ItemStack is) {
|
|
|
|
super( PartExportBus.class, is );
|
2013-12-30 06:55:02 +01:00
|
|
|
settings.registerSetting( Settings.REDSTONE_OUTPUT, RedstoneMode.IGNORE );
|
|
|
|
settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onActivate(EntityPlayer player, Vec3 pos)
|
|
|
|
{
|
|
|
|
if ( !player.isSneaking() )
|
|
|
|
{
|
|
|
|
if ( Platform.isClient() )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_BUS );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
|
|
|
|
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
|
|
|
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
|
|
|
|
|
|
|
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
|
|
|
rh.renderInventoryBox( renderer );
|
|
|
|
|
|
|
|
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
|
|
|
rh.renderInventoryBox( renderer );
|
|
|
|
|
|
|
|
rh.setBounds( 6, 6, 15, 10, 10, 16 );
|
|
|
|
rh.renderInventoryBox( renderer );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
|
|
|
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
|
|
|
|
|
|
|
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
|
|
|
rh.renderBlock( x, y, z, renderer );
|
|
|
|
|
|
|
|
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
|
|
|
rh.renderBlock( x, y, z, renderer );
|
|
|
|
|
|
|
|
rh.setBounds( 6, 6, 15, 10, 10, 16 );
|
|
|
|
rh.renderBlock( x, y, z, renderer );
|
|
|
|
|
|
|
|
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
|
|
|
CableBusTextures.PartMonitorBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
|
|
|
CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
|
|
|
|
|
|
|
rh.setBounds( 6, 6, 11, 10, 10, 12 );
|
|
|
|
rh.renderBlock( x, y, z, renderer );
|
|
|
|
|
|
|
|
renderLights( x, y, z, rh, renderer );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int cableConnectionRenderTo()
|
|
|
|
{
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void getBoxes(IPartCollsionHelper bch)
|
|
|
|
{
|
|
|
|
bch.addBox( 4, 4, 12, 12, 12, 14 );
|
|
|
|
bch.addBox( 5, 5, 14, 11, 11, 15 );
|
|
|
|
bch.addBox( 6, 6, 15, 10, 10, 16 );
|
|
|
|
bch.addBox( 6, 6, 11, 10, 10, 12 );
|
|
|
|
}
|
|
|
|
|
2013-12-30 06:55:02 +01:00
|
|
|
@Override
|
|
|
|
protected boolean isSleeping()
|
|
|
|
{
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return getHandler() == null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
|
|
|
{
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return TickRateModulation.SLOWER;
|
|
|
|
}
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|