Basic reformat, hit once, hope never again
This commit is contained in:
@@ -109,6 +109,17 @@ public class AppEngRenderItem extends RenderItem
|
||||
}
|
||||
}
|
||||
|
||||
private void renderQuad( Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6 )
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I( par6 );
|
||||
par1Tessellator.addVertex( par2, par3, 0.0D );
|
||||
par1Tessellator.addVertex( par2, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3, 0.0D );
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
private String getToBeRenderedStackSize( long originalSize )
|
||||
{
|
||||
if( AEConfig.instance.useTerminalUseLargeFont() )
|
||||
@@ -120,15 +131,4 @@ public class AppEngRenderItem extends RenderItem
|
||||
return NUMBER_CONVERTER.toHumanReadableForm( originalSize );
|
||||
}
|
||||
}
|
||||
|
||||
private void renderQuad( Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6 )
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I( par6 );
|
||||
par1Tessellator.addVertex( par2, par3, 0.0D );
|
||||
par1Tessellator.addVertex( par2, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3, 0.0D );
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package appeng.client.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -287,9 +286,9 @@ public class BaseBlockRender
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
if ( info.isValid() )
|
||||
if( info.isValid() )
|
||||
{
|
||||
if ( block.hasSubtypes() )
|
||||
if( block.hasSubtypes() )
|
||||
block.setRenderStateByMeta( item.getItemDamage() );
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
@@ -304,7 +303,7 @@ public class BaseBlockRender
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, item, tess, 0xffffff, renderer );
|
||||
|
||||
if ( block.hasSubtypes() )
|
||||
if( block.hasSubtypes() )
|
||||
info.setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
@@ -312,7 +311,7 @@ public class BaseBlockRender
|
||||
|
||||
static public int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
|
||||
{
|
||||
if ( in == null || in == ForgeDirection.UNKNOWN // 1
|
||||
if( in == null || in == ForgeDirection.UNKNOWN // 1
|
||||
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|
||||
|| up == null || up == ForgeDirection.UNKNOWN )
|
||||
return 0;
|
||||
@@ -326,14 +325,14 @@ public class BaseBlockRender
|
||||
|
||||
public void renderInvBlock( EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
|
||||
{
|
||||
if ( Platform.isDrawing( tess ) )
|
||||
if( Platform.isDrawing( tess ) )
|
||||
tess.draw();
|
||||
|
||||
int meta = 0;
|
||||
if ( block != null && block.hasSubtypes() && item != null )
|
||||
if( block != null && block.hasSubtypes() && item != null )
|
||||
meta = item.getItemDamage();
|
||||
|
||||
if ( sides.contains( ForgeDirection.DOWN ) )
|
||||
if( sides.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, -1.0F, 0.0F );
|
||||
@@ -342,7 +341,7 @@ public class BaseBlockRender
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.UP ) )
|
||||
if( sides.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
@@ -351,7 +350,7 @@ public class BaseBlockRender
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.NORTH ) )
|
||||
if( sides.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, -1.0F );
|
||||
@@ -360,7 +359,7 @@ public class BaseBlockRender
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.SOUTH ) )
|
||||
if( sides.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, 1.0F );
|
||||
@@ -369,7 +368,7 @@ public class BaseBlockRender
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.WEST ) )
|
||||
if( sides.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( -1.0F, 0.0F, 0.0F );
|
||||
@@ -378,7 +377,7 @@ public class BaseBlockRender
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
if ( sides.contains( ForgeDirection.EAST ) )
|
||||
if( sides.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 1.0F, 0.0F, 0.0F );
|
||||
@@ -390,8 +389,8 @@ public class BaseBlockRender
|
||||
|
||||
public IIcon firstNotNull( IIcon... s )
|
||||
{
|
||||
for ( IIcon o : s )
|
||||
if ( o != null )
|
||||
for( IIcon o : s )
|
||||
if( o != null )
|
||||
return o;
|
||||
return ExtraBlockTextures.getMissing();
|
||||
}
|
||||
@@ -413,7 +412,7 @@ public class BaseBlockRender
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
if ( te != null )
|
||||
if( te != null )
|
||||
{
|
||||
forward = te.getForward();
|
||||
up = te.getUp();
|
||||
@@ -437,9 +436,9 @@ public class BaseBlockRender
|
||||
@Nullable
|
||||
public IOrientable getOrientable( AEBaseBlock block, IBlockAccess w, int x, int y, int z )
|
||||
{
|
||||
if ( block.hasBlockTileEntity() )
|
||||
if( block.hasBlockTileEntity() )
|
||||
return (AEBaseTile) block.getTileEntity( w, x, y, z );
|
||||
else if ( block instanceof IOrientableBlock )
|
||||
else if( block instanceof IOrientableBlock )
|
||||
return ( (IOrientableBlock) block ).getOrientable( w, x, y, z );
|
||||
return null;
|
||||
}
|
||||
@@ -472,19 +471,19 @@ public class BaseBlockRender
|
||||
double bY = maxX * x.offsetY + maxY * y.offsetY + maxZ * z.offsetY;
|
||||
double bZ = maxX * x.offsetZ + maxY * y.offsetZ + maxZ * z.offsetZ;
|
||||
|
||||
if ( x.offsetX + y.offsetX + z.offsetX < 0 )
|
||||
if( x.offsetX + y.offsetX + z.offsetX < 0 )
|
||||
{
|
||||
aX += 1;
|
||||
bX += 1;
|
||||
}
|
||||
|
||||
if ( x.offsetY + y.offsetY + z.offsetY < 0 )
|
||||
if( x.offsetY + y.offsetY + z.offsetY < 0 )
|
||||
{
|
||||
aY += 1;
|
||||
bY += 1;
|
||||
}
|
||||
|
||||
if ( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
|
||||
if( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
|
||||
{
|
||||
aZ += 1;
|
||||
bZ += 1;
|
||||
@@ -514,7 +513,7 @@ public class BaseBlockRender
|
||||
double layerBZ = 0.0;
|
||||
|
||||
boolean flip = false;
|
||||
switch ( orientation )
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
|
||||
@@ -594,7 +593,7 @@ public class BaseBlockRender
|
||||
@SideOnly( Side.CLIENT )
|
||||
private void renderFace( Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, double ua, double ub, double va, double vb, IIcon ico, boolean flip )
|
||||
{
|
||||
if ( flip )
|
||||
if( flip )
|
||||
{
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
|
||||
@@ -613,7 +612,7 @@ public class BaseBlockRender
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void renderFace( int x, int y, int z, Block block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation )
|
||||
{
|
||||
switch ( orientation )
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( block, x, y, z, ico );
|
||||
@@ -663,10 +662,10 @@ public class BaseBlockRender
|
||||
|
||||
private double mapFaceUV( int offset, int uv )
|
||||
{
|
||||
if ( offset == 0 )
|
||||
if( offset == 0 )
|
||||
return 0;
|
||||
|
||||
if ( offset > 0 )
|
||||
if( offset > 0 )
|
||||
return uv / 16.0;
|
||||
|
||||
return ( 16.0 - uv ) / 16.0;
|
||||
@@ -684,7 +683,7 @@ public class BaseBlockRender
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if ( Minecraft.isAmbientOcclusionEnabled() )
|
||||
if( Minecraft.isAmbientOcclusionEnabled() )
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
else
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
@@ -707,12 +706,12 @@ public class BaseBlockRender
|
||||
|
||||
protected void applyTESRRotation( double x, double y, double z, ForgeDirection forward, ForgeDirection up )
|
||||
{
|
||||
if ( forward != null && up != null )
|
||||
if( forward != null && up != null )
|
||||
{
|
||||
if ( forward == ForgeDirection.UNKNOWN )
|
||||
if( forward == ForgeDirection.UNKNOWN )
|
||||
forward = ForgeDirection.SOUTH;
|
||||
|
||||
if ( up == ForgeDirection.UNKNOWN )
|
||||
if( up == ForgeDirection.UNKNOWN )
|
||||
up = ForgeDirection.UP;
|
||||
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
@@ -749,7 +748,7 @@ public class BaseBlockRender
|
||||
|
||||
public void doRenderItem( ItemStack itemstack, TileEntity par1EntityItemFrame )
|
||||
{
|
||||
if ( itemstack != null )
|
||||
if( itemstack != null )
|
||||
{
|
||||
EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack );
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
|
||||
@@ -18,29 +18,25 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.TmpFlippableIcon;
|
||||
|
||||
|
||||
public class BlockRenderInfo
|
||||
{
|
||||
|
||||
public BlockRenderInfo(BaseBlockRender inst) {
|
||||
this.rendererInstance = inst;
|
||||
}
|
||||
|
||||
final public BaseBlockRender rendererInstance;
|
||||
|
||||
private boolean useTmp = false;
|
||||
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpNorthIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpEastIcon = new TmpFlippableIcon();
|
||||
private final TmpFlippableIcon tmpWestIcon = new TmpFlippableIcon();
|
||||
|
||||
private boolean useTmp = false;
|
||||
private FlippableIcon topIcon = null;
|
||||
private FlippableIcon bottomIcon = null;
|
||||
private FlippableIcon southIcon = null;
|
||||
@@ -48,7 +44,12 @@ public class BlockRenderInfo
|
||||
private FlippableIcon eastIcon = null;
|
||||
private FlippableIcon westIcon = null;
|
||||
|
||||
public void updateIcons(FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon West)
|
||||
public BlockRenderInfo( BaseBlockRender inst )
|
||||
{
|
||||
this.rendererInstance = inst;
|
||||
}
|
||||
|
||||
public void updateIcons( FlippableIcon Bottom, FlippableIcon Top, FlippableIcon North, FlippableIcon South, FlippableIcon East, FlippableIcon West )
|
||||
{
|
||||
this.topIcon = Top;
|
||||
this.bottomIcon = Bottom;
|
||||
@@ -56,12 +57,11 @@ public class BlockRenderInfo
|
||||
this.northIcon = North;
|
||||
this.eastIcon = East;
|
||||
this.westIcon = West;
|
||||
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcon(IIcon IIcon)
|
||||
public void setTemporaryRenderIcon( IIcon IIcon )
|
||||
{
|
||||
if ( IIcon == null )
|
||||
if( IIcon == null )
|
||||
this.useTmp = false;
|
||||
else
|
||||
{
|
||||
@@ -75,7 +75,7 @@ public class BlockRenderInfo
|
||||
}
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon)
|
||||
public void setTemporaryRenderIcons( IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon )
|
||||
{
|
||||
this.tmpTopIcon.setOriginal( nTopIcon == null ? this.getTexture( ForgeDirection.UP ) : nTopIcon );
|
||||
this.tmpBottomIcon.setOriginal( nBottomIcon == null ? this.getTexture( ForgeDirection.DOWN ) : nBottomIcon );
|
||||
@@ -86,45 +86,45 @@ public class BlockRenderInfo
|
||||
this.useTmp = true;
|
||||
}
|
||||
|
||||
public FlippableIcon getTexture(ForgeDirection dir)
|
||||
public FlippableIcon getTexture( ForgeDirection dir )
|
||||
{
|
||||
if ( this.useTmp )
|
||||
if( this.useTmp )
|
||||
{
|
||||
switch (dir)
|
||||
switch( dir )
|
||||
{
|
||||
case DOWN:
|
||||
return this.tmpBottomIcon;
|
||||
case UP:
|
||||
return this.tmpTopIcon;
|
||||
case NORTH:
|
||||
return this.tmpNorthIcon;
|
||||
case SOUTH:
|
||||
return this.tmpSouthIcon;
|
||||
case EAST:
|
||||
return this.tmpEastIcon;
|
||||
case WEST:
|
||||
return this.tmpWestIcon;
|
||||
default:
|
||||
break;
|
||||
case DOWN:
|
||||
return this.tmpBottomIcon;
|
||||
case UP:
|
||||
return this.tmpTopIcon;
|
||||
case NORTH:
|
||||
return this.tmpNorthIcon;
|
||||
case SOUTH:
|
||||
return this.tmpSouthIcon;
|
||||
case EAST:
|
||||
return this.tmpEastIcon;
|
||||
case WEST:
|
||||
return this.tmpWestIcon;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
switch( dir )
|
||||
{
|
||||
case DOWN:
|
||||
return this.bottomIcon;
|
||||
case UP:
|
||||
return this.topIcon;
|
||||
case NORTH:
|
||||
return this.northIcon;
|
||||
case SOUTH:
|
||||
return this.southIcon;
|
||||
case EAST:
|
||||
return this.eastIcon;
|
||||
case WEST:
|
||||
return this.westIcon;
|
||||
default:
|
||||
break;
|
||||
case DOWN:
|
||||
return this.bottomIcon;
|
||||
case UP:
|
||||
return this.topIcon;
|
||||
case NORTH:
|
||||
return this.northIcon;
|
||||
case SOUTH:
|
||||
return this.southIcon;
|
||||
case EAST:
|
||||
return this.eastIcon;
|
||||
case WEST:
|
||||
return this.westIcon;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return this.topIcon;
|
||||
@@ -134,5 +134,4 @@ public class BlockRenderInfo
|
||||
{
|
||||
return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
this.az = ForgeDirection.SOUTH;
|
||||
this.ay = ForgeDirection.UP;
|
||||
this.color = HEX_WHITE;
|
||||
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
|
||||
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
|
||||
this.maybeBaseBlock = this.maybeBlock.transform( new BaseBlockTransformFunction() );
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
public double getBound( ForgeDirection side )
|
||||
{
|
||||
switch ( side )
|
||||
switch( side )
|
||||
{
|
||||
default:
|
||||
case UNKNOWN:
|
||||
@@ -129,7 +129,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
public void setRenderColor( int color )
|
||||
{
|
||||
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
final BlockCableBus cableBus = (BlockCableBus) block;
|
||||
cableBus.setRenderColor( color );
|
||||
@@ -150,7 +150,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
public void setBounds( double[] bounds )
|
||||
{
|
||||
if ( bounds == null || bounds.length != 6 )
|
||||
if( bounds == null || bounds.length != 6 )
|
||||
return;
|
||||
|
||||
this.minX = bounds[0];
|
||||
@@ -161,7 +161,6 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
this.maxZ = bounds[5];
|
||||
}
|
||||
|
||||
|
||||
private static class BoundBoxCalculator implements IPartCollisionHelper
|
||||
{
|
||||
private final BusRenderHelper helper;
|
||||
@@ -183,7 +182,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void addBox( double minX, double minY, double minZ, double maxX, double maxY, double maxZ )
|
||||
{
|
||||
if ( this.started )
|
||||
if( this.started )
|
||||
{
|
||||
this.minX = Math.min( this.minX, (float) minX );
|
||||
this.minY = Math.min( this.minY, (float) minY );
|
||||
@@ -227,17 +226,33 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} @Override
|
||||
}
|
||||
|
||||
|
||||
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
|
||||
{
|
||||
@Nullable
|
||||
@Override
|
||||
public AEBaseBlock apply( Block input )
|
||||
{
|
||||
if( input instanceof AEBaseBlock )
|
||||
{
|
||||
return ( (AEBaseBlock) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForPass( int pass )
|
||||
{
|
||||
this.renderingForPass = pass;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean renderThis()
|
||||
{
|
||||
if ( this.renderingForPass == this.currentPass || this.noAlphaPass )
|
||||
if( this.renderingForPass == this.currentPass || this.noAlphaPass )
|
||||
{
|
||||
this.itemsRendered++;
|
||||
return true;
|
||||
@@ -259,7 +274,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
|
||||
|
||||
if ( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
|
||||
if( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
|
||||
{
|
||||
rbw.populate( sim );
|
||||
rbw.faces = EnumSet.allOf( ForgeDirection.class );
|
||||
@@ -276,7 +291,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
rbw.faces.clear();
|
||||
|
||||
this.bbc.started = false;
|
||||
if ( p == null )
|
||||
if( p == null )
|
||||
{
|
||||
this.bbc.minX = this.bbc.minY = this.bbc.minZ = 0;
|
||||
this.bbc.maxX = this.bbc.maxY = this.bbc.maxZ = 16;
|
||||
@@ -285,18 +300,18 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
p.getBoxes( this.bbc );
|
||||
|
||||
if ( this.bbc.minX < 1 )
|
||||
if( this.bbc.minX < 1 )
|
||||
this.bbc.minX = 1;
|
||||
if ( this.bbc.minY < 1 )
|
||||
if( this.bbc.minY < 1 )
|
||||
this.bbc.minY = 1;
|
||||
if ( this.bbc.minZ < 1 )
|
||||
if( this.bbc.minZ < 1 )
|
||||
this.bbc.minZ = 1;
|
||||
|
||||
if ( this.bbc.maxX > 15 )
|
||||
if( this.bbc.maxX > 15 )
|
||||
this.bbc.maxX = 15;
|
||||
if ( this.bbc.maxY > 15 )
|
||||
if( this.bbc.maxY > 15 )
|
||||
this.bbc.maxY = 15;
|
||||
if ( this.bbc.maxZ > 15 )
|
||||
if( this.bbc.maxZ > 15 )
|
||||
this.bbc.maxZ = 15;
|
||||
}
|
||||
|
||||
@@ -304,7 +319,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
this.bbr.renderBlockBounds( rbw, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
|
||||
|
||||
for ( Block block : this.maybeBlock.asSet() )
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
rbw.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
@@ -338,7 +353,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void setTexture( IIcon ico )
|
||||
{
|
||||
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
baseBlock.getRendererInstance().setTemporaryRenderIcon( ico );
|
||||
}
|
||||
@@ -356,7 +371,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
list[4] = West;
|
||||
list[5] = East;
|
||||
|
||||
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
baseBlock.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( ForgeDirection.UP ).ordinal()], list[this.mapRotation( ForgeDirection.DOWN ).ordinal()], list[this.mapRotation( ForgeDirection.SOUTH ).ordinal()], list[this.mapRotation( ForgeDirection.NORTH ).ordinal()], list[this.mapRotation( ForgeDirection.EAST ).ordinal()], list[this.mapRotation( ForgeDirection.WEST ).ordinal()] );
|
||||
}
|
||||
@@ -368,30 +383,30 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
ForgeDirection up = this.ay;
|
||||
ForgeDirection west = ForgeDirection.UNKNOWN;
|
||||
|
||||
if ( forward == null || up == null )
|
||||
if( forward == null || up == null )
|
||||
return dir;
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
|
||||
for ( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
|
||||
if ( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
|
||||
for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
|
||||
if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
|
||||
west = dx;
|
||||
|
||||
if ( dir == forward )
|
||||
if( dir == forward )
|
||||
return ForgeDirection.SOUTH;
|
||||
if ( dir == forward.getOpposite() )
|
||||
if( dir == forward.getOpposite() )
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
if ( dir == up )
|
||||
if( dir == up )
|
||||
return ForgeDirection.UP;
|
||||
if ( dir == up.getOpposite() )
|
||||
if( dir == up.getOpposite() )
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
if ( dir == west )
|
||||
if( dir == west )
|
||||
return ForgeDirection.WEST;
|
||||
if ( dir == west.getOpposite() )
|
||||
if( dir == west.getOpposite() )
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
@@ -402,7 +417,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
|
||||
|
||||
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), baseBlock, null, Tessellator.instance, this.color, renderer );
|
||||
}
|
||||
@@ -414,7 +429,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
renderer.setRenderBounds( this.minX / 16.0, this.minY / 16.0, this.minZ / 16.0, this.maxX / 16.0, this.maxY / 16.0, this.maxZ / 16.0 );
|
||||
this.setTexture( IIcon );
|
||||
|
||||
for ( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.of( face ), baseBlock, null, Tessellator.instance, this.color, renderer );
|
||||
}
|
||||
@@ -423,10 +438,10 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void renderBlock( int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
if ( !this.renderThis() )
|
||||
if( !this.renderThis() )
|
||||
return;
|
||||
|
||||
for ( Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
for( Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
final AEBaseBlock block = (AEBaseBlock) multiPart;
|
||||
|
||||
@@ -452,7 +467,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public Block getBlock()
|
||||
{
|
||||
for ( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
return block;
|
||||
}
|
||||
@@ -474,10 +489,10 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
if ( !this.renderThis() )
|
||||
if( !this.renderThis() )
|
||||
return;
|
||||
|
||||
for ( Block block : this.maybeBlock.asSet() )
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
@@ -486,10 +501,10 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer )
|
||||
{
|
||||
if ( !this.renderThis() )
|
||||
if( !this.renderThis() )
|
||||
return;
|
||||
|
||||
switch ( face )
|
||||
switch( face )
|
||||
{
|
||||
case DOWN:
|
||||
face = this.ay.getOpposite();
|
||||
@@ -515,7 +530,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
break;
|
||||
}
|
||||
|
||||
for ( Block block : this.maybeBlock.asSet() )
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderCutoutFace( block, ico, x, y, z, renderer, face, edgeThickness );
|
||||
}
|
||||
@@ -524,11 +539,11 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
@Override
|
||||
public void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer )
|
||||
{
|
||||
if ( !this.renderThis() )
|
||||
if( !this.renderThis() )
|
||||
return;
|
||||
|
||||
this.prepareBounds( renderer );
|
||||
switch ( face )
|
||||
switch( face )
|
||||
{
|
||||
case DOWN:
|
||||
face = this.ay.getOpposite();
|
||||
@@ -554,7 +569,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
break;
|
||||
}
|
||||
|
||||
for ( Block block : this.maybeBlock.asSet() )
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderFace( x, y, z, block, ico, renderer, face );
|
||||
}
|
||||
@@ -577,19 +592,4 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
return this.az;
|
||||
}
|
||||
|
||||
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
|
||||
{
|
||||
@Nullable
|
||||
@Override
|
||||
public AEBaseBlock apply( Block input )
|
||||
{
|
||||
if ( input instanceof AEBaseBlock )
|
||||
{
|
||||
return ( (AEBaseBlock) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -42,46 +43,31 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class BusRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
public static final BusRenderer INSTANCE = new BusRenderer();
|
||||
|
||||
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
|
||||
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
|
||||
|
||||
public IPart getRenderer(ItemStack is, IPartItem c)
|
||||
{
|
||||
int id = (Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET) | is.getItemDamage();
|
||||
|
||||
IPart part = RENDER_PART.get( id );
|
||||
if ( part == null )
|
||||
{
|
||||
part = c.createPartFromItemStack( is );
|
||||
if ( part != null )
|
||||
RENDER_PART.put( id, part );
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
||||
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
if ( item == null )
|
||||
if( item == null )
|
||||
return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -90,8 +76,7 @@ public class BusRenderer implements IItemRenderer
|
||||
GL11.glEnable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem
|
||||
&& ((IAlphaPassItem) item.getItem()).useAlphaPass( item ) )
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) && item.getItem() instanceof IAlphaPassItem && ( (IAlphaPassItem) item.getItem() ).useAlphaPass( item ) )
|
||||
{
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
@@ -105,19 +90,19 @@ public class BusRenderer implements IItemRenderer
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
}
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
{
|
||||
GL11.glTranslatef( -0.2f, -0.1f, -0.3f );
|
||||
}
|
||||
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
GL11.glScalef( 0.8f, 0.8f, 0.8f );
|
||||
GL11.glTranslatef( -0.8f, -0.87f, -0.7f );
|
||||
}
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
|
||||
|
||||
GL11.glTranslated( 0.2, 0.3, 0.1 );
|
||||
@@ -138,29 +123,29 @@ public class BusRenderer implements IItemRenderer
|
||||
this.renderer.useInventoryTint = false;
|
||||
this.renderer.overrideBlockTexture = null;
|
||||
|
||||
if ( item.getItem() instanceof IFacadeItem )
|
||||
if( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
IFacadePart fp = fi.createPartFromItemStack( item, ForgeDirection.SOUTH );
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
{
|
||||
GL11.glRotatef( 160.0f, 0.0f, 1.0f, 0.0f );
|
||||
GL11.glTranslated( -0.4, 0.1, -1.6 );
|
||||
}
|
||||
|
||||
if ( fp != null )
|
||||
if( fp != null )
|
||||
fp.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPart ip = this.getRenderer( item, (IPartItem) item.getItem() );
|
||||
if ( ip != null )
|
||||
if( ip != null )
|
||||
{
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
int depth = ip.cableConnectionRenderTo();
|
||||
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * (8 - depth) - 0.06f );
|
||||
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f );
|
||||
}
|
||||
|
||||
ip.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
|
||||
@@ -172,4 +157,19 @@ public class BusRenderer implements IItemRenderer
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public IPart getRenderer( ItemStack is, IPartItem c )
|
||||
{
|
||||
int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage();
|
||||
|
||||
IPart part = RENDER_PART.get( id );
|
||||
if( part == null )
|
||||
{
|
||||
part = c.createPartFromItemStack( is );
|
||||
if( part != null )
|
||||
RENDER_PART.put( id, part );
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
@@ -33,6 +34,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.parts.BusCollisionHelper;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
|
||||
public class CableRenderHelper
|
||||
{
|
||||
|
||||
@@ -43,70 +45,21 @@ public class CableRenderHelper
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private void setSide(ForgeDirection s)
|
||||
{
|
||||
ForgeDirection ax;
|
||||
ForgeDirection ay;
|
||||
ForgeDirection az;
|
||||
|
||||
switch (s)
|
||||
{
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
|
||||
}
|
||||
|
||||
public void renderStatic(CableBusContainer cableBusContainer, IFacadeContainer iFacadeContainer)
|
||||
public void renderStatic( CableBusContainer cableBusContainer, IFacadeContainer iFacadeContainer )
|
||||
{
|
||||
TileEntity te = cableBusContainer.getTile();
|
||||
RenderBlocksWorkaround renderer = BusRenderer.INSTANCE.renderer;
|
||||
|
||||
if ( renderer.overrideBlockTexture != null )
|
||||
if( renderer.overrideBlockTexture != null )
|
||||
BusRenderHelper.INSTANCE.setPass( 0 );
|
||||
|
||||
if ( renderer.blockAccess == null )
|
||||
if( renderer.blockAccess == null )
|
||||
renderer.blockAccess = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
for (ForgeDirection s : ForgeDirection.values())
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if ( part != null )
|
||||
if( part != null )
|
||||
{
|
||||
this.setSide( s );
|
||||
renderer.renderAllFaces = true;
|
||||
@@ -122,16 +75,16 @@ public class CableRenderHelper
|
||||
}
|
||||
}
|
||||
|
||||
if ( !iFacadeContainer.isEmpty() )
|
||||
if( !iFacadeContainer.isEmpty() )
|
||||
{
|
||||
/**
|
||||
* snag list of boxes...
|
||||
*/
|
||||
List<AxisAlignedBB> boxes = new ArrayList<AxisAlignedBB>();
|
||||
for (ForgeDirection s : ForgeDirection.values())
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if ( part != null )
|
||||
if( part != null )
|
||||
{
|
||||
this.setSide( s );
|
||||
BusRenderHelper brh = BusRenderHelper.INSTANCE;
|
||||
@@ -144,7 +97,7 @@ public class CableRenderHelper
|
||||
double min = 2.0 / 16.0;
|
||||
double max = 14.0 / 16.0;
|
||||
|
||||
for (AxisAlignedBB bb : boxes)
|
||||
for( AxisAlignedBB bb : boxes )
|
||||
{
|
||||
int o = 0;
|
||||
o += bb.maxX > max ? 1 : 0;
|
||||
@@ -154,23 +107,23 @@ public class CableRenderHelper
|
||||
o += bb.minY < min ? 1 : 0;
|
||||
o += bb.minZ < min ? 1 : 0;
|
||||
|
||||
if ( o >= 2 )
|
||||
if( o >= 2 )
|
||||
useThinFacades = true;
|
||||
}
|
||||
|
||||
for (ForgeDirection s : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
IFacadePart fPart = iFacadeContainer.getFacade( s );
|
||||
if ( fPart != null )
|
||||
if( fPart != null )
|
||||
{
|
||||
AxisAlignedBB b = null;
|
||||
fPart.setThinFacades( useThinFacades );
|
||||
AxisAlignedBB pb = fPart.getPrimaryBox();
|
||||
for (AxisAlignedBB bb : boxes)
|
||||
for( AxisAlignedBB bb : boxes )
|
||||
{
|
||||
if ( bb.intersectsWith( pb ) )
|
||||
if( bb.intersectsWith( pb ) )
|
||||
{
|
||||
if ( b == null )
|
||||
if( b == null )
|
||||
b = bb;
|
||||
else
|
||||
{
|
||||
@@ -188,8 +141,7 @@ public class CableRenderHelper
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
this.setSide( s );
|
||||
fPart.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b,
|
||||
cableBusContainer.getPart( s ) == null );
|
||||
fPart.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b, cableBusContainer.getPart( s ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,55 +152,104 @@ public class CableRenderHelper
|
||||
}
|
||||
}
|
||||
|
||||
public void renderDynamic(CableBusContainer cableBusContainer, double x, double y, double z)
|
||||
private void setSide( ForgeDirection s )
|
||||
{
|
||||
for (ForgeDirection s : ForgeDirection.values())
|
||||
ForgeDirection ax;
|
||||
ForgeDirection ay;
|
||||
ForgeDirection az;
|
||||
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
|
||||
}
|
||||
|
||||
public void renderDynamic( CableBusContainer cableBusContainer, double x, double y, double z )
|
||||
{
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if ( part != null )
|
||||
if( part != null )
|
||||
{
|
||||
ForgeDirection ax;
|
||||
ForgeDirection ay;
|
||||
ForgeDirection az;
|
||||
|
||||
switch (s)
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
|
||||
@@ -256,5 +257,4 @@ public class CableRenderHelper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,30 +18,32 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
|
||||
public class ItemRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
public static final ItemRenderer INSTANCE = new ItemRenderer();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
@@ -51,9 +53,9 @@ public class ItemRenderer implements IItemRenderer
|
||||
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
|
||||
|
||||
WorldRender.INSTANCE.renderItemBlock( item, type, data );
|
||||
@@ -61,5 +63,4 @@ public class ItemRenderer implements IItemRenderer
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -30,24 +31,31 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
|
||||
public class SpatialSkyRender extends IRenderHandler
|
||||
{
|
||||
|
||||
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
|
||||
|
||||
private final Random random = new Random();
|
||||
private long cycle = 0;
|
||||
private final int dspList;
|
||||
private long cycle = 0;
|
||||
|
||||
public SpatialSkyRender() {
|
||||
public SpatialSkyRender()
|
||||
{
|
||||
this.dspList = GLAllocation.generateDisplayLists( 1 );
|
||||
}
|
||||
|
||||
public static IRenderHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(float partialTicks, WorldClient world, Minecraft mc)
|
||||
public void render( float partialTicks, WorldClient world, Minecraft mc )
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
if ( now - this.cycle > 2000 )
|
||||
if( now - this.cycle > 2000 )
|
||||
{
|
||||
this.cycle = now;
|
||||
GL11.glNewList( this.dspList, GL11.GL_COMPILE );
|
||||
@@ -57,59 +65,59 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
float fade = now - this.cycle;
|
||||
fade /= 1000;
|
||||
fade = 0.15f * (1.0f - Math.abs( (fade - 1.0f) * (fade - 1.0f) ));
|
||||
fade = 0.15f * ( 1.0f - Math.abs( ( fade - 1.0f ) * ( fade - 1.0f ) ) );
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
GL11.glDisable(GL11.GL_FOG);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glDisable( GL11.GL_FOG );
|
||||
GL11.glDisable( GL11.GL_ALPHA_TEST );
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
GL11.glDepthMask( false );
|
||||
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 1 )
|
||||
{
|
||||
GL11.glRotatef( 90.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 2)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 2 )
|
||||
{
|
||||
GL11.glRotatef( -90.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 3)
|
||||
{
|
||||
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
if( i == 3 )
|
||||
{
|
||||
GL11.glRotatef( 180.0F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
if (i == 4)
|
||||
{
|
||||
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
if( i == 4 )
|
||||
{
|
||||
GL11.glRotatef( 90.0F, 0.0F, 0.0F, 1.0F );
|
||||
}
|
||||
|
||||
if (i == 5)
|
||||
{
|
||||
GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
|
||||
}
|
||||
if( i == 5 )
|
||||
{
|
||||
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F );
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(0);
|
||||
tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D);
|
||||
tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D);
|
||||
tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D);
|
||||
tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I( 0 );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDepthMask( true );
|
||||
|
||||
if ( fade > 0.0f )
|
||||
if( fade > 0.0f )
|
||||
{
|
||||
GL11.glDisable( GL11.GL_FOG );
|
||||
GL11.glDisable( GL11.GL_ALPHA_TEST );
|
||||
@@ -129,7 +137,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
GL11.glPopAttrib();
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
}
|
||||
|
||||
private void renderTwinkles()
|
||||
@@ -137,7 +145,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
for (int i = 0; i < 50; ++i)
|
||||
for( int i = 0; i < 50; ++i )
|
||||
{
|
||||
double iX = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
double iY = this.random.nextFloat() * 2.0F - 1.0F;
|
||||
@@ -145,7 +153,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
double d3 = 0.05F + this.random.nextFloat() * 0.1F;
|
||||
double dist = iX * iX + iY * iY + iZ * iZ;
|
||||
|
||||
if ( dist < 1.0D && dist > 0.01D )
|
||||
if( dist < 1.0D && dist > 0.01D )
|
||||
{
|
||||
dist = 1.0D / Math.sqrt( dist );
|
||||
iX *= dist;
|
||||
@@ -164,11 +172,11 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
double d15 = Math.sin( d14 );
|
||||
double d16 = Math.cos( d14 );
|
||||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
for( int j = 0; j < 4; ++j )
|
||||
{
|
||||
double d17 = 0.0D;
|
||||
double d18 = ((j & 2) - 1) * d3;
|
||||
double d19 = ((j + 1 & 2) - 1) * d3;
|
||||
double d18 = ( ( j & 2 ) - 1 ) * d3;
|
||||
double d19 = ( ( j + 1 & 2 ) - 1 ) * d3;
|
||||
double d20 = d18 * d16 - d19 * d15;
|
||||
double d21 = d19 * d16 + d18 * d15;
|
||||
double d22 = d20 * d12 + d17 * d13;
|
||||
@@ -182,10 +190,4 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static IRenderHandler getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -34,7 +35,8 @@ import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
@@ -43,26 +45,27 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
final BaseBlockRender blkRender;
|
||||
final double MAX_DISTANCE;
|
||||
|
||||
public TESRWrapper(BaseBlockRender render) {
|
||||
public TESRWrapper( BaseBlockRender render )
|
||||
{
|
||||
this.blkRender = render;
|
||||
this.MAX_DISTANCE = this.blkRender.getTesrRenderDistance();
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f)
|
||||
final public void renderTileEntityAt( TileEntity te, double x, double y, double z, float f )
|
||||
{
|
||||
if ( te instanceof AEBaseTile )
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
Block b = te.getBlockType();
|
||||
|
||||
if ( b instanceof AEBaseBlock && ((AEBaseTile) te).requiresTESR() )
|
||||
if( b instanceof AEBaseBlock && ( (AEBaseTile) te ).requiresTESR() )
|
||||
{
|
||||
if ( Math.abs( x ) > this.MAX_DISTANCE || Math.abs( y ) > this.MAX_DISTANCE || Math.abs( z ) > this.MAX_DISTANCE )
|
||||
if( Math.abs( x ) > this.MAX_DISTANCE || Math.abs( y ) > this.MAX_DISTANCE || Math.abs( z ) > this.MAX_DISTANCE )
|
||||
return;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
if ( Platform.isDrawing( tess ) )
|
||||
if( Platform.isDrawing( tess ) )
|
||||
return;
|
||||
|
||||
try
|
||||
@@ -73,20 +76,19 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
this.renderBlocksInstance.blockAccess = te.getWorldObj();
|
||||
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, this.renderBlocksInstance );
|
||||
|
||||
if ( Platform.isDrawing( tess ) )
|
||||
if( Platform.isDrawing( tess ) )
|
||||
throw new RuntimeException( "Error during rendering." );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
catch (Throwable t)
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.severe( "Hi, Looks like there was a crash while rendering something..." );
|
||||
t.printStackTrace();
|
||||
AELog.severe( "MC will now crash ( probably )!" );
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -34,33 +35,34 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
private final RenderBlocks renderer = new RenderBlocks();
|
||||
final int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static final WorldRender INSTANCE = new WorldRender();
|
||||
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
|
||||
final int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
private final RenderBlocks renderer = new RenderBlocks();
|
||||
boolean hasError = false;
|
||||
|
||||
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
|
||||
private WorldRender()
|
||||
{
|
||||
}
|
||||
|
||||
void setRender(AEBaseBlock in, BaseBlockRender r)
|
||||
void setRender( AEBaseBlock in, BaseBlockRender r )
|
||||
{
|
||||
this.blockRenders.put( in, r );
|
||||
}
|
||||
|
||||
private WorldRender() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
public void renderInventoryBlock( Block block, int metadata, int modelID, RenderBlocks renderer )
|
||||
{
|
||||
// wtf is this for?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer )
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) block;
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
@@ -68,7 +70,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int modelId)
|
||||
public boolean shouldRender3DInInventory( int modelId )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -79,10 +81,15 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
return this.renderID;
|
||||
}
|
||||
|
||||
public void renderItemBlock(ItemStack item, ItemRenderType type, Object[] data)
|
||||
private BaseBlockRender getRender( AEBaseBlock block )
|
||||
{
|
||||
return block.getRendererInstance().rendererInstance;
|
||||
}
|
||||
|
||||
public void renderItemBlock( ItemStack item, ItemRenderType type, Object[] data )
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( item.getItem() );
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
AEBaseBlock block = (AEBaseBlock) blk;
|
||||
this.renderer.setRenderBoundsFromBlock( block );
|
||||
@@ -93,7 +100,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !this.hasError )
|
||||
if( !this.hasError )
|
||||
{
|
||||
this.hasError = true;
|
||||
AELog.severe( "Invalid render - item/block mismatch" );
|
||||
@@ -102,9 +109,4 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private BaseBlockRender getRender(AEBaseBlock block)
|
||||
{
|
||||
return block.getRendererInstance().rendererInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,90 +47,17 @@ import appeng.parts.networking.PartCable;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvider
|
||||
{
|
||||
|
||||
IIcon getConnectedCable(IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered)
|
||||
public RenderBlockAssembler()
|
||||
{
|
||||
final int tileYPos = y + side.offsetY;
|
||||
if ( -1 < tileYPos && tileYPos < 256 )
|
||||
{
|
||||
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
if ( ne instanceof IGridHost && ne instanceof IPartHost )
|
||||
{
|
||||
IPartHost ph = (IPartHost) ne;
|
||||
IPart pcx = ph.getPart( ForgeDirection.UNKNOWN );
|
||||
if ( pcx instanceof PartCable )
|
||||
{
|
||||
PartCable pc = (PartCable) pcx;
|
||||
if ( pc.isConnected( side.getOpposite() ) )
|
||||
{
|
||||
if ( covered )
|
||||
return pc.getCoveredTexture( pc.getCableColor() );
|
||||
return pc.getGlassTexture( pc.getCableColor() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void renderCableAt(double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, double pull, boolean covered)
|
||||
{
|
||||
IIcon texture = null;
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.WEST, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.EAST, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.NORTH, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.SOUTH, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.DOWN, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.UP, covered ) );
|
||||
if ( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
public RenderBlockAssembler() {
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, 0 ) );
|
||||
|
||||
@@ -177,14 +104,14 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
BlockMolecularAssembler blk = (BlockMolecularAssembler) block;
|
||||
TileMolecularAssembler tma = blk.getTileEntity( world, x, y, z );
|
||||
|
||||
if ( BlockMolecularAssembler.booleanAlphaPass )
|
||||
if( BlockMolecularAssembler.booleanAlphaPass )
|
||||
{
|
||||
if ( tma.isPowered() )
|
||||
if( tma.isPowered() )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
TaughtIcon lights = new TaughtIcon( ExtraBlockTextures.BlockMolecularAssemblerLights.getIcon(), -2.0f );
|
||||
@@ -274,8 +201,83 @@ public class RenderBlockAssembler extends BaseBlockRender implements IBoxProvide
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderCableAt( double Thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, double pull, boolean covered )
|
||||
{
|
||||
IIcon texture = null;
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.WEST, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - Thickness, 0.5D - Thickness, 0.5D - Thickness - pull, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.EAST, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D - Thickness, 1.0D, 0.5D + Thickness, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.NORTH, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.0D, 0.5D + Thickness, 0.5D + Thickness, 0.5D - Thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.SOUTH, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D + Thickness, 0.5D + Thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.DOWN, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.0D, 0.5D - Thickness, 0.5D + Thickness, 0.5D - Thickness - pull, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.UP, covered ) );
|
||||
if( texture != null )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - Thickness, 0.5D + Thickness + pull, 0.5D - Thickness, 0.5D + Thickness, 1.0D, 0.5D + Thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
IIcon getConnectedCable( IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered )
|
||||
{
|
||||
final int tileYPos = y + side.offsetY;
|
||||
if( -1 < tileYPos && tileYPos < 256 )
|
||||
{
|
||||
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
if( ne instanceof IGridHost && ne instanceof IPartHost )
|
||||
{
|
||||
IPartHost ph = (IPartHost) ne;
|
||||
IPart pcx = ph.getPart( ForgeDirection.UNKNOWN );
|
||||
if( pcx instanceof PartCable )
|
||||
{
|
||||
PartCable pc = (PartCable) pcx;
|
||||
if( pc.isConnected( side.getOpposite() ) )
|
||||
{
|
||||
if( covered )
|
||||
return pc.getCoveredTexture( pc.getCableColor() );
|
||||
return pc.getGlassTexture( pc.getCableColor() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes(IPartCollisionHelper bch)
|
||||
public void getBoxes( IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 0, 0, 0, 16, 16, 16 );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -42,15 +43,17 @@ import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockCharger extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockCharger() {
|
||||
public RenderBlockCharger()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
@@ -78,11 +81,10 @@ public class RenderBlockCharger extends BaseBlockRender
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
@@ -124,13 +126,13 @@ public class RenderBlockCharger extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
ItemStack sis = null;
|
||||
if ( tile instanceof IInventory )
|
||||
sis = ((IInventory) tile).getStackInSlot( 0 );
|
||||
if( tile instanceof IInventory )
|
||||
sis = ( (IInventory) tile ).getStackInSlot( 0 );
|
||||
|
||||
if ( sis != null )
|
||||
if( sis != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
@@ -142,7 +144,7 @@ public class RenderBlockCharger extends BaseBlockRender
|
||||
GL11.glScalef( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
if( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
{
|
||||
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
@@ -162,7 +164,7 @@ public class RenderBlockCharger extends BaseBlockRender
|
||||
|
||||
this.doRenderItem( sis, tile );
|
||||
}
|
||||
catch (Exception err)
|
||||
catch( Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
@@ -170,5 +172,4 @@ public class RenderBlockCharger extends BaseBlockRender
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -28,15 +29,17 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
|
||||
public class RenderBlockController extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockController() {
|
||||
public RenderBlockController()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
|
||||
boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y, z ) instanceof TileController;
|
||||
@@ -49,12 +52,12 @@ public class RenderBlockController extends BaseBlockRender
|
||||
|
||||
ExtraBlockTextures lights = null;
|
||||
|
||||
if ( xx && !yy && !zz )
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
if( isConflict )
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
@@ -67,12 +70,12 @@ public class RenderBlockController extends BaseBlockRender
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
else if ( !xx && yy && !zz )
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
if( isConflict )
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
@@ -83,12 +86,12 @@ public class RenderBlockController extends BaseBlockRender
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateNorth = 0;
|
||||
}
|
||||
else if ( !xx && !yy && zz )
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
if ( hasPower )
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
if( isConflict )
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
else
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
@@ -100,33 +103,32 @@ public class RenderBlockController extends BaseBlockRender
|
||||
renderer.uvRotateSouth = 1;
|
||||
renderer.uvRotateTop = 0;
|
||||
}
|
||||
else if ( (xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) >= 2 )
|
||||
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||
{
|
||||
int v = (Math.abs( x ) + Math.abs( y ) + Math.abs( z )) % 2;
|
||||
int v = ( Math.abs( x ) + Math.abs( y ) + Math.abs( z ) ) % 2;
|
||||
renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
if ( v == 0 )
|
||||
if( v == 0 )
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideA.getIcon() );
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideB.getIcon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( hasPower )
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerPowered.getIcon() );
|
||||
if ( isConflict )
|
||||
if( isConflict )
|
||||
lights = ExtraBlockTextures.BlockControllerConflict;
|
||||
else
|
||||
lights = ExtraBlockTextures.BlockControllerLights;
|
||||
}
|
||||
else
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
if ( lights != null )
|
||||
if( lights != null )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
|
||||
@@ -143,9 +145,9 @@ public class RenderBlockController extends BaseBlockRender
|
||||
return out;
|
||||
}
|
||||
|
||||
private TileEntity getTileEntity(IBlockAccess world, int x, int y, int z)
|
||||
private TileEntity getTileEntity( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
if ( y >= 0 )
|
||||
if( y >= 0 )
|
||||
return world.getTileEntity( x, y, z );
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -40,26 +41,29 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
|
||||
|
||||
public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
{
|
||||
|
||||
protected RenderBlockCraftingCPU(boolean useTESR, int range) {
|
||||
protected RenderBlockCraftingCPU( boolean useTESR, int range )
|
||||
{
|
||||
super( useTESR, range );
|
||||
}
|
||||
|
||||
public RenderBlockCraftingCPU() {
|
||||
public RenderBlockCraftingCPU()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
IIcon theIcon = null;
|
||||
boolean formed = false;
|
||||
boolean emitsLight = false;
|
||||
|
||||
TileCraftingTile ct = blk.getTileEntity( w, x, y, z );
|
||||
if ( ct != null && ct.isFormed() )
|
||||
if( ct != null && ct.isFormed() )
|
||||
{
|
||||
formed = true;
|
||||
emitsLight = ct.isPowered();
|
||||
@@ -67,18 +71,18 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
int meta = w.getBlockMetadata( x, y, z ) & 3;
|
||||
|
||||
boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
|
||||
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | (formed ? 8 : 0) );
|
||||
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
|
||||
|
||||
IIcon nonForward = theIcon;
|
||||
if ( isMonitor )
|
||||
if( isMonitor )
|
||||
{
|
||||
for ( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
for( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
nonForward = craftingBlock.getIcon( 0, meta | ( formed ? 8 : 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( formed && renderer.overrideBlockTexture == null )
|
||||
if( formed && renderer.overrideBlockTexture == null )
|
||||
{
|
||||
renderer = BusRenderer.INSTANCE.renderer;
|
||||
BusRenderHelper i = BusRenderHelper.INSTANCE;
|
||||
@@ -92,7 +96,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
{
|
||||
ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
|
||||
}
|
||||
catch (Throwable ignored)
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -115,14 +119,13 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.NORTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.SOUTH );
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
i.setBounds( this.fso( side, lowX, ForgeDirection.WEST ), this.fso( side, lowY, ForgeDirection.DOWN ), this.fso( side, lowZ, ForgeDirection.NORTH ),
|
||||
this.fso( side, highX, ForgeDirection.EAST ), this.fso( side, highY, ForgeDirection.UP ), this.fso( side, highZ, ForgeDirection.SOUTH ) );
|
||||
i.setBounds( this.fso( side, lowX, ForgeDirection.WEST ), this.fso( side, lowY, ForgeDirection.DOWN ), this.fso( side, lowZ, ForgeDirection.NORTH ), this.fso( side, highX, ForgeDirection.EAST ), this.fso( side, highY, ForgeDirection.UP ), this.fso( side, highZ, ForgeDirection.SOUTH ) );
|
||||
i.prepareBounds( renderer );
|
||||
|
||||
boolean LocalEmit = emitsLight;
|
||||
if ( blk instanceof BlockCraftingMonitor && ct.getForward() != side )
|
||||
if( blk instanceof BlockCraftingMonitor && ct.getForward() != side )
|
||||
LocalEmit = false;
|
||||
|
||||
this.handleSide( blk, meta, x, y, z, i, renderer, ct.getForward() == side ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
|
||||
@@ -144,74 +147,75 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCorner(BusRenderHelper i, RenderBlocks renderer, IBlockAccess w, int x, int y, int z, ForgeDirection up, ForgeDirection east,
|
||||
ForgeDirection south)
|
||||
private boolean isConnected( IBlockAccess w, int x, int y, int z, ForgeDirection side )
|
||||
{
|
||||
if ( this.isConnected( w, x, y, z, up ) )
|
||||
final int tileYPos = y + side.offsetY;
|
||||
if( 0 <= tileYPos && tileYPos <= 255 )
|
||||
{
|
||||
final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
|
||||
return tile instanceof TileCraftingTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCorner( BusRenderHelper i, RenderBlocks renderer, IBlockAccess w, int x, int y, int z, ForgeDirection up, ForgeDirection east, ForgeDirection south )
|
||||
{
|
||||
if( this.isConnected( w, x, y, z, up ) )
|
||||
return;
|
||||
if ( this.isConnected( w, x, y, z, east ) )
|
||||
if( this.isConnected( w, x, y, z, east ) )
|
||||
return;
|
||||
if ( this.isConnected( w, x, y, z, south ) )
|
||||
if( this.isConnected( w, x, y, z, south ) )
|
||||
return;
|
||||
|
||||
i.setBounds( this.gso( east, 3, ForgeDirection.WEST ), this.gso( up, 3, ForgeDirection.DOWN ), this.gso( south, 3, ForgeDirection.NORTH ),
|
||||
this.gso( east, 13, ForgeDirection.EAST ), this.gso( up, 13, ForgeDirection.UP ), this.gso( south, 13, ForgeDirection.SOUTH ) );
|
||||
i.setBounds( this.gso( east, 3, ForgeDirection.WEST ), this.gso( up, 3, ForgeDirection.DOWN ), this.gso( south, 3, ForgeDirection.NORTH ), this.gso( east, 13, ForgeDirection.EAST ), this.gso( up, 13, ForgeDirection.UP ), this.gso( south, 13, ForgeDirection.SOUTH ) );
|
||||
i.prepareBounds( renderer );
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRing.getIcon() );
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
}
|
||||
|
||||
private float gso(ForgeDirection side, float def, ForgeDirection target)
|
||||
private float fso( ForgeDirection side, float def, ForgeDirection target )
|
||||
{
|
||||
if ( side != target )
|
||||
if( side == target )
|
||||
{
|
||||
if ( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
return 16;
|
||||
return 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
private float fso(ForgeDirection side, float def, ForgeDirection target)
|
||||
private void handleSide( AEBaseBlock blk, int meta, int x, int y, int z, BusRenderHelper i, RenderBlocks renderer, IIcon color, boolean emitsLight, boolean isMonitor, ForgeDirection side, IBlockAccess w )
|
||||
{
|
||||
if ( side == target )
|
||||
{
|
||||
if ( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
return 16;
|
||||
return 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
private void handleSide(AEBaseBlock blk, int meta, int x, int y, int z, BusRenderHelper i, RenderBlocks renderer, IIcon color, boolean emitsLight,
|
||||
boolean isMonitor, ForgeDirection side, IBlockAccess w)
|
||||
{
|
||||
if ( this.isConnected( w, x, y, z, side ) )
|
||||
if( this.isConnected( w, x, y, z, side ) )
|
||||
return;
|
||||
|
||||
i.setFacesToRender( EnumSet.of( side ) );
|
||||
|
||||
if ( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
|
||||
if( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitFit.getIcon() );
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingMonitorOuter.getIcon() );
|
||||
else
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
|
||||
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
|
||||
if ( color != null )
|
||||
if( color != null )
|
||||
{
|
||||
i.setTexture( color );
|
||||
|
||||
if ( !emitsLight )
|
||||
if( !emitsLight )
|
||||
{
|
||||
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
{
|
||||
int b = w.getLightBrightnessForSkyBlocks( x + side.offsetX, y + side.offsetY, z + side.offsetZ, 0 );
|
||||
|
||||
@@ -233,7 +237,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isMonitor )
|
||||
if( isMonitor )
|
||||
{
|
||||
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
|
||||
AEColor col = sr.getColor();
|
||||
@@ -257,68 +261,66 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
i.renderFace( x, y, z, color, side, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (ForgeDirection a : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection a : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if ( a == side || a == side.getOpposite() )
|
||||
if( a == side || a == side.getOpposite() )
|
||||
continue;
|
||||
|
||||
if ( (side.offsetX != 0 || side.offsetZ != 0)
|
||||
&& (a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH) )
|
||||
if( ( side.offsetX != 0 || side.offsetZ != 0 ) && ( a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH ) )
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
else if ( (side.offsetY != 0) && (a == ForgeDirection.EAST || a == ForgeDirection.WEST) )
|
||||
else if( ( side.offsetY != 0 ) && ( a == ForgeDirection.EAST || a == ForgeDirection.WEST ) )
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
else
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
|
||||
|
||||
double width = 3.0 / 16.0;
|
||||
|
||||
if ( !(i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999) )
|
||||
if( !( i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999 ) )
|
||||
{
|
||||
switch (a)
|
||||
switch( a )
|
||||
{
|
||||
case DOWN:
|
||||
renderer.renderMinY = 0;
|
||||
renderer.renderMaxY = width;
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderMaxX = 1;
|
||||
renderer.renderMinX = 1.0 - width;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderMinZ = 0;
|
||||
renderer.renderMaxZ = width;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderMaxZ = 1;
|
||||
renderer.renderMinZ = 1.0 - width;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderMaxY = 1;
|
||||
renderer.renderMinY = 1.0 - width;
|
||||
break;
|
||||
case WEST:
|
||||
renderer.renderMinX = 0;
|
||||
renderer.renderMaxX = width;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
case DOWN:
|
||||
renderer.renderMinY = 0;
|
||||
renderer.renderMaxY = width;
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderMaxX = 1;
|
||||
renderer.renderMinX = 1.0 - width;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderMinZ = 0;
|
||||
renderer.renderMaxZ = width;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderMaxZ = 1;
|
||||
renderer.renderMinZ = 1.0 - width;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderMaxY = 1;
|
||||
renderer.renderMinY = 1.0 - width;
|
||||
break;
|
||||
case WEST:
|
||||
renderer.renderMinX = 0;
|
||||
renderer.renderMaxX = width;
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
}
|
||||
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
@@ -327,18 +329,14 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isConnected(IBlockAccess w, int x, int y, int z, ForgeDirection side)
|
||||
private float gso( ForgeDirection side, float def, ForgeDirection target )
|
||||
{
|
||||
final int tileYPos = y + side.offsetY;
|
||||
if ( 0 <= tileYPos && tileYPos <= 255)
|
||||
if( side != target )
|
||||
{
|
||||
final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
|
||||
return tile instanceof TileCraftingTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
return 16;
|
||||
return 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,33 +45,34 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
{
|
||||
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public RenderBlockCraftingCPUMonitor() {
|
||||
public RenderBlockCraftingCPUMonitor()
|
||||
{
|
||||
super( true, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
if ( Platform.isDrawing( tess ) )
|
||||
if( Platform.isDrawing( tess ) )
|
||||
return;
|
||||
|
||||
if ( tile instanceof TileCraftingMonitorTile )
|
||||
if( tile instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
TileCraftingMonitorTile cmt = (TileCraftingMonitorTile) tile;
|
||||
IAEItemStack ais = cmt.getJobProgress();
|
||||
|
||||
if ( cmt.dspList == null )
|
||||
if( cmt.dspList == null )
|
||||
{
|
||||
cmt.updateList = true;
|
||||
cmt.dspList = GLAllocation.generateDisplayLists( 1 );
|
||||
}
|
||||
|
||||
if ( ais != null )
|
||||
if( ais != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
|
||||
|
||||
if ( cmt.updateList )
|
||||
if( cmt.updateList )
|
||||
{
|
||||
cmt.updateList = false;
|
||||
GL11.glNewList( cmt.dspList, GL11.GL_COMPILE_AND_EXECUTE );
|
||||
@@ -86,7 +87,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
}
|
||||
}
|
||||
|
||||
private void tesrRenderScreen(Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais)
|
||||
private void tesrRenderScreen( Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais )
|
||||
{
|
||||
ForgeDirection side = cmt.getForward();
|
||||
|
||||
@@ -94,7 +95,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
int spin = 0;
|
||||
|
||||
int max = 5;
|
||||
while (walrus != cmt.getUp() && max > 0)
|
||||
while( walrus != cmt.getUp() && max > 0 )
|
||||
{
|
||||
max--;
|
||||
spin++;
|
||||
@@ -108,38 +109,38 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
float scale = 0.7f;
|
||||
GL11.glScalef( scale, scale, scale );
|
||||
|
||||
if ( side == ForgeDirection.UP )
|
||||
if( side == ForgeDirection.UP )
|
||||
{
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( spin * 90.0F, 0, 0, 1 );
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.DOWN )
|
||||
if( side == ForgeDirection.DOWN )
|
||||
{
|
||||
GL11.glScalef( 1.0f, -1.0f, 1.0f );
|
||||
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( spin * -90.0F, 0, 0, 1 );
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.EAST )
|
||||
if( side == ForgeDirection.EAST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.WEST )
|
||||
if( side == ForgeDirection.WEST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.NORTH )
|
||||
if( side == ForgeDirection.NORTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.SOUTH )
|
||||
if( side == ForgeDirection.SOUTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
@@ -164,9 +165,8 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
ClientHelper.proxy.doRenderItem( sis, cmt.getWorldObj() );
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
@@ -186,5 +186,4 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -35,15 +36,17 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
|
||||
public class RenderBlockCrank extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockCrank() {
|
||||
public RenderBlockCrank()
|
||||
{
|
||||
super( true, 60 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
@@ -57,22 +60,22 @@ public class RenderBlockCrank extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderBlocks)
|
||||
public void renderTile( AEBaseBlock blk, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderBlocks )
|
||||
{
|
||||
TileCrank tc = (TileCrank) tile;
|
||||
if ( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
|
||||
if( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
|
||||
return;
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if ( Minecraft.isAmbientOcclusionEnabled() )
|
||||
if( Minecraft.isAmbientOcclusionEnabled() )
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
else
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
@@ -102,5 +105,4 @@ public class RenderBlockCrank extends BaseBlockRender
|
||||
tess.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -27,25 +28,27 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
|
||||
public class RenderBlockEnergyCube extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockEnergyCube() {
|
||||
public RenderBlockEnergyCube()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
|
||||
double internalCurrentPower = myItem.getAECurrentPower( is );
|
||||
double internalMaxPower = myItem.getAEMaxPower( is );
|
||||
|
||||
int meta = (int) (8.0 * (internalCurrentPower / internalMaxPower));
|
||||
int meta = (int) ( 8.0 * ( internalCurrentPower / internalMaxPower ) );
|
||||
|
||||
if ( meta > 7 )
|
||||
if( meta > 7 )
|
||||
meta = 7;
|
||||
if ( meta < 0 )
|
||||
if( meta < 0 )
|
||||
meta = 0;
|
||||
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, meta ) );
|
||||
@@ -54,7 +57,7 @@ public class RenderBlockEnergyCube extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -46,15 +47,17 @@ import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockInscriber extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockInscriber() {
|
||||
public RenderBlockInscriber()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
@@ -95,14 +98,15 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
BlockInscriber blk = (BlockInscriber) block;
|
||||
|
||||
IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
if ( te == null ) return false;
|
||||
if( te == null )
|
||||
return false;
|
||||
|
||||
ForgeDirection fdy = te.getUp();
|
||||
ForgeDirection fdz = te.getForward();
|
||||
@@ -137,7 +141,7 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
TileInscriber inv = (TileInscriber) tile;
|
||||
|
||||
@@ -163,19 +167,19 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
float base = 0.4f;
|
||||
|
||||
long absoluteProgress = 0;
|
||||
if ( inv.smash )
|
||||
if( inv.smash )
|
||||
{
|
||||
long currentTime = System.currentTimeMillis();
|
||||
absoluteProgress = currentTime - inv.clientStart;
|
||||
if ( absoluteProgress > 800 )
|
||||
if( absoluteProgress > 800 )
|
||||
inv.smash = false;
|
||||
}
|
||||
|
||||
float relativeProgress = absoluteProgress % 800 / 400.0f;
|
||||
float progress = relativeProgress;
|
||||
|
||||
if ( progress > 1.0f )
|
||||
progress = 1.0f - (progress - 1.0f);
|
||||
if( progress > 1.0f )
|
||||
progress = 1.0f - ( progress - 1.0f );
|
||||
press -= progress / 5.0f;
|
||||
|
||||
IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
|
||||
@@ -189,8 +193,8 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
|
||||
tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
|
||||
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
|
||||
middle -= 2.0f * 0.02f;
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
|
||||
@@ -200,29 +204,29 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
|
||||
tess.addVertexWithUV( TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
|
||||
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * (press - base) ) );
|
||||
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
|
||||
tess.draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
int items = 0;
|
||||
if ( inv.getStackInSlot( 0 ) != null )
|
||||
if( inv.getStackInSlot( 0 ) != null )
|
||||
items++;
|
||||
if ( inv.getStackInSlot( 1 ) != null )
|
||||
if( inv.getStackInSlot( 1 ) != null )
|
||||
items++;
|
||||
if ( inv.getStackInSlot( 2 ) != null )
|
||||
if( inv.getStackInSlot( 2 ) != null )
|
||||
items++;
|
||||
|
||||
if ( relativeProgress > 1.0f || items == 0 )
|
||||
if( relativeProgress > 1.0f || items == 0 )
|
||||
{
|
||||
ItemStack is = inv.getStackInSlot( 3 );
|
||||
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
{
|
||||
InscriberRecipe ir = inv.getTask();
|
||||
if ( ir != null )
|
||||
if( ir != null )
|
||||
is = ir.output.copy();
|
||||
}
|
||||
|
||||
@@ -234,13 +238,11 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
this.renderItem( inv.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
|
||||
this.renderItem( inv.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void renderItem(ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f,
|
||||
RenderBlocks renderer)
|
||||
public void renderItem( ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
if ( sis != null )
|
||||
if( sis != null )
|
||||
{
|
||||
sis = sis.copy();
|
||||
GL11.glPushMatrix();
|
||||
@@ -253,7 +255,7 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
GL11.glScalef( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
if ( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
if( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
{
|
||||
GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
@@ -275,7 +277,7 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
|
||||
this.doRenderItem( sis, tile );
|
||||
}
|
||||
catch (Exception err)
|
||||
catch( Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
@@ -283,5 +285,4 @@ public class RenderBlockInscriber extends BaseBlockRender
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -29,20 +30,22 @@ import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
|
||||
|
||||
public class RenderBlockInterface extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockInterface() {
|
||||
public RenderBlockInterface()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileInterface ti = block.getTileEntity( world, x, y, z );
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if ( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
|
||||
if( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
IIcon side = ExtraBlockTextures.BlockInterfaceAlternateArrow.getIcon();
|
||||
info.setTemporaryRenderIcons( ExtraBlockTextures.BlockInterfaceAlternate.getIcon(), block.getIcon( 0, 0 ), side, side, side, side );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -34,25 +35,27 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
|
||||
|
||||
public class RenderBlockPaint extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockPaint() {
|
||||
public RenderBlockPaint()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TilePaint tp = imb.getTileEntity( world, x, y, z );
|
||||
boolean out = false;
|
||||
if ( tp != null )
|
||||
if( tp != null )
|
||||
{
|
||||
// super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
|
||||
@@ -67,18 +70,18 @@ public class RenderBlockPaint extends BaseBlockRender
|
||||
|
||||
EnumSet<ForgeDirection> validSides = EnumSet.noneOf( ForgeDirection.class );
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
if ( tp.isSideValid( side ) )
|
||||
if( tp.isSideValid( side ) )
|
||||
validSides.add( side );
|
||||
}
|
||||
|
||||
for (Splotch s : tp.getDots())
|
||||
for( Splotch s : tp.getDots() )
|
||||
{
|
||||
if ( !validSides.contains( s.side ) )
|
||||
if( !validSides.contains( s.side ) )
|
||||
continue;
|
||||
|
||||
if ( s.lumen )
|
||||
if( s.lumen )
|
||||
{
|
||||
tess.setColorOpaque_I( s.color.whiteVariant );
|
||||
tess.setBrightness( lumen );
|
||||
@@ -100,13 +103,13 @@ public class RenderBlockPaint extends BaseBlockRender
|
||||
pos_x = Math.max( H, Math.min( 1.0 - H, pos_x ) );
|
||||
pos_y = Math.max( H, Math.min( 1.0 - H, pos_y ) );
|
||||
|
||||
if ( s.side == ForgeDirection.SOUTH || s.side == ForgeDirection.NORTH )
|
||||
if( s.side == ForgeDirection.SOUTH || s.side == ForgeDirection.NORTH )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += y;
|
||||
}
|
||||
|
||||
else if ( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
|
||||
else if( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += z;
|
||||
@@ -120,54 +123,54 @@ public class RenderBlockPaint extends BaseBlockRender
|
||||
|
||||
IIcon ico = icoSet[s.getSeed() % icoSet.length];
|
||||
|
||||
switch (s.side)
|
||||
switch( s.side )
|
||||
{
|
||||
case UP:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case UP:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case DOWN:
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, y + offset, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + H, y + offset, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case EAST:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case WEST:
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y - H, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y - H, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + H, pos_y + H, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - H, pos_y + H, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case SOUTH:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
case NORTH:
|
||||
tess.addVertexWithUV( pos_x - H, pos_y - H, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y - H, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + H, pos_y + H, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - H, pos_y + H, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -28,20 +29,22 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
|
||||
|
||||
public class RenderBlockQuartzAccelerator extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockQuartzAccelerator() {
|
||||
public RenderBlockQuartzAccelerator()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
if ( te instanceof TileQuartzGrowthAccelerator )
|
||||
if( te instanceof TileQuartzGrowthAccelerator )
|
||||
{
|
||||
if ( ((TileQuartzGrowthAccelerator) te).hasPower )
|
||||
if( ( (TileQuartzGrowthAccelerator) te ).hasPower )
|
||||
{
|
||||
IIcon top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
|
||||
IIcon side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -34,23 +35,25 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
|
||||
public class RenderBlockSkyChest extends BaseBlockRender
|
||||
{
|
||||
|
||||
final ModelChest model = new ModelChest();
|
||||
|
||||
public RenderBlockSkyChest() {
|
||||
public RenderBlockSkyChest()
|
||||
{
|
||||
super( true, 80 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc;
|
||||
if ( is.getItemDamage() == 1 )
|
||||
if( is.getItemDamage() == 1 )
|
||||
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skyblockchest.png" );
|
||||
else
|
||||
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skychest.png" );
|
||||
@@ -62,37 +65,37 @@ public class RenderBlockSkyChest extends BaseBlockRender
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glTranslatef( -0.0F, -1.0F, -1.0F );
|
||||
|
||||
this.model.chestLid.offsetY = -(0.9f / 16.0f);
|
||||
this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);
|
||||
this.model.chestLid.offsetY = -( 0.9f / 16.0f );
|
||||
this.model.chestLid.rotateAngleX = -( ( lidAngle * 3.141593F ) / 2.0F );
|
||||
this.model.renderAll();
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
|
||||
{
|
||||
if ( !(tile instanceof TileSkyChest) )
|
||||
if( !( tile instanceof TileSkyChest ) )
|
||||
return;
|
||||
|
||||
TileSkyChest skyChest = (TileSkyChest) tile;
|
||||
|
||||
if ( !skyChest.hasWorldObj() )
|
||||
if( !skyChest.hasWorldObj() )
|
||||
return;
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc;
|
||||
|
||||
if ( tile.getWorldObj().getBlockMetadata( tile.xCoord, tile.yCoord, tile.zCoord ) == 1 )
|
||||
if( tile.getWorldObj().getBlockMetadata( tile.xCoord, tile.yCoord, tile.zCoord ) == 1 )
|
||||
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skyblockchest.png" );
|
||||
else
|
||||
loc = new ResourceLocation( "appliedenergistics2", "textures/models/skychest.png" );
|
||||
@@ -107,26 +110,26 @@ public class RenderBlockSkyChest extends BaseBlockRender
|
||||
long now = System.currentTimeMillis();
|
||||
long distance = now - skyChest.lastEvent;
|
||||
|
||||
if ( skyChest.playerOpen > 0 )
|
||||
if( skyChest.playerOpen > 0 )
|
||||
skyChest.lidAngle += distance * 0.0001;
|
||||
else
|
||||
skyChest.lidAngle -= distance * 0.0001;
|
||||
|
||||
if ( skyChest.lidAngle > 0.5f )
|
||||
if( skyChest.lidAngle > 0.5f )
|
||||
skyChest.lidAngle = 0.5f;
|
||||
|
||||
if ( skyChest.lidAngle < 0.0f )
|
||||
if( skyChest.lidAngle < 0.0f )
|
||||
skyChest.lidAngle = 0.0f;
|
||||
|
||||
float lidAngle = skyChest.lidAngle;
|
||||
lidAngle = 1.0F - lidAngle;
|
||||
lidAngle = 1.0F - lidAngle * lidAngle * lidAngle;
|
||||
|
||||
this.model.chestLid.offsetY = -(1.01f / 16.0f);
|
||||
this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F);
|
||||
this.model.chestLid.offsetY = -( 1.01f / 16.0f );
|
||||
this.model.chestLid.rotateAngleX = -( ( lidAngle * 3.141593F ) / 2.0F );
|
||||
this.model.renderAll();
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -39,40 +40,42 @@ import appeng.hooks.CompassResult;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
|
||||
|
||||
public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
{
|
||||
|
||||
float r = 0;
|
||||
final ModelCompass model = new ModelCompass();
|
||||
float r = 0;
|
||||
|
||||
public RenderBlockSkyCompass() {
|
||||
public RenderBlockSkyCompass()
|
||||
{
|
||||
super( true, 80 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
boolean isGood = false;
|
||||
|
||||
IInventory inv = Minecraft.getMinecraft().thePlayer.inventory;
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
if ( inv.getStackInSlot( x ) == is )
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
if( inv.getStackInSlot( x ) == is )
|
||||
isGood = true;
|
||||
|
||||
if ( !isGood )
|
||||
if( !isGood )
|
||||
type = ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
GL11.glRotatef( -90.0f, 0.0f, 0.0f, 1.0f );
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
@@ -81,25 +84,25 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glRotatef( 15.3f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glScalef( 2.5f, 2.5f, 2.5f );
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.3F, -1.65F, -0.19F );
|
||||
else
|
||||
GL11.glTranslatef( 0.2F, -1.65F, -0.19F );
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
float rYaw = p.rotationYaw;
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED )
|
||||
if( type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
p = (EntityPlayer) obj[1];
|
||||
rYaw = p.renderYawOffset;
|
||||
@@ -110,20 +113,20 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
int z = (int) p.posZ;
|
||||
CompassResult cr = CompassManager.INSTANCE.getCompassDirection( 0, x, y, z );
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 3; j++)
|
||||
for( int i = 0; i < 3; i++ )
|
||||
for( int j = 0; j < 3; j++ )
|
||||
CompassManager.INSTANCE.getCompassDirection( 0, x + i - 1, y, z + j - 1 );
|
||||
|
||||
if ( cr.hasResult )
|
||||
if( cr.hasResult )
|
||||
{
|
||||
if ( cr.spin )
|
||||
if( cr.spin )
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
{
|
||||
float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
float adjustment = (float) Math.PI * 0.74f;
|
||||
@@ -140,38 +143,37 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
else
|
||||
{
|
||||
now %= 1000000;
|
||||
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
|
||||
{
|
||||
if ( !(tile instanceof TileSkyCompass) )
|
||||
if( !( tile instanceof TileSkyCompass ) )
|
||||
return;
|
||||
|
||||
TileSkyCompass skyCompass = (TileSkyCompass) tile;
|
||||
|
||||
if ( !skyCompass.hasWorldObj() )
|
||||
if( !skyCompass.hasWorldObj() )
|
||||
return;
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
@@ -186,33 +188,32 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
CompassResult cr = null;
|
||||
if ( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
|
||||
if( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
|
||||
cr = CompassManager.INSTANCE.getCompassDirection( 0, tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
else
|
||||
cr = new CompassResult( false, true, 0 );
|
||||
|
||||
if ( cr.hasResult )
|
||||
if( cr.hasResult )
|
||||
{
|
||||
if ( cr.spin )
|
||||
if( cr.spin )
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
else
|
||||
this.model.renderAll( (float) (skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad) );
|
||||
|
||||
this.model.renderAll( (float) ( skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
now %= 1000000;
|
||||
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */ );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
private double flipidiy(double rad)
|
||||
private double flipidiy( double rad )
|
||||
{
|
||||
double x = Math.cos( rad );
|
||||
double y = Math.sin( rad );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -38,15 +39,24 @@ import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockWireless extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderBlockWireless() {
|
||||
int centerX = 0;
|
||||
int centerY = 0;
|
||||
int centerZ = 0;
|
||||
AEBaseBlock blk;
|
||||
boolean hasChan = false;
|
||||
boolean hasPower = false;
|
||||
|
||||
public RenderBlockWireless()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
this.blk = blk;
|
||||
this.centerX = 0;
|
||||
@@ -81,43 +91,30 @@ public class RenderBlockWireless extends BaseBlockRender
|
||||
|
||||
int s = 1;
|
||||
|
||||
for (ForgeDirection side : sides)
|
||||
for( ForgeDirection side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
|
||||
ForgeDirection.SOUTH );
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for (ForgeDirection side : sides)
|
||||
for( ForgeDirection side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, ForgeDirection.EAST, ForgeDirection.UP,
|
||||
ForgeDirection.SOUTH );
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
int centerX = 0;
|
||||
int centerY = 0;
|
||||
int centerZ = 0;
|
||||
AEBaseBlock blk;
|
||||
boolean hasChan = false;
|
||||
boolean hasPower = false;
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileWireless tw = blk.getTileEntity( world, x, y, z );
|
||||
this.blk = blk;
|
||||
if ( tw != null )
|
||||
if( tw != null )
|
||||
{
|
||||
this.hasChan = (tw.clientFlags & (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG)) == (TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG);
|
||||
this.hasPower = (tw.clientFlags & TileWireless.POWERED_FLAG) == TileWireless.POWERED_FLAG;
|
||||
this.hasChan = ( tw.clientFlags & ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG ) ) == ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG );
|
||||
this.hasPower = ( tw.clientFlags & TileWireless.POWERED_FLAG ) == TileWireless.POWERED_FLAG;
|
||||
|
||||
BlockRenderInfo ri = blk.getRendererInstance();
|
||||
|
||||
@@ -151,20 +148,16 @@ public class RenderBlockWireless extends BaseBlockRender
|
||||
|
||||
int s = 1;
|
||||
|
||||
for (ForgeDirection side : sides)
|
||||
for( ForgeDirection side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 2 : -2), 8 + (side.offsetY != 0 ? side.offsetY * 2 : -2), 2
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 2 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 4 : 2),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 4 : 2), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for (ForgeDirection side : sides)
|
||||
for( ForgeDirection side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + (side.offsetX != 0 ? side.offsetX * 4 : -1), 8 + (side.offsetY != 0 ? side.offsetY * 4 : -1), 1
|
||||
+ (side.offsetZ != 0 ? side.offsetZ * 4 : -1) + s, 8 + (side.offsetX != 0 ? side.offsetX * 5 : 1),
|
||||
8 + (side.offsetY != 0 ? side.offsetY * 5 : 1), 2 + (side.offsetZ != 0 ? side.offsetZ * 5 : 1) + s, fdx, fdy, fdz );
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
@@ -173,13 +166,13 @@ public class RenderBlockWireless extends BaseBlockRender
|
||||
// ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
|
||||
|
||||
if ( this.hasChan )
|
||||
if( this.hasChan )
|
||||
{
|
||||
int l = 14;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.blackVariant );
|
||||
}
|
||||
else if ( this.hasPower )
|
||||
else if( this.hasPower )
|
||||
{
|
||||
int l = 9;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
@@ -191,17 +184,17 @@ public class RenderBlockWireless extends BaseBlockRender
|
||||
Tessellator.instance.setColorOpaque_I( 0x000000 );
|
||||
}
|
||||
|
||||
if ( ForgeDirection.UP != fdz.getOpposite() )
|
||||
if( ForgeDirection.UP != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.UP );
|
||||
if ( ForgeDirection.DOWN != fdz.getOpposite() )
|
||||
if( ForgeDirection.DOWN != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.DOWN );
|
||||
if ( ForgeDirection.EAST != fdz.getOpposite() )
|
||||
if( ForgeDirection.EAST != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.EAST );
|
||||
if ( ForgeDirection.WEST != fdz.getOpposite() )
|
||||
if( ForgeDirection.WEST != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.WEST );
|
||||
if ( ForgeDirection.SOUTH != fdz.getOpposite() )
|
||||
if( ForgeDirection.SOUTH != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.SOUTH );
|
||||
if ( ForgeDirection.NORTH != fdz.getOpposite() )
|
||||
if( ForgeDirection.NORTH != fdz.getOpposite() )
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.NORTH );
|
||||
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
@@ -211,45 +204,45 @@ public class RenderBlockWireless extends BaseBlockRender
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderTorchAtAngle(RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z)
|
||||
private void renderTorchAtAngle( RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z )
|
||||
{
|
||||
IIcon r = (this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : this.blk.getIcon( 0, 0 ));
|
||||
IIcon r = ( this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : this.blk.getIcon( 0, 0 ) );
|
||||
IIcon sides = new OffsetIcon( r, 0.0f, -2.0f );
|
||||
|
||||
switch (z)
|
||||
switch( z )
|
||||
{
|
||||
case DOWN:
|
||||
renderer.uvRotateNorth = 3;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
renderer.uvRotateWest = 3;
|
||||
break;
|
||||
case EAST:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.uvRotateBottom = 3;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case WEST:
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.uvRotateNorth = 3;
|
||||
renderer.uvRotateSouth = 3;
|
||||
renderer.uvRotateEast = 3;
|
||||
renderer.uvRotateWest = 3;
|
||||
break;
|
||||
case EAST:
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.uvRotateTop = 0;
|
||||
renderer.uvRotateBottom = 0;
|
||||
renderer.uvRotateNorth = 2;
|
||||
renderer.uvRotateSouth = 1;
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.uvRotateTop = 3;
|
||||
renderer.uvRotateBottom = 3;
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
break;
|
||||
case WEST:
|
||||
renderer.uvRotateTop = 2;
|
||||
renderer.uvRotateBottom = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
renderer.uvRotateWest = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -34,15 +35,17 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderDrive extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderDrive() {
|
||||
public RenderDrive()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
@@ -52,7 +55,7 @@ public class RenderDrive extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileDrive sp = imb.getTileEntity( world, x, y, z );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
@@ -68,219 +71,149 @@ public class RenderDrive extends BaseBlockRender
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
|
||||
for (int yy = 0; yy < 5; yy++)
|
||||
for( int yy = 0; yy < 5; yy++ )
|
||||
{
|
||||
for (int xx = 0; xx < 2; xx++)
|
||||
for( int xx = 0; xx < 2; xx++ )
|
||||
{
|
||||
int stat = sp.getCellStatus( yy * 2 + (1 - xx) );
|
||||
int stat = sp.getCellStatus( yy * 2 + ( 1 - xx ) );
|
||||
this.selectFace( renderer, west, up, forward, 2 + xx * 7, 7 + xx * 7, 1 + yy * 3, 3 + yy * 3 );
|
||||
|
||||
int spin = 0;
|
||||
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
{
|
||||
case 1:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 3;
|
||||
case 1:
|
||||
switch( up )
|
||||
{
|
||||
case UP:
|
||||
spin = 3;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 1;
|
||||
case -1:
|
||||
switch( up )
|
||||
{
|
||||
case UP:
|
||||
spin = 1;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
case -2:
|
||||
switch( up )
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 2;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
case 2:
|
||||
switch( up )
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 1;
|
||||
case 3:
|
||||
switch( up )
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 3;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 1;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 3;
|
||||
case -3:
|
||||
switch( up )
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 2;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -2:
|
||||
switch (up)
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 2;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (up)
|
||||
{
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
case NORTH:
|
||||
spin = 0;
|
||||
break;
|
||||
case SOUTH:
|
||||
spin = 0;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 3;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 1;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
case -3:
|
||||
switch (up)
|
||||
{
|
||||
case UP:
|
||||
spin = 2;
|
||||
break;
|
||||
case DOWN:
|
||||
spin = 0;
|
||||
break;
|
||||
case EAST:
|
||||
spin = 1;
|
||||
break;
|
||||
case WEST:
|
||||
spin = 3;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
double u1 = ico.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
|
||||
double u2 = ico.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
|
||||
double u3 = ico.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
|
||||
double u4 = ico.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
|
||||
double u1 = ico.getInterpolatedU( ( spin % 4 < 2 ) ? 1 : 6 );
|
||||
double u2 = ico.getInterpolatedU( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 6 );
|
||||
double u3 = ico.getInterpolatedU( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 6 );
|
||||
double u4 = ico.getInterpolatedU( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 6 );
|
||||
|
||||
int m = 1;
|
||||
int mx = 3;
|
||||
if ( stat == 0 )
|
||||
if( stat == 0 )
|
||||
{
|
||||
m = 4;
|
||||
mx = 5;
|
||||
}
|
||||
|
||||
double v1 = ico.getInterpolatedV( ((spin + 1) % 4 < 2) ? m : mx );
|
||||
double v2 = ico.getInterpolatedV( ((spin + 2) % 4 < 2) ? m : mx );
|
||||
double v3 = ico.getInterpolatedV( ((spin + 3) % 4 < 2) ? m : mx );
|
||||
double v4 = ico.getInterpolatedV( ((spin) % 4 < 2) ? m : mx );
|
||||
double v1 = ico.getInterpolatedV( ( ( spin + 1 ) % 4 < 2 ) ? m : mx );
|
||||
double v2 = ico.getInterpolatedV( ( ( spin + 2 ) % 4 < 2 ) ? m : mx );
|
||||
double v3 = ico.getInterpolatedV( ( ( spin + 3 ) % 4 < 2 ) ? m : mx );
|
||||
double v4 = ico.getInterpolatedV( ( ( spin ) % 4 < 2 ) ? m : mx );
|
||||
|
||||
tess.setBrightness( b );
|
||||
tess.setColorOpaque_I( 0xffffff );
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (forward == ForgeDirection.UP && up == ForgeDirection.SOUTH) || forward == ForgeDirection.DOWN )
|
||||
this.selectFace( renderer, west, up, forward, 3 + xx * 7, 4 + xx * 7, 1 + yy * 3, 2 + yy * 3 );
|
||||
else
|
||||
this.selectFace( renderer, west, up, forward, 5 + xx * 7, 6 + xx * 7, 2 + yy * 3, 3 + yy * 3 );
|
||||
|
||||
if ( stat != 0 )
|
||||
{
|
||||
IIcon whiteIcon = ExtraBlockTextures.White.getIcon();
|
||||
u1 = whiteIcon.getInterpolatedU( (spin % 4 < 2) ? 1 : 6 );
|
||||
u2 = whiteIcon.getInterpolatedU( ((spin + 1) % 4 < 2) ? 1 : 6 );
|
||||
u3 = whiteIcon.getInterpolatedU( ((spin + 2) % 4 < 2) ? 1 : 6 );
|
||||
u4 = whiteIcon.getInterpolatedU( ((spin + 3) % 4 < 2) ? 1 : 6 );
|
||||
|
||||
v1 = whiteIcon.getInterpolatedV( ((spin + 1) % 4 < 2) ? 1 : 3 );
|
||||
v2 = whiteIcon.getInterpolatedV( ((spin + 2) % 4 < 2) ? 1 : 3 );
|
||||
v3 = whiteIcon.getInterpolatedV( ((spin + 3) % 4 < 2) ? 1 : 3 );
|
||||
v4 = whiteIcon.getInterpolatedV( ((spin) % 4 < 2) ? 1 : 3 );
|
||||
|
||||
if ( sp.isPowered() )
|
||||
tess.setBrightness( 15 << 20 | 15 << 4 );
|
||||
else
|
||||
tess.setBrightness( 0 );
|
||||
|
||||
if ( stat == 1 )
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
if ( stat == 2 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
if ( stat == 3 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
|
||||
switch (forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3)
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
@@ -317,6 +250,76 @@ public class RenderDrive extends BaseBlockRender
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
|
||||
if( ( forward == ForgeDirection.UP && up == ForgeDirection.SOUTH ) || forward == ForgeDirection.DOWN )
|
||||
this.selectFace( renderer, west, up, forward, 3 + xx * 7, 4 + xx * 7, 1 + yy * 3, 2 + yy * 3 );
|
||||
else
|
||||
this.selectFace( renderer, west, up, forward, 5 + xx * 7, 6 + xx * 7, 2 + yy * 3, 3 + yy * 3 );
|
||||
|
||||
if( stat != 0 )
|
||||
{
|
||||
IIcon whiteIcon = ExtraBlockTextures.White.getIcon();
|
||||
u1 = whiteIcon.getInterpolatedU( ( spin % 4 < 2 ) ? 1 : 6 );
|
||||
u2 = whiteIcon.getInterpolatedU( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 6 );
|
||||
u3 = whiteIcon.getInterpolatedU( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 6 );
|
||||
u4 = whiteIcon.getInterpolatedU( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 6 );
|
||||
|
||||
v1 = whiteIcon.getInterpolatedV( ( ( spin + 1 ) % 4 < 2 ) ? 1 : 3 );
|
||||
v2 = whiteIcon.getInterpolatedV( ( ( spin + 2 ) % 4 < 2 ) ? 1 : 3 );
|
||||
v3 = whiteIcon.getInterpolatedV( ( ( spin + 3 ) % 4 < 2 ) ? 1 : 3 );
|
||||
v4 = whiteIcon.getInterpolatedV( ( ( spin ) % 4 < 2 ) ? 1 : 3 );
|
||||
|
||||
if( sp.isPowered() )
|
||||
tess.setBrightness( 15 << 20 | 15 << 4 );
|
||||
else
|
||||
tess.setBrightness( 0 );
|
||||
|
||||
if( stat == 1 )
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
if( stat == 2 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
if( stat == 3 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -39,35 +40,37 @@ import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderMEChest extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderMEChest() {
|
||||
public RenderMEChest()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator.instance.setBrightness( 0 );
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
|
||||
renderer );
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileChest sp = imb.getTileEntity( world, x, y, z );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if ( sp == null ) return false;
|
||||
if( sp == null )
|
||||
return false;
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
ForgeDirection forward = sp.getForward();
|
||||
@@ -82,7 +85,7 @@ public class RenderMEChest extends BaseBlockRender
|
||||
|
||||
int offsetU = -4;
|
||||
int offsetV = 8;
|
||||
if ( stat == 0 )
|
||||
if( stat == 0 )
|
||||
offsetV = 3;
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
@@ -90,15 +93,15 @@ public class RenderMEChest extends BaseBlockRender
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
|
||||
FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
|
||||
if ( forward == ForgeDirection.EAST && (up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH) )
|
||||
if( forward == ForgeDirection.EAST && ( up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH ) )
|
||||
flippableIcon.setFlip( true, false );
|
||||
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
|
||||
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
|
||||
flippableIcon.setFlip( false, true );
|
||||
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
|
||||
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
|
||||
flippableIcon.setFlip( true, false );
|
||||
else if ( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
|
||||
else if( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
|
||||
flippableIcon.setFlip( false, true );
|
||||
else if ( forward == ForgeDirection.DOWN )
|
||||
else if( forward == ForgeDirection.DOWN )
|
||||
flippableIcon.setFlip( true, false );
|
||||
|
||||
/*
|
||||
@@ -110,27 +113,27 @@ public class RenderMEChest extends BaseBlockRender
|
||||
|
||||
this.renderFace( x, y, z, imb, flippableIcon, renderer, forward );
|
||||
|
||||
if ( stat != 0 )
|
||||
if( stat != 0 )
|
||||
{
|
||||
b = 0;
|
||||
if ( sp.isPowered() )
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
if ( stat == 1 )
|
||||
if( stat == 1 )
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
if ( stat == 2 )
|
||||
if( stat == 2 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
if ( stat == 3 )
|
||||
if( stat == 3 )
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
this.selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
|
||||
this.renderFace( x, y, z, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
|
||||
}
|
||||
|
||||
b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
|
||||
if ( sp.isPowered() )
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
@@ -145,7 +148,7 @@ public class RenderMEChest extends BaseBlockRender
|
||||
IIcon ico = ch == null ? null : ch.getTopTexture_Light();
|
||||
this.renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
|
||||
if ( ico != null )
|
||||
if( ico != null )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = ch == null ? null : ch.getTopTexture_Medium();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -26,23 +27,24 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
|
||||
public class RenderNull extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderNull() {
|
||||
public RenderNull()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
@@ -41,61 +42,12 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
|
||||
public class RenderQNB extends BaseBlockRender
|
||||
{
|
||||
|
||||
public void renderCableAt(double thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull,
|
||||
Collection<ForgeDirection> connections)
|
||||
{
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture );
|
||||
|
||||
if ( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if ( connections.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
float minPx = 2.0f / 16.0f;
|
||||
float maxPx = 14.0f / 16.0f;
|
||||
@@ -105,10 +57,10 @@ public class RenderQNB extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileQuantumBridge tqb = block.getTileEntity( world, x, y, z );
|
||||
if ( tqb == null )
|
||||
if( tqb == null )
|
||||
return false;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
@@ -117,11 +69,11 @@ public class RenderQNB extends BaseBlockRender
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
for ( Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
|
||||
for( Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
|
||||
{
|
||||
if ( tqb.getBlockType() == linkBlock )
|
||||
if( tqb.getBlockType() == linkBlock )
|
||||
{
|
||||
if ( tqb.isFormed() )
|
||||
if( tqb.isFormed() )
|
||||
{
|
||||
EnumSet<ForgeDirection> sides = tqb.getConnections();
|
||||
|
||||
@@ -139,18 +91,17 @@ public class RenderQNB extends BaseBlockRender
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !tqb.isFormed() )
|
||||
if( !tqb.isFormed() )
|
||||
{
|
||||
float renderMin = 2.0f / 16.0f;
|
||||
float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
else if ( tqb.isCorner() )
|
||||
else if( tqb.isCorner() )
|
||||
{
|
||||
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D,
|
||||
tqb.getConnections() );
|
||||
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D, tqb.getConnections() );
|
||||
|
||||
float renderMin = 4.0f / 16.0f;
|
||||
float renderMax = 12.0f / 16.0f;
|
||||
@@ -158,7 +109,7 @@ public class RenderQNB extends BaseBlockRender
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
if ( tqb.isPowered() )
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
|
||||
renderMin = 3.9f / 16.0f;
|
||||
@@ -168,9 +119,8 @@ public class RenderQNB extends BaseBlockRender
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -186,7 +136,7 @@ public class RenderQNB extends BaseBlockRender
|
||||
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
|
||||
if ( tqb.isPowered() )
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
renderMin = -0.01f / 16.0f;
|
||||
renderMax = 16.01f / 16.0f;
|
||||
@@ -195,7 +145,7 @@ public class RenderQNB extends BaseBlockRender
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
@@ -205,4 +155,53 @@ public class RenderQNB extends BaseBlockRender
|
||||
renderer.renderAllFaces = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderCableAt( double thickness, IBlockAccess world, int x, int y, int z, AEBaseBlock block, RenderBlocks renderer, IIcon texture, double pull, Collection<ForgeDirection> connections )
|
||||
{
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture );
|
||||
|
||||
if( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -32,117 +33,27 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
|
||||
|
||||
public class RenderQuartzGlass extends BaseBlockRender
|
||||
{
|
||||
|
||||
static byte[][][] offsets;
|
||||
|
||||
public RenderQuartzGlass() {
|
||||
public RenderQuartzGlass()
|
||||
{
|
||||
super( false, 0 );
|
||||
if ( offsets == null )
|
||||
if( offsets == null )
|
||||
{
|
||||
Random r = new Random( 924 );
|
||||
offsets = new byte[10][10][10];
|
||||
for (int x = 0; x < 10; x++)
|
||||
for (int y = 0; y < 10; y++)
|
||||
for( int x = 0; x < 10; x++ )
|
||||
for( int y = 0; y < 10; y++ )
|
||||
r.nextBytes( offsets[x][y] );
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFlush(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return this.isGlass( imb, world, x, y, z );
|
||||
}
|
||||
|
||||
boolean isGlass(AEBaseBlock imb, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
|
||||
}
|
||||
|
||||
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
|
||||
}
|
||||
|
||||
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
|
||||
}
|
||||
|
||||
void renderEdge(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction)
|
||||
{
|
||||
if ( !this.isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
|
||||
{
|
||||
if ( !this.isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
|
||||
{
|
||||
float minX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
|
||||
float minY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
|
||||
float minZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
|
||||
float maxX = 0.5f + (side.offsetX + direction.offsetX) / 2.0f;
|
||||
float maxY = 0.5f + (side.offsetY + direction.offsetY) / 2.0f;
|
||||
float maxZ = 0.5f + (side.offsetZ + direction.offsetZ) / 2.0f;
|
||||
|
||||
if ( 0 == side.offsetX && 0 == direction.offsetX )
|
||||
{
|
||||
minX = 0.0f;
|
||||
maxX = 1.0f;
|
||||
}
|
||||
if ( 0 == side.offsetY && 0 == direction.offsetY )
|
||||
{
|
||||
minY = 0.0f;
|
||||
maxY = 1.0f;
|
||||
}
|
||||
if ( 0 == side.offsetZ && 0 == direction.offsetZ )
|
||||
{
|
||||
minZ = 0.0f;
|
||||
maxZ = 1.0f;
|
||||
}
|
||||
|
||||
if ( maxX <= 0.001f )
|
||||
maxX += 0.9f / 16.0f;
|
||||
if ( maxY <= 0.001f )
|
||||
maxY += 0.9f / 16.0f;
|
||||
if ( maxZ <= 0.001f )
|
||||
maxZ += 0.9f / 16.0f;
|
||||
|
||||
if ( minX >= 0.999f )
|
||||
minX -= 0.9f / 16.0f;
|
||||
if ( minY >= 0.999f )
|
||||
minY -= 0.9f / 16.0f;
|
||||
if ( minZ >= 0.999f )
|
||||
minZ -= 0.9f / 16.0f;
|
||||
|
||||
renderer.setRenderBounds( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
|
||||
switch (side)
|
||||
{
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.GlassFrame.getIcon();
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
@@ -151,7 +62,7 @@ public class RenderQuartzGlass extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
@@ -162,20 +73,20 @@ public class RenderQuartzGlass extends BaseBlockRender
|
||||
int u = offsets[cx][cy][cz] % 4;
|
||||
int v = offsets[9 - cx][9 - cy][9 - cz] % 4;
|
||||
|
||||
switch (Math.abs( (offsets[cx][cy][cz] + (x + y + z)) % 4 ))
|
||||
switch( Math.abs( ( offsets[cx][cy][cz] + ( x + y + z ) ) % 4 ) )
|
||||
{
|
||||
case 0:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
|
||||
break;
|
||||
case 1:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
|
||||
break;
|
||||
case 2:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassC.getIcon(), u, v );
|
||||
break;
|
||||
case 3:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassD.getIcon(), u, v );
|
||||
break;
|
||||
case 0:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
|
||||
break;
|
||||
case 1:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
|
||||
break;
|
||||
case 2:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassC.getIcon(), u, v );
|
||||
break;
|
||||
case 3:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassD.getIcon(), u, v );
|
||||
break;
|
||||
}
|
||||
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
@@ -214,4 +125,95 @@ public class RenderQuartzGlass extends BaseBlockRender
|
||||
return result;
|
||||
}
|
||||
|
||||
void renderEdge( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction )
|
||||
{
|
||||
if( !this.isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
|
||||
{
|
||||
if( !this.isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
|
||||
{
|
||||
float minX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
|
||||
float minY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
|
||||
float minZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
|
||||
float maxX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
|
||||
float maxY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
|
||||
float maxZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
|
||||
|
||||
if( 0 == side.offsetX && 0 == direction.offsetX )
|
||||
{
|
||||
minX = 0.0f;
|
||||
maxX = 1.0f;
|
||||
}
|
||||
if( 0 == side.offsetY && 0 == direction.offsetY )
|
||||
{
|
||||
minY = 0.0f;
|
||||
maxY = 1.0f;
|
||||
}
|
||||
if( 0 == side.offsetZ && 0 == direction.offsetZ )
|
||||
{
|
||||
minZ = 0.0f;
|
||||
maxZ = 1.0f;
|
||||
}
|
||||
|
||||
if( maxX <= 0.001f )
|
||||
maxX += 0.9f / 16.0f;
|
||||
if( maxY <= 0.001f )
|
||||
maxY += 0.9f / 16.0f;
|
||||
if( maxZ <= 0.001f )
|
||||
maxZ += 0.9f / 16.0f;
|
||||
|
||||
if( minX >= 0.999f )
|
||||
minX -= 0.9f / 16.0f;
|
||||
if( minY >= 0.999f )
|
||||
minY -= 0.9f / 16.0f;
|
||||
if( minZ >= 0.999f )
|
||||
minZ -= 0.9f / 16.0f;
|
||||
|
||||
renderer.setRenderBounds( minX, minY, minZ, maxX, maxY, maxZ );
|
||||
|
||||
switch( side )
|
||||
{
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean isFlush( AEBaseBlock imb, IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.isGlass( imb, world, x, y, z );
|
||||
}
|
||||
|
||||
boolean isGlass( AEBaseBlock imb, IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
|
||||
}
|
||||
|
||||
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
|
||||
}
|
||||
|
||||
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -28,15 +29,17 @@ import appeng.block.solids.OreQuartz;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
public class RenderQuartzOre extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderQuartzOre() {
|
||||
public RenderQuartzOre()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
|
||||
@@ -45,7 +48,7 @@ public class RenderQuartzOre extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
OreQuartz blk = (OreQuartz) block;
|
||||
blk.setEnhanceBrightness( true );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -34,15 +35,17 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
|
||||
public class RenderQuartzTorch extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderQuartzTorch() {
|
||||
public RenderQuartzTorch()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
@@ -90,15 +93,14 @@ public class RenderQuartzTorch extends BaseBlockRender
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
BlockQuartzTorch blk = (BlockQuartzTorch) block;
|
||||
|
||||
IOrientable te = ((IOrientableBlock) block).getOrientable( world, x, y, z );
|
||||
IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z );
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
float Point3 = 7.0f / 16.0f;
|
||||
@@ -117,19 +119,19 @@ public class RenderQuartzTorch extends BaseBlockRender
|
||||
float zOff = 0.0f;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
if ( te != null )
|
||||
if( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
xOff = forward.offsetX * -(4.0f / 16.0f);
|
||||
yOff = forward.offsetY * -(4.0f / 16.0f);
|
||||
zOff = forward.offsetZ * -(4.0f / 16.0f);
|
||||
xOff = forward.offsetX * -( 4.0f / 16.0f );
|
||||
yOff = forward.offsetY * -( 4.0f / 16.0f );
|
||||
zOff = forward.offsetZ * -( 4.0f / 16.0f );
|
||||
}
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
|
||||
int r = (x + y + z) % 2;
|
||||
if ( r == 0 )
|
||||
int r = ( x + y + z ) % 2;
|
||||
if( r == 0 )
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
@@ -160,48 +162,48 @@ public class RenderQuartzTorch extends BaseBlockRender
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
if ( te != null )
|
||||
if( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
switch (forward)
|
||||
switch( forward )
|
||||
{
|
||||
case EAST:
|
||||
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
default:
|
||||
case EAST:
|
||||
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -26,22 +27,24 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
|
||||
|
||||
public class RenderTinyTNT extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RenderTinyTNT() {
|
||||
public RenderTinyTNT()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
@@ -49,5 +52,4 @@ public class RenderTinyTNT extends BaseBlockRender
|
||||
renderer.renderAllFaces = false;
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -31,30 +32,32 @@ import appeng.client.render.BusRenderer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
|
||||
|
||||
public class RendererCableBus extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RendererCableBus() {
|
||||
public RendererCableBus()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
// nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
AEBaseTile t = block.getTileEntity( world, x, y, z );
|
||||
|
||||
if ( t instanceof TileCableBus )
|
||||
if( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.INSTANCE.renderer.renderAllFaces = true;
|
||||
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
|
||||
BusRenderer.INSTANCE.renderer.overrideBlockTexture = renderer.overrideBlockTexture;
|
||||
((TileCableBus) t).cb.renderStatic( x, y, z );
|
||||
( (TileCableBus) t ).cb.renderStatic( x, y, z );
|
||||
BusRenderer.INSTANCE.renderer.renderAllFaces = false;
|
||||
}
|
||||
|
||||
@@ -62,13 +65,12 @@ public class RendererCableBus extends BaseBlockRender
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
{
|
||||
if ( t instanceof TileCableBus )
|
||||
if( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.INSTANCE.renderer.overrideBlockTexture = null;
|
||||
((TileCableBus) t).cb.renderDynamic( x, y, z );
|
||||
( (TileCableBus) t ).cb.renderDynamic( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -34,29 +35,30 @@ import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
|
||||
|
||||
public class RendererSecurity extends BaseBlockRender
|
||||
{
|
||||
|
||||
public RendererSecurity() {
|
||||
public RendererSecurity()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
|
||||
renderer );
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld(AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
TileSecurity sp = imb.getTileEntity( world, x, y, z );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
@@ -68,7 +70,7 @@ public class RendererSecurity extends BaseBlockRender
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
|
||||
if ( sp.isActive() )
|
||||
if( sp.isActive() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ public class RendererSecurity extends BaseBlockRender
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||
IIcon ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( x, y, z, imb, ico, renderer, up );
|
||||
if ( sp.isActive() )
|
||||
if( sp.isActive() )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
|
||||
@@ -34,8 +34,8 @@ public class AssemblerFX extends EntityFX
|
||||
|
||||
final IAEItemStack item;
|
||||
final EntityFloatingItem fi;
|
||||
float time = 0;
|
||||
final float speed;
|
||||
float time = 0;
|
||||
|
||||
public AssemblerFX( World w, double x, double y, double z, double r, double g, double b, float speed, IAEItemStack is )
|
||||
{
|
||||
@@ -47,7 +47,7 @@ public class AssemblerFX extends EntityFX
|
||||
this.speed = speed;
|
||||
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
|
||||
w.spawnEntityInWorld( this.fi );
|
||||
this.particleMaxAge = ( int ) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
||||
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ public class AssemblerFX extends EntityFX
|
||||
{
|
||||
super.onUpdate();
|
||||
|
||||
if ( this.isDead )
|
||||
if( this.isDead )
|
||||
this.fi.setDead();
|
||||
else
|
||||
{
|
||||
float lifeSpan = ( float ) this.particleAge / ( float ) this.particleMaxAge;
|
||||
float lifeSpan = (float) this.particleAge / (float) this.particleMaxAge;
|
||||
this.fi.setProgress( lifeSpan );
|
||||
}
|
||||
}
|
||||
@@ -76,13 +76,12 @@ public class AssemblerFX extends EntityFX
|
||||
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
this.time += l;
|
||||
if ( this.time > 4.0 )
|
||||
if( this.time > 4.0 )
|
||||
{
|
||||
this.time -= 4.0;
|
||||
// if ( CommonHelper.proxy.shouldAddParticles( r ) )
|
||||
for ( int x = 0; x < ( int ) Math.ceil( this.speed / 5 ); x++ )
|
||||
for( int x = 0; x < (int) Math.ceil( this.speed / 5 ); x++ )
|
||||
CommonHelper.proxy.spawnEffect( EffectType.Crafting, this.worldObj, this.posX, this.posY, this.posZ, null );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class ChargedOreFX extends EntityReddustFX
|
||||
public ChargedOreFX( World w, double x, double y, double z, float r, float g, float b )
|
||||
{
|
||||
super( w, x, y, z, 0.21f, 0.61f, 1.0f );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,9 +37,8 @@ public class ChargedOreFX extends EntityReddustFX
|
||||
int j1 = super.getBrightnessForRender( par1 );
|
||||
j1 = Math.max( j1 >> 20, j1 >> 4 );
|
||||
j1 += 3;
|
||||
if ( j1 > 15 )
|
||||
if( j1 > 15 )
|
||||
j1 = 15;
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,12 +43,6 @@ public class CraftingFx extends EntityBreakingFX
|
||||
private final int startBlkY;
|
||||
private final int startBlkZ;
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public CraftingFx( World par1World, double par2, double par4, double par6, Item par8Item )
|
||||
{
|
||||
super( par1World, par2, par4, par6, par8Item );
|
||||
@@ -68,6 +62,47 @@ public class CraftingFx extends EntityBreakingFX
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float partialTick, float x, float y, float z, float rx, float rz )
|
||||
{
|
||||
if( partialTick < 0 || partialTick > 1 )
|
||||
return;
|
||||
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float scale = 0.1F * this.particleScale;
|
||||
|
||||
float offX = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
|
||||
float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
|
||||
float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
|
||||
float f14 = 1.0F;
|
||||
|
||||
int blkX = MathHelper.floor_double( offX );
|
||||
int blkY = MathHelper.floor_double( offY );
|
||||
int blkZ = MathHelper.floor_double( offZ );
|
||||
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
|
||||
{
|
||||
offX -= interpPosX;
|
||||
offY -= interpPosY;
|
||||
offZ -= interpPosZ;
|
||||
|
||||
// AELog.info( "" + partialTick );
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale, f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale, f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale, f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale, f6, f9 );
|
||||
}
|
||||
}
|
||||
|
||||
public void fromItem( ForgeDirection d )
|
||||
{
|
||||
this.posX += 0.2 * d.offsetX;
|
||||
@@ -83,44 +118,4 @@ public class CraftingFx extends EntityBreakingFX
|
||||
this.particleScale *= 0.51f;
|
||||
this.particleAlpha *= 0.51f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float partialTick, float x, float y, float z, float rx, float rz )
|
||||
{
|
||||
if ( partialTick < 0 || partialTick > 1 )
|
||||
return;
|
||||
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float scale = 0.1F * this.particleScale;
|
||||
|
||||
float offX = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
|
||||
float offY = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
|
||||
float offZ = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
|
||||
float f14 = 1.0F;
|
||||
|
||||
int blkX = MathHelper.floor_double( offX );
|
||||
int blkY = MathHelper.floor_double( offY );
|
||||
int blkZ = MathHelper.floor_double( offZ );
|
||||
if ( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
|
||||
{
|
||||
offX -= interpPosX;
|
||||
offY -= interpPosY;
|
||||
offZ -= interpPosZ;
|
||||
|
||||
// AELog.info( "" + partialTick );
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale,
|
||||
f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale,
|
||||
f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( offX + x * scale + rx * scale, offY + y * scale, offZ + z * scale + rz * scale,
|
||||
f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( offX + x * scale - rx * scale, offY - y * scale, offZ + z * scale - rz * scale,
|
||||
f6, f9 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,12 +43,6 @@ public class EnergyFx extends EntityBreakingFX
|
||||
private final int startBlkY;
|
||||
private final int startBlkZ;
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public EnergyFx( World par1World, double par2, double par4, double par6, Item par8Item )
|
||||
{
|
||||
super( par1World, par2, par4, par6, par8Item );
|
||||
@@ -67,6 +61,40 @@ public class EnergyFx extends EntityBreakingFX
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
|
||||
{
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float f10 = 0.1F * this.particleScale;
|
||||
|
||||
float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
|
||||
float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
|
||||
float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
|
||||
float f14 = 1.0F;
|
||||
|
||||
int blkX = MathHelper.floor_double( this.posX );
|
||||
int blkY = MathHelper.floor_double( this.posY );
|
||||
int blkZ = MathHelper.floor_double( this.posZ );
|
||||
|
||||
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
|
||||
{
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
|
||||
}
|
||||
}
|
||||
|
||||
public void fromItem( ForgeDirection d )
|
||||
{
|
||||
this.posX += 0.2 * d.offsetX;
|
||||
@@ -82,37 +110,4 @@ public class EnergyFx extends EntityBreakingFX
|
||||
this.particleScale *= 0.89f;
|
||||
this.particleAlpha *= 0.89f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
|
||||
{
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float f10 = 0.1F * this.particleScale;
|
||||
|
||||
float f11 = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
|
||||
float f12 = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
|
||||
float f13 = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
|
||||
float f14 = 1.0F;
|
||||
|
||||
int blkX = MathHelper.floor_double( this.posX );
|
||||
int blkY = MathHelper.floor_double( this.posY );
|
||||
int blkZ = MathHelper.floor_double( this.posZ );
|
||||
|
||||
if ( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
|
||||
{
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10,
|
||||
f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10,
|
||||
f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10,
|
||||
f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10,
|
||||
f6, f9 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,13 +53,11 @@ public class LightningArcFX extends LightningFX
|
||||
double lastDirectionZ = this.rz * i;
|
||||
|
||||
double len = Math.sqrt( lastDirectionX * lastDirectionX + lastDirectionY * lastDirectionY + lastDirectionZ * lastDirectionZ );
|
||||
for ( int s = 0; s < this.steps; s++ )
|
||||
for( int s = 0; s < this.steps; s++ )
|
||||
{
|
||||
this.Steps[s][0] = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
|
||||
this.Steps[s][1] = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
|
||||
this.Steps[s][2] = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,19 @@ import net.minecraft.world.World;
|
||||
public class LightningFX extends EntityFX
|
||||
{
|
||||
|
||||
final int steps = this.getSteps();
|
||||
private static final Random RANDOM_GENERATOR = new Random();
|
||||
final int steps = this.getSteps();
|
||||
final double[][] Steps;
|
||||
final double[] I = new double[3];
|
||||
final double[] K = new double[3];
|
||||
float currentPoint = 0;
|
||||
boolean hasData = false;
|
||||
|
||||
public LightningFX( World w, double x, double y, double z, double r, double g, double b )
|
||||
{
|
||||
this( w, x, y, z, r, g, b, 6 );
|
||||
this.regen();
|
||||
}
|
||||
|
||||
protected LightningFX( World w, double x, double y, double z, double r, double g, double b, int maxAge )
|
||||
{
|
||||
@@ -47,19 +57,24 @@ public class LightningFX extends EntityFX
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
protected void regen()
|
||||
{
|
||||
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
for( int s = 0; s < this.steps; s++ )
|
||||
{
|
||||
this.Steps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
this.Steps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
this.Steps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
private int getSteps()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
public LightningFX( World w, double x, double y, double z, double r, double g, double b )
|
||||
{
|
||||
this( w, x, y, z, r, g, b, 6 );
|
||||
this.regen();
|
||||
}
|
||||
|
||||
float currentPoint = 0;
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender( float par1 )
|
||||
{
|
||||
@@ -67,25 +82,12 @@ public class LightningFX extends EntityFX
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
|
||||
protected void regen()
|
||||
{
|
||||
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
|
||||
for ( int s = 0; s < this.steps; s++ )
|
||||
{
|
||||
this.Steps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
this.Steps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
this.Steps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
float j = 1.0f;
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
|
||||
if ( this.particleAge == 3 )
|
||||
if( this.particleAge == 3 )
|
||||
{
|
||||
this.regen();
|
||||
}
|
||||
@@ -108,12 +110,12 @@ public class LightningFX extends EntityFX
|
||||
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
double offX = -rZ;
|
||||
double offY = MathHelper.cos( ( float ) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
|
||||
double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
|
||||
double offZ = rX;
|
||||
|
||||
for ( int layer = 0; layer < 2; layer++ )
|
||||
for( int layer = 0; layer < 2; layer++ )
|
||||
{
|
||||
if ( layer == 0 )
|
||||
if( layer == 0 )
|
||||
{
|
||||
scale = 0.04;
|
||||
offX *= 0.001;
|
||||
@@ -130,7 +132,7 @@ public class LightningFX extends EntityFX
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.65f, this.particleBlue * j * 0.85f, this.particleAlpha );
|
||||
}
|
||||
|
||||
for ( int cycle = 0; cycle < 3; cycle++ )
|
||||
for( int cycle = 0; cycle < 3; cycle++ )
|
||||
{
|
||||
this.clear();
|
||||
|
||||
@@ -138,7 +140,7 @@ public class LightningFX extends EntityFX
|
||||
double y = ( this.prevPosY + ( this.posY - this.prevPosY ) * l - interpPosY ) - offY;
|
||||
double z = ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * l - interpPosZ ) - offZ;
|
||||
|
||||
for ( int s = 0; s < this.steps; s++ )
|
||||
for( int s = 0; s < this.steps; s++ )
|
||||
{
|
||||
double xN = x + this.Steps[s][0];
|
||||
double yN = y + this.Steps[s][1];
|
||||
@@ -148,26 +150,26 @@ public class LightningFX extends EntityFX
|
||||
double yD = yN - y;
|
||||
double zD = zN - z;
|
||||
|
||||
if ( cycle == 0 )
|
||||
if( cycle == 0 )
|
||||
{
|
||||
ox = ( yD * 0 ) - ( 1 * zD );
|
||||
oy = ( zD * 0 ) - ( 0 * xD );
|
||||
oz = ( xD * 1 ) - ( 0 * yD );
|
||||
}
|
||||
if ( cycle == 1 )
|
||||
if( cycle == 1 )
|
||||
{
|
||||
ox = ( yD * 1 ) - ( 0 * zD );
|
||||
oy = ( zD * 0 ) - ( 1 * xD );
|
||||
oz = ( xD * 0 ) - ( 0 * yD );
|
||||
}
|
||||
if ( cycle == 2 )
|
||||
if( cycle == 2 )
|
||||
{
|
||||
ox = ( yD * 0 ) - ( 0 * zD );
|
||||
oy = ( zD * 1 ) - ( 0 * xD );
|
||||
oz = ( xD * 0 ) - ( 1 * yD );
|
||||
}
|
||||
|
||||
double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( ( double ) this.steps - ( double ) s ) / this.steps ) * scale );
|
||||
double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( (double) this.steps - (double) s ) / this.steps ) * scale );
|
||||
ox /= ss;
|
||||
oy /= ss;
|
||||
oz /= ss;
|
||||
@@ -194,13 +196,14 @@ public class LightningFX extends EntityFX
|
||||
*/
|
||||
}
|
||||
|
||||
boolean hasData = false;
|
||||
final double[] I = new double[3];
|
||||
final double[] K = new double[3];
|
||||
private void clear()
|
||||
{
|
||||
this.hasData = false;
|
||||
}
|
||||
|
||||
private void draw( Tessellator tess, double[] a, double[] b, double f6, double f8 )
|
||||
{
|
||||
if ( this.hasData )
|
||||
if( this.hasData )
|
||||
{
|
||||
tess.addVertexWithUV( a[0], a[1], a[2], f6, f8 );
|
||||
tess.addVertexWithUV( this.I[0], this.I[1], this.I[2], f6, f8 );
|
||||
@@ -208,15 +211,10 @@ public class LightningFX extends EntityFX
|
||||
tess.addVertexWithUV( b[0], b[1], b[2], f6, f8 );
|
||||
}
|
||||
this.hasData = true;
|
||||
for ( int x = 0; x < 3; x++ )
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
this.I[x] = a[x];
|
||||
this.K[x] = b[x];
|
||||
}
|
||||
}
|
||||
|
||||
private void clear()
|
||||
{
|
||||
this.hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,20 +78,15 @@ public class MatterCannonFX extends EntityBreakingFX
|
||||
float f9 = this.particleTextureIndex.getMaxV();
|
||||
float f10 = 0.05F * this.particleScale;
|
||||
|
||||
float f11 = ( float ) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
|
||||
float f12 = ( float ) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
|
||||
float f13 = ( float ) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
|
||||
float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
|
||||
float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
|
||||
float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
|
||||
float f14 = 1.0F;
|
||||
|
||||
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10,
|
||||
f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10,
|
||||
f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10,
|
||||
f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10,
|
||||
f6, f9 );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
|
||||
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f6, f8 );
|
||||
par1Tessellator.addVertexWithUV( f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f6, f9 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class VibrantFX extends EntityFX
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.particleMaxAge = ( int ) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
|
||||
this.particleMaxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class VibrantFX extends EntityFX
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.particleScale *= 0.95;
|
||||
|
||||
if ( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
|
||||
if( this.particleMaxAge <= 0 || this.particleScale < 0.1 )
|
||||
{
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -29,6 +30,7 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
|
||||
|
||||
public class ItemEncodedPatternRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
@@ -36,14 +38,14 @@ public class ItemEncodedPatternRenderer implements IItemRenderer
|
||||
boolean recursive;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
|
||||
|
||||
if ( !this.recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
|
||||
if( !this.recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
|
||||
{
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
||||
if ( iep.getOutput( item ) != null )
|
||||
if( iep.getOutput( item ) != null )
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,13 +53,13 @@ public class ItemEncodedPatternRenderer implements IItemRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
this.recursive = true;
|
||||
|
||||
|
||||
@@ -31,26 +31,27 @@ import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
|
||||
|
||||
public class PaintBallRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
if ( item.getItemDamage() >= 20 )
|
||||
if( item.getItemDamage() >= 20 )
|
||||
par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
|
||||
|
||||
float f4 = par2Icon.getMinU();
|
||||
@@ -68,19 +69,19 @@ public class PaintBallRender implements IItemRenderer
|
||||
AEColor col = ipb.getColor( item );
|
||||
|
||||
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
int r = (colorValue >> 16) & 0xff;
|
||||
int g = (colorValue >> 8) & 0xff;
|
||||
int r = ( colorValue >> 16 ) & 0xff;
|
||||
int g = ( colorValue >> 8 ) & 0xff;
|
||||
int b = ( colorValue ) & 0xff;
|
||||
|
||||
int full = (int) (255 * 0.3);
|
||||
int full = (int) ( 255 * 0.3 );
|
||||
float fail = 0.7f;
|
||||
|
||||
if ( item.getItemDamage() >= 20 )
|
||||
GL11.glColor4ub( (byte) (full + r * fail), (byte) (full + g * fail), (byte) (full + b * fail), (byte) 255 );
|
||||
if( item.getItemDamage() >= 20 )
|
||||
GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 );
|
||||
else
|
||||
GL11.glColor4ub( (byte) r, (byte) g, (byte) b, (byte) 255 );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
@@ -97,7 +98,7 @@ public class PaintBallRender implements IItemRenderer
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else
|
||||
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -28,27 +27,30 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
|
||||
|
||||
public class ToolBiometricCardRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
|
||||
@@ -62,7 +64,7 @@ public class ToolBiometricCardRender implements IItemRenderer
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
@@ -94,10 +96,10 @@ public class ToolBiometricCardRender implements IItemRenderer
|
||||
float v = ExtraItemTextures.White.getIcon().getInterpolatedV( 8.1 );
|
||||
|
||||
String username = "";
|
||||
if ( item.getItem() instanceof IBiometricCard )
|
||||
if( item.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
GameProfile gp = (( IBiometricCard) item.getItem() ).getProfile(item);
|
||||
if ( gp != null )
|
||||
GameProfile gp = ( (IBiometricCard) item.getItem() ).getProfile( item );
|
||||
if( gp != null )
|
||||
username = gp.getName();
|
||||
}
|
||||
int hash = username.length() > 0 ? username.hashCode() : 0;
|
||||
@@ -110,26 +112,25 @@ public class ToolBiometricCardRender implements IItemRenderer
|
||||
float z = 0;
|
||||
|
||||
AEColor col = AEColor.values()[Math.abs( 3 + hash ) % AEColor.values().length];
|
||||
if ( hash == 0 )
|
||||
if( hash == 0 )
|
||||
col = AEColor.Black;
|
||||
|
||||
for (int x = 0; x < 8; x++)// 8
|
||||
for( int x = 0; x < 8; x++ )// 8
|
||||
{
|
||||
for (int y = 0; y < 6; y++)// 6
|
||||
for( int y = 0; y < 6; y++ )// 6
|
||||
{
|
||||
boolean isLit = false;
|
||||
float scale = 0.3f / 255.0f;
|
||||
|
||||
if ( x == 0 || y == 0 || x == 7 || y == 5 )
|
||||
if( x == 0 || y == 0 || x == 7 || y == 5 )
|
||||
isLit = false;
|
||||
else
|
||||
isLit = (hash & (1 << x)) != 0 || (hash & (1 << y)) != 0;
|
||||
isLit = ( hash & ( 1 << x ) ) != 0 || ( hash & ( 1 << y ) ) != 0;
|
||||
|
||||
if ( isLit )
|
||||
if( isLit )
|
||||
tessellator.setColorOpaque_I( col.mediumVariant );
|
||||
else
|
||||
tessellator.setColorOpaque_F( ((col.blackVariant >> 16) & 0xff) * scale, ((col.blackVariant >> 8) & 0xff) * scale,
|
||||
(col.blackVariant & 0xff) * scale );
|
||||
tessellator.setColorOpaque_F( ( ( col.blackVariant >> 16 ) & 0xff ) * scale, ( ( col.blackVariant >> 8 ) & 0xff ) * scale, ( col.blackVariant & 0xff ) * scale );
|
||||
|
||||
tessellator.addVertexWithUV( x, y, z, u, v );
|
||||
tessellator.addVertexWithUV( x + 1, y, z, u, v );
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
@@ -30,23 +31,24 @@ import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
|
||||
|
||||
public class ToolColorApplicatorRender implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
|
||||
@@ -60,7 +62,7 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
GL11.glScalef( 16F, 16F, 10F );
|
||||
@@ -78,9 +80,9 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else if ( type == ItemRenderType.EQUIPPED )
|
||||
else if( type == ItemRenderType.EQUIPPED )
|
||||
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
else
|
||||
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
@@ -98,15 +100,15 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
IIcon light = ExtraItemTextures.ToolColorApplicatorTip_Light.getIcon();
|
||||
|
||||
GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||
if ( type != ItemRenderType.INVENTORY )
|
||||
if( type != ItemRenderType.INVENTORY )
|
||||
GL11.glTranslatef( 2, 0, 0 );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
AEColor col = null;
|
||||
|
||||
col = ((ToolColorApplicator) item.getItem()).getActiveColor( item );
|
||||
col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item );
|
||||
|
||||
if ( col != null )
|
||||
if( col != null )
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
|
||||
public class ModelCompass extends ModelBase
|
||||
{
|
||||
|
||||
@@ -33,7 +35,8 @@ public class ModelCompass extends ModelBase
|
||||
|
||||
final ModelRenderer Pointer;
|
||||
|
||||
public ModelCompass() {
|
||||
public ModelCompass()
|
||||
{
|
||||
this.textureWidth = 16;
|
||||
this.textureHeight = 8;
|
||||
|
||||
@@ -90,14 +93,14 @@ public class ModelCompass extends ModelBase
|
||||
this.setRotation( this.Base, 0F, 0F, 0F );
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
private void setRotation( ModelRenderer model, float x, float y, float z )
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void renderAll(float rad)
|
||||
public void renderAll( float rad )
|
||||
{
|
||||
this.setRotation( this.Pointer, 0F, 0F, 0F );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user