Most of the 1.8 Port.
This commit is contained in:
@@ -19,24 +19,22 @@
|
||||
package appeng.parts.networking;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
@@ -54,10 +52,13 @@ import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IReadOnlyCollection;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.TaughtIcon;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -71,7 +72,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
final int[] channelsOnSide = new int[] { 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
EnumSet<ForgeDirection> connections = EnumSet.noneOf( ForgeDirection.class );
|
||||
EnumSet<AEPartLocation> connections = EnumSet.noneOf( AEPartLocation.class );
|
||||
boolean powered = false;
|
||||
|
||||
public PartCable( ItemStack is )
|
||||
@@ -144,8 +145,8 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return true;
|
||||
}
|
||||
|
||||
this.getHost().removePart( ForgeDirection.UNKNOWN, true );
|
||||
this.getHost().addPart( newPart, ForgeDirection.UNKNOWN, who );
|
||||
this.getHost().removePart( AEPartLocation.INTERNAL, true );
|
||||
this.getHost().addPart( newPart, AEPartLocation.INTERNAL, who );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -153,15 +154,16 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValidSides( EnumSet<ForgeDirection> sides )
|
||||
public void setValidSides(
|
||||
EnumSet<EnumFacing> sides )
|
||||
{
|
||||
this.proxy.setValidSides( sides );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnected( ForgeDirection side )
|
||||
public boolean isConnected( EnumFacing side )
|
||||
{
|
||||
return this.connections.contains( side );
|
||||
return this.connections.contains( AEPartLocation.fromFacing( side ) );
|
||||
}
|
||||
|
||||
public void markForUpdate()
|
||||
@@ -190,7 +192,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
IPartHost ph = this.getHost();
|
||||
if( ph != null )
|
||||
{
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation dir : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
IPart p = ph.getPart( dir );
|
||||
if( p instanceof IGridHost )
|
||||
@@ -228,7 +230,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
switch( of )
|
||||
{
|
||||
@@ -257,22 +259,22 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
||||
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(),renderer ) );
|
||||
rh.setBounds( 6.0f, 6.0f, 2.0f, 10.0f, 10.0f, 14.0f );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setTexture( null );
|
||||
}
|
||||
|
||||
public IIcon getTexture( AEColor c )
|
||||
public IAESprite getTexture( AEColor c,IRenderHelper renderer )
|
||||
{
|
||||
return this.getGlassTexture( c );
|
||||
return this.getGlassTexture( c,renderer );
|
||||
}
|
||||
|
||||
public IIcon getGlassTexture( AEColor c )
|
||||
public IAESprite getGlassTexture( AEColor c,IRenderHelper renderer )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
@@ -314,7 +316,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
final AEColoredItemDefinition glassCable = AEApi.instance().definitions().parts().cableGlass();
|
||||
final ItemStack glassCableStack = glassCable.stack( AEColor.Transparent, 1 );
|
||||
|
||||
return glassCable.item( AEColor.Transparent ).getIconIndex( glassCableStack );
|
||||
return renderer.getIcon( glassCableStack );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -325,13 +327,12 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
boolean useCovered = false;
|
||||
boolean requireDetailed = false;
|
||||
|
||||
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation dir : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
IPart p = this.getHost().getPart( dir );
|
||||
if( p instanceof IGridHost )
|
||||
@@ -346,7 +347,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
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.getWorld().getTileEntity( pos.offset( dir.getFacing() ) );
|
||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
||||
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
|
||||
if( partHost == null && gh != null && gh.getCableConnectionType( dir ) != AECableType.GLASS )
|
||||
@@ -358,15 +359,15 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
if( useCovered )
|
||||
{
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(),renderer ) );
|
||||
}
|
||||
|
||||
IPartHost ph = this.getHost();
|
||||
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
|
||||
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
|
||||
{
|
||||
IPart bp = ph.getPart( of );
|
||||
if( bp instanceof IGridHost )
|
||||
@@ -397,7 +398,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,27 +408,27 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
if( useCovered )
|
||||
{
|
||||
rh.setBounds( 5, 5, 5, 11, 11, 11 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setBounds( 6, 6, 6, 10, 10, 10 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
this.renderGlassConnection( x, y, z, rh, renderer, of );
|
||||
this.renderGlassConnection( pos, rh, renderer, of );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IIcon def = this.getTexture( this.getCableColor() );
|
||||
IAESprite def = this.getTexture( this.getCableColor(), renderer );
|
||||
rh.setTexture( def );
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing(), of.getFacing().getOpposite() ) ) );
|
||||
switch( of )
|
||||
{
|
||||
case DOWN:
|
||||
@@ -449,10 +450,10 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
}
|
||||
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
rh.setTexture( null );
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
IGridNode n = this.getGridNode();
|
||||
if( n != null )
|
||||
{
|
||||
for( ForgeDirection thisSide : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation thisSide : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
IPart part = this.getHost().getPart( thisSide );
|
||||
if( part != null )
|
||||
@@ -512,8 +513,8 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
for( IGridConnection gc : n.getConnections() )
|
||||
{
|
||||
ForgeDirection side = gc.getDirection( n );
|
||||
if( side != ForgeDirection.UNKNOWN )
|
||||
AEPartLocation side = gc.getDirection( n );
|
||||
if( side != AEPartLocation.INTERNAL )
|
||||
{
|
||||
boolean isTier2a = this.proxy.getNode().hasFlag( GridFlags.DENSE_CAPACITY );
|
||||
boolean isTier2b = gc.getOtherSide( this.proxy.getNode() ).hasFlag( GridFlags.DENSE_CAPACITY );
|
||||
@@ -535,7 +536,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
{
|
||||
if( this.proxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
cs |= ( 1 << ForgeDirection.UNKNOWN.ordinal() );
|
||||
cs |= ( 1 << AEPartLocation.INTERNAL.ordinal() );
|
||||
}
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
@@ -553,14 +554,14 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
int cs = data.readByte();
|
||||
int sideOut = data.readInt();
|
||||
|
||||
EnumSet<ForgeDirection> myC = this.connections.clone();
|
||||
EnumSet<AEPartLocation> myC = this.connections.clone();
|
||||
boolean wasPowered = this.powered;
|
||||
this.powered = false;
|
||||
boolean channelsChanged = false;
|
||||
|
||||
for( ForgeDirection d : ForgeDirection.values() )
|
||||
for( AEPartLocation d : AEPartLocation.values() )
|
||||
{
|
||||
if( d != ForgeDirection.UNKNOWN )
|
||||
if( d != AEPartLocation.INTERNAL )
|
||||
{
|
||||
int ch = ( sideOut >> ( d.ordinal() * 4 ) ) & 0xF;
|
||||
if( ch != this.channelsOnSide[d.ordinal()] )
|
||||
@@ -570,7 +571,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
}
|
||||
|
||||
if( d == ForgeDirection.UNKNOWN )
|
||||
if( d == AEPartLocation.INTERNAL )
|
||||
{
|
||||
int id = 1 << d.ordinal();
|
||||
if( id == ( cs & id ) )
|
||||
@@ -597,12 +598,12 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getBreakingTexture()
|
||||
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
|
||||
{
|
||||
return this.getTexture( this.getCableColor() );
|
||||
return this.getTexture( this.getCableColor(), renderer ).getAtlas();
|
||||
}
|
||||
|
||||
public IIcon getCoveredTexture( AEColor c )
|
||||
public IAESprite getCoveredTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
@@ -644,30 +645,30 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
final AEColoredItemDefinition coveredCable = AEApi.instance().definitions().parts().cableCovered();
|
||||
final ItemStack coveredCableStack = coveredCable.stack( AEColor.Transparent, 1 );
|
||||
|
||||
return coveredCable.item( AEColor.Transparent ).getIconIndex( coveredCableStack );
|
||||
return renderer.getIcon( coveredCableStack );
|
||||
}
|
||||
|
||||
protected boolean nonLinear( EnumSet<ForgeDirection> sides )
|
||||
protected boolean nonLinear( EnumSet<AEPartLocation> sides )
|
||||
{
|
||||
return ( sides.contains( ForgeDirection.EAST ) && sides.contains( ForgeDirection.WEST ) ) || ( sides.contains( ForgeDirection.NORTH ) && sides.contains( ForgeDirection.SOUTH ) ) || ( sides.contains( ForgeDirection.UP ) && sides.contains( ForgeDirection.DOWN ) );
|
||||
return ( sides.contains( AEPartLocation.EAST ) && sides.contains( AEPartLocation.WEST ) ) || ( sides.contains( AEPartLocation.NORTH ) && sides.contains( AEPartLocation.SOUTH ) ) || ( sides.contains( AEPartLocation.UP ) && sides.contains( AEPartLocation.DOWN ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderGlassConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, ForgeDirection of )
|
||||
public void renderGlassConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
|
||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
||||
IGridHost gh = te instanceof IGridHost ? (IGridHost) te : null;
|
||||
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
|
||||
|
||||
if( gh != null && partHost != null && gh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
|
||||
{
|
||||
rh.setTexture( this.getTexture( partHost.getColor() ) );
|
||||
rh.setTexture( this.getTexture( partHost.getColor(), renderer ) );
|
||||
}
|
||||
else if( partHost == null && gh != null && gh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||
{
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
|
||||
switch( of )
|
||||
{
|
||||
case DOWN:
|
||||
@@ -692,12 +693,12 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.renderBlock( pos, renderer );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
|
||||
switch( of )
|
||||
@@ -724,25 +725,25 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.renderBlock( pos, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderCoveredConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
|
||||
public void renderCoveredConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
|
||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
||||
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
|
||||
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
|
||||
if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null && partHost.getColor() != AEColor.Transparent )
|
||||
{
|
||||
rh.setTexture( this.getGlassTexture( partHost.getColor() ) );
|
||||
rh.setTexture( this.getGlassTexture( partHost.getColor(), renderer ) );
|
||||
}
|
||||
else if( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||
{
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
|
||||
switch( of )
|
||||
{
|
||||
case DOWN:
|
||||
@@ -767,17 +768,17 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
else if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.COVERED && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
|
||||
{
|
||||
rh.setTexture( this.getCoveredTexture( partHost.getColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( partHost.getColor(), renderer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
|
||||
switch( of )
|
||||
@@ -804,30 +805,30 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.renderBlock( pos, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderSmartConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
|
||||
public void renderSmartConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
|
||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
||||
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
|
||||
boolean isGlass = false;
|
||||
AEColor myColor = this.getCableColor();
|
||||
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of ) ) );
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing() ) ) );
|
||||
|
||||
if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) == AECableType.GLASS && partHost.getPart( of.getOpposite() ) == null && partHost.getColor() != AEColor.Transparent )
|
||||
{
|
||||
isGlass = true;
|
||||
rh.setTexture( this.getGlassTexture( myColor = partHost.getColor() ) );
|
||||
rh.setTexture( this.getGlassTexture( myColor = partHost.getColor(), renderer ) );
|
||||
}
|
||||
else if( partHost == null && ghh != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS )
|
||||
{
|
||||
rh.setTexture( this.getSmartTexture( myColor ) );
|
||||
rh.setTexture( this.getSmartTexture( myColor, renderer ) );
|
||||
switch( of )
|
||||
{
|
||||
case DOWN:
|
||||
@@ -851,40 +852,40 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
default:
|
||||
return;
|
||||
}
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
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 );
|
||||
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
|
||||
if( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
|
||||
if( of == AEPartLocation.EAST || of == AEPartLocation.WEST )
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
|
||||
ico.setFlip( false, true );
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setColorOpaque_I( myColor.blackVariant );
|
||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||
renderer.setColorOpaque_I( myColor.whiteVariant );
|
||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
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(), renderer ) );
|
||||
}
|
||||
|
||||
else if( ghh != null && partHost != null && ghh.getCableConnectionType( of.getOpposite() ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
|
||||
{
|
||||
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor() ) );
|
||||
rh.setTexture( this.getSmartTexture( myColor = partHost.getColor(), renderer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getSmartTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getSmartTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
|
||||
switch( of )
|
||||
@@ -911,30 +912,30 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.renderBlock( pos, renderer );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
|
||||
if( !isGlass )
|
||||
{
|
||||
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 );
|
||||
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setColorOpaque_I( myColor.blackVariant );
|
||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||
renderer.setColorOpaque_I( myColor.whiteVariant );
|
||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public IIcon getSmartTexture( AEColor c )
|
||||
public IAESprite getSmartTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
@@ -976,11 +977,11 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
final IParts parts = AEApi.instance().definitions().parts();
|
||||
final ItemStack smartCableStack = parts.cableSmart().stack( AEColor.Transparent, 1 );
|
||||
|
||||
return parts.cableCovered().item( AEColor.Transparent ).getIconIndex( smartCableStack );
|
||||
return renderer.getIcon(smartCableStack );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void setSmartConnectionRotations( ForgeDirection of, RenderBlocks renderer )
|
||||
protected void setSmartConnectionRotations( AEPartLocation of, IRenderHelper renderer )
|
||||
{
|
||||
switch( of )
|
||||
{
|
||||
@@ -1055,14 +1056,14 @@ public class PartCable extends AEBasePart implements IPartCable
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void renderAllFaces( AEBaseBlock blk, int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
protected void renderAllFaces( AEBaseBlock blk, BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
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 );
|
||||
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.NORTH ), ForgeDirection.NORTH, renderer );
|
||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.SOUTH ), ForgeDirection.SOUTH, renderer );
|
||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.DOWN ), ForgeDirection.DOWN, renderer );
|
||||
rh.renderFace( x, y, z, blk.getRendererInstance().getTexture( ForgeDirection.UP ), ForgeDirection.UP, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.WEST ), EnumFacing.WEST, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.EAST ), EnumFacing.EAST, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.NORTH ), EnumFacing.NORTH, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.SOUTH ), EnumFacing.SOUTH, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.DOWN ), EnumFacing.DOWN, renderer );
|
||||
rh.renderFace( pos, blk.getRendererInstance().getTexture( AEPartLocation.UP ), EnumFacing.UP, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,13 @@ package appeng.parts.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -42,6 +40,9 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.Platform;
|
||||
@@ -91,7 +92,7 @@ public class PartCableCovered extends PartCable
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
switch( of )
|
||||
{
|
||||
@@ -120,7 +121,7 @@ public class PartCableCovered extends PartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
||||
|
||||
@@ -128,25 +129,25 @@ public class PartCableCovered extends PartCable
|
||||
float offU = 0;
|
||||
float offV = 9;
|
||||
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
}
|
||||
|
||||
offU = 9;
|
||||
offV = 0;
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
}
|
||||
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
}
|
||||
@@ -155,28 +156,27 @@ public class PartCableCovered extends PartCable
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTexture( AEColor c )
|
||||
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
return this.getCoveredTexture( c );
|
||||
return this.getCoveredTexture( c, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
|
||||
EnumSet<ForgeDirection> sides = this.connections.clone();
|
||||
EnumSet<AEPartLocation> sides = this.connections.clone();
|
||||
|
||||
boolean hasBuses = false;
|
||||
IPartHost ph = this.getHost();
|
||||
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
|
||||
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
|
||||
{
|
||||
IPart bp = ph.getPart( of );
|
||||
if( bp instanceof IGridHost )
|
||||
{
|
||||
if( of != ForgeDirection.UNKNOWN )
|
||||
if( of != AEPartLocation.INTERNAL )
|
||||
{
|
||||
sides.add( of );
|
||||
hasBuses = true;
|
||||
@@ -208,27 +208,27 @@ public class PartCableCovered extends PartCable
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
|
||||
{
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
rh.setBounds( 5, 5, 5, 11, 11, 11 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
IIcon def = this.getTexture( this.getCableColor() );
|
||||
IIcon off = new OffsetIcon( def, 0, -12 );
|
||||
for( ForgeDirection of : this.connections )
|
||||
IAESprite def = this.getTexture( this.getCableColor(), renderer );
|
||||
IAESprite off = new OffsetIcon( def, 0, -12 );
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
switch( of )
|
||||
{
|
||||
@@ -254,7 +254,7 @@ public class PartCableCovered extends PartCable
|
||||
}
|
||||
}
|
||||
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.parts.networking;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.helpers.Reflected;
|
||||
|
||||
|
||||
|
||||
@@ -21,16 +21,13 @@ package appeng.parts.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -43,8 +40,11 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.client.texture.TaughtIcon;
|
||||
import appeng.helpers.Reflected;
|
||||
@@ -95,7 +95,7 @@ public class PartCableSmart extends PartCable
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
switch( of )
|
||||
{
|
||||
@@ -124,18 +124,18 @@ public class PartCableSmart extends PartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
||||
|
||||
float offU = 0;
|
||||
float offV = 9;
|
||||
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
|
||||
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
|
||||
{
|
||||
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
@@ -145,11 +145,11 @@ public class PartCableSmart extends PartCable
|
||||
|
||||
offU = 9;
|
||||
offV = 0;
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
|
||||
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
|
||||
{
|
||||
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
@@ -157,11 +157,11 @@ public class PartCableSmart extends PartCable
|
||||
rh.renderInventoryFace( ch2, side, renderer );
|
||||
}
|
||||
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
|
||||
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
|
||||
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
|
||||
{
|
||||
rh.setBounds( 5.0f, 5.0f, 2.0f, 11.0f, 11.0f, 14.0f );
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
@@ -173,28 +173,27 @@ public class PartCableSmart extends PartCable
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTexture( AEColor c )
|
||||
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
return this.getSmartTexture( c );
|
||||
return this.getSmartTexture( c, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
|
||||
EnumSet<ForgeDirection> sides = this.connections.clone();
|
||||
EnumSet<AEPartLocation> sides = this.connections.clone();
|
||||
|
||||
boolean hasBuses = false;
|
||||
IPartHost ph = this.getHost();
|
||||
for( ForgeDirection of : EnumSet.complementOf( this.connections ) )
|
||||
for( AEPartLocation of : EnumSet.complementOf( this.connections ) )
|
||||
{
|
||||
IPart bp = ph.getPart( of );
|
||||
if( bp instanceof IGridHost )
|
||||
{
|
||||
if( of != ForgeDirection.UNKNOWN )
|
||||
if( of != AEPartLocation.INTERNAL )
|
||||
{
|
||||
sides.add( of );
|
||||
hasBuses = true;
|
||||
@@ -226,65 +225,65 @@ public class PartCableSmart extends PartCable
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
this.setSmartConnectionRotations( of, renderer );
|
||||
IIcon firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f );
|
||||
IIcon secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f );
|
||||
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], false ).getIcon(), -0.2f );
|
||||
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( this.channelsOnSide[of.ordinal()], true ).getIcon(), -0.2f );
|
||||
|
||||
if( of == ForgeDirection.EAST || of == ForgeDirection.WEST )
|
||||
if( of == AEPartLocation.EAST || of == AEPartLocation.WEST )
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
|
||||
ico.setFlip( false, true );
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
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(), renderer ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
|
||||
{
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getCoveredTexture( this.getCableColor(), renderer ) );
|
||||
rh.setBounds( 5, 5, 5, 11, 11, 11 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
|
||||
AEPartLocation selectedSide = AEPartLocation.INTERNAL;
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
selectedSide = of;
|
||||
break;
|
||||
}
|
||||
|
||||
int channels = this.channelsOnSide[selectedSide.ordinal()];
|
||||
IIcon def = this.getTexture( this.getCableColor() );
|
||||
IIcon off = new OffsetIcon( def, 0, -12 );
|
||||
IAESprite def = this.getTexture( this.getCableColor(), renderer );
|
||||
IAESprite off = new OffsetIcon( def, 0, -12 );
|
||||
|
||||
IIcon firstTaughtIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IIcon firstOffsetIcon = new OffsetIcon( firstTaughtIcon, 0, -12 );
|
||||
IAESprite firstTaughtIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IAESprite firstOffsetIcon = new OffsetIcon( firstTaughtIcon, 0, -12 );
|
||||
|
||||
IIcon secondTaughtIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
IIcon secondOffsetIcon = new OffsetIcon( secondTaughtIcon, 0, -12 );
|
||||
IAESprite secondTaughtIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
IAESprite secondOffsetIcon = new OffsetIcon( secondTaughtIcon, 0, -12 );
|
||||
|
||||
switch( selectedSide )
|
||||
{
|
||||
@@ -292,22 +291,22 @@ public class PartCableSmart extends PartCable
|
||||
case UP:
|
||||
renderer.setRenderBounds( 5 / 16.0, 0, 5 / 16.0, 11 / 16.0, 16 / 16.0, 11 / 16.0 );
|
||||
rh.setTexture( def, def, off, off, off, off );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstTaughtIcon, firstTaughtIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondTaughtIcon, secondTaughtIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
@@ -320,13 +319,13 @@ public class PartCableSmart extends PartCable
|
||||
renderer.uvRotateNorth = 0;
|
||||
|
||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
|
||||
ico.setFlip( false, true );
|
||||
|
||||
renderer.setRenderBounds( 0, 5 / 16.0, 5 / 16.0, 16 / 16.0, 11 / 16.0, 11 / 16.0 );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
FlippableIcon fpA = new FlippableIcon( firstTaughtIcon );
|
||||
FlippableIcon fpB = new FlippableIcon( secondTaughtIcon );
|
||||
@@ -337,13 +336,13 @@ public class PartCableSmart extends PartCable
|
||||
fpA.setFlip( true, false );
|
||||
fpB.setFlip( true, false );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstOffsetIcon, firstTaughtIcon, fpA );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondOffsetIcon, secondTaughtIcon, fpB );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
@@ -354,17 +353,17 @@ public class PartCableSmart extends PartCable
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstOffsetIcon, firstOffsetIcon, firstTaughtIcon, firstTaughtIcon, firstOffsetIcon, firstOffsetIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondOffsetIcon, secondOffsetIcon, secondTaughtIcon, secondTaughtIcon, secondOffsetIcon, secondOffsetIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -21,17 +21,14 @@ package appeng.parts.networking;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -46,9 +43,12 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.client.texture.TaughtIcon;
|
||||
import appeng.helpers.Reflected;
|
||||
@@ -99,7 +99,7 @@ public class PartDenseCable extends PartCable
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
if( this.isDense( of ) )
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public class PartDenseCable extends PartCable
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
GL11.glTranslated( -0.0, -0.0, 0.3 );
|
||||
rh.setBounds( 4.0f, 4.0f, 2.0f, 12.0f, 12.0f, 14.0f );
|
||||
@@ -164,11 +164,11 @@ public class PartDenseCable extends PartCable
|
||||
float offU = 0;
|
||||
float offV = 9;
|
||||
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
OffsetIcon main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
OffsetIcon ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
|
||||
OffsetIcon ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.UP, EnumFacing.DOWN ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
rh.renderInventoryFace( ch1, side, renderer );
|
||||
@@ -177,22 +177,22 @@ public class PartDenseCable extends PartCable
|
||||
|
||||
offU = 9;
|
||||
offV = 0;
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), offU, offV );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), offU, offV );
|
||||
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), offU, offV );
|
||||
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), offU, offV );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.EAST, ForgeDirection.WEST ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.EAST, EnumFacing.WEST ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
rh.renderInventoryFace( ch1, side, renderer );
|
||||
rh.renderInventoryFace( ch2, side, renderer );
|
||||
}
|
||||
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor() ), 0, 0 );
|
||||
main = new OffsetIcon( this.getTexture( this.getCableColor(), renderer ), 0, 0 );
|
||||
ch1 = new OffsetIcon( this.getChannelTex( 4, false ).getIcon(), 0, 0 );
|
||||
ch2 = new OffsetIcon( this.getChannelTex( 4, true ).getIcon(), 0, 0 );
|
||||
|
||||
for( ForgeDirection side : EnumSet.of( ForgeDirection.SOUTH, ForgeDirection.NORTH ) )
|
||||
for( EnumFacing side : EnumSet.of( EnumFacing.SOUTH, EnumFacing.NORTH ) )
|
||||
{
|
||||
rh.renderInventoryFace( main, side, renderer );
|
||||
rh.renderInventoryFace( ch1, side, renderer );
|
||||
@@ -203,27 +203,26 @@ public class PartDenseCable extends PartCable
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getTexture( AEColor c )
|
||||
public IAESprite getTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
if( c == AEColor.Transparent )
|
||||
{
|
||||
return AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ).getIconIndex();
|
||||
return renderer.getIcon( AEApi.instance().definitions().parts().cableSmart().stack( AEColor.Transparent, 1 ) );
|
||||
}
|
||||
|
||||
return this.getSmartTexture( c );
|
||||
return this.getSmartTexture( c, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
|
||||
EnumSet<ForgeDirection> sides = this.connections.clone();
|
||||
EnumSet<AEPartLocation> sides = this.connections.clone();
|
||||
|
||||
boolean hasBuses = false;
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
if( !this.isDense( of ) )
|
||||
{
|
||||
@@ -233,45 +232,45 @@ public class PartDenseCable extends PartCable
|
||||
|
||||
if( sides.size() != 2 || !this.nonLinear( sides ) || hasBuses )
|
||||
{
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
if( this.isDense( of ) )
|
||||
{
|
||||
this.renderDenseConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
this.renderDenseConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
else if( this.isSmart( of ) )
|
||||
{
|
||||
this.renderSmartConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
this.renderSmartConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderCoveredConnection( x, y, z, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
this.renderCoveredConnection( pos, rh, renderer, this.channelsOnSide[of.ordinal()], of );
|
||||
}
|
||||
}
|
||||
|
||||
rh.setTexture( this.getDenseTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getDenseTexture( this.getCableColor(), renderer ) );
|
||||
rh.setBounds( 3, 3, 3, 13, 13, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
ForgeDirection selectedSide = ForgeDirection.UNKNOWN;
|
||||
AEPartLocation selectedSide = AEPartLocation.INTERNAL;
|
||||
|
||||
for( ForgeDirection of : this.connections )
|
||||
for( AEPartLocation of : this.connections )
|
||||
{
|
||||
selectedSide = of;
|
||||
break;
|
||||
}
|
||||
|
||||
int channels = this.channelsOnSide[selectedSide.ordinal()];
|
||||
IIcon def = this.getTexture( this.getCableColor() );
|
||||
IIcon off = new OffsetIcon( def, 0, -12 );
|
||||
IAESprite def = this.getTexture( this.getCableColor(), renderer );
|
||||
IAESprite off = new OffsetIcon( def, 0, -12 );
|
||||
|
||||
IIcon firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IIcon firstOffset = new OffsetIcon( firstIcon, 0, -12 );
|
||||
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IAESprite firstOffset = new OffsetIcon( firstIcon, 0, -12 );
|
||||
|
||||
IIcon secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
IIcon secondOffset = new OffsetIcon( secondIcon, 0, -12 );
|
||||
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
IAESprite secondOffset = new OffsetIcon( secondIcon, 0, -12 );
|
||||
|
||||
switch( selectedSide )
|
||||
{
|
||||
@@ -279,22 +278,22 @@ public class PartDenseCable extends PartCable
|
||||
case UP:
|
||||
renderer.setRenderBounds( 3 / 16.0, 0, 3 / 16.0, 13 / 16.0, 16 / 16.0, 13 / 16.0 );
|
||||
rh.setTexture( def, def, off, off, off, off );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstIcon, firstIcon, firstOffset, firstOffset, firstOffset, firstOffset );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondIcon, secondIcon, secondOffset, secondOffset, secondOffset, secondOffset );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
@@ -307,13 +306,13 @@ public class PartDenseCable extends PartCable
|
||||
renderer.uvRotateNorth = 0;
|
||||
|
||||
AEBaseBlock blk = (AEBaseBlock) rh.getBlock();
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||
FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST );
|
||||
ico.setFlip( false, true );
|
||||
|
||||
renderer.setRenderBounds( 0, 3 / 16.0, 3 / 16.0, 16 / 16.0, 13 / 16.0, 13 / 16.0 );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
FlippableIcon fpA = new FlippableIcon( firstIcon );
|
||||
FlippableIcon fpB = new FlippableIcon( secondIcon );
|
||||
@@ -321,13 +320,13 @@ public class PartDenseCable extends PartCable
|
||||
fpA.setFlip( true, false );
|
||||
fpB.setFlip( true, false );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstOffset, firstOffset, firstOffset, firstOffset, firstIcon, fpA );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondOffset, secondOffset, secondOffset, secondOffset, secondIcon, fpB );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
@@ -338,17 +337,17 @@ public class PartDenseCable extends PartCable
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.setRenderBounds( 3 / 16.0, 3 / 16.0, 0, 13 / 16.0, 13 / 16.0, 16 / 16.0 );
|
||||
rh.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
rh.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().blackVariant );
|
||||
rh.setTexture( firstOffset, firstOffset, firstIcon, firstIcon, firstOffset, firstOffset );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
renderer.setColorOpaque_I( this.getCableColor().whiteVariant );
|
||||
rh.setTexture( secondOffset, secondOffset, secondIcon, secondIcon, secondOffset, secondOffset );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -360,9 +359,9 @@ public class PartDenseCable extends PartCable
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderDenseConnection( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, int channels, ForgeDirection of )
|
||||
public void renderDenseConnection( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer, int channels, AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( x + of.offsetX, y + of.offsetY, z + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( pos.offset( of.getFacing() ) );
|
||||
IPartHost partHost = te instanceof IPartHost ? (IPartHost) te : null;
|
||||
IGridHost ghh = te instanceof IGridHost ? (IGridHost) te : null;
|
||||
boolean isGlass = false;
|
||||
@@ -377,12 +376,12 @@ public class PartDenseCable extends PartCable
|
||||
* 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y,
|
||||
* z, renderer );
|
||||
*
|
||||
* if ( true ) { setSmartConnectionRotations( of, renderer ); IIcon firstIcon = new TaughtIcon( getChannelTex(
|
||||
* channels, false ).getIcon(), -0.2f ); IIcon secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
|
||||
* if ( true ) { setSmartConnectionRotations( of, renderer ); TextureAtlasSprite firstIcon = new TaughtIcon( getChannelTex(
|
||||
* channels, false ).getIcon(), -0.2f ); TextureAtlasSprite secondIcon = new TaughtIcon( 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(
|
||||
* if ( of == AEPartLocation.EAST || of == AEPartLocation.WEST ) { AEBaseBlock blk = (AEBaseBlock)
|
||||
* rh.getBlock(); FlippableIcon ico = blk.getRendererInstance().getTexture( AEPartLocation.EAST ); ico.setFlip(
|
||||
* false, true ); }
|
||||
*
|
||||
* Tessellator.INSTANCE.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.INSTANCE.setColorOpaque_I(
|
||||
@@ -398,14 +397,14 @@ public class PartDenseCable extends PartCable
|
||||
* rh.setTexture( getTexture( getCableColor() ) ); }
|
||||
*/
|
||||
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of, of.getOpposite() ) ) );
|
||||
rh.setFacesToRender( EnumSet.complementOf( EnumSet.of( of.getFacing(), of.getFacing().getOpposite() ) ) );
|
||||
if( ghh != null && partHost != null && ghh.getCableConnectionType( of ) != AECableType.GLASS && partHost.getColor() != AEColor.Transparent && partHost.getPart( of.getOpposite() ) == null )
|
||||
{
|
||||
rh.setTexture( this.getTexture( myColor = partHost.getColor() ) );
|
||||
rh.setTexture( this.getTexture( myColor = partHost.getColor(), renderer ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
rh.setTexture( this.getTexture( this.getCableColor() ) );
|
||||
rh.setTexture( this.getTexture( this.getCableColor(), renderer ) );
|
||||
}
|
||||
|
||||
switch( of )
|
||||
@@ -432,32 +431,32 @@ public class PartDenseCable extends PartCable
|
||||
return;
|
||||
}
|
||||
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
|
||||
rh.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
if( !isGlass )
|
||||
{
|
||||
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 );
|
||||
IAESprite firstIcon = new TaughtIcon( this.getChannelTex( channels, false ).getIcon(), -0.2f );
|
||||
IAESprite secondIcon = new TaughtIcon( this.getChannelTex( channels, true ).getIcon(), -0.2f );
|
||||
|
||||
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( myColor.blackVariant );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setColorOpaque_I( myColor.blackVariant );
|
||||
rh.setTexture( firstIcon, firstIcon, firstIcon, firstIcon, firstIcon, firstIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||
renderer.setColorOpaque_I( myColor.whiteVariant );
|
||||
rh.setTexture( secondIcon, secondIcon, secondIcon, secondIcon, secondIcon, secondIcon );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
|
||||
this.renderAllFaces( (AEBaseBlock) rh.getBlock(), pos, rh, renderer );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSmart( ForgeDirection of )
|
||||
private boolean isSmart( AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) );
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
||||
@@ -466,7 +465,7 @@ public class PartDenseCable extends PartCable
|
||||
return false;
|
||||
}
|
||||
|
||||
private IIcon getDenseTexture( AEColor c )
|
||||
private IAESprite getDenseTexture( AEColor c, IRenderHelper renderer )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
@@ -505,12 +504,12 @@ public class PartDenseCable extends PartCable
|
||||
default:
|
||||
}
|
||||
|
||||
return this.is.getIconIndex();
|
||||
return renderer.getIcon( is );
|
||||
}
|
||||
|
||||
private boolean isDense( ForgeDirection of )
|
||||
private boolean isDense( AEPartLocation of )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + of.offsetX, this.tile.yCoord + of.offsetY, this.tile.zCoord + of.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( of.getFacing() ) );
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
||||
|
||||
@@ -22,18 +22,15 @@ package appeng.parts.networking;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -44,6 +41,9 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.parts.AEBasePart;
|
||||
@@ -64,7 +64,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.GLASS;
|
||||
}
|
||||
@@ -77,11 +77,11 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
GL11.glTranslated( -0.2, -0.3, 0.0 );
|
||||
|
||||
rh.setTexture( this.is.getIconIndex() );
|
||||
rh.setTexture( renderer.getIcon( is ) );
|
||||
rh.setBounds( 6.0f, 6.0f, 5.0f, 10.0f, 10.0f, 11.0f );
|
||||
rh.renderInventoryBox( renderer );
|
||||
rh.setTexture( null );
|
||||
@@ -89,12 +89,12 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
IIcon myIcon = this.is.getIconIndex();
|
||||
IAESprite myIcon = renderer.getIcon( is );
|
||||
rh.setTexture( myIcon );
|
||||
rh.setBounds( 6, 6, 10, 10, 10, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
rh.setTexture( null );
|
||||
}
|
||||
|
||||
@@ -127,10 +127,10 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
|
||||
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
|
||||
{
|
||||
super.setPartHostInfo( side, host, tile );
|
||||
this.outerProxy.setValidSides( EnumSet.of( side ) );
|
||||
this.outerProxy.setValidSides( EnumSet.of( side.getFacing() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +146,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
|
||||
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
|
||||
{
|
||||
super.onPlacement( player, held, side );
|
||||
this.outerProxy.setOwner( player );
|
||||
|
||||
Reference in New Issue
Block a user