Merge pull request #855 from yueh/fix-cable-renderer
Fixes cable render crash and covered cables render as smart.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.parts.networking;
|
package appeng.parts.networking;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ import appeng.me.helpers.AENetworkProxy;
|
|||||||
import appeng.parts.AEBasePart;
|
import appeng.parts.AEBasePart;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class PartCable extends AEBasePart implements IPartCable
|
public class PartCable extends AEBasePart implements IPartCable
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -70,15 +72,16 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
EnumSet<ForgeDirection> connections = EnumSet.noneOf( ForgeDirection.class );
|
EnumSet<ForgeDirection> connections = EnumSet.noneOf( ForgeDirection.class );
|
||||||
boolean powered = false;
|
boolean powered = false;
|
||||||
|
|
||||||
public PartCable(Class c, ItemStack is) {
|
public PartCable( Class c, ItemStack is )
|
||||||
|
{
|
||||||
super( c, is );
|
super( c, is );
|
||||||
this.proxy.setFlags( GridFlags.PREFERRED );
|
this.proxy.setFlags( GridFlags.PREFERRED );
|
||||||
this.proxy.setIdlePowerUsage( 0.0 );
|
this.proxy.setIdlePowerUsage( 0.0 );
|
||||||
this.proxy.myColor = AEColor.values()[((ItemMultiPart) is.getItem()).variantOf( is.getItemDamage() )];
|
this.proxy.myColor = AEColor.values()[( ( ItemMultiPart ) is.getItem() ).variantOf( is.getItemDamage() )];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConnected(ForgeDirection side)
|
public boolean isConnected( ForgeDirection side )
|
||||||
{
|
{
|
||||||
return this.connections.contains( side );
|
return this.connections.contains( side );
|
||||||
}
|
}
|
||||||
@@ -89,9 +92,9 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
return BusSupport.CABLE;
|
return BusSupport.CABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getGlassTexture(AEColor c)
|
public IIcon getGlassTexture( AEColor c )
|
||||||
{
|
{
|
||||||
switch (c)
|
switch ( c )
|
||||||
{
|
{
|
||||||
case Black:
|
case Black:
|
||||||
return CableBusTextures.MECable_Black.getIcon();
|
return CableBusTextures.MECable_Black.getIcon();
|
||||||
@@ -131,14 +134,14 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
AEApi.instance().parts().partCableGlass.stack( AEColor.Transparent, 1 ) );
|
AEApi.instance().parts().partCableGlass.stack( AEColor.Transparent, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getTexture(AEColor c)
|
public IIcon getTexture( AEColor c )
|
||||||
{
|
{
|
||||||
return this.getGlassTexture( c );
|
return this.getGlassTexture( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getCoveredTexture(AEColor c)
|
public IIcon getCoveredTexture( AEColor c )
|
||||||
{
|
{
|
||||||
switch (c)
|
switch ( c )
|
||||||
{
|
{
|
||||||
case Black:
|
case Black:
|
||||||
return CableBusTextures.MECovered_Black.getIcon();
|
return CableBusTextures.MECovered_Black.getIcon();
|
||||||
@@ -178,9 +181,9 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) );
|
AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getSmartTexture(AEColor c)
|
public IIcon getSmartTexture( AEColor c )
|
||||||
{
|
{
|
||||||
switch (c)
|
switch ( c )
|
||||||
{
|
{
|
||||||
case Black:
|
case Black:
|
||||||
return CableBusTextures.MESmart_Black.getIcon();
|
return CableBusTextures.MESmart_Black.getIcon();
|
||||||
@@ -244,7 +247,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound data)
|
public void writeToNBT( NBTTagCompound data )
|
||||||
{
|
{
|
||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
|
|
||||||
@@ -255,17 +258,19 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
if ( node != null )
|
if ( node != null )
|
||||||
{
|
{
|
||||||
for (IGridConnection gc : node.getConnections())
|
for ( IGridConnection gc : node.getConnections() )
|
||||||
|
{
|
||||||
howMany = Math.max( gc.getUsedChannels(), howMany );
|
howMany = Math.max( gc.getUsedChannels(), howMany );
|
||||||
|
}
|
||||||
|
|
||||||
data.setByte( "usedChannels", (byte) howMany );
|
data.setByte( "usedChannels", ( byte ) howMany );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToStream(ByteBuf data) throws IOException
|
public void writeToStream( ByteBuf data ) throws IOException
|
||||||
{
|
{
|
||||||
int cs = 0;
|
int cs = 0;
|
||||||
int sideOut = 0;
|
int sideOut = 0;
|
||||||
@@ -273,7 +278,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
IGridNode n = this.getGridNode();
|
IGridNode n = this.getGridNode();
|
||||||
if ( n != null )
|
if ( n != null )
|
||||||
{
|
{
|
||||||
for (ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS)
|
for ( ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS )
|
||||||
{
|
{
|
||||||
IPart part = this.getHost().getPart( thisSide );
|
IPart part = this.getHost().getPart( thisSide );
|
||||||
if ( part != null )
|
if ( part != null )
|
||||||
@@ -281,18 +286,22 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
if ( part.getGridNode() != null )
|
if ( part.getGridNode() != null )
|
||||||
{
|
{
|
||||||
IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
|
IReadOnlyCollection<IGridConnection> set = part.getGridNode().getConnections();
|
||||||
for (IGridConnection gc : set)
|
for ( IGridConnection gc : set )
|
||||||
{
|
{
|
||||||
if ( this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
|
if ( this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY ) && gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY ) )
|
||||||
sideOut |= (gc.getUsedChannels() / 4) << (4 * thisSide.ordinal());
|
{
|
||||||
|
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * thisSide.ordinal() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sideOut |= (gc.getUsedChannels()) << (4 * thisSide.ordinal());
|
{
|
||||||
|
sideOut |= ( gc.getUsedChannels() ) << ( 4 * thisSide.ordinal() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IGridConnection gc : n.getConnections())
|
for ( IGridConnection gc : n.getConnections() )
|
||||||
{
|
{
|
||||||
ForgeDirection side = gc.getDirection( n );
|
ForgeDirection side = gc.getDirection( n );
|
||||||
if ( side != ForgeDirection.UNKNOWN )
|
if ( side != ForgeDirection.UNKNOWN )
|
||||||
@@ -301,10 +310,14 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
boolean isTier2b = gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
|
boolean isTier2b = gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
|
||||||
|
|
||||||
if ( isTier2a && isTier2b )
|
if ( isTier2a && isTier2b )
|
||||||
sideOut |= (gc.getUsedChannels() / 4) << (4 * side.ordinal());
|
{
|
||||||
|
sideOut |= ( gc.getUsedChannels() / 4 ) << ( 4 * side.ordinal() );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sideOut |= gc.getUsedChannels() << (4 * side.ordinal());
|
{
|
||||||
cs |= (1 << side.ordinal());
|
sideOut |= gc.getUsedChannels() << ( 4 * side.ordinal() );
|
||||||
|
}
|
||||||
|
cs |= ( 1 << side.ordinal() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,19 +325,21 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( this.proxy.getEnergy().isNetworkPowered() )
|
if ( this.proxy.getEnergy().isNetworkPowered() )
|
||||||
cs |= (1 << ForgeDirection.UNKNOWN.ordinal());
|
{
|
||||||
|
cs |= ( 1 << ForgeDirection.UNKNOWN.ordinal() );
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
}
|
||||||
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// aww...
|
// aww...
|
||||||
}
|
}
|
||||||
|
|
||||||
data.writeByte( (byte) cs );
|
data.writeByte( ( byte ) cs );
|
||||||
data.writeInt( sideOut );
|
data.writeInt( sideOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean readFromStream(ByteBuf data) throws IOException
|
public boolean readFromStream( ByteBuf data ) throws IOException
|
||||||
{
|
{
|
||||||
int cs = data.readByte();
|
int cs = data.readByte();
|
||||||
int sideOut = data.readInt();
|
int sideOut = data.readInt();
|
||||||
@@ -334,11 +349,11 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
this.powered = false;
|
this.powered = false;
|
||||||
boolean channelsChanged = false;
|
boolean channelsChanged = false;
|
||||||
|
|
||||||
for (ForgeDirection d : ForgeDirection.values())
|
for ( ForgeDirection d : ForgeDirection.values() )
|
||||||
{
|
{
|
||||||
if ( d != ForgeDirection.UNKNOWN )
|
if ( d != ForgeDirection.UNKNOWN )
|
||||||
{
|
{
|
||||||
int ch = (sideOut >> (d.ordinal() * 4)) & 0xF;
|
int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF;
|
||||||
if ( ch != this.channelsOnSide[d.ordinal()] )
|
if ( ch != this.channelsOnSide[d.ordinal()] )
|
||||||
{
|
{
|
||||||
channelsChanged = true;
|
channelsChanged = true;
|
||||||
@@ -349,24 +364,30 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
if ( d == ForgeDirection.UNKNOWN )
|
if ( d == ForgeDirection.UNKNOWN )
|
||||||
{
|
{
|
||||||
int id = 1 << d.ordinal();
|
int id = 1 << d.ordinal();
|
||||||
if ( id == (cs & id) )
|
if ( id == ( cs & id ) )
|
||||||
|
{
|
||||||
this.powered = true;
|
this.powered = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int id = 1 << d.ordinal();
|
int id = 1 << d.ordinal();
|
||||||
if ( id == (cs & id) )
|
if ( id == ( cs & id ) )
|
||||||
|
{
|
||||||
this.connections.add( d );
|
this.connections.add( d );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this.connections.remove( d );
|
this.connections.remove( d );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return !myC.equals( this.connections ) || wasPowered != this.powered || channelsChanged;
|
return !myC.equals( this.connections ) || wasPowered != this.powered || channelsChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBoxes(IPartCollisionHelper bch)
|
public void getBoxes( IPartCollisionHelper bch )
|
||||||
{
|
{
|
||||||
bch.addBox( 6.0, 6.0, 6.0, 10.0, 10.0, 10.0 );
|
bch.addBox( 6.0, 6.0, 6.0, 10.0, 10.0, 10.0 );
|
||||||
|
|
||||||
@@ -374,15 +395,19 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
{
|
{
|
||||||
IGridNode n = this.getGridNode();
|
IGridNode n = this.getGridNode();
|
||||||
if ( n != null )
|
if ( n != null )
|
||||||
|
{
|
||||||
this.connections = n.getConnectedSides();
|
this.connections = n.getConnectedSides();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this.connections.clear();
|
this.connections.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IPartHost ph = this.getHost();
|
IPartHost ph = this.getHost();
|
||||||
if ( ph != null )
|
if ( ph != null )
|
||||||
{
|
{
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for ( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||||
{
|
{
|
||||||
IPart p = ph.getPart( dir );
|
IPart p = ph.getPart( dir );
|
||||||
if ( p instanceof IGridHost )
|
if ( p instanceof IGridHost )
|
||||||
@@ -390,9 +415,11 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
double dist = p.cableConnectionRenderTo();
|
double dist = p.cableConnectionRenderTo();
|
||||||
|
|
||||||
if ( dist > 8 )
|
if ( dist > 8 )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (dir)
|
switch ( dir )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
bch.addBox( 6.0, dist, 6.0, 10.0, 6.0, 10.0 );
|
bch.addBox( 6.0, dist, 6.0, 10.0, 6.0, 10.0 );
|
||||||
@@ -418,9 +445,9 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ForgeDirection of : this.connections)
|
for ( ForgeDirection of : this.connections )
|
||||||
{
|
{
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
bch.addBox( 6.0, 0.0, 6.0, 10.0, 6.0, 10.0 );
|
bch.addBox( 6.0, 0.0, 6.0, 10.0, 6.0, 10.0 );
|
||||||
@@ -446,8 +473,8 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
||||||
|
|
||||||
@@ -458,28 +485,30 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public IIcon getBreakingTexture()
|
public IIcon getBreakingTexture()
|
||||||
{
|
{
|
||||||
return this.getTexture( this.getCableColor() );
|
return this.getTexture( this.getCableColor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderGlassConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of)
|
public void renderGlassConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of )
|
||||||
{
|
{
|
||||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
IPartHost partHost = te instanceof IPartHost ? ( IPartHost ) te : null;
|
||||||
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
|
IGridHost gh = te instanceof IGridHost ? ( IGridHost ) te : null;
|
||||||
|
|
||||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
||||||
|
|
||||||
if ( gh != null && partHost != null && gh.getCableConnectionType( of ) == AECableType.GLASS && partHost.getColor() != AEColor.Transparent
|
if ( gh != null && partHost != null && gh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getColor() != AEColor.Transparent
|
||||||
&& partHost.getPart( of.getOpposite() ) == null )
|
&& partHost.getPart( of.getOpposite() ) == null )
|
||||||
|
{
|
||||||
rh.setTexture( this.getTexture( partHost.getColor() ) );
|
rh.setTexture( this.getTexture( partHost.getColor() ) );
|
||||||
else if ( partHost == null && gh != null && gh.getCableConnectionType( of ) != AECableType.GLASS )
|
}
|
||||||
|
else if ( partHost == null && gh != null && gh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||||
{
|
{
|
||||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
||||||
@@ -507,9 +536,11 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||||
|
}
|
||||||
|
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 6, 0, 6, 10, 6, 10 );
|
rh.setBounds( 6, 0, 6, 10, 6, 10 );
|
||||||
@@ -537,14 +568,16 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CableBusTextures getChannelTex(int i, boolean b)
|
protected CableBusTextures getChannelTex( int i, boolean b )
|
||||||
{
|
{
|
||||||
if ( !this.powered )
|
if ( !this.powered )
|
||||||
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ( b )
|
if ( b )
|
||||||
{
|
{
|
||||||
switch (i)
|
switch ( i )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return CableBusTextures.Channels10;
|
return CableBusTextures.Channels10;
|
||||||
@@ -560,7 +593,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (i)
|
switch ( i )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return CableBusTextures.Channels00;
|
return CableBusTextures.Channels00;
|
||||||
@@ -576,22 +609,23 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderCoveredConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of)
|
public void renderCoveredConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
|
||||||
{
|
{
|
||||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
IPartHost partHost = te instanceof IPartHost ? ( IPartHost ) te : null;
|
||||||
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
|
IGridHost ghh = te instanceof IGridHost ? ( IGridHost ) te : null;
|
||||||
boolean isSmart = false;
|
|
||||||
|
|
||||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
||||||
if ( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null
|
if ( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null
|
||||||
&& partHost.getColor() != AEColor.Transparent )
|
&& partHost.getColor() != AEColor.Transparent )
|
||||||
|
{
|
||||||
rh.setTexture( this.getGlassTexture( partHost.getColor() ) );
|
rh.setTexture( this.getGlassTexture( partHost.getColor() ) );
|
||||||
else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS )
|
}
|
||||||
|
else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||||
{
|
{
|
||||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
||||||
@@ -619,18 +653,17 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||||
}
|
}
|
||||||
else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.COVERED && partHost.getColor() != AEColor.Transparent
|
else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.COVERED && partHost.getColor() != AEColor.Transparent
|
||||||
&& partHost.getPart( of.getOpposite() ) == null )
|
&& partHost.getPart( of.getOpposite() ) == null )
|
||||||
rh.setTexture( this.getCoveredTexture( partHost.getColor() ) );
|
|
||||||
else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) == AECableType.SMART && partHost.getPart( of.getOpposite() ) == null )
|
|
||||||
{
|
{
|
||||||
isSmart = true;
|
rh.setTexture( this.getCoveredTexture( partHost.getColor() ) );
|
||||||
rh.setTexture( this.getSmartTexture( this.getCableColor() ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||||
|
}
|
||||||
|
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 6, 0, 6, 10, 5, 10 );
|
rh.setBounds( 6, 0, 6, 10, 5, 10 );
|
||||||
@@ -656,41 +689,15 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
rh.renderBlock( x, y, z, renderer );
|
rh.renderBlock( x, y, z, renderer );
|
||||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||||
|
|
||||||
if ( isSmart )
|
|
||||||
{
|
|
||||||
this.setSmartConnectionRotations( of, renderer );
|
|
||||||
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
|
||||||
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
|
||||||
|
|
||||||
if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
|
|
||||||
{
|
|
||||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
|
||||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
|
||||||
ico.setFlip( false, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
|
||||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
|
||||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
|
||||||
|
|
||||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
|
||||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
|
||||||
|
|
||||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderSmartConnection(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of)
|
public void renderSmartConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
|
||||||
{
|
{
|
||||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
IPartHost partHost = te instanceof IPartHost ? ( IPartHost ) te : null;
|
||||||
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
|
IGridHost ghh = te instanceof IGridHost ? ( IGridHost ) te : null;
|
||||||
boolean isGlass = false;
|
boolean isGlass = false;
|
||||||
AEColor myColor = this.getCableColor();
|
AEColor myColor = this.getCableColor();
|
||||||
|
|
||||||
@@ -705,7 +712,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
else if ( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||||
{
|
{
|
||||||
rh.setTexture( this.getSmartTexture( myColor ) );
|
rh.setTexture( this.getSmartTexture( myColor ) );
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
rh.setBounds( 5, 0, 5, 11, 4, 11 );
|
||||||
@@ -736,7 +743,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
|
if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
|
||||||
{
|
{
|
||||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
AEBaseBlock blk = ( AEBaseBlock ) rh.getBlock();
|
||||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||||
ico.setFlip( false, true );
|
ico.setFlip( false, true );
|
||||||
}
|
}
|
||||||
@@ -744,24 +751,28 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||||
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
||||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
this.renderAllFaces( ( AEBaseBlock ) rh.getBlock(), x, y, z, rh, renderer );
|
||||||
|
|
||||||
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
this.renderAllFaces( ( AEBaseBlock ) rh.getBlock(), x, y, z, rh, renderer );
|
||||||
|
|
||||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||||
|
|
||||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent
|
else if ( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent
|
||||||
&& partHost.getPart( of.getOpposite() ) == null )
|
&& partHost.getPart( of.getOpposite() ) == null )
|
||||||
|
{
|
||||||
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor() ) );
|
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor() ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rh.setTexture( this.getSmartTexture( this.getCableColor() ) );
|
rh.setTexture( this.getSmartTexture( this.getCableColor() ) );
|
||||||
|
}
|
||||||
|
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 6, 0, 6, 10, 5, 10 );
|
rh.setBounds( 6, 0, 6, 10, 5, 10 );
|
||||||
@@ -798,21 +809,21 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||||
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
||||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
this.renderAllFaces( ( AEBaseBlock ) rh.getBlock(), x, y, z, rh, renderer );
|
||||||
|
|
||||||
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
this.renderAllFaces( ( AEBaseBlock ) rh.getBlock(), x, y, z, rh, renderer );
|
||||||
|
|
||||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
protected void setSmartConnectionRotations(ForgeDirection of, RenderBlocks renderer)
|
protected void setSmartConnectionRotations( ForgeDirection of, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case UP:
|
case UP:
|
||||||
case DOWN:
|
case DOWN:
|
||||||
@@ -845,11 +856,11 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
protected void renderAllFaces(AEBaseBlock blk, int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
protected void renderAllFaces( AEBaseBlock blk, int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
rh.setBounds( (float) renderer.renderMinX * 16.0f, (float) renderer.renderMinY * 16.0f, (float) renderer.renderMinZ * 16.0f,
|
rh.setBounds( ( float ) renderer.renderMinX * 16.0f, ( float ) renderer.renderMinY * 16.0f, ( float ) renderer.renderMinZ * 16.0f,
|
||||||
(float) renderer.renderMaxX * 16.0f, (float) renderer.renderMaxY * 16.0f, (float) renderer.renderMaxZ * 16.0f );
|
( float ) renderer.renderMaxX * 16.0f, ( float ) renderer.renderMaxY * 16.0f, ( float ) renderer.renderMaxZ * 16.0f );
|
||||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.WEST ), ForgeDirection.WEST, renderer );
|
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.WEST ), ForgeDirection.WEST, renderer );
|
||||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.EAST ), ForgeDirection.EAST, renderer );
|
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.EAST ), ForgeDirection.EAST, renderer );
|
||||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.NORTH ), ForgeDirection.NORTH, renderer );
|
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.NORTH ), ForgeDirection.NORTH, renderer );
|
||||||
@@ -859,19 +870,19 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||||
boolean useCovered = false;
|
boolean useCovered = false;
|
||||||
boolean requireDetailed = false;
|
boolean requireDetailed = false;
|
||||||
|
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for ( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||||
{
|
{
|
||||||
IPart p = this.getHost().getPart( dir );
|
IPart p = this.getHost().getPart( dir );
|
||||||
if ( p != null && p instanceof IGridHost )
|
if ( p != null && p instanceof IGridHost )
|
||||||
{
|
{
|
||||||
IGridHost igh = (IGridHost) p;
|
IGridHost igh = ( IGridHost ) p;
|
||||||
AECableType type = igh.getCableConnectionType( dir.getOpposite() );
|
AECableType type = igh.getCableConnectionType( dir.getOpposite() );
|
||||||
if ( type == AECableType.COVERED || type == AECableType.SMART )
|
if ( type == AECableType.COVERED || type == AECableType.SMART )
|
||||||
{
|
{
|
||||||
@@ -882,12 +893,14 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
else if ( this.connections.contains( dir ) )
|
else if ( this.connections.contains( dir ) )
|
||||||
{
|
{
|
||||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ );
|
TileEntity te = this.tile.getWorldObj().getTileEntity( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ );
|
||||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
IPartHost partHost = te instanceof IPartHost ? ( IPartHost ) te : null;
|
||||||
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
|
IGridHost gh = te instanceof IGridHost ? ( IGridHost ) te : null;
|
||||||
if ( partHost == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS )
|
if ( partHost == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS )
|
||||||
|
{
|
||||||
requireDetailed = true;
|
requireDetailed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( useCovered )
|
if ( useCovered )
|
||||||
{
|
{
|
||||||
@@ -899,7 +912,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
IPartHost ph = this.getHost();
|
IPartHost ph = this.getHost();
|
||||||
for (ForgeDirection of : EnumSet.complementOf( this.connections ))
|
for ( ForgeDirection of : EnumSet.complementOf( this.connections ) )
|
||||||
{
|
{
|
||||||
IPart bp = ph.getPart( of );
|
IPart bp = ph.getPart( of );
|
||||||
if ( bp instanceof IGridHost )
|
if ( bp instanceof IGridHost )
|
||||||
@@ -907,7 +920,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
int len = bp.cableConnectionRenderTo();
|
int len = bp.cableConnectionRenderTo();
|
||||||
if ( len < 8 )
|
if ( len < 8 )
|
||||||
{
|
{
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
rh.setBounds( 6, len, 6, 10, 6, 10 );
|
rh.setBounds( 6, len, 6, 10, 6, 10 );
|
||||||
@@ -948,7 +961,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
rh.renderBlock( x, y, z, renderer );
|
rh.renderBlock( x, y, z, renderer );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ForgeDirection of : this.connections)
|
for ( ForgeDirection of : this.connections )
|
||||||
{
|
{
|
||||||
this.renderGlassConnection( x, y, z, rh, renderer, of );
|
this.renderGlassConnection( x, y, z, rh, renderer, of );
|
||||||
}
|
}
|
||||||
@@ -958,10 +971,10 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
IIcon def = this.getTexture( this.getCableColor() );
|
IIcon def = this.getTexture( this.getCableColor() );
|
||||||
rh.setTexture( def );
|
rh.setTexture( def );
|
||||||
|
|
||||||
for (ForgeDirection of : this.connections)
|
for ( ForgeDirection of : this.connections )
|
||||||
{
|
{
|
||||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
|
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
|
||||||
switch (of)
|
switch ( of )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
case UP:
|
case UP:
|
||||||
@@ -990,20 +1003,28 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean changeColor(AEColor newColor, EntityPlayer who)
|
public boolean changeColor( AEColor newColor, EntityPlayer who )
|
||||||
{
|
{
|
||||||
if ( this.getCableColor() != newColor )
|
if ( this.getCableColor() != newColor )
|
||||||
{
|
{
|
||||||
ItemStack newPart = null;
|
ItemStack newPart = null;
|
||||||
|
|
||||||
if ( this.getCableConnectionType() == AECableType.GLASS )
|
if ( this.getCableConnectionType() == AECableType.GLASS )
|
||||||
|
{
|
||||||
newPart = AEApi.instance().parts().partCableGlass.stack( newColor, 1 );
|
newPart = AEApi.instance().parts().partCableGlass.stack( newColor, 1 );
|
||||||
|
}
|
||||||
else if ( this.getCableConnectionType() == AECableType.COVERED )
|
else if ( this.getCableConnectionType() == AECableType.COVERED )
|
||||||
|
{
|
||||||
newPart = AEApi.instance().parts().partCableCovered.stack( newColor, 1 );
|
newPart = AEApi.instance().parts().partCableCovered.stack( newColor, 1 );
|
||||||
|
}
|
||||||
else if ( this.getCableConnectionType() == AECableType.SMART )
|
else if ( this.getCableConnectionType() == AECableType.SMART )
|
||||||
|
{
|
||||||
newPart = AEApi.instance().parts().partCableSmart.stack( newColor, 1 );
|
newPart = AEApi.instance().parts().partCableSmart.stack( newColor, 1 );
|
||||||
|
}
|
||||||
else if ( this.getCableConnectionType() == AECableType.DENSE )
|
else if ( this.getCableConnectionType() == AECableType.DENSE )
|
||||||
|
{
|
||||||
newPart = AEApi.instance().parts().partCableDense.stack( newColor, 1 );
|
newPart = AEApi.instance().parts().partCableDense.stack( newColor, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
boolean hasPermission = true;
|
boolean hasPermission = true;
|
||||||
|
|
||||||
@@ -1011,7 +1032,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
{
|
{
|
||||||
hasPermission = this.proxy.getSecurity().hasPermission( who, SecurityPermissions.BUILD );
|
hasPermission = this.proxy.getSecurity().hasPermission( who, SecurityPermissions.BUILD );
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
@@ -1019,7 +1040,9 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
if ( newPart != null && hasPermission )
|
if ( newPart != null && hasPermission )
|
||||||
{
|
{
|
||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
this.getHost().removePart( ForgeDirection.UNKNOWN, true );
|
this.getHost().removePart( ForgeDirection.UNKNOWN, true );
|
||||||
this.getHost().addPart( newPart, ForgeDirection.UNKNOWN, who );
|
this.getHost().addPart( newPart, ForgeDirection.UNKNOWN, who );
|
||||||
@@ -1030,16 +1053,16 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValidSides(EnumSet<ForgeDirection> sides)
|
public void setValidSides( EnumSet<ForgeDirection> sides )
|
||||||
{
|
{
|
||||||
this.proxy.setValidSides( sides );
|
this.proxy.setValidSides( sides );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean nonLinear(EnumSet<ForgeDirection> sides)
|
protected boolean nonLinear( EnumSet<ForgeDirection> sides )
|
||||||
{
|
{
|
||||||
return (sides.contains( ForgeDirection.EAST ) && sides.contains( ForgeDirection.WEST ))
|
return ( sides.contains( ForgeDirection.EAST ) && sides.contains( ForgeDirection.WEST ) )
|
||||||
|| (sides.contains( ForgeDirection.NORTH ) && sides.contains( ForgeDirection.SOUTH ))
|
|| ( sides.contains( ForgeDirection.NORTH ) && sides.contains( ForgeDirection.SOUTH ) )
|
||||||
|| (sides.contains( ForgeDirection.UP ) && sides.contains( ForgeDirection.DOWN ));
|
|| ( sides.contains( ForgeDirection.UP ) && sides.contains( ForgeDirection.DOWN ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user