Removed old rendering system
Removed old rendering system. Some parts may be left over, but they won't affect testing. 1.10-R todo tag marks things to do with rendering.
This commit is contained in:
@@ -1,790 +0,0 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.BlockFaceUV;
|
||||
import net.minecraft.client.renderer.block.model.BlockPartFace;
|
||||
import net.minecraft.client.renderer.block.model.FaceBakery;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.BaseIcon;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
|
||||
public class BakingModelGenerator implements ModelGenerator
|
||||
{
|
||||
private static final class CachedModel implements IBakedModel
|
||||
{
|
||||
private final List<BakedQuad> general;
|
||||
private final List<BakedQuad>[] faces = new List[6];
|
||||
|
||||
public CachedModel()
|
||||
{
|
||||
this.general = new ArrayList<BakedQuad>();
|
||||
for( final EnumFacing f : EnumFacing.VALUES )
|
||||
{
|
||||
this.faces[f.ordinal()] = new ArrayList<BakedQuad>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture()
|
||||
{
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms()
|
||||
{
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
|
||||
{
|
||||
return side == null ? general : this.faces[side.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int uvRotateBottom;
|
||||
private int uvRotateEast;
|
||||
private int uvRotateNorth;
|
||||
private int uvRotateSouth;
|
||||
private int uvRotateTop;
|
||||
private int uvRotateWest;
|
||||
private IAESprite overrideBlockTexture;
|
||||
private boolean renderAllFaces;
|
||||
|
||||
private double renderMinX;
|
||||
private double renderMaxX;
|
||||
|
||||
private double renderMinY;
|
||||
private double renderMaxY;
|
||||
|
||||
private double renderMinZ;
|
||||
private double renderMaxZ;
|
||||
|
||||
private IBlockAccess blockAccess;
|
||||
|
||||
private final CachedModel generatedModel = new CachedModel();
|
||||
|
||||
// used to create faces...
|
||||
private final FaceBakery faceBakery = new FaceBakery();
|
||||
|
||||
private float tx = 0, ty = 0, tz = 0;
|
||||
private final float[] defUVs = { 0, 0, 1, 1 };
|
||||
|
||||
private final float[] quadsUV = { 0, 0, 1, 1, 0, 0, 1, 1 };
|
||||
private EnumSet<EnumFacing> renderFaces = EnumSet.allOf( EnumFacing.class );
|
||||
private boolean flipTexture = false;
|
||||
private final List<SMFace> faces = new ArrayList();
|
||||
|
||||
// private int point = 0;
|
||||
private int brightness = -1;
|
||||
private VertexBuffer vertexBuffer;
|
||||
//private final float[][] points = new float[4][];
|
||||
private EnumFacing currentFace = EnumFacing.UP;
|
||||
private int color = -1;
|
||||
|
||||
public void setRenderBoundsFromBlock( final IBlockState state, final @Nullable BlockPos pos )
|
||||
{
|
||||
if( state == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AxisAlignedBB boundingBox;
|
||||
try
|
||||
{
|
||||
boundingBox = state.getBoundingBox( getBlockAccess(), pos );
|
||||
}
|
||||
catch( NullPointerException e )
|
||||
{
|
||||
boundingBox = Block.FULL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
this.setRenderMinX( boundingBox.minX );
|
||||
this.setRenderMinY( boundingBox.minY );
|
||||
this.setRenderMinZ( boundingBox.minZ );
|
||||
this.setRenderMaxX( boundingBox.maxX );
|
||||
this.setRenderMaxY( boundingBox.maxY );
|
||||
this.setRenderMaxZ( boundingBox.maxZ );
|
||||
}
|
||||
|
||||
public void setRenderBounds( final double d, final double e, final double f, final double g, final double h, final double i )
|
||||
{
|
||||
this.setRenderMinX( d );
|
||||
this.setRenderMinY( e );
|
||||
this.setRenderMinZ( f );
|
||||
this.setRenderMaxX( g );
|
||||
this.setRenderMaxY( h );
|
||||
this.setRenderMaxZ( i );
|
||||
}
|
||||
|
||||
public void setBrightness( final int i )
|
||||
{
|
||||
this.brightness = i;
|
||||
}
|
||||
|
||||
public void setColorRGBA_F( final int r, final int g, final int b, final float a )
|
||||
{
|
||||
final int alpha = (int) ( a * 0xff );
|
||||
this.color = alpha << 24 | r << 16 | b << 8 | b;
|
||||
}
|
||||
|
||||
public void setColorOpaque_I( final int whiteVariant )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color = // alpha << 24 |
|
||||
whiteVariant;
|
||||
}
|
||||
|
||||
public void setColorOpaque( final int r, final int g, final int b )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color = // alpha << 24 |
|
||||
r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
public void setColorOpaque_F( final int r, final int g, final int b )
|
||||
{
|
||||
final int alpha = 0xff;
|
||||
this.color = // alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 | Math.min( 0xff, Math.max( 0, g ) ) << 8 | Math.min( 0xff, Math.max( 0, b ) );
|
||||
}
|
||||
|
||||
public void setColorOpaque_F( final float rf, final float bf, final float gf )
|
||||
{
|
||||
final int r = (int) ( rf * 0xff );
|
||||
final int g = (int) ( gf * 0xff );
|
||||
final int b = (int) ( bf * 0xff );
|
||||
final int alpha = 0xff;
|
||||
this.color = // alpha << 24 |
|
||||
Math.min( 0xff, Math.max( 0, r ) ) << 16 | Math.min( 0xff, Math.max( 0, g ) ) << 8 | Math.min( 0xff, Math.max( 0, b ) );
|
||||
}
|
||||
|
||||
public IAESprite getIcon( final ItemStack is )
|
||||
{
|
||||
final Item it = is.getItem();
|
||||
|
||||
if( it instanceof ItemMultiPart )
|
||||
{
|
||||
return ( (ItemMultiPart) it ).getIcon( is );
|
||||
}
|
||||
|
||||
final Block blk = Block.getBlockFromItem( it );
|
||||
|
||||
if( blk != null )
|
||||
{
|
||||
return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0];
|
||||
}
|
||||
|
||||
if( it instanceof AEBaseItem )
|
||||
{
|
||||
final IAESprite ico = ( (AEBaseItem) it ).getIcon( is );
|
||||
if( ico != null )
|
||||
{
|
||||
return ico;
|
||||
}
|
||||
}
|
||||
|
||||
return new MissingIcon( is );
|
||||
}
|
||||
|
||||
public IAESprite[] getIcon( final IBlockState state )
|
||||
{
|
||||
final IAESprite[] out = new IAESprite[6];
|
||||
|
||||
final Block blk = state.getBlock();
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
final AEBaseBlock base = (AEBaseBlock) blk;
|
||||
for( final EnumFacing face : EnumFacing.VALUES )
|
||||
{
|
||||
out[face.ordinal()] = base.getIcon( face, state );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final TextureAtlasSprite spite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( state );
|
||||
if( spite == null )
|
||||
{
|
||||
out[0] = new MissingIcon( blk );
|
||||
out[1] = new MissingIcon( blk );
|
||||
out[2] = new MissingIcon( blk );
|
||||
out[3] = new MissingIcon( blk );
|
||||
out[4] = new MissingIcon( blk );
|
||||
out[5] = new MissingIcon( blk );
|
||||
}
|
||||
else
|
||||
{
|
||||
final IAESprite mySpite = new BaseIcon( spite );
|
||||
out[0] = mySpite;
|
||||
out[1] = mySpite;
|
||||
out[2] = mySpite;
|
||||
out[3] = mySpite;
|
||||
out[4] = mySpite;
|
||||
out[5] = mySpite;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
public IAESprite[] getIcon( final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
final IBlockState state = world.getBlockState( pos );
|
||||
final Block blk = state.getBlock();
|
||||
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
final IAESprite[] out = new IAESprite[6];
|
||||
|
||||
final AEBaseBlock base = (AEBaseBlock) blk;
|
||||
for( final EnumFacing face : EnumFacing.VALUES )
|
||||
{
|
||||
out[face.ordinal()] = base.getIcon( world, pos, face );
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
return this.getIcon( state );
|
||||
}
|
||||
|
||||
//TODO 1.9.4 aftermath - Check that this shit still works. VertexBuffer
|
||||
public void addVertexWithUV( final EnumFacing face, final double x, final double y, final double z, final double u, final double v )
|
||||
{
|
||||
//this.points[this.point++] = new float[] { (float) x + this.tx, (float) y + this.ty, (float) z + this.tz, (float) u, (float) v };
|
||||
if( vertexBuffer == null )
|
||||
{
|
||||
vertexBuffer = new VertexBuffer( 4 );
|
||||
vertexBuffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
}
|
||||
vertexBuffer.pos( x, y, z ).tex( u, v ).endVertex();
|
||||
// if( this.point == 4 )
|
||||
if( vertexBuffer.getVertexCount() == 4)
|
||||
{
|
||||
/*this.brightness = -1;
|
||||
final int[] vertData = {
|
||||
Float.floatToRawIntBits( this.points[0][0] ),
|
||||
Float.floatToRawIntBits( this.points[0][1] ),
|
||||
Float.floatToRawIntBits( this.points[0][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[0][3] ),
|
||||
Float.floatToRawIntBits( this.points[0][4] ),
|
||||
// 0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[1][0] ),
|
||||
Float.floatToRawIntBits( this.points[1][1] ),
|
||||
Float.floatToRawIntBits( this.points[1][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[1][3] ),
|
||||
Float.floatToRawIntBits( this.points[1][4] ),
|
||||
// 0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[2][0] ),
|
||||
Float.floatToRawIntBits( this.points[2][1] ),
|
||||
Float.floatToRawIntBits( this.points[2][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[2][3] ),
|
||||
Float.floatToRawIntBits( this.points[2][4] ),
|
||||
// 0,
|
||||
|
||||
Float.floatToRawIntBits( this.points[3][0] ),
|
||||
Float.floatToRawIntBits( this.points[3][1] ),
|
||||
Float.floatToRawIntBits( this.points[3][2] ),
|
||||
this.brightness,
|
||||
Float.floatToRawIntBits( this.points[3][3] ),
|
||||
Float.floatToRawIntBits( this.points[3][4] ),
|
||||
// 0,
|
||||
};
|
||||
|
||||
this.generatedModel.general.add( new BakedQuad( vertData, this.color, face, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, DefaultVertexFormats.POSITION_TEX ) );
|
||||
for( List<BakedQuad> list : this.generatedModel.faces )
|
||||
{
|
||||
list.add( new BakedQuad( vertData, this.color, face, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, DefaultVertexFormats.POSITION_TEX ) );
|
||||
}
|
||||
|
||||
this.point = 0;*/
|
||||
|
||||
vertexBuffer.finishDrawing();
|
||||
final VertexBuffer.State state = vertexBuffer.getVertexState();
|
||||
this.generatedModel.general.add( new BakedQuad( state.getRawBuffer(), this.color, face, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, state.getVertexFormat() ) );
|
||||
for( List<BakedQuad> list : this.generatedModel.faces )
|
||||
{
|
||||
list.add( new BakedQuad( state.getRawBuffer(), this.color, face, Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, state.getVertexFormat() ) );
|
||||
}
|
||||
vertexBuffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderStandardBlock( final Block block, final BlockPos pos )
|
||||
{
|
||||
// setRenderBoundsFromBlock( block );
|
||||
|
||||
final IAESprite[] textures = this.getIcon( this.getBlockAccess(), pos );
|
||||
this.setColorOpaque_I( 0xffffff );
|
||||
|
||||
this.renderFaceXNeg( block, pos, textures[EnumFacing.WEST.ordinal()] );
|
||||
this.renderFaceXPos( block, pos, textures[EnumFacing.EAST.ordinal()] );
|
||||
this.renderFaceYNeg( block, pos, textures[EnumFacing.DOWN.ordinal()] );
|
||||
this.renderFaceYPos( block, pos, textures[EnumFacing.UP.ordinal()] );
|
||||
this.renderFaceZNeg( block, pos, textures[EnumFacing.NORTH.ordinal()] );
|
||||
this.renderFaceZPos( block, pos, textures[EnumFacing.SOUTH.ordinal()] );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTranslation( final int x, final int y, final int z )
|
||||
{
|
||||
this.tx = x;
|
||||
this.ty = y;
|
||||
this.tz = z;
|
||||
}
|
||||
|
||||
public boolean isAlphaPass()
|
||||
{
|
||||
return MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
private float[] getFaceUvs( final EnumFacing face, final Vector3f to_16, final Vector3f from_16 )
|
||||
{
|
||||
float from_a = 0;
|
||||
float from_b = 0;
|
||||
float to_a = 0;
|
||||
float to_b = 0;
|
||||
|
||||
switch( face )
|
||||
{
|
||||
case UP:
|
||||
from_a = from_16.x / 16.0f;
|
||||
from_b = from_16.z / 16.0f;
|
||||
to_a = to_16.x / 16.0f;
|
||||
to_b = to_16.z / 16.0f;
|
||||
break;
|
||||
case DOWN:
|
||||
from_a = from_16.x / 16.0f;
|
||||
from_b = from_16.z / 16.0f;
|
||||
to_a = to_16.x / 16.0f;
|
||||
to_b = to_16.z / 16.0f;
|
||||
break;
|
||||
case SOUTH:
|
||||
from_a = from_16.x / 16.0f;
|
||||
from_b = from_16.y / 16.0f;
|
||||
to_a = to_16.x / 16.0f;
|
||||
to_b = to_16.y / 16.0f;
|
||||
break;
|
||||
case NORTH:
|
||||
from_a = from_16.x / 16.0f;
|
||||
from_b = from_16.y / 16.0f;
|
||||
to_a = to_16.x / 16.0f;
|
||||
to_b = to_16.y / 16.0f;
|
||||
break;
|
||||
case EAST:
|
||||
from_a = from_16.y / 16.0f;
|
||||
from_b = from_16.z / 16.0f;
|
||||
to_a = to_16.y / 16.0f;
|
||||
to_b = to_16.z / 16.0f;
|
||||
break;
|
||||
case WEST:
|
||||
from_a = from_16.y / 16.0f;
|
||||
from_b = from_16.z / 16.0f;
|
||||
to_a = to_16.y / 16.0f;
|
||||
to_b = to_16.z / 16.0f;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
from_a = 1.0f - from_a;
|
||||
from_b = 1.0f - from_b;
|
||||
to_a = 1.0f - to_a;
|
||||
to_b = 1.0f - to_b;
|
||||
|
||||
final float[] afloat = {// :P
|
||||
16.0f * ( this.quadsUV[0] + this.quadsUV[2] * from_a + this.quadsUV[4] * from_b ), // 0
|
||||
16.0f * ( this.quadsUV[1] + this.quadsUV[3] * from_a + this.quadsUV[5] * from_b ), // 1
|
||||
|
||||
16.0f * ( this.quadsUV[0] + this.quadsUV[2] * to_a + this.quadsUV[4] * from_b ), // 2
|
||||
16.0f * ( this.quadsUV[1] + this.quadsUV[3] * to_a + this.quadsUV[5] * from_b ), // 3
|
||||
|
||||
16.0f * ( this.quadsUV[0] + this.quadsUV[2] * to_a + this.quadsUV[4] * to_b ), // 2
|
||||
16.0f * ( this.quadsUV[1] + this.quadsUV[3] * to_a + this.quadsUV[5] * to_b ), // 3
|
||||
|
||||
16.0f * ( this.quadsUV[0] + this.quadsUV[2] * from_a + this.quadsUV[4] * to_b ), // 0
|
||||
16.0f * ( this.quadsUV[1] + this.quadsUV[3] * from_a + this.quadsUV[5] * to_b ), // 1
|
||||
};
|
||||
|
||||
return afloat;
|
||||
}
|
||||
|
||||
public void renderFaceXNeg( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinX() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.WEST;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceYNeg( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinY() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.DOWN;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceZNeg( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMinZ() < 0.0001;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.NORTH;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceYPos( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMaxY() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.UP;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceZPos( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMaxZ() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMinX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.SOUTH;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceXPos( final Block blk, final BlockPos pos, final IAESprite lights )
|
||||
{
|
||||
final boolean isEdge = this.getRenderMaxX() > 0.9999;
|
||||
final Vector3f to = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMinY() * 16.0f, (float) this.getRenderMinZ() * 16.0f );
|
||||
final Vector3f from = new Vector3f( (float) this.getRenderMaxX() * 16.0f, (float) this.getRenderMaxY() * 16.0f, (float) this.getRenderMaxZ() * 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.EAST;
|
||||
this.addFace( myFace, isEdge, to, from, this.defUVs, lights );
|
||||
}
|
||||
|
||||
private void addFace( final EnumFacing face, final boolean isEdge, final Vector3f to, final Vector3f from, final float[] defUVs2, IAESprite texture )
|
||||
{
|
||||
if( this.getOverrideBlockTexture() != null )
|
||||
{
|
||||
texture = this.getOverrideBlockTexture();
|
||||
}
|
||||
|
||||
this.faces.add( new SMFace( face, isEdge, this.color, to, from, defUVs2, new IconUnwrapper( texture ) ) );
|
||||
}
|
||||
|
||||
public void setNormal( final float x, final float y, final float z )
|
||||
{
|
||||
if( x > 0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.EAST;
|
||||
}
|
||||
if( x < -0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.WEST;
|
||||
}
|
||||
if( y > 0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.UP;
|
||||
}
|
||||
if( y < -0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.DOWN;
|
||||
}
|
||||
if( z > 0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.SOUTH;
|
||||
}
|
||||
if( z < -0.5 )
|
||||
{
|
||||
this.currentFace = EnumFacing.NORTH;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverrideBlockTexture( final IAESprite object )
|
||||
{
|
||||
this.overrideBlockTexture = object;
|
||||
}
|
||||
|
||||
public void finalizeModel( final boolean Flip )
|
||||
{
|
||||
ModelRotation mr = ModelRotation.X0_Y0;
|
||||
|
||||
if( Flip )
|
||||
{
|
||||
mr = ModelRotation.X0_Y180;
|
||||
}
|
||||
|
||||
for( final SMFace face : this.faces )
|
||||
{
|
||||
final EnumFacing myFace = face.getFace();
|
||||
final float[] uvs = this.getFaceUvs( myFace, face.getFrom(), face.getTo() );
|
||||
|
||||
final BlockFaceUV uv = new BlockFaceUV( uvs, 0 );
|
||||
final BlockPartFace bpf = new BlockPartFace( myFace, face.getColor(), "", uv );
|
||||
|
||||
BakedQuad bf = this.faceBakery.makeBakedQuad( face.getTo(), face.getFrom(), bpf, face.getSpite(), myFace, mr, null, true, true );
|
||||
bf = new BakedQuad( bf.getVertexData(), face.getColor(), bf.getFace(), Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry( TextureMap.LOCATION_BLOCKS_TEXTURE.toString() ), true, DefaultVertexFormats.POSITION_TEX );
|
||||
|
||||
if( face.isEdge() )
|
||||
{
|
||||
this.generatedModel.faces[myFace.ordinal()].add( bf );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.generatedModel.general.add( bf );
|
||||
for( List<BakedQuad> list : this.generatedModel.faces )
|
||||
{
|
||||
list.add( bf );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IBakedModel getOutput()
|
||||
{
|
||||
return this.generatedModel;
|
||||
}
|
||||
|
||||
public IAESprite getOverrideBlockTexture()
|
||||
{
|
||||
return this.overrideBlockTexture;
|
||||
}
|
||||
|
||||
public IBlockAccess getBlockAccess()
|
||||
{
|
||||
return this.blockAccess;
|
||||
}
|
||||
|
||||
public void setBlockAccess( final IBlockAccess blockAccess )
|
||||
{
|
||||
this.blockAccess = blockAccess;
|
||||
}
|
||||
|
||||
public boolean isRenderAllFaces()
|
||||
{
|
||||
return this.renderAllFaces;
|
||||
}
|
||||
|
||||
public void setRenderAllFaces( final boolean renderAllFaces )
|
||||
{
|
||||
this.renderAllFaces = renderAllFaces;
|
||||
}
|
||||
|
||||
public int getUvRotateBottom()
|
||||
{
|
||||
return this.uvRotateBottom;
|
||||
}
|
||||
|
||||
public int setUvRotateBottom( final int uvRotateBottom )
|
||||
{
|
||||
this.uvRotateBottom = uvRotateBottom;
|
||||
return uvRotateBottom;
|
||||
}
|
||||
|
||||
public int getUvRotateEast()
|
||||
{
|
||||
return this.uvRotateEast;
|
||||
}
|
||||
|
||||
public int setUvRotateEast( final int uvRotateEast )
|
||||
{
|
||||
this.uvRotateEast = uvRotateEast;
|
||||
return uvRotateEast;
|
||||
}
|
||||
|
||||
public int getUvRotateNorth()
|
||||
{
|
||||
return this.uvRotateNorth;
|
||||
}
|
||||
|
||||
public int setUvRotateNorth( final int uvRotateNorth )
|
||||
{
|
||||
this.uvRotateNorth = uvRotateNorth;
|
||||
return uvRotateNorth;
|
||||
}
|
||||
|
||||
public int getUvRotateSouth()
|
||||
{
|
||||
return this.uvRotateSouth;
|
||||
}
|
||||
|
||||
public int setUvRotateSouth( final int uvRotateSouth )
|
||||
{
|
||||
this.uvRotateSouth = uvRotateSouth;
|
||||
return uvRotateSouth;
|
||||
}
|
||||
|
||||
public int getUvRotateTop()
|
||||
{
|
||||
return this.uvRotateTop;
|
||||
}
|
||||
|
||||
public int setUvRotateTop( final int uvRotateTop )
|
||||
{
|
||||
this.uvRotateTop = uvRotateTop;
|
||||
return uvRotateTop;
|
||||
}
|
||||
|
||||
public int getUvRotateWest()
|
||||
{
|
||||
return this.uvRotateWest;
|
||||
}
|
||||
|
||||
public int setUvRotateWest( final int uvRotateWest )
|
||||
{
|
||||
this.uvRotateWest = uvRotateWest;
|
||||
return uvRotateWest;
|
||||
}
|
||||
|
||||
public double getRenderMinX()
|
||||
{
|
||||
return this.renderMinX;
|
||||
}
|
||||
|
||||
public void setRenderMinX( final double renderMinX )
|
||||
{
|
||||
this.renderMinX = renderMinX;
|
||||
}
|
||||
|
||||
public double getRenderMinY()
|
||||
{
|
||||
return this.renderMinY;
|
||||
}
|
||||
|
||||
public void setRenderMinY( final double renderMinY )
|
||||
{
|
||||
this.renderMinY = renderMinY;
|
||||
}
|
||||
|
||||
public double getRenderMinZ()
|
||||
{
|
||||
return this.renderMinZ;
|
||||
}
|
||||
|
||||
public void setRenderMinZ( final double renderMinZ )
|
||||
{
|
||||
this.renderMinZ = renderMinZ;
|
||||
}
|
||||
|
||||
public double getRenderMaxX()
|
||||
{
|
||||
return this.renderMaxX;
|
||||
}
|
||||
|
||||
public void setRenderMaxX( final double renderMaxX )
|
||||
{
|
||||
this.renderMaxX = renderMaxX;
|
||||
}
|
||||
|
||||
public double getRenderMaxY()
|
||||
{
|
||||
return this.renderMaxY;
|
||||
}
|
||||
|
||||
public void setRenderMaxY( final double renderMaxY )
|
||||
{
|
||||
this.renderMaxY = renderMaxY;
|
||||
}
|
||||
|
||||
public double getRenderMaxZ()
|
||||
{
|
||||
return this.renderMaxZ;
|
||||
}
|
||||
|
||||
public void setRenderMaxZ( final double renderMaxZ )
|
||||
{
|
||||
this.renderMaxZ = renderMaxZ;
|
||||
}
|
||||
|
||||
public boolean isFlipTexture()
|
||||
{
|
||||
return this.flipTexture;
|
||||
}
|
||||
|
||||
public void setFlipTexture( final boolean flipTexture )
|
||||
{
|
||||
this.flipTexture = flipTexture;
|
||||
}
|
||||
|
||||
public EnumSet<EnumFacing> getRenderFaces()
|
||||
{
|
||||
return this.renderFaces;
|
||||
}
|
||||
|
||||
public void setRenderFaces( final EnumSet<EnumFacing> renderFaces )
|
||||
{
|
||||
this.renderFaces = renderFaces;
|
||||
}
|
||||
}
|
||||
@@ -1,768 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
{
|
||||
private static final int ORIENTATION_BITS = 7;
|
||||
private static final int FLIP_H_BIT = 8;
|
||||
private static final int FLIP_V_BIT = 16;
|
||||
private static final byte[][][] ORIENTATION_MAP = new byte[6][6][6];
|
||||
|
||||
private final boolean hasTESR;
|
||||
private final double renderDistance;
|
||||
private final FloatBuffer rotMat = BufferUtils.createFloatBuffer( 16 );
|
||||
|
||||
private static int dynRender = 0;
|
||||
private final ModelResourceLocation modelPath = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "DynamicRender" + dynRender++ ), "inventory" );
|
||||
|
||||
public BaseBlockRender()
|
||||
{
|
||||
this( false, 20 );
|
||||
}
|
||||
|
||||
public BaseBlockRender( final boolean enableTESR, final double renderDistance )
|
||||
{
|
||||
this.hasTESR = enableTESR;
|
||||
this.renderDistance = renderDistance;
|
||||
setOriMap();
|
||||
}
|
||||
|
||||
private static void setOriMap()
|
||||
{
|
||||
// pointed up...
|
||||
ORIENTATION_MAP[0][3][1] = 0;
|
||||
ORIENTATION_MAP[1][3][1] = 0;
|
||||
ORIENTATION_MAP[2][3][1] = 0;
|
||||
ORIENTATION_MAP[3][3][1] = 0;
|
||||
ORIENTATION_MAP[4][3][1] = 0;
|
||||
ORIENTATION_MAP[5][3][1] = 0;
|
||||
|
||||
ORIENTATION_MAP[0][5][1] = 1;
|
||||
ORIENTATION_MAP[1][5][1] = 2;
|
||||
ORIENTATION_MAP[2][5][1] = 0;
|
||||
ORIENTATION_MAP[3][5][1] = 0;
|
||||
ORIENTATION_MAP[4][5][1] = 0;
|
||||
ORIENTATION_MAP[5][5][1] = 0;
|
||||
|
||||
ORIENTATION_MAP[0][2][1] = 3;
|
||||
ORIENTATION_MAP[1][2][1] = 3;
|
||||
ORIENTATION_MAP[2][2][1] = 0;
|
||||
ORIENTATION_MAP[3][2][1] = 0;
|
||||
ORIENTATION_MAP[4][2][1] = 0;
|
||||
ORIENTATION_MAP[5][2][1] = 0;
|
||||
|
||||
ORIENTATION_MAP[0][4][1] = 2;
|
||||
ORIENTATION_MAP[1][4][1] = 1;
|
||||
ORIENTATION_MAP[2][4][1] = 0;
|
||||
ORIENTATION_MAP[3][4][1] = 0;
|
||||
ORIENTATION_MAP[4][4][1] = 0;
|
||||
ORIENTATION_MAP[5][4][1] = 0;
|
||||
|
||||
// upside down
|
||||
ORIENTATION_MAP[0][3][0] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][3][0] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][3][0] = 3;
|
||||
ORIENTATION_MAP[3][3][0] = 3;
|
||||
ORIENTATION_MAP[4][3][0] = 3;
|
||||
ORIENTATION_MAP[5][3][0] = 3;
|
||||
|
||||
ORIENTATION_MAP[0][4][0] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][4][0] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][4][0] = 3;
|
||||
ORIENTATION_MAP[3][4][0] = 3;
|
||||
ORIENTATION_MAP[4][4][0] = 3;
|
||||
ORIENTATION_MAP[5][4][0] = 3;
|
||||
|
||||
ORIENTATION_MAP[0][5][0] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][5][0] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][5][0] = 3;
|
||||
ORIENTATION_MAP[3][5][0] = 3;
|
||||
ORIENTATION_MAP[4][5][0] = 3;
|
||||
ORIENTATION_MAP[5][5][0] = 3;
|
||||
|
||||
ORIENTATION_MAP[0][2][0] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][2][0] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][2][0] = 3;
|
||||
ORIENTATION_MAP[3][2][0] = 3;
|
||||
ORIENTATION_MAP[4][2][0] = 3;
|
||||
ORIENTATION_MAP[5][2][0] = 3;
|
||||
|
||||
// side 1
|
||||
ORIENTATION_MAP[0][3][5] = 1 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[1][3][5] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][3][5] = 1;
|
||||
ORIENTATION_MAP[3][3][5] = 1;
|
||||
ORIENTATION_MAP[4][3][5] = 1;
|
||||
ORIENTATION_MAP[5][3][5] = 1 | FLIP_V_BIT;
|
||||
|
||||
ORIENTATION_MAP[0][1][5] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][1][5] = 1;
|
||||
ORIENTATION_MAP[2][1][5] = 3 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[3][1][5] = 3;
|
||||
ORIENTATION_MAP[4][1][5] = 1 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[5][1][5] = 1;
|
||||
|
||||
ORIENTATION_MAP[0][2][5] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][2][5] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][2][5] = 1;
|
||||
ORIENTATION_MAP[3][2][5] = 2 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[4][2][5] = 1 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[5][2][5] = 1;
|
||||
|
||||
ORIENTATION_MAP[0][0][5] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][0][5] = 1;
|
||||
ORIENTATION_MAP[2][0][5] = 0;
|
||||
ORIENTATION_MAP[3][0][5] = FLIP_V_BIT;
|
||||
ORIENTATION_MAP[4][0][5] = 1;
|
||||
ORIENTATION_MAP[5][0][5] = 1 | FLIP_V_BIT;
|
||||
|
||||
// side 2
|
||||
ORIENTATION_MAP[0][1][2] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][1][2] = 0;
|
||||
ORIENTATION_MAP[2][1][2] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][1][2] = 1;
|
||||
ORIENTATION_MAP[4][1][2] = 3;
|
||||
ORIENTATION_MAP[5][1][2] = 3 | FLIP_H_BIT;
|
||||
|
||||
ORIENTATION_MAP[0][4][2] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][4][2] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][4][2] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][4][2] = 1;
|
||||
ORIENTATION_MAP[4][4][2] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][4][2] = 2;
|
||||
|
||||
ORIENTATION_MAP[0][0][2] = FLIP_V_BIT;
|
||||
ORIENTATION_MAP[1][0][2] = 0;
|
||||
ORIENTATION_MAP[2][0][2] = 2;
|
||||
ORIENTATION_MAP[3][0][2] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][0][2] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][0][2] = 0;
|
||||
|
||||
ORIENTATION_MAP[0][5][2] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][5][2] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[2][5][2] = 2;
|
||||
ORIENTATION_MAP[3][5][2] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][5][2] = 2;
|
||||
ORIENTATION_MAP[5][5][2] = 1 | FLIP_H_BIT;
|
||||
|
||||
// side 3
|
||||
ORIENTATION_MAP[0][0][3] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][0][3] = 3;
|
||||
ORIENTATION_MAP[2][0][3] = 1;
|
||||
ORIENTATION_MAP[3][0][3] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][0][3] = 0;
|
||||
ORIENTATION_MAP[5][0][3] = FLIP_H_BIT;
|
||||
|
||||
ORIENTATION_MAP[0][4][3] = 3;
|
||||
ORIENTATION_MAP[1][4][3] = 3;
|
||||
ORIENTATION_MAP[2][4][3] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][4][3] = 2;
|
||||
ORIENTATION_MAP[4][4][3] = 1;
|
||||
ORIENTATION_MAP[5][4][3] = 2 | FLIP_H_BIT;
|
||||
|
||||
ORIENTATION_MAP[0][1][3] = 3 | FLIP_V_BIT;
|
||||
ORIENTATION_MAP[1][1][3] = 3;
|
||||
ORIENTATION_MAP[2][1][3] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][1][3] = 2;
|
||||
ORIENTATION_MAP[4][1][3] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][1][3] = 0;
|
||||
|
||||
ORIENTATION_MAP[0][5][3] = 3;
|
||||
ORIENTATION_MAP[1][5][3] = 3;
|
||||
ORIENTATION_MAP[2][5][3] = 1;
|
||||
ORIENTATION_MAP[3][5][3] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][5][3] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][5][3] = 1;
|
||||
|
||||
// side 4
|
||||
ORIENTATION_MAP[0][3][4] = 1;
|
||||
ORIENTATION_MAP[1][3][4] = 2;
|
||||
ORIENTATION_MAP[2][3][4] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][3][4] = 1;
|
||||
ORIENTATION_MAP[4][3][4] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][3][4] = 1;
|
||||
|
||||
ORIENTATION_MAP[0][0][4] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][0][4] = 2;
|
||||
ORIENTATION_MAP[2][0][4] = 0;
|
||||
ORIENTATION_MAP[3][0][4] = FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][0][4] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[5][0][4] = 1;
|
||||
|
||||
ORIENTATION_MAP[0][1][4] = 1 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[1][1][4] = 2;
|
||||
ORIENTATION_MAP[2][1][4] = 3 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[3][1][4] = 3;
|
||||
ORIENTATION_MAP[4][1][4] = 2;
|
||||
ORIENTATION_MAP[5][1][4] = 1 | FLIP_H_BIT;
|
||||
|
||||
ORIENTATION_MAP[0][2][4] = 1;
|
||||
ORIENTATION_MAP[1][2][4] = 2;
|
||||
ORIENTATION_MAP[2][2][4] = 1;
|
||||
ORIENTATION_MAP[3][2][4] = 2 | FLIP_H_BIT;
|
||||
ORIENTATION_MAP[4][2][4] = 2;
|
||||
ORIENTATION_MAP[5][2][4] = 1 | FLIP_H_BIT;
|
||||
}
|
||||
|
||||
public boolean hasTESR()
|
||||
{
|
||||
return this.hasTESR;
|
||||
}
|
||||
|
||||
protected int adjustBrightness( final int v, final double d )
|
||||
{
|
||||
int r = 0xff & ( v >> 16 );
|
||||
int g = 0xff & ( v >> 8 );
|
||||
int b = 0xff & ( v );
|
||||
|
||||
r *= d;
|
||||
g *= d;
|
||||
b *= d;
|
||||
|
||||
r = Math.min( 255, Math.max( 0, r ) );
|
||||
g = Math.min( 255, Math.max( 0, g ) );
|
||||
b = Math.min( 255, Math.max( 0, b ) );
|
||||
|
||||
return ( r << 16 ) | ( g << 8 ) | b;
|
||||
}
|
||||
|
||||
double getTesrRenderDistance()
|
||||
{
|
||||
return this.renderDistance;
|
||||
}
|
||||
|
||||
public void renderInventory( final B block, final ItemStack item, final ModelGenerator renderer, final appeng.client.ItemRenderType type, final Object[] data )
|
||||
{
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
if( info.isValid() )
|
||||
{
|
||||
if( block.hasSubtypes() )
|
||||
{
|
||||
block.setRenderStateByMeta( item.getItemDamage() );
|
||||
}
|
||||
|
||||
renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
|
||||
renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
|
||||
renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, EnumFacing.SOUTH, EnumFacing.UP ) ) );
|
||||
}
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), block, item, 0xffffff, renderer );
|
||||
|
||||
if( block.hasSubtypes() )
|
||||
{
|
||||
info.setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
}
|
||||
|
||||
static int getOrientation( final EnumFacing in, final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
if( in == null // 1
|
||||
|| forward == null // 2
|
||||
|| up == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
final int a = in.ordinal();
|
||||
final int b = forward.ordinal();
|
||||
final int c = up.ordinal();
|
||||
|
||||
return ORIENTATION_MAP[a][b][c];
|
||||
}
|
||||
|
||||
public void renderInvBlock( final EnumSet<AEPartLocation> sides, final B block, final ItemStack item, final int color, final ModelGenerator tess )
|
||||
{
|
||||
if( block != null && block.hasSubtypes() && item != null )
|
||||
{
|
||||
final int meta = item.getItemDamage();
|
||||
}
|
||||
|
||||
final IAESprite[] icons = tess.getIcon( item == null ? block.getDefaultState() : block.getStateFromMeta( item.getMetadata() ) );
|
||||
final BlockPos zero = new BlockPos( 0, 0, 0 );
|
||||
|
||||
if( sides.contains( AEPartLocation.DOWN ) )
|
||||
{
|
||||
tess.setNormal( 0.0F, -1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceYNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.DOWN ), icons[AEPartLocation.DOWN.ordinal()] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( AEPartLocation.UP ) )
|
||||
{
|
||||
tess.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceYPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.UP ), icons[AEPartLocation.UP.ordinal()] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( AEPartLocation.NORTH ) )
|
||||
{
|
||||
tess.setNormal( 0.0F, 0.0F, -1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceZNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.NORTH ), icons[AEPartLocation.NORTH.ordinal()] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( AEPartLocation.SOUTH ) )
|
||||
{
|
||||
tess.setNormal( 0.0F, 0.0F, 1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceZPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.SOUTH ), icons[AEPartLocation.SOUTH.ordinal()] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( AEPartLocation.WEST ) )
|
||||
{
|
||||
tess.setNormal( -1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceXNeg( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.WEST ), icons[AEPartLocation.WEST.ordinal()] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( AEPartLocation.EAST ) )
|
||||
{
|
||||
tess.setNormal( 1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
tess.renderFaceXPos( block, zero, this.firstNotNull( tess.getOverrideBlockTexture(), block.getRendererInstance().getTexture( AEPartLocation.EAST ), icons[AEPartLocation.EAST.ordinal()] ) );
|
||||
}
|
||||
}
|
||||
|
||||
private IAESprite firstNotNull( final IAESprite... s )
|
||||
{
|
||||
for( final IAESprite o : s )
|
||||
{
|
||||
if( o != null )
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
return ExtraBlockTextures.getMissing();
|
||||
}
|
||||
|
||||
public boolean renderInWorld( final B block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
final boolean o = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
return o;
|
||||
}
|
||||
|
||||
public void preRenderInWorld( final B block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
final IOrientable te = this.getOrientable( block, world, pos );
|
||||
if( te != null )
|
||||
{
|
||||
final EnumFacing forward = te.getForward();
|
||||
final EnumFacing up = te.getUp();
|
||||
|
||||
renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, forward, up ) ) );
|
||||
renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, forward, up ) ) );
|
||||
|
||||
renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, forward, up ) ) );
|
||||
renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, forward, up ) ) );
|
||||
|
||||
renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, forward, up ) ) );
|
||||
renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, forward, up ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void postRenderInWorld( final ModelGenerator renderer )
|
||||
{
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IOrientable getOrientable( final B block, final IBlockAccess w, final BlockPos pos )
|
||||
{
|
||||
return block.getOrientable( w, pos );
|
||||
}
|
||||
|
||||
protected void setInvRenderBounds( final ModelGenerator renderer, final int i, final int j, final int k, final int l, final int m, final int n )
|
||||
{
|
||||
renderer.setRenderBounds( i / 16.0, j / 16.0, k / 16.0, l / 16.0, m / 16.0, n / 16.0 );
|
||||
}
|
||||
|
||||
protected void renderBlockBounds( final ModelGenerator renderer,
|
||||
|
||||
double minX, double minY, double minZ,
|
||||
|
||||
double maxX, double maxY, double maxZ,
|
||||
|
||||
final EnumFacing x, final EnumFacing y, final EnumFacing z )
|
||||
{
|
||||
minX /= 16.0;
|
||||
minY /= 16.0;
|
||||
minZ /= 16.0;
|
||||
maxX /= 16.0;
|
||||
maxY /= 16.0;
|
||||
maxZ /= 16.0;
|
||||
|
||||
double aX = minX * x.getFrontOffsetX() + minY * y.getFrontOffsetX() + minZ * z.getFrontOffsetX();
|
||||
double aY = minX * x.getFrontOffsetY() + minY * y.getFrontOffsetY() + minZ * z.getFrontOffsetY();
|
||||
double aZ = minX * x.getFrontOffsetZ() + minY * y.getFrontOffsetZ() + minZ * z.getFrontOffsetZ();
|
||||
|
||||
double bX = maxX * x.getFrontOffsetX() + maxY * y.getFrontOffsetX() + maxZ * z.getFrontOffsetX();
|
||||
double bY = maxX * x.getFrontOffsetY() + maxY * y.getFrontOffsetY() + maxZ * z.getFrontOffsetY();
|
||||
double bZ = maxX * x.getFrontOffsetZ() + maxY * y.getFrontOffsetZ() + maxZ * z.getFrontOffsetZ();
|
||||
|
||||
if( x.getFrontOffsetX() + y.getFrontOffsetX() + z.getFrontOffsetX() < 0 )
|
||||
{
|
||||
aX += 1;
|
||||
bX += 1;
|
||||
}
|
||||
|
||||
if( x.getFrontOffsetY() + y.getFrontOffsetY() + z.getFrontOffsetY() < 0 )
|
||||
{
|
||||
aY += 1;
|
||||
bY += 1;
|
||||
}
|
||||
|
||||
if( x.getFrontOffsetZ() + y.getFrontOffsetZ() + z.getFrontOffsetZ() < 0 )
|
||||
{
|
||||
aZ += 1;
|
||||
bZ += 1;
|
||||
}
|
||||
|
||||
renderer.setRenderMinX( Math.min( aX, bX ) );
|
||||
renderer.setRenderMinY( Math.min( aY, bY ) );
|
||||
renderer.setRenderMinZ( Math.min( aZ, bZ ) );
|
||||
renderer.setRenderMaxX( Math.max( aX, bX ) );
|
||||
renderer.setRenderMaxY( Math.max( aY, bY ) );
|
||||
renderer.setRenderMaxZ( Math.max( aZ, bZ ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void renderCutoutFace( final B block, final IAESprite ico, final BlockPos pos, final ModelGenerator tess, final EnumFacing orientation, final float edgeThickness )
|
||||
{
|
||||
double offsetX = 0.0;
|
||||
double offsetY = 0.0;
|
||||
double offsetZ = 0.0;
|
||||
double layerAX = 0.0;
|
||||
double layerAZ = 0.0;
|
||||
double layerBY = 0.0;
|
||||
double layerBZ = 0.0;
|
||||
|
||||
boolean flip = false;
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
|
||||
layerAX = 1.0;
|
||||
layerBY = 1.0;
|
||||
flip = true;
|
||||
|
||||
break;
|
||||
case SOUTH:
|
||||
|
||||
layerAX = 1.0;
|
||||
layerBY = 1.0;
|
||||
offsetZ = 1.0;
|
||||
|
||||
break;
|
||||
case EAST:
|
||||
|
||||
flip = true;
|
||||
layerAZ = 1.0;
|
||||
layerBY = 1.0;
|
||||
offsetX = 1.0;
|
||||
|
||||
break;
|
||||
case WEST:
|
||||
|
||||
layerAZ = 1.0;
|
||||
layerBY = 1.0;
|
||||
|
||||
break;
|
||||
case UP:
|
||||
|
||||
flip = true;
|
||||
layerAX = 1.0;
|
||||
layerBZ = 1.0;
|
||||
offsetY = 1.0;
|
||||
|
||||
break;
|
||||
case DOWN:
|
||||
|
||||
layerAX = 1.0;
|
||||
layerBZ = 1.0;
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
offsetX += pos.getX();
|
||||
offsetY += pos.getY();
|
||||
offsetZ += pos.getZ();
|
||||
|
||||
final double layerBX = 0.0;
|
||||
final double layerAY = 0.0;
|
||||
this.renderFace( orientation, tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
// u -> u
|
||||
0, 1.0,
|
||||
// v -> v
|
||||
0, edgeThickness, ico, flip );
|
||||
|
||||
this.renderFace( orientation, tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
// u -> u
|
||||
0.0, edgeThickness,
|
||||
// v -> v
|
||||
edgeThickness, 1.0 - edgeThickness, ico, flip );
|
||||
|
||||
this.renderFace( orientation, tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
// u -> u
|
||||
1.0 - edgeThickness, 1.0,
|
||||
// v -> v
|
||||
edgeThickness, 1.0 - edgeThickness, ico, flip );
|
||||
|
||||
this.renderFace( orientation, tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
// u -> u
|
||||
0, 1.0,
|
||||
// v -> v
|
||||
1.0 - edgeThickness, 1.0, ico, flip );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private void renderFace( final EnumFacing face, final ModelGenerator tess, final double offsetX, final double offsetY, final double offsetZ, final double ax, final double ay, final double az, final double bx, final double by, final double bz, final double ua, final double ub, final double va, final double vb, final IAESprite ico, final boolean flip )
|
||||
{
|
||||
if( flip )
|
||||
{
|
||||
tess.addVertexWithUV( face, 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( face, 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 ) );
|
||||
tess.addVertexWithUV( face, offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( face, offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
tess.addVertexWithUV( face, 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( face, offsetX + ax * ub + bx * va, offsetY + ay * ub + by * va, offsetZ + az * ub + bz * va, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( face, offsetX + ax * ub + bx * vb, offsetY + ay * ub + by * vb, offsetZ + az * ub + bz * vb, ico.getInterpolatedU( ub * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( face, 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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void renderFace( final BlockPos pos, final B block, final IAESprite ico, final ModelGenerator renderer, final EnumFacing orientation )
|
||||
{
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( block, pos, ico );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( block, pos, ico );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( block, pos, ico );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( block, pos, ico );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( block, pos, ico );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( block, pos, ico );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void selectFace( final ModelGenerator renderer, final EnumFacing west, final EnumFacing up, final EnumFacing forward, final int u1, final int u2, int v1, int v2 )
|
||||
{
|
||||
v1 = 16 - v1;
|
||||
v2 = 16 - v2;
|
||||
|
||||
final double minX = ( forward.getFrontOffsetX() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetX(), u1 ) + this.mapFaceUV( up.getFrontOffsetX(), v1 );
|
||||
final double minY = ( forward.getFrontOffsetY() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetY(), u1 ) + this.mapFaceUV( up.getFrontOffsetY(), v1 );
|
||||
final double minZ = ( forward.getFrontOffsetZ() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetZ(), u1 ) + this.mapFaceUV( up.getFrontOffsetZ(), v1 );
|
||||
|
||||
final double maxX = ( forward.getFrontOffsetX() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetX(), u2 ) + this.mapFaceUV( up.getFrontOffsetX(), v2 );
|
||||
final double maxY = ( forward.getFrontOffsetY() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetY(), u2 ) + this.mapFaceUV( up.getFrontOffsetY(), v2 );
|
||||
final double maxZ = ( forward.getFrontOffsetZ() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetZ(), u2 ) + this.mapFaceUV( up.getFrontOffsetZ(), v2 );
|
||||
|
||||
renderer.setRenderMinX( Math.max( 0.0, Math.min( minX, maxX ) - ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ) );
|
||||
renderer.setRenderMaxX( Math.min( 1.0, Math.max( minX, maxX ) + ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) ) );
|
||||
|
||||
renderer.setRenderMinY( Math.max( 0.0, Math.min( minY, maxY ) - ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ) );
|
||||
renderer.setRenderMaxY( Math.min( 1.0, Math.max( minY, maxY ) + ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) ) );
|
||||
|
||||
renderer.setRenderMinZ( Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ) );
|
||||
renderer.setRenderMaxZ( Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) ) );
|
||||
}
|
||||
|
||||
private double mapFaceUV( final int offset, final int uv )
|
||||
{
|
||||
if( offset == 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( offset > 0 )
|
||||
{
|
||||
return uv / 16.0;
|
||||
}
|
||||
|
||||
return ( 16.0 - uv ) / 16.0;
|
||||
}
|
||||
|
||||
public void renderTile( final B block, final T tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateTop( renderer.setUvRotateEast( renderer.setUvRotateWest( renderer.setUvRotateNorth( renderer.setUvRotateSouth( 0 ) ) ) ) ) );
|
||||
|
||||
final AEPartLocation up = AEPartLocation.UP;
|
||||
final AEPartLocation forward = AEPartLocation.SOUTH;
|
||||
this.applyTESRRotation( x, y, z, forward.getFacing(), up.getFacing() );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if( Minecraft.isAmbientOcclusionEnabled() )
|
||||
{
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
}
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
final BlockPos pos = tile.getPos();
|
||||
renderer.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() );
|
||||
|
||||
// note that this is a terrible approach...
|
||||
renderer.setRenderBoundsFromBlock( block.getDefaultState(), pos );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateTop( renderer.setUvRotateEast( renderer.setUvRotateWest( renderer.setUvRotateNorth( renderer.setUvRotateSouth( 0 ) ) ) ) ) );
|
||||
}
|
||||
|
||||
protected void applyTESRRotation( final double x, final double y, final double z, final EnumFacing forward, final EnumFacing up )
|
||||
{
|
||||
if( forward != null && up != null )
|
||||
{
|
||||
final EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
this.rotMat.put( 0, west.getFrontOffsetX() );
|
||||
this.rotMat.put( 1, west.getFrontOffsetY() );
|
||||
this.rotMat.put( 2, west.getFrontOffsetZ() );
|
||||
this.rotMat.put( 3, 0 );
|
||||
|
||||
this.rotMat.put( 4, up.getFrontOffsetX() );
|
||||
this.rotMat.put( 5, up.getFrontOffsetY() );
|
||||
this.rotMat.put( 6, up.getFrontOffsetZ() );
|
||||
this.rotMat.put( 7, 0 );
|
||||
|
||||
this.rotMat.put( 8, forward.getFrontOffsetX() );
|
||||
this.rotMat.put( 9, forward.getFrontOffsetY() );
|
||||
this.rotMat.put( 10, forward.getFrontOffsetZ() );
|
||||
this.rotMat.put( 11, 0 );
|
||||
|
||||
this.rotMat.put( 12, 0 );
|
||||
this.rotMat.put( 13, 0 );
|
||||
this.rotMat.put( 14, 0 );
|
||||
this.rotMat.put( 15, 1 );
|
||||
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
|
||||
GL11.glMultMatrix( this.rotMat );
|
||||
GL11.glTranslated( -0.5, -0.5, -0.5 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glTranslated( x, y, z );
|
||||
}
|
||||
}
|
||||
|
||||
public void doRenderItem( final ItemStack itemstack, final TileEntity par1EntityItemFrame )
|
||||
{
|
||||
if( itemstack != null )
|
||||
{
|
||||
final EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorld(), 0.0D, 0.0D, 0.0D, itemstack );
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
|
||||
// set all this stuff and then do shit? meh?
|
||||
entityitem.hoverStart = 0;
|
||||
entityitem.setNoDespawn();
|
||||
entityitem.rotationYaw = 0;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( 0, -0.14F, 0 );
|
||||
|
||||
// RenderItem.renderInFrame = true;
|
||||
Minecraft.getMinecraft().getRenderManager().doRenderEntity( entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, true );
|
||||
// RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public ModelResourceLocation getResourcePath()
|
||||
{
|
||||
return this.modelPath;
|
||||
}
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.TmpFlippableIcon;
|
||||
|
||||
|
||||
public class BlockRenderInfo
|
||||
{
|
||||
|
||||
private final BaseBlockRender rendererInstance;
|
||||
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;
|
||||
private FlippableIcon northIcon = null;
|
||||
private FlippableIcon eastIcon = null;
|
||||
private FlippableIcon westIcon = null;
|
||||
|
||||
public BlockRenderInfo( final BaseBlockRender inst )
|
||||
{
|
||||
this.rendererInstance = inst;
|
||||
}
|
||||
|
||||
public void updateIcons( final FlippableIcon bottom, final FlippableIcon top, final FlippableIcon north, final FlippableIcon south, final FlippableIcon east, final FlippableIcon west )
|
||||
{
|
||||
this.topIcon = top;
|
||||
this.bottomIcon = bottom;
|
||||
this.southIcon = south;
|
||||
this.northIcon = north;
|
||||
this.eastIcon = east;
|
||||
this.westIcon = west;
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcon( final IAESprite icon )
|
||||
{
|
||||
if( icon == null )
|
||||
{
|
||||
this.useTmp = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.useTmp = true;
|
||||
this.tmpTopIcon.setOriginal( icon );
|
||||
this.tmpBottomIcon.setOriginal( icon );
|
||||
this.tmpSouthIcon.setOriginal( icon );
|
||||
this.tmpNorthIcon.setOriginal( icon );
|
||||
this.tmpEastIcon.setOriginal( icon );
|
||||
this.tmpWestIcon.setOriginal( icon );
|
||||
}
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcons( final IAESprite nTopIcon, final IAESprite nBottomIcon, final IAESprite nSouthIcon, final IAESprite nNorthIcon, final IAESprite nEastIcon, final IAESprite nWestIcon )
|
||||
{
|
||||
this.tmpTopIcon.setOriginal( nTopIcon == null ? this.getTexture( AEPartLocation.UP ) : nTopIcon );
|
||||
this.tmpBottomIcon.setOriginal( nBottomIcon == null ? this.getTexture( AEPartLocation.DOWN ) : nBottomIcon );
|
||||
this.tmpSouthIcon.setOriginal( nSouthIcon == null ? this.getTexture( AEPartLocation.SOUTH ) : nSouthIcon );
|
||||
this.tmpNorthIcon.setOriginal( nNorthIcon == null ? this.getTexture( AEPartLocation.NORTH ) : nNorthIcon );
|
||||
this.tmpEastIcon.setOriginal( nEastIcon == null ? this.getTexture( AEPartLocation.EAST ) : nEastIcon );
|
||||
this.tmpWestIcon.setOriginal( nWestIcon == null ? this.getTexture( AEPartLocation.WEST ) : nWestIcon );
|
||||
this.useTmp = true;
|
||||
}
|
||||
|
||||
public FlippableIcon getTexture( final AEPartLocation dir )
|
||||
{
|
||||
if( this.useTmp )
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return this.topIcon;
|
||||
}
|
||||
|
||||
boolean isValid()
|
||||
{
|
||||
return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null;
|
||||
}
|
||||
|
||||
public BaseBlockRender getRendererInstance()
|
||||
{
|
||||
return this.rendererInstance;
|
||||
}
|
||||
}
|
||||
@@ -1,546 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public final class BusRenderHelper implements IPartRenderHelper
|
||||
{
|
||||
public static final BusRenderHelper INSTANCE = new BusRenderHelper();
|
||||
private static final int HEX_WHITE = 0xffffff;
|
||||
|
||||
private final BoundBoxCalculator bbc;
|
||||
private final boolean noAlphaPass;
|
||||
private final BaseBlockRender bbr;
|
||||
private final Optional<Block> maybeBlock;
|
||||
private final Optional<AEBaseBlock> maybeBaseBlock;
|
||||
private int renderingForPass;
|
||||
private int currentPass;
|
||||
private int itemsRendered;
|
||||
private double minX;
|
||||
private double minY;
|
||||
private double minZ;
|
||||
private double maxX;
|
||||
private double maxY;
|
||||
private double maxZ;
|
||||
private EnumFacing ax;
|
||||
private EnumFacing ay;
|
||||
private EnumFacing az;
|
||||
private int color;
|
||||
|
||||
public BusRenderHelper()
|
||||
{
|
||||
this.bbc = new BoundBoxCalculator( this );
|
||||
this.noAlphaPass = !AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass );
|
||||
this.bbr = new BaseBlockRender<AEBaseBlock, AEBaseTile>();
|
||||
this.renderingForPass = 0;
|
||||
this.currentPass = 0;
|
||||
this.itemsRendered = 0;
|
||||
this.minX = 0;
|
||||
this.minY = 0;
|
||||
this.minZ = 0;
|
||||
this.maxX = 16;
|
||||
this.maxY = 16;
|
||||
this.maxZ = 16;
|
||||
this.ax = EnumFacing.EAST;
|
||||
this.az = EnumFacing.SOUTH;
|
||||
this.ay = EnumFacing.UP;
|
||||
this.color = HEX_WHITE;
|
||||
this.maybeBlock = AEApi.instance().definitions().blocks().multiPart().maybeBlock();
|
||||
this.maybeBaseBlock = this.maybeBlock.transform( new BaseBlockTransformFunction() );
|
||||
}
|
||||
|
||||
public int getItemsRendered()
|
||||
{
|
||||
return this.itemsRendered;
|
||||
}
|
||||
|
||||
public void setPass( final int pass )
|
||||
{
|
||||
this.renderingForPass = 0;
|
||||
this.currentPass = pass;
|
||||
this.itemsRendered = 0;
|
||||
}
|
||||
|
||||
public double getBound( final AEPartLocation side )
|
||||
{
|
||||
switch( side )
|
||||
{
|
||||
default:
|
||||
case INTERNAL:
|
||||
return 0.5;
|
||||
case DOWN:
|
||||
return this.minY;
|
||||
case EAST:
|
||||
return this.maxX;
|
||||
case NORTH:
|
||||
return this.minZ;
|
||||
case SOUTH:
|
||||
return this.maxZ;
|
||||
case UP:
|
||||
return this.maxY;
|
||||
case WEST:
|
||||
return this.minX;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* public void setRenderColor( int color )
|
||||
* {
|
||||
* for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
* {
|
||||
* final BlockCableBus cableBus = (BlockCableBus) block;
|
||||
* cableBus.setRenderColor( color );
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
public void setOrientation( final EnumFacing dx, final EnumFacing dy, final EnumFacing dz )
|
||||
{
|
||||
this.ax = dx == null ? EnumFacing.EAST : dx;
|
||||
this.ay = dy == null ? EnumFacing.UP : dy;
|
||||
this.az = dz == null ? EnumFacing.SOUTH : dz;
|
||||
}
|
||||
|
||||
public double[] getBounds()
|
||||
{
|
||||
return new double[] { this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ };
|
||||
}
|
||||
|
||||
public void setBounds( final double[] bounds )
|
||||
{
|
||||
if( bounds == null || bounds.length != 6 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.minX = bounds[0];
|
||||
this.minY = bounds[1];
|
||||
this.minZ = bounds[2];
|
||||
this.maxX = bounds[3];
|
||||
this.maxY = bounds[4];
|
||||
this.maxZ = bounds[5];
|
||||
}
|
||||
|
||||
private static class BoundBoxCalculator implements IPartCollisionHelper
|
||||
{
|
||||
private final BusRenderHelper helper;
|
||||
private boolean started = false;
|
||||
|
||||
private float minX;
|
||||
private float minY;
|
||||
private float minZ;
|
||||
|
||||
private float maxX;
|
||||
private float maxY;
|
||||
private float maxZ;
|
||||
|
||||
public BoundBoxCalculator( final BusRenderHelper helper )
|
||||
{
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBox( final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ )
|
||||
{
|
||||
if( this.started )
|
||||
{
|
||||
this.minX = Math.min( this.minX, (float) minX );
|
||||
this.minY = Math.min( this.minY, (float) minY );
|
||||
this.minZ = Math.min( this.minZ, (float) minZ );
|
||||
this.maxX = Math.max( this.maxX, (float) maxX );
|
||||
this.maxY = Math.max( this.maxY, (float) maxY );
|
||||
this.maxZ = Math.max( this.maxZ, (float) maxZ );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.started = true;
|
||||
this.minX = (float) minX;
|
||||
this.minY = (float) minY;
|
||||
this.minZ = (float) minZ;
|
||||
this.maxX = (float) maxX;
|
||||
this.maxY = (float) maxY;
|
||||
this.maxZ = (float) maxZ;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldX()
|
||||
{
|
||||
return this.helper.ax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldY()
|
||||
{
|
||||
return this.helper.ay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldZ()
|
||||
{
|
||||
return this.helper.az;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBBCollision()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class BaseBlockTransformFunction implements Function<Block, AEBaseBlock>
|
||||
{
|
||||
@Nullable
|
||||
@Override
|
||||
public AEBaseBlock apply( final Block input )
|
||||
{
|
||||
if( input instanceof AEBaseBlock )
|
||||
{
|
||||
return( (AEBaseBlock) input );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderForPass( final int pass )
|
||||
{
|
||||
this.renderingForPass = pass;
|
||||
}
|
||||
|
||||
private boolean renderThis()
|
||||
{
|
||||
if( this.renderingForPass == this.currentPass || this.noAlphaPass )
|
||||
{
|
||||
this.itemsRendered++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds( final float minX, final float minY, final float minZ, final float maxX, final float maxY, final float maxZ )
|
||||
{
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.minZ = minZ;
|
||||
this.maxX = maxX;
|
||||
this.maxY = maxY;
|
||||
this.maxZ = maxZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvColor( final int newColor )
|
||||
{
|
||||
this.color = newColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture( final IAESprite ico )
|
||||
{
|
||||
for( final AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
baseBlock.getRendererInstance().setTemporaryRenderIcon( ico );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture( final IAESprite down, final IAESprite up, final IAESprite north, final IAESprite south, final IAESprite west, final IAESprite east )
|
||||
{
|
||||
final IAESprite[] list = new IAESprite[6];
|
||||
|
||||
list[0] = down;
|
||||
list[1] = up;
|
||||
list[2] = north;
|
||||
list[3] = south;
|
||||
list[4] = west;
|
||||
list[5] = east;
|
||||
|
||||
for( final AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
baseBlock.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( EnumFacing.UP ).ordinal()], list[this.mapRotation( EnumFacing.DOWN ).ordinal()], list[this.mapRotation( EnumFacing.SOUTH ).ordinal()], list[this.mapRotation( EnumFacing.NORTH ).ordinal()], list[this.mapRotation( EnumFacing.EAST ).ordinal()], list[this.mapRotation( EnumFacing.WEST ).ordinal()] );
|
||||
}
|
||||
}
|
||||
|
||||
private EnumFacing mapRotation( final EnumFacing dir )
|
||||
{
|
||||
final EnumFacing forward = this.az;
|
||||
final EnumFacing up = this.ay;
|
||||
|
||||
if( forward == null || up == null )
|
||||
{
|
||||
return dir;
|
||||
}
|
||||
|
||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
|
||||
EnumFacing west = null;
|
||||
for( final EnumFacing dx : EnumFacing.VALUES )
|
||||
{
|
||||
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
|
||||
{
|
||||
west = dx;
|
||||
}
|
||||
}
|
||||
|
||||
if( dir == forward )
|
||||
{
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
if( dir == forward.getOpposite() )
|
||||
{
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
if( dir == up )
|
||||
{
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
if( dir == up.getOpposite() )
|
||||
{
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
|
||||
if( dir == west )
|
||||
{
|
||||
return EnumFacing.WEST;
|
||||
}
|
||||
if( dir == west.getOpposite() )
|
||||
{
|
||||
return EnumFacing.EAST;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBox( final ModelGenerator renderer )
|
||||
{
|
||||
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( final AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), baseBlock, null, this.color, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryFace( final IAESprite icon, final EnumFacing face, final ModelGenerator renderer )
|
||||
{
|
||||
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( icon );
|
||||
|
||||
for( final AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.of( AEPartLocation.fromFacing( face ) ), baseBlock, null, this.color, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBlock( final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for( final Block multiPart : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
final AEBaseBlock block = (AEBaseBlock) multiPart;
|
||||
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
final EnumFacing forward = BusRenderHelper.INSTANCE.az;
|
||||
final EnumFacing up = BusRenderHelper.INSTANCE.ay;
|
||||
|
||||
renderer.setUvRotateBottom( info.getTexture( AEPartLocation.DOWN ).setFlip( BaseBlockRender.getOrientation( EnumFacing.DOWN, forward, up ) ) );
|
||||
renderer.setUvRotateTop( info.getTexture( AEPartLocation.UP ).setFlip( BaseBlockRender.getOrientation( EnumFacing.UP, forward, up ) ) );
|
||||
|
||||
renderer.setUvRotateEast( info.getTexture( AEPartLocation.EAST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.EAST, forward, up ) ) );
|
||||
renderer.setUvRotateWest( info.getTexture( AEPartLocation.WEST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.WEST, forward, up ) ) );
|
||||
|
||||
renderer.setUvRotateNorth( info.getTexture( AEPartLocation.NORTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.NORTH, forward, up ) ) );
|
||||
renderer.setUvRotateSouth( info.getTexture( AEPartLocation.SOUTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.SOUTH, forward, up ) ) );
|
||||
|
||||
this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
|
||||
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock()
|
||||
{
|
||||
for( final Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
return block;
|
||||
}
|
||||
|
||||
throw new MissingDefinition( "Tried to access the multi part block without it being defined." );
|
||||
}
|
||||
|
||||
public void prepareBounds( final ModelGenerator renderer )
|
||||
{
|
||||
this.bbr.renderBlockBounds( renderer, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFacesToRender( final EnumSet<EnumFacing> faces )
|
||||
{
|
||||
BusRenderer.INSTANCE.getRenderer().setRenderFaces( faces );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBlockCurrentBounds( final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for( final Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceCutout( final BlockPos pos, final IAESprite ico, EnumFacing face, final float edgeThickness, final ModelGenerator renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch( face )
|
||||
{
|
||||
case DOWN:
|
||||
face = this.ay.getOpposite();
|
||||
break;
|
||||
case EAST:
|
||||
face = this.ax;
|
||||
break;
|
||||
case NORTH:
|
||||
face = this.az.getOpposite();
|
||||
break;
|
||||
case SOUTH:
|
||||
face = this.az;
|
||||
break;
|
||||
case UP:
|
||||
face = this.ay;
|
||||
break;
|
||||
case WEST:
|
||||
face = this.ax.getOpposite();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for( final AEBaseBlock block : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderCutoutFace( block, ico, pos, renderer, face, edgeThickness );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFace( final BlockPos pos, final IAESprite ico, EnumFacing face, final ModelGenerator renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.prepareBounds( renderer );
|
||||
switch( face )
|
||||
{
|
||||
case DOWN:
|
||||
face = this.ay.getOpposite();
|
||||
break;
|
||||
case EAST:
|
||||
face = this.ax;
|
||||
break;
|
||||
case NORTH:
|
||||
face = this.az.getOpposite();
|
||||
break;
|
||||
case SOUTH:
|
||||
face = this.az;
|
||||
break;
|
||||
case UP:
|
||||
face = this.ay;
|
||||
break;
|
||||
case WEST:
|
||||
face = this.ax.getOpposite();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for( final AEBaseBlock block : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderFace( pos, block, ico, renderer, face );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldX()
|
||||
{
|
||||
return this.ax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldY()
|
||||
{
|
||||
return this.ay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getWorldZ()
|
||||
{
|
||||
return this.az;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
|
||||
|
||||
public class BusRenderer
|
||||
{
|
||||
|
||||
public static BusRenderer INSTANCE = new BusRenderer();
|
||||
|
||||
public ModelGenerator mg;
|
||||
|
||||
public ModelGenerator getRenderer()
|
||||
{
|
||||
return this.mg;
|
||||
}
|
||||
|
||||
public void setRenderer( ModelGenerator renderer )
|
||||
{
|
||||
this.mg = renderer;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,285 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.parts.BusCollisionHelper;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
|
||||
public class CableRenderHelper
|
||||
{
|
||||
|
||||
private static final CableRenderHelper INSTANCE = new CableRenderHelper();
|
||||
|
||||
public static CableRenderHelper getInstance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void renderStatic( final CableBusContainer cableBusContainer, final IFacadeContainer iFacadeContainer )
|
||||
{
|
||||
final TileEntity te = cableBusContainer.getTile();
|
||||
final ModelGenerator renderer = BusRenderer.INSTANCE.getRenderer();
|
||||
|
||||
if( renderer.getOverrideBlockTexture() != null )
|
||||
{
|
||||
BusRenderHelper.INSTANCE.setPass( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BusRenderHelper.INSTANCE.setPass( MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.TRANSLUCENT ? 1 : 0 );
|
||||
}
|
||||
|
||||
if( renderer.getBlockAccess() == null )
|
||||
{
|
||||
renderer.setBlockAccess( Minecraft.getMinecraft().theWorld );
|
||||
}
|
||||
|
||||
for( final AEPartLocation s : AEPartLocation.values() )
|
||||
{
|
||||
final IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
this.setSide( s );
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
// renderer.flipTexture = false;
|
||||
renderer.setUvRotateBottom( 0 );
|
||||
renderer.setUvRotateEast( 0 );
|
||||
renderer.setUvRotateNorth( 0 );
|
||||
renderer.setUvRotateSouth( 0 );
|
||||
renderer.setUvRotateTop( 0 );
|
||||
renderer.setUvRotateWest( 0 );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
part.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer );
|
||||
|
||||
// renderer.faces = EnumSet.allOf( EnumFacing.class );
|
||||
// renderer.useTextures = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( !iFacadeContainer.isEmpty() )
|
||||
{
|
||||
/**
|
||||
* snag list of boxes...
|
||||
*/
|
||||
final List<AxisAlignedBB> boxes = new ArrayList<AxisAlignedBB>();
|
||||
for( final AEPartLocation s : AEPartLocation.values() )
|
||||
{
|
||||
final IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
this.setSide( s );
|
||||
final BusRenderHelper brh = BusRenderHelper.INSTANCE;
|
||||
final BusCollisionHelper bch = new BusCollisionHelper( boxes, brh.getWorldX(), brh.getWorldY(), brh.getWorldZ(), null, true );
|
||||
part.getBoxes( bch );
|
||||
}
|
||||
}
|
||||
|
||||
boolean useThinFacades = false;
|
||||
final double min = 2.0 / 16.0;
|
||||
final double max = 14.0 / 16.0;
|
||||
|
||||
for( final AxisAlignedBB bb : boxes )
|
||||
{
|
||||
int o = 0;
|
||||
o += bb.maxX > max ? 1 : 0;
|
||||
o += bb.maxY > max ? 1 : 0;
|
||||
o += bb.maxZ > max ? 1 : 0;
|
||||
o += bb.minX < min ? 1 : 0;
|
||||
o += bb.minY < min ? 1 : 0;
|
||||
o += bb.minZ < min ? 1 : 0;
|
||||
|
||||
if( o >= 2 )
|
||||
{
|
||||
useThinFacades = true;
|
||||
}
|
||||
}
|
||||
|
||||
for( final AEPartLocation s : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
final IFacadePart fPart = iFacadeContainer.getFacade( s );
|
||||
if( fPart != null )
|
||||
{
|
||||
fPart.setThinFacades( useThinFacades );
|
||||
final AxisAlignedBB pb = fPart.getPrimaryBox();
|
||||
AEAxisAlignedBB b = null;
|
||||
for( final AxisAlignedBB bb : boxes )
|
||||
{
|
||||
if( bb.intersectsWith( pb ) )
|
||||
{
|
||||
if( b == null )
|
||||
{
|
||||
b = AEAxisAlignedBB.fromBounds( bb );
|
||||
}
|
||||
else
|
||||
{
|
||||
b.maxX = Math.max( b.maxX, bb.maxX );
|
||||
b.maxY = Math.max( b.maxY, bb.maxY );
|
||||
b.maxZ = Math.max( b.maxZ, bb.maxZ );
|
||||
b.minX = Math.min( b.minX, bb.minX );
|
||||
b.minY = Math.min( b.minY, bb.minY );
|
||||
b.minZ = Math.min( b.minZ, bb.minZ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setFlipTexture( false );
|
||||
renderer.setUvRotateBottom( 0 );
|
||||
renderer.setUvRotateEast( 0 );
|
||||
renderer.setUvRotateNorth( 0 );
|
||||
renderer.setUvRotateSouth( 0 );
|
||||
renderer.setUvRotateTop( 0 );
|
||||
renderer.setUvRotateWest( 0 );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
this.setSide( s );
|
||||
|
||||
fPart.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b == null ? null : b.getBoundingBox(), cableBusContainer.getPart( s ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
// renderer.isFacade = false;
|
||||
// renderer.enableAO = false;
|
||||
// renderer.sett
|
||||
}
|
||||
}
|
||||
|
||||
private void setSide( final AEPartLocation s )
|
||||
{
|
||||
final EnumFacing ax;
|
||||
final EnumFacing ay;
|
||||
final EnumFacing az;
|
||||
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.NORTH;
|
||||
az = EnumFacing.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.SOUTH;
|
||||
az = EnumFacing.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = EnumFacing.SOUTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = EnumFacing.NORTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = EnumFacing.WEST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
default:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
|
||||
}
|
||||
|
||||
public void renderDynamic( final CableBusContainer cableBusContainer, final double x, final double y, final double z )
|
||||
{
|
||||
for( final EnumFacing s : EnumFacing.values() )
|
||||
{
|
||||
final IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
final EnumFacing ax;
|
||||
final EnumFacing ay;
|
||||
final EnumFacing az;
|
||||
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.NORTH;
|
||||
az = EnumFacing.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.SOUTH;
|
||||
az = EnumFacing.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = EnumFacing.SOUTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = EnumFacing.NORTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = EnumFacing.WEST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
default:
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
|
||||
part.renderDynamic( x, y, z, BusRenderHelper.INSTANCE, BusRenderer.INSTANCE.getRenderer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
|
||||
|
||||
public interface ISimpleBlockRenderingHandler
|
||||
{
|
||||
void renderInventoryBlock( Block block, int metadata, int modelID, ModelGenerator renderer );
|
||||
|
||||
boolean renderWorldBlock( IBlockAccess world, BlockPos pos, Block block, int modelId, ModelGenerator renderer );
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import appeng.api.util.IAESprite;
|
||||
|
||||
|
||||
public class IconUnwrapper extends TextureAtlasSprite
|
||||
{
|
||||
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
private final float max_u;
|
||||
private final float min_u;
|
||||
private final float min_v;
|
||||
private final float max_v;
|
||||
|
||||
protected IconUnwrapper( final IAESprite src )
|
||||
{
|
||||
super( src.getIconName() );
|
||||
this.width = src.getIconWidth();
|
||||
this.height = src.getIconHeight();
|
||||
this.min_u = src.getMinU();
|
||||
this.max_u = src.getMaxU();
|
||||
this.min_v = src.getMinV();
|
||||
this.max_v = src.getMaxV();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth()
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight()
|
||||
{
|
||||
return this.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxU()
|
||||
{
|
||||
return this.max_u;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinV()
|
||||
{
|
||||
return this.min_v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxV()
|
||||
{
|
||||
return this.max_v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconName()
|
||||
{
|
||||
return super.getIconName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinU()
|
||||
{
|
||||
return this.min_u;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedU( final double d )
|
||||
{
|
||||
final float f = this.max_u - this.min_u;
|
||||
return this.min_u + f * (float) d / 16.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedV( final double d )
|
||||
{
|
||||
final float f = this.max_v - this.min_v;
|
||||
return this.min_v + f * ( (float) d / 16.0F );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderBlocksWorkaround extends BakingModelGenerator
|
||||
{
|
||||
|
||||
private boolean flipTexture;
|
||||
private EnumSet<EnumFacing> faces;
|
||||
private boolean useTextures;
|
||||
private EnumSet<EnumFacing> renderFaces;
|
||||
private float opacity;
|
||||
|
||||
public void setTexture( final Object object )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void setOpacity( final float f )
|
||||
{
|
||||
this.opacity = f;
|
||||
}
|
||||
|
||||
public EnumSet<EnumFacing> getFaces()
|
||||
{
|
||||
return this.faces;
|
||||
}
|
||||
|
||||
public void setFaces( final EnumSet<EnumFacing> faces )
|
||||
{
|
||||
this.faces = faces;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
public class SMFace
|
||||
{
|
||||
|
||||
private final EnumFacing face;
|
||||
private final boolean isEdge;
|
||||
|
||||
private final Vector3f to;
|
||||
private final Vector3f from;
|
||||
|
||||
private final float[] uv;
|
||||
|
||||
private final TextureAtlasSprite spite;
|
||||
|
||||
private final int color;
|
||||
|
||||
public SMFace( final EnumFacing face, final boolean isEdge, final int color, final Vector3f to, final Vector3f from, final float[] defUVs2, final TextureAtlasSprite iconUnwrapper )
|
||||
{
|
||||
this.color = color;
|
||||
this.face = face;
|
||||
this.isEdge = isEdge;
|
||||
this.to = to;
|
||||
this.from = from;
|
||||
this.uv = defUVs2;
|
||||
this.spite = iconUnwrapper;
|
||||
}
|
||||
|
||||
public int getColor()
|
||||
{
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public EnumFacing getFace()
|
||||
{
|
||||
return this.face;
|
||||
}
|
||||
|
||||
public Vector3f getFrom()
|
||||
{
|
||||
return this.from;
|
||||
}
|
||||
|
||||
public Vector3f getTo()
|
||||
{
|
||||
return this.to;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getSpite()
|
||||
{
|
||||
return this.spite;
|
||||
}
|
||||
|
||||
public boolean isEdge()
|
||||
{
|
||||
return this.isEdge;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
private final ModelGenerator renderBlocksInstance = new BakingModelGenerator();
|
||||
private final BaseBlockRender blkRender;
|
||||
private final double maxDistance;
|
||||
|
||||
public TESRWrapper( final BaseBlockRender render )
|
||||
{
|
||||
this.blkRender = render;
|
||||
this.maxDistance = this.blkRender.getTesrRenderDistance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderTileEntityAt( final TileEntity te, final double x, final double y, final double z, final float f, final int something )
|
||||
{
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
final Block b = te.getBlockType();
|
||||
|
||||
if( b instanceof AEBaseBlock && ( (AEBaseTile) te ).requiresTESR() )
|
||||
{
|
||||
if( Math.abs( x ) > this.maxDistance || Math.abs( y ) > this.maxDistance || Math.abs( z ) > this.maxDistance )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Tessellator tess = Tessellator.getInstance();
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
this.renderBlocksInstance.setBlockAccess( te.getWorld() );
|
||||
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess.getBuffer(), x, y, z, f, this.renderBlocksInstance );
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
catch( final Throwable t )
|
||||
{
|
||||
AELog.error( "Hi, Looks like there was a crash while rendering something..." );
|
||||
t.printStackTrace();
|
||||
AELog.error( "MC will now crash ( probably )!" );
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.core.AELog;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
private static final WorldRender INSTANCE = new WorldRender();
|
||||
private final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
|
||||
private final ModelGenerator renderer = new BakingModelGenerator();
|
||||
private boolean hasError = false;
|
||||
|
||||
private WorldRender()
|
||||
{
|
||||
}
|
||||
|
||||
void setRender( final AEBaseBlock in, final BaseBlockRender r )
|
||||
{
|
||||
this.blockRenders.put( in, r );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock( final Block block, final int metadata, final int modelID, final ModelGenerator renderer )
|
||||
{
|
||||
// wtf is this for?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock( final IBlockAccess world, final BlockPos pos, final Block block, final int modelId, final ModelGenerator renderer )
|
||||
{
|
||||
final AEBaseBlock blk = (AEBaseBlock) block;
|
||||
renderer.setRenderBoundsFromBlock( world.getBlockState( pos ), pos );
|
||||
return this.getRender( blk ).renderInWorld( blk, world, pos, renderer );
|
||||
}
|
||||
|
||||
private BaseBlockRender getRender( final AEBaseBlock block )
|
||||
{
|
||||
return block.getRendererInstance().getRendererInstance();
|
||||
}
|
||||
|
||||
void renderItemBlock( final ItemStack item, final ItemRenderType type, final Object[] data )
|
||||
{
|
||||
final Block blk = Block.getBlockFromItem( item.getItem() );
|
||||
if( blk instanceof AEBaseBlock )
|
||||
{
|
||||
final AEBaseBlock block = (AEBaseBlock) blk;
|
||||
this.renderer.setRenderBoundsFromBlock( block.getDefaultState(), null );
|
||||
|
||||
this.renderer.setUvRotateBottom( this.renderer.setUvRotateEast( this.renderer.setUvRotateNorth( this.renderer.setUvRotateSouth( this.renderer.setUvRotateTop( this.renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
this.getRender( block ).renderInventory( block, item, this.renderer, type, data );
|
||||
this.renderer.setUvRotateBottom( this.renderer.setUvRotateEast( this.renderer.setUvRotateNorth( this.renderer.setUvRotateSouth( this.renderer.setUvRotateTop( this.renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !this.hasError )
|
||||
{
|
||||
this.hasError = true;
|
||||
AELog.error( "Invalid render - item/block mismatch" );
|
||||
AELog.error( " item: " + item.getUnlocalizedName() );
|
||||
AELog.error( " block: " + blk.getUnlocalizedName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.parts.IBoxProvider;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.crafting.BlockMolecularAssembler;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.TaughtIcon;
|
||||
import appeng.parts.networking.PartCable;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssembler, TileMolecularAssembler> implements IBoxProvider
|
||||
{
|
||||
|
||||
public RenderBlockAssembler()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockMolecularAssembler blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0] );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 14, 0, 14, 16, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 14, 2, 2, 16, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 0, 14, 14, 2, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 0, 2, 16, 2, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 0, 0, 16, 2, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 2, 0, 2, 16, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 0, 2, 2, 2, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 14, 14, 16, 16, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 0, 14, 16, 14, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 14, 0, 16, 16, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 2, 0, 16, 14, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 2, 14, 2, 14, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 1, 1, 15, 15, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockMolecularAssembler maBlock, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileMolecularAssembler tma = maBlock.getTileEntity( world, pos );
|
||||
|
||||
if( renderer.isAlphaPass() )
|
||||
{
|
||||
if( tma.isPowered() )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, EnumFacing.WEST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
final TaughtIcon lights = new TaughtIcon( ExtraBlockTextures.BlockMolecularAssemblerLights.getIcon(), -2.0f );
|
||||
renderer.setColorRGBA_F( 1, 1, 1, 0.3f );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( maBlock, pos, lights );
|
||||
renderer.renderFaceXPos( maBlock, pos, lights );
|
||||
renderer.renderFaceYNeg( maBlock, pos, lights );
|
||||
renderer.renderFaceYPos( maBlock, pos, lights );
|
||||
renderer.renderFaceZNeg( maBlock, pos, lights );
|
||||
renderer.renderFaceZPos( maBlock, pos, lights );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
|
||||
// renderer = BusRenderer.INSTANCE.renderer;
|
||||
BusRenderer.INSTANCE.setRenderer( renderer );
|
||||
|
||||
this.preRenderInWorld( maBlock, world, pos, renderer );
|
||||
|
||||
final IOrientable te = this.getOrientable( maBlock, world, pos );
|
||||
|
||||
final EnumFacing fdy = te.getUp();
|
||||
final EnumFacing fdz = te.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
this.renderCableAt( 0.11D, world, pos, maBlock, renderer, 0.141D, false );
|
||||
this.renderCableAt( 0.188D, world, pos, maBlock, renderer, 0.1875D, true );
|
||||
|
||||
maBlock.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( world.getBlockState( pos ) )[0] );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 14, 0, 14, 16, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 14, 2, 2, 16, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 0, 14, 14, 2, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 0, 2, 16, 2, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
// sides...
|
||||
this.renderBlockBounds( renderer, 0, 0, 0, 16, 2, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 2, 0, 2, 16, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 0, 2, 2, 2, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 14, 14, 16, 16, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 0, 14, 16, 14, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 14, 0, 16, 16, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 2, 0, 16, 14, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 2, 14, 2, 14, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( maBlock, pos );
|
||||
|
||||
maBlock.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderCableAt( final double thickness, final IBlockAccess world, final BlockPos pos, final BlockMolecularAssembler block, final ModelGenerator renderer, final double pull, final boolean covered )
|
||||
{
|
||||
IAESprite texture = null;
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.WEST, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.EAST, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.NORTH, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.SOUTH, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.DOWN, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, pos, EnumFacing.UP, covered, renderer ) );
|
||||
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, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
private IAESprite getConnectedCable( final IBlockAccess world, final BlockPos pos, final EnumFacing side, final boolean covered, final ModelGenerator renderer )
|
||||
{
|
||||
final int tileYPos = pos.getY() + side.getFrontOffsetY();
|
||||
if( -1 < tileYPos && tileYPos < 256 )
|
||||
{
|
||||
final TileEntity ne = world.getTileEntity( pos.offset( side ) );
|
||||
if( ne instanceof IGridHost && ne instanceof IPartHost )
|
||||
{
|
||||
final IPartHost ph = (IPartHost) ne;
|
||||
final IPart pcx = ph.getPart( AEPartLocation.INTERNAL );
|
||||
if( pcx instanceof PartCable )
|
||||
{
|
||||
final PartCable pc = (PartCable) pcx;
|
||||
if( pc.isConnected( side.getOpposite() ) )
|
||||
{
|
||||
if( covered )
|
||||
{
|
||||
return pc.getCoveredTexture( pc.getCableColor(), renderer );
|
||||
}
|
||||
return pc.getGlassTexture( pc.getCableColor(), renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes( final IPartCollisionHelper bch )
|
||||
{
|
||||
bch.addBox( 0, 0, 0, 16, 16, 16 );
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharger>
|
||||
{
|
||||
|
||||
public RenderBlockCharger()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockCharger blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setRenderAllFaces( true );
|
||||
this.setInvRenderBounds( renderer, 6, 1, 0, 10, 15, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( ExtraBlockTextures.BlockChargerInside.getIcon(), null, null, null, null, null );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 0, 2, 14, 3, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 3, 3, 13, 4, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( null, ExtraBlockTextures.BlockChargerInside.getIcon(), null, null, null, null );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 13, 2, 14, 16, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 12, 3, 13, 13, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockCharger block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
final IOrientable te = this.getOrientable( block, world, pos );
|
||||
|
||||
final EnumFacing fdy = te.getUp();
|
||||
final EnumFacing fdz = te.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
this.renderBlockBounds( renderer, 6, 1, 0, 10, 15, 2, fdx, fdy, fdz );
|
||||
boolean out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcons( ExtraBlockTextures.BlockChargerInside.getIcon(), null, null, null, null, null );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 0, 2, 14, 3, 14, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 3, 3, 3, 13, 4, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcons( null, ExtraBlockTextures.BlockChargerInside.getIcon(), null, null, null, null );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 13, 2, 14, 16, 14, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 3, 12, 3, 13, 13, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockCharger block, final TileCharger tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
final ItemStack sis = tile.getStackInSlot( 0 );
|
||||
|
||||
if( sis != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glTranslatef( 0.5f, 0.35f, 0.5f );
|
||||
GL11.glScalef( 1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f );
|
||||
GL11.glScalef( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
final Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
/*
|
||||
* if( sis.getItemSpriteNumber() == 0 && block != null && IRenderHelper.renderItemIn3d(
|
||||
* blk.getRenderType() ) )
|
||||
* {
|
||||
* GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
* GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
* GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
|
||||
* }
|
||||
*/
|
||||
|
||||
// << 20 | light << 4;
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
|
||||
this.doRenderItem( sis, tile );
|
||||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.block.networking.BlockController.ControllerBlockState;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
|
||||
public class RenderBlockController extends BaseBlockRender<BlockController, TileController>
|
||||
{
|
||||
|
||||
public RenderBlockController()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockController blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
|
||||
final boolean xx = this.getTileEntity( world, pos.offset( EnumFacing.WEST ) ) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.EAST ) ) instanceof TileController;
|
||||
final boolean yy = this.getTileEntity( world, pos.offset( EnumFacing.DOWN ) ) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.UP ) ) instanceof TileController;
|
||||
final boolean zz = this.getTileEntity( world, pos.offset( EnumFacing.SOUTH ) ) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.NORTH ) ) instanceof TileController;
|
||||
|
||||
final BlockController.ControllerBlockState meta = (ControllerBlockState) world.getBlockState( pos ).getValue( BlockController.CONTROLLER_STATE );
|
||||
final boolean hasPower = meta != BlockController.ControllerBlockState.offline;
|
||||
final boolean isConflict = meta == BlockController.ControllerBlockState.conflicted;
|
||||
|
||||
ExtraBlockTextures lights = null;
|
||||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if( isConflict )
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
}
|
||||
else
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumn.getIcon() );
|
||||
}
|
||||
|
||||
renderer.setUvRotateEast( 1 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
}
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if( isConflict )
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
}
|
||||
else
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumn.getIcon() );
|
||||
}
|
||||
|
||||
renderer.setUvRotateEast( 0 );
|
||||
renderer.setUvRotateNorth( 0 );
|
||||
}
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumnPowered.getIcon() );
|
||||
if( isConflict )
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnConflict;
|
||||
}
|
||||
else
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerColumnLights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerColumn.getIcon() );
|
||||
}
|
||||
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 1 );
|
||||
renderer.setUvRotateTop( 0 );
|
||||
}
|
||||
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||
{
|
||||
final int v = ( Math.abs( pos.getX() ) + Math.abs( pos.getY() ) + Math.abs( pos.getZ() ) ) % 2;
|
||||
renderer.setUvRotateEast( renderer.setUvRotateBottom( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
|
||||
if( v == 0 )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideA.getIcon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerInsideB.getIcon() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( hasPower )
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockControllerPowered.getIcon() );
|
||||
if( isConflict )
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerConflict;
|
||||
}
|
||||
else
|
||||
{
|
||||
lights = ExtraBlockTextures.BlockControllerLights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
}
|
||||
|
||||
final boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
if( lights != null )
|
||||
{
|
||||
renderer.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( blk, pos, lights.getIcon() );
|
||||
renderer.renderFaceXPos( blk, pos, lights.getIcon() );
|
||||
renderer.renderFaceYNeg( blk, pos, lights.getIcon() );
|
||||
renderer.renderFaceYPos( blk, pos, lights.getIcon() );
|
||||
renderer.renderFaceZNeg( blk, pos, lights.getIcon() );
|
||||
renderer.renderFaceZPos( blk, pos, lights.getIcon() );
|
||||
}
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
renderer.setUvRotateEast( renderer.setUvRotateBottom( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
return out;
|
||||
}
|
||||
|
||||
private TileEntity getTileEntity( final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
if( pos.getY() >= 0 )
|
||||
{
|
||||
return world.getTileEntity( pos );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,375 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderHelper;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
|
||||
|
||||
public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileCraftingTile> extends BaseBlockRender<B, T>
|
||||
{
|
||||
|
||||
protected RenderBlockCraftingCPU( final boolean useTESR, final int range )
|
||||
{
|
||||
super( useTESR, range );
|
||||
}
|
||||
|
||||
public RenderBlockCraftingCPU()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final B blk, final IBlockAccess w, final BlockPos pos, ModelGenerator renderer )
|
||||
{
|
||||
boolean formed = false;
|
||||
boolean emitsLight = false;
|
||||
|
||||
final TileCraftingTile ct = blk.getTileEntity( w, pos );
|
||||
if( ct != null && ct.isFormed() )
|
||||
{
|
||||
formed = true;
|
||||
emitsLight = ct.isPowered();
|
||||
}
|
||||
|
||||
final boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
|
||||
final IAESprite theIcon = renderer.getIcon( w.getBlockState( pos ) )[EnumFacing.SOUTH.ordinal()];
|
||||
|
||||
int meta = 1;
|
||||
for( final Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
if( craftingBlock == blk )
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
IAESprite nonForward = theIcon;
|
||||
if( isMonitor )
|
||||
{
|
||||
for( final Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
nonForward = renderer.getIcon( craftingBlock.getDefaultState() )[EnumFacing.SOUTH.ordinal()]; // craftingBlock.getIcon(
|
||||
// 0,
|
||||
// meta
|
||||
// | (
|
||||
// formed
|
||||
// ? 8 :
|
||||
// 0 )
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
if( formed && renderer.getOverrideBlockTexture() == null )
|
||||
{
|
||||
renderer = BusRenderer.INSTANCE.getRenderer();
|
||||
final BusRenderHelper i = BusRenderHelper.INSTANCE;
|
||||
|
||||
renderer.setBlockAccess( w );
|
||||
i.setPass( MinecraftForgeClient.getRenderLayer() == BlockRenderLayer.TRANSLUCENT ? 1 : 0 );
|
||||
i.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
final float highX = this.isConnected( w, pos, EnumFacing.EAST ) ? 16 : 13.01f;
|
||||
final float lowX = this.isConnected( w, pos, EnumFacing.WEST ) ? 0 : 2.99f;
|
||||
|
||||
final float highY = this.isConnected( w, pos, EnumFacing.UP ) ? 16 : 13.01f;
|
||||
final float lowY = this.isConnected( w, pos, EnumFacing.DOWN ) ? 0 : 2.99f;
|
||||
|
||||
final float highZ = this.isConnected( w, pos, EnumFacing.SOUTH ) ? 16 : 13.01f;
|
||||
final float lowZ = this.isConnected( w, pos, EnumFacing.NORTH ) ? 0 : 2.99f;
|
||||
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.UP, EnumFacing.EAST, EnumFacing.NORTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.UP, EnumFacing.EAST, EnumFacing.SOUTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.UP, EnumFacing.WEST, EnumFacing.NORTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.UP, EnumFacing.WEST, EnumFacing.SOUTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.NORTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.SOUTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.NORTH );
|
||||
this.renderCorner( i, renderer, w, pos, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.SOUTH );
|
||||
|
||||
for( final EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
i.setBounds( this.fso( side, lowX, EnumFacing.WEST ), this.fso( side, lowY, EnumFacing.DOWN ), this.fso( side, lowZ, EnumFacing.NORTH ), this.fso( side, highX, EnumFacing.EAST ), this.fso( side, highY, EnumFacing.UP ), this.fso( side, highZ, EnumFacing.SOUTH ) );
|
||||
i.prepareBounds( renderer );
|
||||
|
||||
boolean LocalEmit = emitsLight;
|
||||
if( blk instanceof BlockCraftingMonitor && ct.getForward() != side )
|
||||
{
|
||||
LocalEmit = false;
|
||||
}
|
||||
|
||||
this.handleSide( blk, meta, pos, i, renderer, ct.getForward() == side ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
|
||||
}
|
||||
|
||||
// BusRenderer.INSTANCE.renderer.isFacade = false;
|
||||
i.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
final double a = 0.0 / 16.0;
|
||||
final double o = 16.0 / 16.0;
|
||||
renderer.setRenderBounds( a, a, a, o, o, o );
|
||||
|
||||
return renderer.renderStandardBlock( blk, pos );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isConnected( final IBlockAccess w, final BlockPos pos, final EnumFacing side )
|
||||
{
|
||||
final int tileYPos = pos.getY() + side.getFrontOffsetY();
|
||||
if( 0 <= tileYPos && tileYPos <= 255 )
|
||||
{
|
||||
final TileEntity tile = w.getTileEntity( pos.offset( side ) );
|
||||
|
||||
return tile instanceof TileCraftingTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCorner( final BusRenderHelper i, final ModelGenerator renderer, final IBlockAccess w, final BlockPos pos, final EnumFacing up, final EnumFacing east, final EnumFacing south )
|
||||
{
|
||||
if( this.isConnected( w, pos, up ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( this.isConnected( w, pos, east ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( this.isConnected( w, pos, south ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i.setBounds( this.gso( east, 3, EnumFacing.WEST ), this.gso( up, 3, EnumFacing.DOWN ), this.gso( south, 3, EnumFacing.NORTH ), this.gso( east, 13, EnumFacing.EAST ), this.gso( up, 13, EnumFacing.UP ), this.gso( south, 13, EnumFacing.SOUTH ) );
|
||||
i.prepareBounds( renderer );
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRing.getIcon() );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
|
||||
private float fso( final EnumFacing side, final float def, final EnumFacing target )
|
||||
{
|
||||
if( side == target )
|
||||
{
|
||||
if( side.getFrontOffsetX() > 0 || side.getFrontOffsetY() > 0 || side.getFrontOffsetZ() > 0 )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
private void handleSide( final B blk, final int meta, final BlockPos pos, final BusRenderHelper i, final ModelGenerator renderer, final IAESprite color, final boolean emitsLight, final boolean isMonitor, final EnumFacing side, final IBlockAccess w )
|
||||
{
|
||||
if( this.isConnected( w, pos, side ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i.setFacesToRender( EnumSet.of( side ) );
|
||||
|
||||
if( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitFit.getIcon() );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingMonitorOuter.getIcon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
|
||||
}
|
||||
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
if( color != null )
|
||||
{
|
||||
i.setTexture( color );
|
||||
|
||||
if( !emitsLight )
|
||||
{
|
||||
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
{
|
||||
final int b = w.getCombinedLight( pos.offset( side ), 0 );
|
||||
|
||||
final TileCraftingMonitorTile sr = blk.getTileEntity( w, pos );
|
||||
final AEColor col = sr.getColor();
|
||||
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( col.whiteVariant );
|
||||
i.renderFace( pos, color, side, renderer );
|
||||
|
||||
renderer.setColorOpaque_I( col.mediumVariant );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
|
||||
renderer.setColorOpaque_I( col.blackVariant );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isMonitor )
|
||||
{
|
||||
final TileCraftingMonitorTile sr = blk.getTileEntity( w, pos );
|
||||
final AEColor col = sr.getColor();
|
||||
|
||||
renderer.setColorOpaque_I( col.whiteVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, color, side, renderer );
|
||||
|
||||
renderer.setColorOpaque_I( col.mediumVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
|
||||
renderer.setColorOpaque_I( col.blackVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
final AEPartLocation aeDir = AEPartLocation.fromFacing( side );
|
||||
renderer.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, color, side, renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( final EnumFacing a : EnumFacing.VALUES )
|
||||
{
|
||||
if( a == side || a == side.getOpposite() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( side.getFrontOffsetX() != 0 || side.getFrontOffsetZ() != 0 ) && ( a == EnumFacing.NORTH || a == EnumFacing.EAST || a == EnumFacing.WEST || a == EnumFacing.SOUTH ) )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
}
|
||||
else if( ( side.getFrontOffsetY() != 0 ) && ( a == EnumFacing.EAST || a == EnumFacing.WEST ) )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
|
||||
}
|
||||
|
||||
final AEPartLocation dir = AEPartLocation.fromFacing( a );
|
||||
if( !( i.getBound( dir ) < 0.001 || i.getBound( dir ) > 15.999 ) )
|
||||
{
|
||||
final double width = 3.0 / 16.0;
|
||||
switch( a )
|
||||
{
|
||||
case DOWN:
|
||||
renderer.setRenderMinY( 0 );
|
||||
renderer.setRenderMaxY( width );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.setRenderMaxX( 1 );
|
||||
renderer.setRenderMinX( 1.0 - width );
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateEast( 1 );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderMinZ( 0 );
|
||||
renderer.setRenderMaxZ( width );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 1 );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderMaxZ( 1 );
|
||||
renderer.setRenderMinZ( 1.0 - width );
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 1 );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderMaxY( 1 );
|
||||
renderer.setRenderMinY( 1.0 - width );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderMinX( 0 );
|
||||
renderer.setRenderMaxX( width );
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateEast( 1 );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
i.prepareBounds( renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float gso( final EnumFacing side, final float def, final EnumFacing target )
|
||||
{
|
||||
if( side != target )
|
||||
{
|
||||
if( side.getFrontOffsetX() > 0 || side.getFrontOffsetY() > 0 || side.getFrontOffsetZ() > 0 )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.util.IWideReadableNumberConverter;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv1
|
||||
*/
|
||||
public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockCraftingMonitor, TileCraftingMonitorTile>
|
||||
{
|
||||
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public RenderBlockCraftingCPUMonitor()
|
||||
{
|
||||
super( true, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockCraftingMonitor block, final TileCraftingMonitorTile tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
if( tile != null )
|
||||
{
|
||||
final IAEItemStack ais = tile.getJobProgress();
|
||||
|
||||
if( tile.getDisplayList() == null )
|
||||
{
|
||||
tile.setUpdateList( true );
|
||||
tile.setDisplayList( GLAllocation.generateDisplayLists( 1 ) );
|
||||
}
|
||||
|
||||
if( ais != null )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
|
||||
|
||||
if( tile.isUpdateList() )
|
||||
{
|
||||
tile.setUpdateList( false );
|
||||
GL11.glNewList( tile.getDisplayList(), GL11.GL_COMPILE_AND_EXECUTE );
|
||||
this.tesrRenderScreen( tess, tile, ais );
|
||||
GL11.glEndList();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glCallList( tile.getDisplayList() );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tesrRenderScreen( final VertexBuffer tess, final TileCraftingMonitorTile cmt, final IAEItemStack ais )
|
||||
{
|
||||
final EnumFacing side = cmt.getForward();
|
||||
|
||||
EnumFacing walrus = side.getFrontOffsetY() != 0 ? EnumFacing.SOUTH : EnumFacing.UP;
|
||||
int spin = 0;
|
||||
|
||||
int max = 5;
|
||||
while( walrus != cmt.getUp() && max > 0 )
|
||||
{
|
||||
max--;
|
||||
spin++;
|
||||
walrus = Platform.rotateAround( walrus, side );
|
||||
}
|
||||
max--;
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glTranslated( side.getFrontOffsetX() * 0.69, side.getFrontOffsetY() * 0.69, side.getFrontOffsetZ() * 0.69 );
|
||||
|
||||
final float scale = 0.7f;
|
||||
GL11.glScalef( scale, scale, scale );
|
||||
|
||||
if( side == EnumFacing.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 == EnumFacing.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 == EnumFacing.EAST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( side == EnumFacing.WEST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( side == EnumFacing.NORTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
}
|
||||
|
||||
if( side == EnumFacing.SOUTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
try
|
||||
{
|
||||
final ItemStack sis = ais.getItemStack();
|
||||
sis.stackSize = 1;
|
||||
|
||||
final int br = 16 << 20 | 16 << 4;
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
// RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
ClientHelper.proxy.doRenderItem( sis, cmt.getWorld() );
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glTranslatef( 0.0f, 0.14f, -0.24f );
|
||||
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
|
||||
|
||||
final long stackSize = ais.getStackSize();
|
||||
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||
|
||||
final FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
|
||||
final int width = fr.getStringWidth( renderedStackSize );
|
||||
GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f );
|
||||
fr.drawString( renderedStackSize, 0, 0, 0 );
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
|
||||
public class RenderBlockCrank extends BaseBlockRender<BlockCrank, TileCrank>
|
||||
{
|
||||
|
||||
public RenderBlockCrank()
|
||||
{
|
||||
super( true, 60 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockCrank blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
renderer.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.3, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
|
||||
renderer.setRenderBounds( 0.70D - 0.15, 0.75D - 0.05, 0.5D - 0.05, 0.70D + 0.28, 0.75D + 0.05, 0.5D + 0.05 );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockCrank imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockCrank blk, final TileCrank tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderBlocks )
|
||||
{
|
||||
if( tile.getUp() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
if( Minecraft.isAmbientOcclusionEnabled() )
|
||||
{
|
||||
GL11.glShadeModel( GL11.GL_SMOOTH );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glShadeModel( GL11.GL_FLAT );
|
||||
}
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
GL11.glTranslated( 0.5, 0, 0.5 );
|
||||
GL11.glRotatef( tile.getVisibleRotation(), 0, 1, 0 );
|
||||
GL11.glScalef( -1, 1, 1 );
|
||||
GL11.glTranslated( -0.5, 0, -0.5 );
|
||||
|
||||
// tess.setTranslation( -tc.getPos().getX(), -tc.getPos().getY(), -tc.getPos().getZ() );
|
||||
// tess.startDrawingQuads();
|
||||
|
||||
final RenderItem ri = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
final ItemStack stack = new ItemStack( blk );
|
||||
final IBakedModel model = ri.getItemModelMesher().getItemModel( stack );
|
||||
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor( model, 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
/*
|
||||
* renderBlocks.renderAllFaces = true;
|
||||
* renderBlocks.blockAccess = tc.getWorld();
|
||||
* renderBlocks.setRenderBounds( 0.5D - 0.05, 0.5D - 0.5, 0.5D - 0.05, 0.5D + 0.05, 0.5D + 0.1, 0.5D + 0.05 );
|
||||
* renderBlocks.renderStandardBlock( blk, tc.getPos());
|
||||
* renderBlocks.setRenderBounds( 0.70D - 0.15, 0.55D - 0.05, 0.5D - 0.05, 0.70D + 0.15, 0.55D + 0.05, 0.5D +
|
||||
* 0.05 );
|
||||
* renderBlocks.renderStandardBlock( blk, tc.getPos() );
|
||||
*/
|
||||
|
||||
// Tessellator.getInstance().draw();
|
||||
// tess.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
|
||||
|
||||
public class RenderBlockEnergyCube extends BaseBlockRender<BlockEnergyCell, TileEnergyCell>
|
||||
{
|
||||
|
||||
public RenderBlockEnergyCube()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockEnergyCell blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
final IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
|
||||
final double internalCurrentPower = myItem.getAECurrentPower( is );
|
||||
final double internalMaxPower = myItem.getAEMaxPower( is );
|
||||
|
||||
int meta = (int) ( 8.0 * ( internalCurrentPower / internalMaxPower ) );
|
||||
|
||||
if( meta > 7 )
|
||||
{
|
||||
meta = 7;
|
||||
}
|
||||
if( meta < 0 )
|
||||
{
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( blk.getStateFromMeta( meta ) )[0] );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockEnergyCell blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( world.getBlockState( pos ) )[0] );// blk.getIcon( 0, meta );
|
||||
final boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* @author AlgorithmX2
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv0
|
||||
*/
|
||||
public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileInscriber>
|
||||
{
|
||||
|
||||
public RenderBlockInscriber()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockInscriber blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setRenderAllFaces( true );
|
||||
this.setInvRenderBounds( renderer, 6, 1, 0, 10, 15, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
// sides...
|
||||
this.setInvRenderBounds( renderer, 3, 1, 0, 13, 15, 3 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 1, 0, 3, 15, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 13, 1, 0, 16, 15, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 0, 1, 15, 2, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 14, 1, 15, 16, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.BlockInscriberInside.getIcon() );
|
||||
|
||||
// press
|
||||
this.setInvRenderBounds( renderer, 3, 2, 3, 13, 3, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 13, 3, 13, 15, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
// blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockInscriber block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
final IOrientable te = this.getOrientable( block, world, pos );
|
||||
if( te == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final EnumFacing fdy = te.getUp();
|
||||
final EnumFacing fdz = te.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
// sides...
|
||||
this.renderBlockBounds( renderer, 3, 1, 0, 13, 15, 3, fdx, fdy, fdz );
|
||||
boolean out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 1, 0, 3, 15, 16, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 13, 1, 0, 16, 15, 16, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
// top bottom..
|
||||
this.renderBlockBounds( renderer, 1, 0, 1, 15, 4, 15, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 1, 12, 1, 15, 16, 15, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockInscriber block, final TileInscriber tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glCullFace( GL11.GL_FRONT );
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
mc.renderEngine.bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||
|
||||
// << 20 | light << 4;
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
|
||||
|
||||
long absoluteProgress = 0;
|
||||
|
||||
if( tile.isSmash() )
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
absoluteProgress = currentTime - tile.getClientStart();
|
||||
if( absoluteProgress > 800 )
|
||||
{
|
||||
tile.setSmash( false );
|
||||
}
|
||||
}
|
||||
|
||||
final float relativeProgress = absoluteProgress % 800 / 400.0f;
|
||||
float progress = relativeProgress;
|
||||
|
||||
if( progress > 1.0f )
|
||||
{
|
||||
progress = 1.0f - ( progress - 1.0f );
|
||||
}
|
||||
float press = 0.2f;
|
||||
press -= progress / 5.0f;
|
||||
|
||||
final IAESprite ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
|
||||
tess.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
|
||||
|
||||
float middle = 0.5f;
|
||||
middle += 0.02f;
|
||||
final float TwoPx = 2.0f / 16.0f;
|
||||
tess.pos( TwoPx, middle + press, TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) ).endVertex();
|
||||
tess.pos( 1.0 - TwoPx, middle + press, TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) ).endVertex();
|
||||
tess.pos( 1.0 - TwoPx, middle + press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) ).endVertex();
|
||||
tess.pos( TwoPx, middle + press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) ).endVertex();
|
||||
|
||||
tess.pos( TwoPx, middle + press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) ).endVertex();
|
||||
tess.pos( 1.0 - TwoPx, middle + press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) ).endVertex();
|
||||
final float base = 0.4f;
|
||||
tess.pos( 1.0 - TwoPx, middle + base, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
|
||||
tess.pos( TwoPx, middle + base, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
|
||||
|
||||
middle -= 2.0f * 0.02f;
|
||||
tess.pos( 1.0 - TwoPx, middle - press, TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) ).endVertex();
|
||||
tess.pos( TwoPx, middle - press, TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) ).endVertex();
|
||||
tess.pos( TwoPx, middle - press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) ).endVertex();
|
||||
tess.pos( 1.0 - TwoPx, middle - press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 13 ) ).endVertex();
|
||||
|
||||
tess.pos( 1.0 - TwoPx, middle - press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) ).endVertex();
|
||||
tess.pos( TwoPx, middle - press, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) ).endVertex();
|
||||
tess.pos( TwoPx, middle - base, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
|
||||
tess.pos( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx ).tex( ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) ).endVertex();
|
||||
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GL11.glCullFace( GL11.GL_BACK );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glPopMatrix();
|
||||
|
||||
int items = 0;
|
||||
if( tile.getStackInSlot( 0 ) != null )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
if( tile.getStackInSlot( 1 ) != null )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
if( tile.getStackInSlot( 2 ) != null )
|
||||
{
|
||||
items++;
|
||||
}
|
||||
|
||||
if( relativeProgress > 1.0f || items == 0 )
|
||||
{
|
||||
ItemStack is = tile.getStackInSlot( 3 );
|
||||
|
||||
if( is == null )
|
||||
{
|
||||
final IInscriberRecipe ir = tile.getTask();
|
||||
if( ir != null )
|
||||
{
|
||||
is = ir.getOutput().copy();
|
||||
}
|
||||
}
|
||||
|
||||
this.renderItem( is, 0.0f, block, tile, tess, x, y, z, f, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderItem( tile.getStackInSlot( 0 ), press, block, tile, tess, x, y, z, f, renderer );
|
||||
this.renderItem( tile.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
|
||||
this.renderItem( tile.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
private void renderItem( ItemStack sis, final float o, final AEBaseBlock block, final AEBaseTile tile, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
if( sis != null )
|
||||
{
|
||||
sis = sis.copy();
|
||||
GL11.glPushMatrix();
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glTranslatef( 0.5f, 0.5f + o, 0.5f );
|
||||
GL11.glScalef( 1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f );
|
||||
GL11.glScalef( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
final Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
|
||||
/*
|
||||
* if( sis.getItemSpriteNumber() == 0 && block != null && IRenderHelper.renderItemIn3d(
|
||||
* blk.getRenderType() ) )
|
||||
* {
|
||||
* GL11.glRotatef( 25.0f, 1.0f, 0.0f, 0.0f );
|
||||
* GL11.glRotatef( 15.0f, 0.0f, 1.0f, 0.0f );
|
||||
* GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
|
||||
* }
|
||||
*/
|
||||
|
||||
GL11.glRotatef( 90.0f, 1, 0, 0 );
|
||||
|
||||
// << 20 | light << 4;
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
|
||||
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
|
||||
this.doRenderItem( sis, tile );
|
||||
}
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.debug( err );
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
|
||||
|
||||
public class RenderBlockInterface extends BaseBlockRender<BlockInterface, TileInterface>
|
||||
{
|
||||
|
||||
public RenderBlockInterface()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockInterface block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileInterface ti = block.getTileEntity( world, pos );
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if( ti != null && ti.getForward() != null )
|
||||
{
|
||||
final IAESprite side = ExtraBlockTextures.BlockInterfaceAlternateArrow.getIcon();
|
||||
info.setTemporaryRenderIcons( ExtraBlockTextures.BlockInterfaceAlternate.getIcon(), renderer.getIcon( world.getBlockState( pos ) )[0], side, side, side, side );
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld( block, world, pos, renderer );
|
||||
|
||||
info.setTemporaryRenderIcon( null );
|
||||
|
||||
return fz;
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
|
||||
|
||||
public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
|
||||
{
|
||||
|
||||
public RenderBlockPaint()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockPaint block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockPaint imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator tess )
|
||||
{
|
||||
final TilePaint tp = imb.getTileEntity( world, pos );
|
||||
boolean out = false;
|
||||
if( tp != null )
|
||||
{
|
||||
// super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
final int x = pos.getX();
|
||||
final int y = pos.getY();
|
||||
final int z = pos.getZ();
|
||||
|
||||
final IAESprite[] icoSet = { imb.getIcon( EnumFacing.UP, imb.getDefaultState() ), ExtraBlockTextures.BlockPaint2.getIcon(), ExtraBlockTextures.BlockPaint3.getIcon() };
|
||||
|
||||
final int brightness = imb.getLightValue( world.getBlockState( pos ), world, pos );
|
||||
|
||||
final EnumSet<EnumFacing> validSides = EnumSet.noneOf( EnumFacing.class );
|
||||
|
||||
for( final EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
if( tp.isSideValid( side ) )
|
||||
{
|
||||
validSides.add( side );
|
||||
}
|
||||
}
|
||||
|
||||
double offsetConstant = 0.001;
|
||||
final int lumen = 14 << 20 | 14 << 4;
|
||||
for( final Splotch s : tp.getDots() )
|
||||
{
|
||||
if( !validSides.contains( s.getSide() ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( s.isLumen() )
|
||||
{
|
||||
tess.setColorOpaque_I( s.getColor().whiteVariant );
|
||||
tess.setBrightness( lumen );
|
||||
}
|
||||
else
|
||||
{
|
||||
tess.setColorOpaque_I( s.getColor().mediumVariant );
|
||||
tess.setBrightness( brightness );
|
||||
}
|
||||
|
||||
double offset = offsetConstant;
|
||||
offsetConstant += 0.001;
|
||||
|
||||
final double buffer = 0.1;
|
||||
|
||||
double pos_x = s.x();
|
||||
double pos_y = s.y();
|
||||
|
||||
pos_x = Math.max( buffer, Math.min( 1.0 - buffer, pos_x ) );
|
||||
pos_y = Math.max( buffer, Math.min( 1.0 - buffer, pos_y ) );
|
||||
|
||||
if( s.getSide() == EnumFacing.SOUTH || s.getSide() == EnumFacing.NORTH )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += y;
|
||||
}
|
||||
|
||||
else if( s.getSide() == EnumFacing.UP || s.getSide() == EnumFacing.DOWN )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += z;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
pos_x += y;
|
||||
pos_y += z;
|
||||
}
|
||||
|
||||
final IAESprite ico = icoSet[s.getSeed() % icoSet.length];
|
||||
final EnumFacing rs = s.getSide().getOpposite();
|
||||
|
||||
switch( s.getSide() )
|
||||
{
|
||||
case UP:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x + buffer, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x - buffer, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x - buffer, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x + buffer, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x - buffer, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x + buffer, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x + buffer, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, x + offset, pos_x - buffer, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, pos_y - buffer, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, pos_y - buffer, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, pos_y + buffer, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, pos_y + buffer, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, pos_y - buffer, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, pos_y - buffer, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( rs, pos_x + buffer, pos_y + buffer, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( rs, pos_x - buffer, pos_y + buffer, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
out = true;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
|
||||
|
||||
public class RenderBlockQuartzAccelerator extends BaseBlockRender<BlockQuartzGrowthAccelerator, TileQuartzGrowthAccelerator>
|
||||
{
|
||||
|
||||
public RenderBlockQuartzAccelerator()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockQuartzGrowthAccelerator blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
if( te instanceof TileQuartzGrowthAccelerator )
|
||||
{
|
||||
if( ( (TileQuartzGrowthAccelerator) te ).isPowered() )
|
||||
{
|
||||
final IAESprite top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
|
||||
final IAESprite side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( top_Bottom, top_Bottom, side, side, side, side );
|
||||
}
|
||||
}
|
||||
|
||||
final boolean out = super.renderInWorld( blk, world, pos, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.block.storage.BlockSkyChest.SkyChestType;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
|
||||
public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyChest>
|
||||
{
|
||||
|
||||
private static final ResourceLocation SKY_STONE_CHEST = new ResourceLocation( "appliedenergistics2", "textures/models/skychest.png" );
|
||||
private static final ResourceLocation SKY_BLOCK_CHEST = new ResourceLocation( "appliedenergistics2", "textures/models/skyblockchest.png" );
|
||||
private static final ResourceLocation[] METADATA_TO_TEXTURE = { SKY_STONE_CHEST, SKY_BLOCK_CHEST };
|
||||
|
||||
private final ModelChest model = new ModelChest();
|
||||
|
||||
public RenderBlockSkyChest()
|
||||
{
|
||||
super( true, 80 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockSkyChest blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
// GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
// GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
// final int metaData = is.getItemDamage();
|
||||
// final ResourceLocation loc = METADATA_TO_TEXTURE[metaData];
|
||||
|
||||
// Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
// final float lidAngle = 0.0f;
|
||||
|
||||
// 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.renderAll();
|
||||
|
||||
// GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
// GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockSkyChest blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockSkyChest block, final TileSkyChest skyChest, final VertexBuffer tess, final double x, final double y, final double z, final float partialTick, final ModelGenerator renderer )
|
||||
{
|
||||
if( skyChest == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !skyChest.hasWorldObj() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
final IBlockState metaData = skyChest.getWorld().getBlockState( skyChest.getPos() );
|
||||
final ResourceLocation loc = METADATA_TO_TEXTURE[( (BlockSkyChest) metaData.getBlock() ).type == SkyChestType.BLOCK ? 1 : 0];
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
this.applyTESRRotation( x, y, z, skyChest.getForward(), skyChest.getUp() );
|
||||
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glTranslatef( -0.0F, -1.0F, -1.0F );
|
||||
|
||||
final long now = System.currentTimeMillis();
|
||||
final long distance = now - skyChest.getLastEvent();
|
||||
|
||||
if( skyChest.getPlayerOpen() > 0 )
|
||||
{
|
||||
skyChest.setLidAngle( skyChest.getLidAngle() + distance * 0.0001f );
|
||||
}
|
||||
else
|
||||
{
|
||||
skyChest.setLidAngle( skyChest.getLidAngle() - distance * 0.0001f );
|
||||
}
|
||||
|
||||
if( skyChest.getLidAngle() > 0.5f )
|
||||
{
|
||||
skyChest.setLidAngle( 0.5f );
|
||||
}
|
||||
|
||||
if( skyChest.getLidAngle() < 0.0f )
|
||||
{
|
||||
skyChest.setLidAngle( 0.0f );
|
||||
}
|
||||
|
||||
float lidAngle = skyChest.getLidAngle();
|
||||
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 );
|
||||
|
||||
// The vanilla chests wants culling reversed...
|
||||
GL11.glCullFace( GL11.GL_FRONT );
|
||||
this.model.renderAll();
|
||||
GL11.glCullFace( GL11.GL_BACK );
|
||||
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.model.ModelCompass;
|
||||
import appeng.hooks.CompassManager;
|
||||
import appeng.hooks.CompassResult;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
|
||||
|
||||
public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, TileSkyCompass>
|
||||
{
|
||||
|
||||
private final ModelCompass model = new ModelCompass();
|
||||
|
||||
public RenderBlockSkyCompass()
|
||||
{
|
||||
super( true, 80 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockSkyCompass blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
/*
|
||||
* 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 )
|
||||
* {
|
||||
* isGood = true;
|
||||
* }
|
||||
* }
|
||||
* if( !isGood )
|
||||
* {
|
||||
* type = ItemRenderType.FIRST_PERSON_MAP;
|
||||
* }
|
||||
* }
|
||||
* GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
* 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 )
|
||||
* {
|
||||
* GL11.glRotatef( -90.0f, 0.0f, 0.0f, 1.0f );
|
||||
* GL11.glScalef( 1.0F, -1F, -1F );
|
||||
* GL11.glScalef( 2.5f, 2.5f, 2.5f );
|
||||
* GL11.glTranslatef( -0.25F, -1.65F, -0.19F );
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* 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 )
|
||||
* {
|
||||
* 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 )
|
||||
* {
|
||||
* EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
* float rYaw = p.rotationYaw;
|
||||
* if( type == ItemRenderType.EQUIPPED )
|
||||
* {
|
||||
* p = (EntityPlayer) obj[1];
|
||||
* rYaw = p.renderYawOffset;
|
||||
* }
|
||||
* int x = (int) p.posX;
|
||||
* int y = (int) p.posY;
|
||||
* 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++ )
|
||||
* {
|
||||
* CompassManager.INSTANCE.getCompassDirection( 0, x + i - 1, y, z + j - 1 );
|
||||
* }
|
||||
* }
|
||||
* if( cr.isValidResult() )
|
||||
* {
|
||||
* if( cr.isSpin() )
|
||||
* {
|
||||
* now %= 100000;
|
||||
* this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
* {
|
||||
* <<<<<<< HEAD
|
||||
* float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
* float adjustment = (float) Math.PI * 0.74f;
|
||||
* this.model.renderAll( (float) this.flipidiy( cr.rad + offRads + adjustment ) );
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
* float adjustment = (float) Math.PI * -0.74f;
|
||||
* this.model.renderAll( (float) this.flipidiy( cr.rad + offRads + adjustment ) );
|
||||
* =======
|
||||
* final float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
* final float adjustment = (float) Math.PI * 0.74f;
|
||||
* this.model.renderAll( (float) this.flipidiy( cr.getRad() + offRads + adjustment ) );
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* final float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
* final float adjustment = (float) Math.PI * -0.74f;
|
||||
* this.model.renderAll( (float) this.flipidiy( cr.getRad() + offRads + adjustment ) );
|
||||
* >>>>>>> 500fc47... Reduces visibility of internal fields/methods
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* now %= 1000000;
|
||||
* 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 );
|
||||
* }
|
||||
* GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
* GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockSkyCompass blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockSkyCompass block, final TileSkyCompass skyCompass, final VertexBuffer tess, final double x, final double y, final double z, final float partialTick, final ModelGenerator renderer )
|
||||
{
|
||||
if( skyCompass == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !skyCompass.hasWorldObj() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
GL11.glCullFace( GL11.GL_FRONT );
|
||||
|
||||
final ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
this.applyTESRRotation( x, y, z, skyCompass.getUp(), skyCompass.getForward() );
|
||||
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glTranslatef( 0.5F, -1.5F, -0.5F );
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
CompassResult cr = null;
|
||||
if( skyCompass.getForward() == EnumFacing.UP || skyCompass.getForward() == EnumFacing.DOWN )
|
||||
{
|
||||
final BlockPos compassPos = skyCompass.getPos();
|
||||
cr = CompassManager.INSTANCE.getCompassDirection( 0, compassPos.getX(), compassPos.getY(), compassPos.getZ() );
|
||||
}
|
||||
else
|
||||
{
|
||||
cr = new CompassResult( false, true, 0 );
|
||||
}
|
||||
|
||||
if( cr.isValidResult() )
|
||||
{
|
||||
if( cr.isSpin() )
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.model.renderAll( (float) ( skyCompass.getForward() == EnumFacing.DOWN ? this.flipidiy( cr.getRad() ) : cr.getRad() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
now %= 1000000;
|
||||
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glCullFace( GL11.GL_BACK );
|
||||
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
private double flipidiy( final double rad )
|
||||
{
|
||||
final double x = Math.cos( rad );
|
||||
final double y = Math.sin( rad );
|
||||
return Math.atan2( -y, x );
|
||||
}
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWireless>
|
||||
{
|
||||
|
||||
private BlockPos center;
|
||||
private BlockWireless blk;
|
||||
private boolean hasChan = false;
|
||||
private boolean hasPower = false;
|
||||
|
||||
public RenderBlockWireless()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockWireless blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
this.blk = blk;
|
||||
this.center = new BlockPos( 0, 0, 0 );
|
||||
this.hasChan = false;
|
||||
this.hasPower = false;
|
||||
final BlockRenderInfo ri = blk.getRendererInstance();
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
IAESprite r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
r = CableBusTextures.PartWirelessSides.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
// renderer.startDrawingQuads();
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
this.renderTorchAtAngle( renderer, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
super.postRenderInWorld( renderer );
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
|
||||
final AEPartLocation[] sides = { AEPartLocation.EAST, AEPartLocation.WEST, AEPartLocation.UP, AEPartLocation.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for( final AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.xOffset != 0 ? side.xOffset * 2 : -2 ), 8 + ( side.yOffset != 0 ? side.yOffset * 2 : -2 ), 2 + ( side.zOffset != 0 ? side.zOffset * 2 : -1 ) + s, 8 + ( side.xOffset != 0 ? side.xOffset * 4 : 2 ), 8 + ( side.yOffset != 0 ? side.yOffset * 4 : 2 ), 2 + ( side.zOffset != 0 ? side.zOffset * 5 : 1 ) + s, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for( final AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.xOffset != 0 ? side.xOffset * 4 : -1 ), 8 + ( side.yOffset != 0 ? side.yOffset * 4 : -1 ), 1 + ( side.zOffset != 0 ? side.zOffset * 4 : -1 ) + s, 8 + ( side.xOffset != 0 ? side.xOffset * 5 : 1 ), 8 + ( side.yOffset != 0 ? side.yOffset * 5 : 1 ), 2 + ( side.zOffset != 0 ? side.zOffset * 5 : 1 ) + s, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockWireless blk, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileWireless tw = blk.getTileEntity( world, pos );
|
||||
this.blk = blk;
|
||||
if( tw != null )
|
||||
{
|
||||
this.hasChan = ( tw.getClientFlags() & ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG ) ) == ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG );
|
||||
this.hasPower = ( tw.getClientFlags() & TileWireless.POWERED_FLAG ) == TileWireless.POWERED_FLAG;
|
||||
|
||||
final BlockRenderInfo ri = blk.getRendererInstance();
|
||||
|
||||
final EnumFacing fdy = tw.getUp();
|
||||
final EnumFacing fdz = tw.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
IAESprite r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
r = CableBusTextures.PartWirelessSides.getIcon();
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 1, 11, 11, 2, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
this.center = pos;
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
|
||||
this.renderTorchAtAngle( renderer, fdx, fdy, fdz );
|
||||
super.postRenderInWorld( renderer );
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
|
||||
final AEPartLocation[] sides = { AEPartLocation.EAST, AEPartLocation.WEST, AEPartLocation.UP, AEPartLocation.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for( final AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.xOffset != 0 ? side.xOffset * 2 : -2 ), 8 + ( side.yOffset != 0 ? side.yOffset * 2 : -2 ), 2 + ( side.zOffset != 0 ? side.zOffset * 2 : -1 ) + s, 8 + ( side.xOffset != 0 ? side.xOffset * 4 : 2 ), 8 + ( side.yOffset != 0 ? side.yOffset * 4 : 2 ), 2 + ( side.zOffset != 0 ? side.zOffset * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
}
|
||||
|
||||
s = 3;
|
||||
for( final AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.xOffset != 0 ? side.xOffset * 4 : -1 ), 8 + ( side.yOffset != 0 ? side.yOffset * 4 : -1 ), 1 + ( side.zOffset != 0 ? side.zOffset * 4 : -1 ) + s, 8 + ( side.xOffset != 0 ? side.xOffset * 5 : 1 ), 8 + ( side.yOffset != 0 ? side.yOffset * 5 : 1 ), 2 + ( side.zOffset != 0 ? side.zOffset * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
}
|
||||
|
||||
r = CableBusTextures.PartMonitorSidesStatusLights.getIcon();
|
||||
// ri.setTemporaryRenderIcons( r, r, ExtraTextures.BlockChargerInside.getIcon(),
|
||||
// ExtraTextures.BlockChargerInside.getIcon(), r, r );
|
||||
this.renderBlockBounds( renderer, 5, 5, 0, 11, 11, 1, fdx, fdy, fdz );
|
||||
|
||||
if( this.hasChan )
|
||||
{
|
||||
final int l = 14;
|
||||
renderer.setBrightness( l << 20 | l << 4 );
|
||||
renderer.setColorOpaque_I( AEColor.Transparent.blackVariant );
|
||||
}
|
||||
else if( this.hasPower )
|
||||
{
|
||||
final int l = 9;
|
||||
renderer.setBrightness( l << 20 | l << 4 );
|
||||
renderer.setColorOpaque_I( AEColor.Transparent.whiteVariant );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setBrightness( 0 );
|
||||
renderer.setColorOpaque_I( 0x000000 );
|
||||
}
|
||||
|
||||
if( EnumFacing.UP != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.UP );
|
||||
}
|
||||
if( EnumFacing.DOWN != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.DOWN );
|
||||
}
|
||||
if( EnumFacing.EAST != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.EAST );
|
||||
}
|
||||
if( EnumFacing.WEST != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.WEST );
|
||||
}
|
||||
if( EnumFacing.SOUTH != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.SOUTH );
|
||||
}
|
||||
if( EnumFacing.NORTH != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.NORTH );
|
||||
}
|
||||
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
renderer.setRenderAllFaces( false );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderTorchAtAngle( final ModelGenerator renderer, final EnumFacing x, final EnumFacing y, final EnumFacing z )
|
||||
{
|
||||
final IAESprite r = ( this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : renderer.getIcon( this.blk.getDefaultState() )[0] );
|
||||
final IAESprite sides = new OffsetIcon( r, 0.0f, -2.0f );
|
||||
|
||||
switch( z )
|
||||
{
|
||||
case DOWN:
|
||||
renderer.setUvRotateNorth( 3 );
|
||||
renderer.setUvRotateSouth( 3 );
|
||||
renderer.setUvRotateEast( 3 );
|
||||
renderer.setUvRotateWest( 3 );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 2 );
|
||||
renderer.setUvRotateEast( 2 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setUvRotateTop( 0 );
|
||||
renderer.setUvRotateBottom( 0 );
|
||||
renderer.setUvRotateNorth( 2 );
|
||||
renderer.setUvRotateSouth( 1 );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setUvRotateTop( 3 );
|
||||
renderer.setUvRotateBottom( 3 );
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 2 );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setUvRotateTop( 2 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
renderer.setUvRotateEast( 1 );
|
||||
renderer.setUvRotateWest( 2 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
this.renderBlockBounds( renderer, 0, 7, 1, 16, 9, 16, x, y, z );
|
||||
this.renderFace( this.center, this.blk, sides, renderer, y );
|
||||
this.renderFace( this.center, this.blk, sides, renderer, y.getOpposite() );
|
||||
|
||||
this.renderBlockBounds( renderer, 7, 0, 1, 9, 16, 16, x, y, z );
|
||||
this.renderFace( this.center, this.blk, sides, renderer, x );
|
||||
this.renderFace( this.center, this.blk, sides, renderer, x.getOpposite() );
|
||||
|
||||
this.renderBlockBounds( renderer, 7, 7, 1, 9, 9, 10.6, x, y, z );
|
||||
this.renderFace( this.center, this.blk, r, renderer, z );
|
||||
}
|
||||
}
|
||||
@@ -1,349 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.storage.BlockDrive;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
{
|
||||
|
||||
public RenderDrive()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockDrive block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.White.getIcon() );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockDrive imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileDrive sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
final EnumFacing up = sp.getUp();
|
||||
final EnumFacing forward = sp.getForward();
|
||||
final EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
final boolean result = super.renderInWorld( imb, world, pos, renderer );
|
||||
|
||||
final IAESprite ico = ExtraBlockTextures.MEStorageCellTextures.getIcon();
|
||||
|
||||
final int b = world.getCombinedLight( pos.offset( forward ), 0 );
|
||||
|
||||
for( int yy = 0; yy < 5; yy++ )
|
||||
{
|
||||
for( int xx = 0; xx < 2; xx++ )
|
||||
{
|
||||
final 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.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 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 -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 -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 );
|
||||
|
||||
int m = 1;
|
||||
int mx = 3;
|
||||
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 );
|
||||
|
||||
final int x = pos.getX();
|
||||
final int y = pos.getY();
|
||||
final int z = pos.getZ();
|
||||
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 )
|
||||
{
|
||||
case 1:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 );
|
||||
break;
|
||||
}
|
||||
|
||||
if( ( forward == EnumFacing.UP && up == EnumFacing.SOUTH ) || forward == EnumFacing.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 )
|
||||
{
|
||||
final IAESprite 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() )
|
||||
{
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setBrightness( 0 );
|
||||
}
|
||||
|
||||
if( stat == 1 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0x00ff00 );
|
||||
}
|
||||
if( stat == 2 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0xffaa00 );
|
||||
}
|
||||
if( stat == 3 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0xff0000 );
|
||||
}
|
||||
|
||||
switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 )
|
||||
{
|
||||
case 1:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMinZ(), u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u1, v1 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMinX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u2, v2 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMaxY(), z + renderer.getRenderMaxZ(), u3, v3 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.getRenderMaxX(), y + renderer.getRenderMinY(), z + renderer.getRenderMaxZ(), u4, v4 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.storage.BlockChest;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
|
||||
{
|
||||
|
||||
public RenderMEChest()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockChest block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setBrightness( 0 );
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.White.getIcon() );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.MEChest.getIcon() );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.UP ), block, is, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockChest imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileChest sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if( sp == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final EnumFacing up = sp.getUp();
|
||||
final EnumFacing forward = sp.getForward();
|
||||
final EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
this.preRenderInWorld( imb, world, pos, renderer );
|
||||
|
||||
final int stat = sp.getCellStatus( 0 );
|
||||
final boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
this.selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 );
|
||||
|
||||
int offsetV = 8;
|
||||
if( stat == 0 )
|
||||
{
|
||||
offsetV = 3;
|
||||
}
|
||||
|
||||
int b = world.getCombinedLight( pos.offset( forward ), 0 );
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
|
||||
final int offsetU = -4;
|
||||
final FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
|
||||
if( forward == EnumFacing.EAST && ( up == EnumFacing.NORTH || up == EnumFacing.SOUTH ) )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
else if( forward == EnumFacing.NORTH && up == EnumFacing.EAST )
|
||||
{
|
||||
flippableIcon.setFlip( false, true );
|
||||
}
|
||||
else if( forward == EnumFacing.NORTH && up == EnumFacing.WEST )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
else if( forward == EnumFacing.DOWN && up == EnumFacing.EAST )
|
||||
{
|
||||
flippableIcon.setFlip( false, true );
|
||||
}
|
||||
else if( forward == EnumFacing.DOWN )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
|
||||
/*
|
||||
* 1.7.2
|
||||
* else if ( forward == AEPartLocation.EAST && up == AEPartLocation.UP ) flippableIcon.setFlip( true, false );
|
||||
* else if (
|
||||
* forward == AEPartLocation.NORTH && up == AEPartLocation.UP ) flippableIcon.setFlip( true, false );
|
||||
*/
|
||||
|
||||
this.renderFace( pos, imb, flippableIcon, renderer, forward );
|
||||
|
||||
if( stat != 0 )
|
||||
{
|
||||
b = 0;
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
renderer.setBrightness( b );
|
||||
if( stat == 1 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0x00ff00 );
|
||||
}
|
||||
if( stat == 2 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0xffaa00 );
|
||||
}
|
||||
if( stat == 3 )
|
||||
{
|
||||
renderer.setColorOpaque_I( 0xff0000 );
|
||||
}
|
||||
this.selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
|
||||
this.renderFace( pos, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
|
||||
}
|
||||
|
||||
b = world.getCombinedLight( pos.offset( up ), 0 );
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
final ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() );
|
||||
|
||||
renderer.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||
IAESprite ico = ch == null ? null : ch.getTopTexture_Light();
|
||||
this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
|
||||
if( ico != null )
|
||||
{
|
||||
renderer.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = ch == null ? null : ch.getTopTexture_Medium();
|
||||
this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
|
||||
renderer.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
ico = ch == null ? null : ch.getTopTexture_Dark();
|
||||
this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
this.postRenderInWorld( renderer );
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class RenderNull extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
{
|
||||
|
||||
public RenderNull()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final AEBaseBlock block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final AEBaseBlock block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.qnb.BlockQuantumBase;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
|
||||
public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBridge>
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockQuantumBase block, final ItemStack item, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
final float minPx = 2.0f / 16.0f;
|
||||
final float maxPx = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( minPx, minPx, minPx, maxPx, maxPx, maxPx );
|
||||
|
||||
super.renderInventory( block, item, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockQuantumBase block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileQuantumBridge tqb = block.getTileEntity( world, pos );
|
||||
if( tqb == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IParts parts = definitions.parts();
|
||||
|
||||
for( final Block linkBlock : blocks.quantumLink().maybeBlock().asSet() )
|
||||
{
|
||||
if( tqb.getBlockType() == linkBlock )
|
||||
{
|
||||
if( tqb.isFormed() )
|
||||
{
|
||||
final EnumSet<AEPartLocation> sides = tqb.getConnections();
|
||||
|
||||
this.renderCableAt( 0.11D, world, pos, block, renderer, renderer.getIcon( parts.cableGlass().stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
|
||||
|
||||
final Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.188D, world, pos, block, renderer, renderer.getIcon( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.1875D, sides );
|
||||
}
|
||||
|
||||
final float renderMin = 2.0f / 16.0f;
|
||||
final float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !tqb.isFormed() )
|
||||
{
|
||||
final float renderMin = 2.0f / 16.0f;
|
||||
final float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
else if( tqb.isCorner() )
|
||||
{
|
||||
final Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.188D, world, pos, block, renderer, renderer.getIcon( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D, tqb.getConnections() );
|
||||
|
||||
float renderMin = 4.0f / 16.0f;
|
||||
float renderMax = 12.0f / 16.0f;
|
||||
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
|
||||
renderMin = 3.9f / 16.0f;
|
||||
renderMax = 12.1f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
|
||||
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
final int bn = 15;
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
for( final EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( pos, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float renderMin = 2.0f / 16.0f;
|
||||
float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( 0, renderMin, renderMin, 1, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( renderMin, 0, renderMin, renderMax, 1, renderMax );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
renderMin = -0.01f / 16.0f;
|
||||
renderMax = 16.01f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
|
||||
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
final int bn = 15;
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
for( final EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( pos, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderCableAt( final double thickness, final IBlockAccess world, final BlockPos pos, final BlockQuantumBase block, final ModelGenerator renderer, final IAESprite texture, final double pull, final Collection<AEPartLocation> connections )
|
||||
{
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture );
|
||||
|
||||
if( connections.contains( AEPartLocation.WEST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.0D, 0.5D - thickness, 0.5D - thickness, 0.5D - thickness - pull, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( AEPartLocation.EAST ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D + thickness + pull, 0.5D - thickness, 0.5D - thickness, 1.0D, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( AEPartLocation.NORTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.0D, 0.5D + thickness, 0.5D + thickness, 0.5D - thickness - pull );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( AEPartLocation.SOUTH ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D + thickness + pull, 0.5D + thickness, 0.5D + thickness, 1.0D );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( AEPartLocation.DOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.0D, 0.5D - thickness, 0.5D + thickness, 0.5D - thickness - pull, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( AEPartLocation.UP ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D + thickness + pull, 0.5D - thickness, 0.5D + thickness, 1.0D, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.decorative.solid.QuartzGlassBlock;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class RenderQuartzGlass extends BaseBlockRender<QuartzGlassBlock, AEBaseTile>
|
||||
{
|
||||
|
||||
private static byte[][][] offsets;
|
||||
|
||||
public RenderQuartzGlass()
|
||||
{
|
||||
super( false, 0 );
|
||||
if( offsets == null )
|
||||
{
|
||||
final 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++ )
|
||||
{
|
||||
r.nextBytes( offsets[x][y] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final QuartzGlassBlock block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final QuartzGlassBlock imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
final int cx = Math.abs( pos.getX() % 10 );
|
||||
final int cy = Math.abs( pos.getY() % 10 );
|
||||
final int cz = Math.abs( pos.getZ() % 10 );
|
||||
|
||||
final int u = offsets[cx][cy][cz] % 4;
|
||||
final int v = offsets[9 - cx][9 - cy][9 - cz] % 4;
|
||||
|
||||
switch( Math.abs( ( offsets[cx][cy][cz] + ( pos.getX() + pos.getY() + pos.getZ() ) ) % 4 ) )
|
||||
{
|
||||
case 0:
|
||||
renderer.setOverrideBlockTexture( new OffsetIcon( renderer.getIcon( world.getBlockState( pos ) )[0], u / 2, v / 2 ) );
|
||||
break;
|
||||
case 1:
|
||||
renderer.setOverrideBlockTexture( new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 ) );
|
||||
break;
|
||||
case 2:
|
||||
renderer.setOverrideBlockTexture( new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassC.getIcon(), u, v ) );
|
||||
break;
|
||||
case 3:
|
||||
renderer.setOverrideBlockTexture( new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassD.getIcon(), u, v ) );
|
||||
break;
|
||||
}
|
||||
|
||||
final boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.UP, AEPartLocation.EAST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.UP, AEPartLocation.WEST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.UP, AEPartLocation.NORTH );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.UP, AEPartLocation.SOUTH );
|
||||
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.DOWN, AEPartLocation.EAST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.DOWN, AEPartLocation.WEST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.DOWN, AEPartLocation.NORTH );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.DOWN, AEPartLocation.SOUTH );
|
||||
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.EAST, AEPartLocation.UP );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.EAST, AEPartLocation.DOWN );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.EAST, AEPartLocation.NORTH );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.EAST, AEPartLocation.SOUTH );
|
||||
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.WEST, AEPartLocation.UP );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.WEST, AEPartLocation.DOWN );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.WEST, AEPartLocation.NORTH );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.WEST, AEPartLocation.SOUTH );
|
||||
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.NORTH, AEPartLocation.EAST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.NORTH, AEPartLocation.WEST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.NORTH, AEPartLocation.UP );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.NORTH, AEPartLocation.DOWN );
|
||||
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.SOUTH, AEPartLocation.EAST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.SOUTH, AEPartLocation.WEST );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.SOUTH, AEPartLocation.UP );
|
||||
this.renderEdge( imb, world, pos, renderer, AEPartLocation.SOUTH, AEPartLocation.DOWN );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void renderEdge( final QuartzGlassBlock imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer, final AEPartLocation side, final AEPartLocation direction )
|
||||
{
|
||||
if( !this.isFlush( imb, world, pos.getX() + side.xOffset, pos.getY() + side.yOffset, pos.getZ() + side.zOffset ) )
|
||||
{
|
||||
if( !this.isFlush( imb, world, pos.getX() + direction.xOffset, pos.getY() + direction.yOffset, pos.getZ() + direction.zOffset ) )
|
||||
{
|
||||
float minX = 0.5f + ( side.xOffset + direction.xOffset ) / 2.0f;
|
||||
float minY = 0.5f + ( side.yOffset + direction.yOffset ) / 2.0f;
|
||||
float minZ = 0.5f + ( side.zOffset + direction.zOffset ) / 2.0f;
|
||||
float maxX = 0.5f + ( side.xOffset + direction.xOffset ) / 2.0f;
|
||||
float maxY = 0.5f + ( side.yOffset + direction.yOffset ) / 2.0f;
|
||||
float maxZ = 0.5f + ( side.zOffset + direction.zOffset ) / 2.0f;
|
||||
|
||||
if( 0 == side.xOffset && 0 == direction.xOffset )
|
||||
{
|
||||
minX = 0.0f;
|
||||
maxX = 1.0f;
|
||||
}
|
||||
if( 0 == side.yOffset && 0 == direction.yOffset )
|
||||
{
|
||||
minY = 0.0f;
|
||||
maxY = 1.0f;
|
||||
}
|
||||
if( 0 == side.zOffset && 0 == direction.zOffset )
|
||||
{
|
||||
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, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFlush( final QuartzGlassBlock imb, final IBlockAccess world, final int x, final int y, final int z )
|
||||
{
|
||||
return this.isGlass( imb, world, new BlockPos( x, y, z ) );
|
||||
}
|
||||
|
||||
private boolean isGlass( final QuartzGlassBlock imb, final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
return this.isQuartzGlass( world, pos ) || this.isVibrantQuartzGlass( world, pos );
|
||||
}
|
||||
|
||||
private boolean isQuartzGlass( final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, pos );
|
||||
}
|
||||
|
||||
private boolean isVibrantQuartzGlass( final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, pos );
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.decorative.solid.QuartzOreBlock;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class RenderQuartzOre extends BaseBlockRender<QuartzOreBlock, AEBaseTile>
|
||||
{
|
||||
|
||||
public RenderQuartzOre()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final QuartzOreBlock blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final QuartzOreBlock quartz, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
quartz.setEnhanceBrightness( true );
|
||||
super.renderInWorld( quartz, world, pos, renderer );
|
||||
quartz.setEnhanceBrightness( false );
|
||||
|
||||
quartz.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
|
||||
final boolean out = super.renderInWorld( quartz, world, pos, renderer );
|
||||
quartz.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
{
|
||||
|
||||
public RenderQuartzTorch()
|
||||
{
|
||||
super( false, 20 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final AEBaseBlock blk, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
final float Point3 = 7.0f / 16.0f;
|
||||
final float Point12 = 9.0f / 16.0f;
|
||||
|
||||
final float renderBottom = 5.0f / 16.0f;
|
||||
final float renderTop = 10.0f / 16.0f;
|
||||
|
||||
final float xOff = 0.0f;
|
||||
final float yOff = 0.0f;
|
||||
final float zOff = 0.0f;
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
final float singlePixel = 1.0f / 16.0f;
|
||||
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - singlePixel + xOff, renderBottom - singlePixel + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderBottom + yOff, Point12 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( Blocks.HOPPER.getDefaultState() )[0] );
|
||||
renderer.setRenderAllFaces( true );
|
||||
|
||||
final float top = 8.0f / 16.0f;
|
||||
final float bottom = 7.0f / 16.0f;
|
||||
final float Point13 = 10.0f / 16.0f;
|
||||
final float Point2 = 6.0f / 16.0f;
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final AEBaseBlock block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, pos );
|
||||
|
||||
renderer.setRenderAllFaces( true );
|
||||
float zOff = 0.0f;
|
||||
float yOff = 0.0f;
|
||||
float xOff = 0.0f;
|
||||
if( te != null )
|
||||
{
|
||||
final AEPartLocation forward = AEPartLocation.fromFacing( te.getUp() );
|
||||
xOff = forward.xOffset * -( 4.0f / 16.0f );
|
||||
yOff = forward.yOffset * -( 4.0f / 16.0f );
|
||||
zOff = forward.zOffset * -( 4.0f / 16.0f );
|
||||
}
|
||||
|
||||
final float renderTop = 10.0f / 16.0f;
|
||||
final float renderBottom = 5.0f / 16.0f;
|
||||
final float Point12 = 9.0f / 16.0f;
|
||||
final float Point3 = 7.0f / 16.0f;
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
|
||||
final int r = ( pos.getX() + pos.getY() + pos.getZ() ) % 2;
|
||||
final float singlePixel = 1.0f / 16.0f;
|
||||
if( r == 0 )
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - singlePixel + xOff, renderBottom - singlePixel + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderBottom + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom - singlePixel + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderBottom + yOff, Point3 + singlePixel + zOff );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - singlePixel + xOff, renderTop + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderTop + singlePixel + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( Blocks.HOPPER.getDefaultState() )[0] );
|
||||
|
||||
final float top = 8.0f / 16.0f;
|
||||
final float bottom = 7.0f / 16.0f;
|
||||
final float Point13 = 10.0f / 16.0f;
|
||||
final float Point2 = 6.0f / 16.0f;
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
final boolean out = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
if( te != null )
|
||||
{
|
||||
final AEPartLocation forward = AEPartLocation.fromFacing( te.getUp() );
|
||||
switch( forward )
|
||||
{
|
||||
case EAST:
|
||||
renderer.setRenderBounds( 0, bottom + yOff, bottom + zOff, Point2 + xOff, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setRenderAllFaces( false );
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.spatial.BlockSpatialPylon;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
|
||||
public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileSpatialPylon>
|
||||
{
|
||||
|
||||
public RenderSpatialPylon()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockSpatialPylon block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.BlockSpatialPylon_dim.getIcon() );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockSpatialPylon imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
final TileSpatialPylon sp = imb.getTileEntity( world, pos );
|
||||
|
||||
final int displayBits = ( sp == null ) ? 0 : sp.getDisplayBits();
|
||||
|
||||
if( displayBits != 0 )
|
||||
{
|
||||
EnumFacing ori = null;// AEPartLocation.INTERNAL;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_X )
|
||||
{
|
||||
ori = EnumFacing.EAST;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.setUvRotateEast( 1 );
|
||||
renderer.setUvRotateWest( 2 );
|
||||
renderer.setUvRotateTop( 2 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN )
|
||||
{
|
||||
renderer.setUvRotateEast( 2 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setUvRotateEast( 1 );
|
||||
renderer.setUvRotateWest( 1 );
|
||||
renderer.setUvRotateTop( 1 );
|
||||
renderer.setUvRotateBottom( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_Y )
|
||||
{
|
||||
ori = EnumFacing.UP;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.setUvRotateNorth( 3 );
|
||||
renderer.setUvRotateSouth( 3 );
|
||||
renderer.setUvRotateEast( 3 );
|
||||
renderer.setUvRotateWest( 3 );
|
||||
}
|
||||
}
|
||||
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_Z )
|
||||
{
|
||||
ori = EnumFacing.NORTH;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.setUvRotateSouth( 1 );
|
||||
renderer.setUvRotateNorth( 2 );
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN )
|
||||
{
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 2 );
|
||||
renderer.setUvRotateTop( 3 );
|
||||
renderer.setUvRotateBottom( 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.setUvRotateNorth( 1 );
|
||||
renderer.setUvRotateSouth( 2 );
|
||||
}
|
||||
}
|
||||
|
||||
final BlockRenderInfo bri = imb.getRendererInstance();
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
bri.setTemporaryRenderIcons( this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.UP, renderer ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.DOWN, renderer ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.SOUTH, renderer ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.NORTH, renderer ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.EAST, renderer ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, EnumFacing.WEST, renderer ) );
|
||||
|
||||
final boolean r = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_POWERED_ENABLED ) == TileSpatialPylon.DISPLAY_POWERED_ENABLED )
|
||||
{
|
||||
final int bn = 15;
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
|
||||
for( final EnumFacing d : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( pos, imb, this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, d, renderer ), renderer, d );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
bri.setTemporaryRenderIcons( this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.UP, renderer ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.DOWN, renderer ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.SOUTH, renderer ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.NORTH, renderer ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.EAST, renderer ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, EnumFacing.WEST, renderer ) );
|
||||
|
||||
renderer.renderStandardBlock( imb, pos );
|
||||
}
|
||||
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
renderer.setUvRotateEast( renderer.setUvRotateWest( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateBottom( 0 ) ) ) ) ) );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( world.getBlockState( pos ) )[0] );// imb.getIcon( 0, 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.BlockSpatialPylon_dim.getIcon() );
|
||||
result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
return result;
|
||||
}
|
||||
|
||||
private IAESprite getBlockTextureFromSideOutside( final BlockSpatialPylon blk, final TileSpatialPylon sp, final int displayBits, final EnumFacing ori, final EnumFacing dir, final ModelGenerator renderer )
|
||||
{
|
||||
|
||||
if( ori == dir || ori.getOpposite() == dir )
|
||||
{
|
||||
return blk.getRendererInstance().getTexture( AEPartLocation.fromFacing( dir ) );
|
||||
}
|
||||
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_MIDDLE )
|
||||
{
|
||||
return ExtraBlockTextures.BlockSpatialPylonC.getIcon();
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN )
|
||||
{
|
||||
return ExtraBlockTextures.BlockSpatialPylonE.getIcon();
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
return ExtraBlockTextures.BlockSpatialPylonE.getIcon();
|
||||
}
|
||||
|
||||
return renderer.getIcon( blk.getDefaultState() )[0];// blk.getIcon( 0, 0 );
|
||||
}
|
||||
|
||||
private IAESprite getBlockTextureFromSideInside( final BlockSpatialPylon blk, final TileSpatialPylon sp, final int displayBits, final EnumFacing ori, final EnumFacing dir, final ModelGenerator renderer )
|
||||
{
|
||||
final boolean good = ( displayBits & TileSpatialPylon.DISPLAY_ENABLED ) == TileSpatialPylon.DISPLAY_ENABLED;
|
||||
|
||||
if( ori == dir || ori.getOpposite() == dir )
|
||||
{
|
||||
return good ? ExtraBlockTextures.BlockSpatialPylon_dim.getIcon() : ExtraBlockTextures.BlockSpatialPylon_red.getIcon();
|
||||
}
|
||||
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_MIDDLE )
|
||||
{
|
||||
return good ? ExtraBlockTextures.BlockSpatialPylonC_dim.getIcon() : ExtraBlockTextures.BlockSpatialPylonC_red.getIcon();
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN )
|
||||
{
|
||||
return good ? ExtraBlockTextures.BlockSpatialPylonE_dim.getIcon() : ExtraBlockTextures.BlockSpatialPylonE_red.getIcon();
|
||||
}
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
return good ? ExtraBlockTextures.BlockSpatialPylonE_dim.getIcon() : ExtraBlockTextures.BlockSpatialPylonE_red.getIcon();
|
||||
}
|
||||
|
||||
return renderer.getIcon( blk.getDefaultState() )[0];// blk.getIcon( 0, 0 );
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.FullIcon;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class RenderTinyTNT extends BaseBlockRender<BlockTinyTNT, AEBaseTile>
|
||||
{
|
||||
|
||||
public RenderTinyTNT()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockTinyTNT block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( new FullIcon( Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( Blocks.TNT.getDefaultState() ) ) );
|
||||
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( final BlockTinyTNT imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( new FullIcon( Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( Blocks.TNT.getDefaultState() ) ) );
|
||||
renderer.setRenderAllFaces( true );
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
final boolean out = super.renderInWorld( imb, world, pos, renderer );
|
||||
renderer.setRenderAllFaces( false );
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderHelper;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBus>
|
||||
{
|
||||
|
||||
public RendererCableBus()
|
||||
{
|
||||
super( true, 30 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockCableBus blk, final ItemStack item, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setColorOpaque_F( 1, 1, 1 );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
|
||||
BusRenderer.INSTANCE.setRenderer( renderer ); // post data to this...
|
||||
BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 );
|
||||
BusRenderHelper.INSTANCE.setTexture( null );
|
||||
BusRenderHelper.INSTANCE.setInvColor( 0xffffff );
|
||||
renderer.setBlockAccess( ClientHelper.proxy.getWorld() );
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
if( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
final IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
final IFacadePart fp = fi.createPartFromItemStack( item, AEPartLocation.SOUTH );
|
||||
|
||||
if( fp != null )
|
||||
{
|
||||
fp.renderInventory( BusRenderHelper.INSTANCE, renderer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final IPart ip = this.getRenderer( item, (IPartItem) item.getItem() );
|
||||
if( ip != null )
|
||||
{
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
final int depth = ip.cableConnectionRenderTo();
|
||||
}
|
||||
|
||||
ip.renderInventory( BusRenderHelper.INSTANCE, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
renderer.setUvRotateBottom( renderer.setUvRotateEast( renderer.setUvRotateNorth( renderer.setUvRotateSouth( renderer.setUvRotateTop( renderer.setUvRotateWest( 0 ) ) ) ) ) );
|
||||
}
|
||||
|
||||
public IPart getRenderer( final ItemStack is, final IPartItem c )
|
||||
{
|
||||
final 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 static final BusRenderer INSTANCE = new BusRenderer();
|
||||
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockCableBus block, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final AEBaseTile t = block.getTileEntity( world, pos );
|
||||
|
||||
if( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.INSTANCE.setRenderer( renderer ); // post data to this...
|
||||
BusRenderer.INSTANCE.getRenderer().setRenderAllFaces( true );
|
||||
BusRenderer.INSTANCE.getRenderer().setBlockAccess( renderer.getBlockAccess() );
|
||||
BusRenderer.INSTANCE.getRenderer().setOverrideBlockTexture( renderer.getOverrideBlockTexture() );
|
||||
( (TileCableBus) t ).getCableBus().renderStatic();
|
||||
BusRenderer.INSTANCE.getRenderer().setRenderAllFaces( false );
|
||||
}
|
||||
|
||||
return BusRenderHelper.INSTANCE.getItemsRendered() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( final BlockCableBus block, final TileCableBus cableBus, final VertexBuffer tess, final double x, final double y, final double z, final float f, final ModelGenerator renderer )
|
||||
{
|
||||
if( cableBus != null )
|
||||
{
|
||||
BusRenderer.INSTANCE.getRenderer().setOverrideBlockTexture( null );
|
||||
cableBus.getCableBus().renderDynamic( x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IAESprite;
|
||||
import appeng.api.util.ModelGenerator;
|
||||
import appeng.block.misc.BlockSecurity;
|
||||
import appeng.client.ItemRenderType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
|
||||
|
||||
public class RendererSecurity extends BaseBlockRender<BlockSecurity, TileSecurity>
|
||||
{
|
||||
|
||||
public RendererSecurity()
|
||||
{
|
||||
super( false, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( final BlockSecurity block, final ItemStack is, final ModelGenerator renderer, final ItemRenderType type, final Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.getMissing() );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( ExtraBlockTextures.MEChest.getIcon() );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.UP ), block, is, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( final BlockSecurity imb, final IBlockAccess world, final BlockPos pos, final ModelGenerator renderer )
|
||||
{
|
||||
final TileSecurity sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
final EnumFacing up = sp.getUp();
|
||||
|
||||
this.preRenderInWorld( imb, world, pos, renderer );
|
||||
|
||||
final boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
int b = world.getCombinedLight( pos.offset( up ), 0 );
|
||||
if( sp.isActive() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
renderer.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||
IAESprite ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( pos, imb, ico, renderer, up );
|
||||
if( sp.isActive() )
|
||||
{
|
||||
renderer.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( pos, imb, ico, renderer, up );
|
||||
|
||||
renderer.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Dark.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( pos, imb, ico, renderer, up );
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
this.postRenderInWorld( renderer );
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@@ -52,6 +51,7 @@ public class CraftingFx extends ParticleBreaking
|
||||
this.particleRed = 1;
|
||||
this.particleAlpha = 1.3f;
|
||||
this.particleScale = 1.5f;
|
||||
//TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas.
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas();
|
||||
this.particleMaxAge /= 1.2;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@@ -52,6 +51,7 @@ public class EnergyFx extends ParticleBreaking
|
||||
this.particleRed = 255;
|
||||
this.particleAlpha = 1.4f;
|
||||
this.particleScale = 3.5f;
|
||||
//TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas.
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas();
|
||||
|
||||
this.startBlkX = MathHelper.floor_double( this.posX );
|
||||
|
||||
@@ -27,7 +27,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
public class MatterCannonFX extends ParticleBreaking
|
||||
@@ -47,6 +46,7 @@ public class MatterCannonFX extends ParticleBreaking
|
||||
this.motionX = 0.0f;
|
||||
this.motionY = 0.0f;
|
||||
this.motionZ = 0.0f;
|
||||
//TODO 1.10-R - Find exact atlas it was holding and replace this broken code with the atlas.
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockMatterCannonParticle.getIcon().getAtlas();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
//import org.lwjgl.opengl.GL11;
|
||||
//
|
||||
//import net.minecraft.client.renderer.ItemRenderer;
|
||||
//import net.minecraft.client.renderer.Tessellator;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraftforge.client.IItemRenderer;
|
||||
//
|
||||
//import appeng.api.util.AEColor;
|
||||
//import appeng.client.texture.ExtraItemTextures;
|
||||
//import appeng.items.misc.ItemPaintBall;
|
||||
//
|
||||
//
|
||||
//public class PaintBallRender implements IItemRenderer
|
||||
//{
|
||||
//
|
||||
// @Override
|
||||
// public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item, final ItemRendererHelper helper )
|
||||
// {
|
||||
// return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
|
||||
// {
|
||||
// IIcon par2Icon = item.getIconIndex();
|
||||
// if( item.getItemDamage() >= 20 )
|
||||
// {
|
||||
// par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
|
||||
// }
|
||||
//
|
||||
// final float f4 = par2Icon.getMinU();
|
||||
// final float f5 = par2Icon.getMaxU();
|
||||
// final float f6 = par2Icon.getMinV();
|
||||
// final float f7 = par2Icon.getMaxV();
|
||||
//
|
||||
// final ItemPaintBall ipb = (ItemPaintBall) item.getItem();
|
||||
//
|
||||
// final Tessellator tessellator = Tessellator.getInstance();
|
||||
// GL11.glPushMatrix();
|
||||
// GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
//
|
||||
// final AEColor col = ipb.getColor( item );
|
||||
//
|
||||
// final int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
// final int r = ( colorValue >> 16 ) & 0xff;
|
||||
// final int g = ( colorValue >> 8 ) & 0xff;
|
||||
// final int b = ( colorValue ) & 0xff;
|
||||
//
|
||||
// if( item.getItemDamage() >= 20 )
|
||||
// {
|
||||
// final float fail = 0.7f;
|
||||
// final int full = (int) ( 255 * 0.3 );
|
||||
// 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 )
|
||||
// {
|
||||
// GL11.glScalef( 16F, 16F, 10F );
|
||||
// GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
// GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
// GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
//
|
||||
// tessellator.startDrawingQuads();
|
||||
// tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
// tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
// tessellator.addVertexWithUV( 1, 0, 0, f5, f7 );
|
||||
// tessellator.addVertexWithUV( 1, 1, 0, f5, f6 );
|
||||
// tessellator.addVertexWithUV( 0, 1, 0, f4, f6 );
|
||||
// tessellator.draw();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
// {
|
||||
// GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
// }
|
||||
// final float f12 = 0.0625F;
|
||||
// ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 );
|
||||
//
|
||||
// GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
// GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
// GL11.glScalef( 1F, 1.1F, 1F );
|
||||
// GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f );
|
||||
// GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
// }
|
||||
//
|
||||
// GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
//
|
||||
// GL11.glPopAttrib();
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
// }
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.client.ItemRenderType;
|
||||
|
||||
|
||||
// TODO - PORT
|
||||
public class ToolBiometricCardRender // TileEntityItemStackRenderer
|
||||
{
|
||||
|
||||
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item )// , final ItemRendererHelper
|
||||
// helper )
|
||||
{
|
||||
return false;// return helper == ItemRendererHelper.ENTITY_BOBBING || helper ==
|
||||
// ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
|
||||
{
|
||||
/*
|
||||
* TextureAtlasSprite par2Icon = item.getIconIndex();
|
||||
* float f4 = par2Icon.getMinU();
|
||||
* float f5 = par2Icon.getMaxU();
|
||||
* float f6 = par2Icon.getMinV();
|
||||
* float f7 = par2Icon.getMaxV();
|
||||
* float f12 = 0.0625F;
|
||||
* Tessellator tessellator = Tessellator.instance;
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
* if( type == ItemRenderType.INVENTORY )
|
||||
* {
|
||||
* GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
* GL11.glScalef( 16F, 16F, 10F );
|
||||
* GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
* GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
* GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
* tessellator.startDrawingQuads();
|
||||
* tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
* tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
* tessellator.addVertexWithUV( 1, 0, 0, f5, f7 );
|
||||
* tessellator.addVertexWithUV( 1, 1, 0, f5, f6 );
|
||||
* tessellator.addVertexWithUV( 0, 1, 0, f4, f6 );
|
||||
* tessellator.draw();
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
* ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(),
|
||||
* f12 );
|
||||
* GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
* GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
* GL11.glScalef( 1F, 1.1F, 1F );
|
||||
* GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f );
|
||||
* GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
* }
|
||||
* float u = ExtraItemTextures.White.getIcon().getInterpolatedU( 8.1 );
|
||||
* float v = ExtraItemTextures.White.getIcon().getInterpolatedV( 8.1 );
|
||||
* String username = "";
|
||||
* if( item.getItem() instanceof IBiometricCard )
|
||||
* {
|
||||
* GameProfile gp = ( (IBiometricCard) item.getItem() ).getProfile( item );
|
||||
* if( gp != null )
|
||||
* {
|
||||
* username = gp.getName();
|
||||
* }
|
||||
* }
|
||||
* int hash = username.length() > 0 ? username.hashCode() : 0;
|
||||
* GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||
* GL11.glTranslatef( 4, 6, 0 );
|
||||
* GL11.glDisable( GL11.GL_LIGHTING );
|
||||
* tessellator.startDrawingQuads();
|
||||
* float z = 0;
|
||||
* AEColor col = AEColor.values()[Math.abs( 3 + hash ) % AEColor.values().length];
|
||||
* if( hash == 0 )
|
||||
* {
|
||||
* col = AEColor.Black;
|
||||
* }
|
||||
* for( int x = 0; x < 8; x++ )// 8
|
||||
* {
|
||||
* 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 )
|
||||
* {
|
||||
* isLit = false;
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* isLit = ( hash & ( 1 << x ) ) != 0 || ( hash & ( 1 << y ) ) != 0;
|
||||
* }
|
||||
* 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.addVertexWithUV( x, y, z, u, v );
|
||||
* tessellator.addVertexWithUV( x + 1, y, z, u, v );
|
||||
* tessellator.addVertexWithUV( x + 1, y + 1, z, u, v );
|
||||
* tessellator.addVertexWithUV( x, y + 1, z, u, v );
|
||||
* }
|
||||
* }
|
||||
* tessellator.draw();
|
||||
* GL11.glPopAttrib();
|
||||
* GL11.glPopMatrix();
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.client.ItemRenderType;
|
||||
|
||||
|
||||
public class ToolColorApplicatorRender
|
||||
{
|
||||
|
||||
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldUseRenderHelper( final ItemRenderType type, final ItemStack item )
|
||||
{
|
||||
return false;// return helper == ItemRendererHelper.ENTITY_BOBBING || helper ==
|
||||
// ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
public void renderItem( final ItemRenderType type, final ItemStack item, final Object... data )
|
||||
{
|
||||
/*
|
||||
* TextureAtlasSprite par2Icon = item.getIconIndex();
|
||||
* float f4 = par2Icon.getMinU();
|
||||
* float f5 = par2Icon.getMaxU();
|
||||
* float f6 = par2Icon.getMinV();
|
||||
* float f7 = par2Icon.getMaxV();
|
||||
* float f12 = 0.0625F;
|
||||
* Tessellator tessellator = Tessellator.instance;
|
||||
* GL11.glPushMatrix();
|
||||
* GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
* if( type == ItemRenderType.INVENTORY )
|
||||
* {
|
||||
* GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
* GL11.glScalef( 16F, 16F, 10F );
|
||||
* GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||
* GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
* GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
* tessellator.startDrawingQuads();
|
||||
* tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
* tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
* tessellator.addVertexWithUV( 1, 0, 0, f5, f7 );
|
||||
* tessellator.addVertexWithUV( 1, 1, 0, f5, f6 );
|
||||
* tessellator.addVertexWithUV( 0, 1, 0, f4, f6 );
|
||||
* tessellator.draw();
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
* {
|
||||
* GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
* }
|
||||
* else if( type == ItemRenderType.EQUIPPED )
|
||||
* {
|
||||
* GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||
* }
|
||||
* ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(),
|
||||
* f12 );
|
||||
* GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
* GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||
* GL11.glScalef( -1F, -1F, 1F );
|
||||
* GL11.glTranslatef( -1.125F, 0.0f, f12 / -2.0f );
|
||||
* GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
* }
|
||||
* TextureAtlasSprite dark = ExtraItemTextures.ToolColorApplicatorTip_Dark.getIcon();
|
||||
* TextureAtlasSprite med = ExtraItemTextures.ToolColorApplicatorTip_Medium.getIcon();
|
||||
* TextureAtlasSprite light = ExtraItemTextures.ToolColorApplicatorTip_Light.getIcon();
|
||||
* GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||
* if( type != ItemRenderType.INVENTORY )
|
||||
* {
|
||||
* GL11.glTranslatef( 2, 0, 0 );
|
||||
* }
|
||||
* GL11.glDisable( GL11.GL_LIGHTING );
|
||||
* AEColor col = null;
|
||||
* col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item );
|
||||
* if( col != null )
|
||||
* {
|
||||
* tessellator.startDrawingQuads();
|
||||
* f4 = dark.getMinU();
|
||||
* f5 = dark.getMaxU();
|
||||
* f6 = dark.getMinV();
|
||||
* f7 = dark.getMaxV();
|
||||
* tessellator.setColorOpaque_I( col.blackVariant );
|
||||
* tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 0, 0, f5, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 16, 0, f5, f6 );
|
||||
* tessellator.addVertexWithUV( 0, 16, 0, f4, f6 );
|
||||
* f4 = light.getMinU();
|
||||
* f5 = light.getMaxU();
|
||||
* f6 = light.getMinV();
|
||||
* f7 = light.getMaxV();
|
||||
* tessellator.setColorOpaque_I( col.whiteVariant );
|
||||
* tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 0, 0, f5, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 16, 0, f5, f6 );
|
||||
* tessellator.addVertexWithUV( 0, 16, 0, f4, f6 );
|
||||
* f4 = med.getMinU();
|
||||
* f5 = med.getMaxU();
|
||||
* f6 = med.getMinV();
|
||||
* f7 = med.getMaxV();
|
||||
* tessellator.setColorOpaque_I( col.mediumVariant );
|
||||
* tessellator.addVertexWithUV( 0, 0, 0, f4, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 0, 0, f5, f7 );
|
||||
* tessellator.addVertexWithUV( 16, 16, 0, f5, f6 );
|
||||
* tessellator.addVertexWithUV( 0, 16, 0, f4, f6 );
|
||||
* tessellator.draw();
|
||||
* }
|
||||
* GL11.glPopAttrib();
|
||||
* GL11.glPopMatrix();
|
||||
*/
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user