Most of the 1.8 Port.
This commit is contained in:
@@ -19,14 +19,16 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -43,13 +45,25 @@ import appeng.util.ReadableNumberConverter;
|
||||
*/
|
||||
public class AppEngRenderItem extends RenderItem
|
||||
{
|
||||
public AppEngRenderItem(
|
||||
TextureManager textureManager,
|
||||
ModelManager modelManager )
|
||||
{
|
||||
super( textureManager, modelManager );
|
||||
}
|
||||
|
||||
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
public IAEItemStack aeStack;
|
||||
|
||||
@Override
|
||||
public void renderItemOverlayIntoGUI( FontRenderer fontRenderer, TextureManager textureManager, ItemStack is, int par4, int par5, String par6Str )
|
||||
public void renderItemOverlayIntoGUI(
|
||||
FontRenderer fontRenderer,
|
||||
ItemStack is,
|
||||
int xPos,
|
||||
int yPos,
|
||||
String text )
|
||||
{
|
||||
if( is != null )
|
||||
{
|
||||
@@ -70,12 +84,13 @@ public class AppEngRenderItem extends RenderItem
|
||||
GL11.glDisable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glDisable( GL11.GL_ALPHA_TEST );
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
int l = 255 - k << 16 | k << 8;
|
||||
int i1 = ( 255 - k ) / 4 << 16 | 16128;
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, 13, 2, 0 );
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, 12, 1, i1 );
|
||||
this.renderQuad( tessellator, par4 + 2, par5 + 13, j1, 1, l );
|
||||
this.renderQuad( tessellator, xPos + 2, yPos + 13, 13, 2, 0 );
|
||||
this.renderQuad( tessellator, xPos + 2, yPos + 13, 12, 1, i1 );
|
||||
this.renderQuad( tessellator, xPos + 2, yPos + 13, j1, 1, l );
|
||||
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||
GL11.glEnable( GL11.GL_TEXTURE_2D );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
@@ -90,8 +105,8 @@ public class AppEngRenderItem extends RenderItem
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( scaleFactor, scaleFactor, scaleFactor );
|
||||
int X = (int) ( ( (float) par4 + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor );
|
||||
int Y = (int) ( ( (float) par5 + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
|
||||
int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor );
|
||||
int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
|
||||
fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 );
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
@@ -107,8 +122,8 @@ public class AppEngRenderItem extends RenderItem
|
||||
GL11.glDisable( GL11.GL_DEPTH_TEST );
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled( scaleFactor, scaleFactor, scaleFactor );
|
||||
int X = (int) ( ( (float) par4 + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
|
||||
int Y = (int) ( ( (float) par5 + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
|
||||
int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
|
||||
int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
|
||||
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
@@ -121,12 +136,14 @@ public class AppEngRenderItem extends RenderItem
|
||||
|
||||
private void renderQuad( Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6 )
|
||||
{
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I( par6 );
|
||||
par1Tessellator.addVertex( par2, par3, 0.0D );
|
||||
par1Tessellator.addVertex( par2, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3 + par5, 0.0D );
|
||||
par1Tessellator.addVertex( par2 + par4, par3, 0.0D );
|
||||
WorldRenderer wr = par1Tessellator.getWorldRenderer();
|
||||
|
||||
wr.startDrawingQuads();
|
||||
wr.setColorOpaque_I( par6 );
|
||||
wr.addVertex( par2, par3, 0.0D );
|
||||
wr.addVertex( par2, par3 + par5, 0.0D );
|
||||
wr.addVertex( par2 + par4, par3 + par5, 0.0D );
|
||||
wr.addVertex( par2 + par4, par3, 0.0D );
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,30 +24,31 @@ 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.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -64,6 +65,9 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
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 );
|
||||
@@ -280,10 +284,8 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
return this.renderDistance;
|
||||
}
|
||||
|
||||
public void renderInventory( B block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] data )
|
||||
public void renderInventory( B block, ItemStack item, IRenderHelper renderer, ItemRenderType type, Object[] data )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
if( info.isValid() )
|
||||
{
|
||||
@@ -292,17 +294,17 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
block.setRenderStateByMeta( item.getItemDamage() );
|
||||
}
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( getOrientation( ForgeDirection.EAST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( getOrientation( ForgeDirection.WEST, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( getOrientation( ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( getOrientation( ForgeDirection.SOUTH, ForgeDirection.SOUTH, ForgeDirection.UP ) );
|
||||
renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
renderer.uvRotateSouth = info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, EnumFacing.SOUTH, EnumFacing.UP ) );
|
||||
}
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), block, item, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), block, item, 0xffffff, renderer );
|
||||
|
||||
if( block.hasSubtypes() )
|
||||
{
|
||||
@@ -312,11 +314,11 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
public static int getOrientation( ForgeDirection in, ForgeDirection forward, ForgeDirection up )
|
||||
public static int getOrientation( EnumFacing in, EnumFacing forward, EnumFacing up )
|
||||
{
|
||||
if( in == null || in == ForgeDirection.UNKNOWN // 1
|
||||
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
|
||||
|| up == null || up == ForgeDirection.UNKNOWN )
|
||||
if( in == null // 1
|
||||
|| forward == null // 2
|
||||
|| up == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -328,7 +330,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
return ORIENTATION_MAP[a][b][c];
|
||||
}
|
||||
|
||||
public void renderInvBlock( EnumSet<ForgeDirection> sides, B block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
|
||||
public void renderInvBlock( EnumSet<AEPartLocation> sides, B block, ItemStack item, int color, IRenderHelper tess )
|
||||
{
|
||||
int meta = 0;
|
||||
if( block != null && block.hasSubtypes() && item != null )
|
||||
@@ -336,64 +338,55 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
meta = item.getItemDamage();
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.DOWN ) )
|
||||
IAESprite[] icons = tess.getIcon( item == null ? block.getDefaultState() : block.getStateFromMeta( item.getMetadata() ) );
|
||||
BlockPos zero = new BlockPos(0,0,0);
|
||||
|
||||
if( sides.contains( AEPartLocation.DOWN ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, -1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceYNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.DOWN ), block.getIcon( ForgeDirection.DOWN.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceYNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.DOWN ), icons[ AEPartLocation.DOWN.ordinal() ] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.UP ) )
|
||||
if( sides.contains( AEPartLocation.UP ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 1.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceYPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.UP ), block.getIcon( ForgeDirection.UP.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceYPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.UP ), icons[ AEPartLocation.UP.ordinal() ] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.NORTH ) )
|
||||
if( sides.contains( AEPartLocation.NORTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, -1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceZNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.NORTH ), block.getIcon( ForgeDirection.NORTH.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceZNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.NORTH ), icons[ AEPartLocation.NORTH.ordinal() ] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.SOUTH ) )
|
||||
if( sides.contains( AEPartLocation.SOUTH ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 0.0F, 0.0F, 1.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceZPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.SOUTH ), block.getIcon( ForgeDirection.SOUTH.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceZPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.SOUTH ), icons[ AEPartLocation.SOUTH.ordinal() ] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.WEST ) )
|
||||
if( sides.contains( AEPartLocation.WEST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( -1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceXNeg( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.WEST ), block.getIcon( ForgeDirection.WEST.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceXNeg( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.WEST ), icons[ AEPartLocation.WEST.ordinal() ] ) );
|
||||
}
|
||||
|
||||
if( sides.contains( ForgeDirection.EAST ) )
|
||||
if( sides.contains( AEPartLocation.EAST ) )
|
||||
{
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal( 1.0F, 0.0F, 0.0F );
|
||||
tess.setColorOpaque_I( color );
|
||||
renderer.renderFaceXPos( block, 0.0D, 0.0D, 0.0D, this.firstNotNull( renderer.overrideBlockTexture, block.getRendererInstance().getTexture( ForgeDirection.EAST ), block.getIcon( ForgeDirection.EAST.ordinal(), meta ) ) );
|
||||
tess.draw();
|
||||
tess.renderFaceXPos( block, zero, this.firstNotNull( tess.overrideBlockTexture, block.getRendererInstance().getTexture( AEPartLocation.EAST ), icons[ AEPartLocation.EAST.ordinal() ]) );
|
||||
}
|
||||
}
|
||||
|
||||
public IIcon firstNotNull( IIcon... s )
|
||||
public IAESprite firstNotNull( IAESprite... s )
|
||||
{
|
||||
for( IIcon o : s )
|
||||
for( IAESprite o : s )
|
||||
{
|
||||
if( o != null )
|
||||
{
|
||||
@@ -403,62 +396,62 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
return ExtraBlockTextures.getMissing();
|
||||
}
|
||||
|
||||
public boolean renderInWorld( B block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( B block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
boolean o = renderer.renderStandardBlock( block, x, y, z );
|
||||
boolean o = renderer.renderStandardBlock( block, pos );
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
return o;
|
||||
}
|
||||
|
||||
public void preRenderInWorld( B block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public void preRenderInWorld( B block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
ForgeDirection forward = ForgeDirection.SOUTH;
|
||||
ForgeDirection up = ForgeDirection.UP;
|
||||
EnumFacing forward = EnumFacing.SOUTH;
|
||||
EnumFacing up = EnumFacing.UP;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
IOrientable te = this.getOrientable( block, world, pos );
|
||||
if( te != null )
|
||||
{
|
||||
forward = te.getForward();
|
||||
up = te.getUp();
|
||||
forward = te.getForward() ;
|
||||
up = te.getUp() ;
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, forward, up ) );
|
||||
renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( getOrientation( EnumFacing.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( getOrientation( EnumFacing.UP, forward, up ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( getOrientation( ForgeDirection.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( getOrientation( ForgeDirection.WEST, forward, up ) );
|
||||
renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( getOrientation( EnumFacing.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( getOrientation( EnumFacing.WEST, forward, up ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( getOrientation( ForgeDirection.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( getOrientation( ForgeDirection.SOUTH, forward, up ) );
|
||||
renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( getOrientation( EnumFacing.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = info.getTexture( AEPartLocation.SOUTH ).setFlip( getOrientation( EnumFacing.SOUTH, forward, up ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void postRenderInWorld( RenderBlocks renderer )
|
||||
public void postRenderInWorld( IRenderHelper renderer )
|
||||
{
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IOrientable getOrientable( B block, IBlockAccess w, int x, int y, int z )
|
||||
public IOrientable getOrientable( B block, IBlockAccess w, BlockPos pos )
|
||||
{
|
||||
return block.getOrientable( w, x, y, z );
|
||||
return block.getOrientable( w, pos );
|
||||
}
|
||||
|
||||
protected void setInvRenderBounds( RenderBlocks renderer, int i, int j, int k, int l, int m, int n )
|
||||
protected void setInvRenderBounds( IRenderHelper renderer, int i, int j, int k, int l, int m, 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( RenderBlocks renderer,
|
||||
protected void renderBlockBounds( IRenderHelper renderer,
|
||||
|
||||
double minX, double minY, double minZ,
|
||||
|
||||
double maxX, double maxY, double maxZ,
|
||||
|
||||
ForgeDirection x, ForgeDirection y, ForgeDirection z )
|
||||
EnumFacing x, EnumFacing y, EnumFacing z )
|
||||
{
|
||||
minX /= 16.0;
|
||||
minY /= 16.0;
|
||||
@@ -467,27 +460,27 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
maxY /= 16.0;
|
||||
maxZ /= 16.0;
|
||||
|
||||
double aX = minX * x.offsetX + minY * y.offsetX + minZ * z.offsetX;
|
||||
double aY = minX * x.offsetY + minY * y.offsetY + minZ * z.offsetY;
|
||||
double aZ = minX * x.offsetZ + minY * y.offsetZ + minZ * z.offsetZ;
|
||||
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.offsetX + maxY * y.offsetX + maxZ * z.offsetX;
|
||||
double bY = maxX * x.offsetY + maxY * y.offsetY + maxZ * z.offsetY;
|
||||
double bZ = maxX * x.offsetZ + maxY * y.offsetZ + maxZ * z.offsetZ;
|
||||
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.offsetX + y.offsetX + z.offsetX < 0 )
|
||||
if( x.getFrontOffsetX() + y.getFrontOffsetX() + z.getFrontOffsetX() < 0 )
|
||||
{
|
||||
aX += 1;
|
||||
bX += 1;
|
||||
}
|
||||
|
||||
if( x.offsetY + y.offsetY + z.offsetY < 0 )
|
||||
if( x.getFrontOffsetY() + y.getFrontOffsetY() + z.getFrontOffsetY() < 0 )
|
||||
{
|
||||
aY += 1;
|
||||
bY += 1;
|
||||
}
|
||||
|
||||
if( x.offsetZ + y.offsetZ + z.offsetZ < 0 )
|
||||
if( x.getFrontOffsetZ() + y.getFrontOffsetZ() + z.getFrontOffsetZ() < 0 )
|
||||
{
|
||||
aZ += 1;
|
||||
bZ += 1;
|
||||
@@ -502,10 +495,8 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
protected void renderCutoutFace( B block, IIcon ico, int x, int y, int z, RenderBlocks renderer, ForgeDirection orientation, float edgeThickness )
|
||||
protected void renderCutoutFace( B block, IAESprite ico, BlockPos pos, IRenderHelper tess, EnumFacing orientation, float edgeThickness )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
double offsetX = 0.0;
|
||||
double offsetY = 0.0;
|
||||
double offsetZ = 0.0;
|
||||
@@ -565,29 +556,29 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
break;
|
||||
}
|
||||
|
||||
offsetX += x;
|
||||
offsetY += y;
|
||||
offsetZ += z;
|
||||
offsetX += pos.getX();
|
||||
offsetY += pos.getY();
|
||||
offsetZ += pos.getZ();
|
||||
|
||||
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
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( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
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( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
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( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
this.renderFace( orientation,tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
|
||||
// u -> u
|
||||
0, 1.0,
|
||||
// v -> v
|
||||
@@ -595,73 +586,73 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private void renderFace( Tessellator tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, double ua, double ub, double va, double vb, IIcon ico, boolean flip )
|
||||
private void renderFace( EnumFacing face, IRenderHelper tess, double offsetX, double offsetY, double offsetZ, double ax, double ay, double az, double bx, double by, double bz, double ua, double ub, double va, double vb, IAESprite ico, boolean flip )
|
||||
{
|
||||
if( flip )
|
||||
{
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * ua + bx * vb, offsetY + ay * ua + by * vb, offsetZ + az * ua + bz * vb, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( vb * 16.0 ) );
|
||||
tess.addVertexWithUV( 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( 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 * 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( offsetX + ax * ua + bx * va, offsetY + ay * ua + by * va, offsetZ + az * ua + bz * va, ico.getInterpolatedU( ua * 16.0 ), ico.getInterpolatedV( va * 16.0 ) );
|
||||
tess.addVertexWithUV( offsetX + ax * 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( 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( 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 * 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( int x, int y, int z, B block, IIcon ico, RenderBlocks renderer, ForgeDirection orientation )
|
||||
protected void renderFace( BlockPos pos, B block, IAESprite ico, IRenderHelper renderer, EnumFacing orientation )
|
||||
{
|
||||
switch( orientation )
|
||||
{
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( block, x, y, z, ico );
|
||||
renderer.renderFaceZNeg( block, pos, ico );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( block, x, y, z, ico );
|
||||
renderer.renderFaceZPos( block, pos, ico );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( block, x, y, z, ico );
|
||||
renderer.renderFaceXPos( block, pos, ico );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( block, x, y, z, ico );
|
||||
renderer.renderFaceXNeg( block, pos, ico );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( block, x, y, z, ico );
|
||||
renderer.renderFaceYPos( block, pos, ico );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( block, x, y, z, ico );
|
||||
renderer.renderFaceYNeg( block, pos, ico );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void selectFace( RenderBlocks renderer, ForgeDirection west, ForgeDirection up, ForgeDirection forward, int u1, int u2, int v1, int v2 )
|
||||
public void selectFace( IRenderHelper renderer, EnumFacing west, EnumFacing up, EnumFacing forward, int u1, int u2, int v1, int v2 )
|
||||
{
|
||||
v1 = 16 - v1;
|
||||
v2 = 16 - v2;
|
||||
|
||||
double minX = ( forward.offsetX > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetX, u1 ) + this.mapFaceUV( up.offsetX, v1 );
|
||||
double minY = ( forward.offsetY > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetY, u1 ) + this.mapFaceUV( up.offsetY, v1 );
|
||||
double minZ = ( forward.offsetZ > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetZ, u1 ) + this.mapFaceUV( up.offsetZ, v1 );
|
||||
double minX = ( forward.getFrontOffsetX() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetX(), u1 ) + this.mapFaceUV( up.getFrontOffsetX(), v1 );
|
||||
double minY = ( forward.getFrontOffsetY() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetY(), u1 ) + this.mapFaceUV( up.getFrontOffsetY(), v1 );
|
||||
double minZ = ( forward.getFrontOffsetZ() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetZ(), u1 ) + this.mapFaceUV( up.getFrontOffsetZ(), v1 );
|
||||
|
||||
double maxX = ( forward.offsetX > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetX, u2 ) + this.mapFaceUV( up.offsetX, v2 );
|
||||
double maxY = ( forward.offsetY > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetY, u2 ) + this.mapFaceUV( up.offsetY, v2 );
|
||||
double maxZ = ( forward.offsetZ > 0 ? 1 : 0 ) + this.mapFaceUV( west.offsetZ, u2 ) + this.mapFaceUV( up.offsetZ, v2 );
|
||||
double maxX = ( forward.getFrontOffsetX() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetX(), u2 ) + this.mapFaceUV( up.getFrontOffsetX(), v2 );
|
||||
double maxY = ( forward.getFrontOffsetY() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetY(), u2 ) + this.mapFaceUV( up.getFrontOffsetY(), v2 );
|
||||
double maxZ = ( forward.getFrontOffsetZ() > 0 ? 1 : 0 ) + this.mapFaceUV( west.getFrontOffsetZ(), u2 ) + this.mapFaceUV( up.getFrontOffsetZ(), v2 );
|
||||
|
||||
renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - ( forward.offsetX != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + ( forward.offsetX != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMinX = Math.max( 0.0, Math.min( minX, maxX ) - ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxX = Math.min( 1.0, Math.max( minX, maxX ) + ( forward.getFrontOffsetX() != 0 ? 0 : 0.001 ) );
|
||||
|
||||
renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - ( forward.offsetY != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + ( forward.offsetY != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMinY = Math.max( 0.0, Math.min( minY, maxY ) - ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxY = Math.min( 1.0, Math.max( minY, maxY ) + ( forward.getFrontOffsetY() != 0 ? 0 : 0.001 ) );
|
||||
|
||||
renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.offsetZ != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.offsetZ != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMinZ = Math.max( 0.0, Math.min( minZ, maxZ ) - ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) );
|
||||
renderer.renderMaxZ = Math.min( 1.0, Math.max( minZ, maxZ ) + ( forward.getFrontOffsetZ() != 0 ? 0 : 0.001 ) );
|
||||
}
|
||||
|
||||
private double mapFaceUV( int offset, int uv )
|
||||
@@ -679,14 +670,14 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
return ( 16.0 - uv ) / 16.0;
|
||||
}
|
||||
|
||||
public void renderTile( B block, T tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderTile( B block, T tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
ForgeDirection forward = ForgeDirection.SOUTH;
|
||||
ForgeDirection up = ForgeDirection.UP;
|
||||
AEPartLocation forward = AEPartLocation.SOUTH;
|
||||
AEPartLocation up = AEPartLocation.UP;
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
|
||||
|
||||
this.applyTESRRotation( x, y, z, forward, up );
|
||||
this.applyTESRRotation( x, y, z, forward.getFacing(), up.getFacing() );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
@@ -702,49 +693,38 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
tess.setTranslation( -tile.xCoord, -tile.yCoord, -tile.zCoord );
|
||||
tess.startDrawingQuads();
|
||||
BlockPos pos = tile.getPos();
|
||||
renderer.setTranslation( -pos.getX(), -pos.getY(), -pos.getZ() );
|
||||
|
||||
// note that this is a terrible approach...
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
renderer.renderStandardBlock( block, tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
tess.draw();
|
||||
tess.setTranslation( 0, 0, 0 );
|
||||
renderer.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
|
||||
}
|
||||
|
||||
protected void applyTESRRotation( double x, double y, double z, ForgeDirection forward, ForgeDirection up )
|
||||
protected void applyTESRRotation( double x, double y, double z, EnumFacing forward, EnumFacing up )
|
||||
{
|
||||
if( forward != null && up != null )
|
||||
{
|
||||
if( forward == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
forward = ForgeDirection.SOUTH;
|
||||
}
|
||||
EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
if( up == ForgeDirection.UNKNOWN )
|
||||
{
|
||||
up = ForgeDirection.UP;
|
||||
}
|
||||
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
|
||||
this.rotMat.put( 0, west.offsetX );
|
||||
this.rotMat.put( 1, west.offsetY );
|
||||
this.rotMat.put( 2, west.offsetZ );
|
||||
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.offsetX );
|
||||
this.rotMat.put( 5, up.offsetY );
|
||||
this.rotMat.put( 6, up.offsetZ );
|
||||
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.offsetX );
|
||||
this.rotMat.put( 9, forward.offsetY );
|
||||
this.rotMat.put( 10, forward.offsetZ );
|
||||
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 );
|
||||
@@ -765,22 +745,27 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
|
||||
{
|
||||
if( itemstack != null )
|
||||
{
|
||||
EntityItem entityitem = new EntityItem( par1EntityItemFrame.getWorldObj(), 0.0D, 0.0D, 0.0D, itemstack );
|
||||
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.age = 0;
|
||||
entityitem.setNoDespawn();
|
||||
entityitem.rotationYaw = 0;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( 0, -0.14F, 0 );
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw( entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F );
|
||||
RenderItem.renderInFrame = false;
|
||||
//RenderItem.renderInFrame = true;
|
||||
Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw( entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F );
|
||||
//RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public ModelResourceLocation getResourcePath()
|
||||
{
|
||||
return modelPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.TmpFlippableIcon;
|
||||
|
||||
|
||||
@@ -59,7 +58,7 @@ public class BlockRenderInfo
|
||||
this.westIcon = west;
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcon( IIcon icon )
|
||||
public void setTemporaryRenderIcon( IAESprite icon )
|
||||
{
|
||||
if( icon == null )
|
||||
{
|
||||
@@ -77,18 +76,18 @@ public class BlockRenderInfo
|
||||
}
|
||||
}
|
||||
|
||||
public void setTemporaryRenderIcons( IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon )
|
||||
public void setTemporaryRenderIcons( IAESprite nTopIcon, IAESprite nBottomIcon, IAESprite nSouthIcon, IAESprite nNorthIcon, IAESprite nEastIcon, IAESprite nWestIcon )
|
||||
{
|
||||
this.tmpTopIcon.setOriginal( nTopIcon == null ? this.getTexture( ForgeDirection.UP ) : nTopIcon );
|
||||
this.tmpBottomIcon.setOriginal( nBottomIcon == null ? this.getTexture( ForgeDirection.DOWN ) : nBottomIcon );
|
||||
this.tmpSouthIcon.setOriginal( nSouthIcon == null ? this.getTexture( ForgeDirection.SOUTH ) : nSouthIcon );
|
||||
this.tmpNorthIcon.setOriginal( nNorthIcon == null ? this.getTexture( ForgeDirection.NORTH ) : nNorthIcon );
|
||||
this.tmpEastIcon.setOriginal( nEastIcon == null ? this.getTexture( ForgeDirection.EAST ) : nEastIcon );
|
||||
this.tmpWestIcon.setOriginal( nWestIcon == null ? this.getTexture( ForgeDirection.WEST ) : 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( ForgeDirection dir )
|
||||
public FlippableIcon getTexture( AEPartLocation dir )
|
||||
{
|
||||
if( this.useTmp )
|
||||
{
|
||||
|
||||
@@ -20,32 +20,29 @@ 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.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
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.IBoxProvider;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.parts.ISimplifiedBundle;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public final class BusRenderHelper implements IPartRenderHelper
|
||||
@@ -67,9 +64,9 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
private double maxX;
|
||||
private double maxY;
|
||||
private double maxZ;
|
||||
private ForgeDirection ax;
|
||||
private ForgeDirection ay;
|
||||
private ForgeDirection az;
|
||||
private EnumFacing ax;
|
||||
private EnumFacing ay;
|
||||
private EnumFacing az;
|
||||
private int color;
|
||||
|
||||
public BusRenderHelper()
|
||||
@@ -86,9 +83,9 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
this.maxX = 16;
|
||||
this.maxY = 16;
|
||||
this.maxZ = 16;
|
||||
this.ax = ForgeDirection.EAST;
|
||||
this.az = ForgeDirection.SOUTH;
|
||||
this.ay = ForgeDirection.UP;
|
||||
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() );
|
||||
@@ -106,12 +103,12 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
this.itemsRendered = 0;
|
||||
}
|
||||
|
||||
public double getBound( ForgeDirection side )
|
||||
public double getBound( AEPartLocation side )
|
||||
{
|
||||
switch( side )
|
||||
{
|
||||
default:
|
||||
case UNKNOWN:
|
||||
case INTERNAL:
|
||||
return 0.5;
|
||||
case DOWN:
|
||||
return this.minY;
|
||||
@@ -128,20 +125,22 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
}
|
||||
}
|
||||
|
||||
public void setRenderColor( int color )
|
||||
{
|
||||
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
/*
|
||||
public void setRenderColor( int color )
|
||||
{
|
||||
final BlockCableBus cableBus = (BlockCableBus) block;
|
||||
cableBus.setRenderColor( color );
|
||||
for( Block block : AEApi.instance().definitions().blocks().multiPart().maybeBlock().asSet() )
|
||||
{
|
||||
final BlockCableBus cableBus = (BlockCableBus) block;
|
||||
cableBus.setRenderColor( color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrientation( ForgeDirection dx, ForgeDirection dy, ForgeDirection dz )
|
||||
*/
|
||||
|
||||
public void setOrientation( EnumFacing dx, EnumFacing dy, EnumFacing dz )
|
||||
{
|
||||
this.ax = dx == null ? ForgeDirection.EAST : dx;
|
||||
this.ay = dy == null ? ForgeDirection.UP : dy;
|
||||
this.az = dz == null ? ForgeDirection.SOUTH : 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()
|
||||
@@ -207,19 +206,19 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldX()
|
||||
public EnumFacing getWorldX()
|
||||
{
|
||||
return this.helper.ax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldY()
|
||||
public EnumFacing getWorldY()
|
||||
{
|
||||
return this.helper.ay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldZ()
|
||||
public EnumFacing getWorldZ()
|
||||
{
|
||||
return this.helper.az;
|
||||
}
|
||||
@@ -262,91 +261,6 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void normalRendering()
|
||||
{
|
||||
RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
|
||||
rbw.calculations = true;
|
||||
rbw.useTextures = true;
|
||||
rbw.enableAO = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISimplifiedBundle useSimplifiedRendering( int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim )
|
||||
{
|
||||
RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
|
||||
|
||||
if( sim != null && this.maybeBlock.isPresent() && rbw.similarLighting( this.maybeBlock.get(), rbw.blockAccess, x, y, z, sim ) )
|
||||
{
|
||||
rbw.populate( sim );
|
||||
rbw.faces = EnumSet.allOf( ForgeDirection.class );
|
||||
rbw.calculations = false;
|
||||
rbw.useTextures = false;
|
||||
|
||||
return sim;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean allFaces = rbw.renderAllFaces;
|
||||
rbw.renderAllFaces = true;
|
||||
rbw.calculations = true;
|
||||
rbw.faces.clear();
|
||||
|
||||
this.bbc.started = false;
|
||||
if( p == null )
|
||||
{
|
||||
this.bbc.minX = this.bbc.minY = this.bbc.minZ = 0;
|
||||
this.bbc.maxX = this.bbc.maxY = this.bbc.maxZ = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.getBoxes( this.bbc );
|
||||
|
||||
if( this.bbc.minX < 1 )
|
||||
{
|
||||
this.bbc.minX = 1;
|
||||
}
|
||||
if( this.bbc.minY < 1 )
|
||||
{
|
||||
this.bbc.minY = 1;
|
||||
}
|
||||
if( this.bbc.minZ < 1 )
|
||||
{
|
||||
this.bbc.minZ = 1;
|
||||
}
|
||||
|
||||
if( this.bbc.maxX > 15 )
|
||||
{
|
||||
this.bbc.maxX = 15;
|
||||
}
|
||||
if( this.bbc.maxY > 15 )
|
||||
{
|
||||
this.bbc.maxY = 15;
|
||||
}
|
||||
if( this.bbc.maxZ > 15 )
|
||||
{
|
||||
this.bbc.maxZ = 15;
|
||||
}
|
||||
}
|
||||
|
||||
this.setBounds( this.bbc.minX, this.bbc.minY, this.bbc.minZ, this.bbc.maxX, this.bbc.maxY, this.bbc.maxZ );
|
||||
|
||||
this.bbr.renderBlockBounds( rbw, this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ, this.ax, this.ay, this.az );
|
||||
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
rbw.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
rbw.faces = EnumSet.allOf( ForgeDirection.class );
|
||||
rbw.renderAllFaces = allFaces;
|
||||
rbw.calculations = false;
|
||||
rbw.useTextures = false;
|
||||
|
||||
return rbw.getLightingCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds( float minX, float minY, float minZ, float maxX, float maxY, float maxZ )
|
||||
{
|
||||
@@ -365,7 +279,7 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture( IIcon ico )
|
||||
public void setTexture( IAESprite ico )
|
||||
{
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
@@ -374,9 +288,9 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexture( IIcon down, IIcon up, IIcon north, IIcon south, IIcon west, IIcon east )
|
||||
public void setTexture( IAESprite down, IAESprite up, IAESprite north, IAESprite south, IAESprite west, IAESprite east )
|
||||
{
|
||||
IIcon[] list = new IIcon[6];
|
||||
IAESprite[] list = new IAESprite[6];
|
||||
|
||||
list[0] = down;
|
||||
list[1] = up;
|
||||
@@ -387,28 +301,28 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
for( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
baseBlock.getRendererInstance().setTemporaryRenderIcons( list[this.mapRotation( ForgeDirection.UP ).ordinal()], list[this.mapRotation( ForgeDirection.DOWN ).ordinal()], list[this.mapRotation( ForgeDirection.SOUTH ).ordinal()], list[this.mapRotation( ForgeDirection.NORTH ).ordinal()], list[this.mapRotation( ForgeDirection.EAST ).ordinal()], list[this.mapRotation( ForgeDirection.WEST ).ordinal()] );
|
||||
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()] );
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection mapRotation( ForgeDirection dir )
|
||||
public EnumFacing mapRotation( EnumFacing dir )
|
||||
{
|
||||
ForgeDirection forward = this.az;
|
||||
ForgeDirection up = this.ay;
|
||||
ForgeDirection west = ForgeDirection.UNKNOWN;
|
||||
EnumFacing forward = this.az;
|
||||
EnumFacing up = this.ay;
|
||||
EnumFacing west = null;
|
||||
|
||||
if( forward == null || up == null )
|
||||
{
|
||||
return dir;
|
||||
}
|
||||
|
||||
int west_x = forward.offsetY * up.offsetZ - forward.offsetZ * up.offsetY;
|
||||
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
|
||||
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
|
||||
int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
|
||||
for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing dx : EnumFacing.VALUES )
|
||||
{
|
||||
if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
|
||||
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
|
||||
{
|
||||
west = dx;
|
||||
}
|
||||
@@ -416,59 +330,59 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
if( dir == forward )
|
||||
{
|
||||
return ForgeDirection.SOUTH;
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
if( dir == forward.getOpposite() )
|
||||
{
|
||||
return ForgeDirection.NORTH;
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
if( dir == up )
|
||||
{
|
||||
return ForgeDirection.UP;
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
if( dir == up.getOpposite() )
|
||||
{
|
||||
return ForgeDirection.DOWN;
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
|
||||
if( dir == west )
|
||||
{
|
||||
return ForgeDirection.WEST;
|
||||
return EnumFacing.WEST;
|
||||
}
|
||||
if( dir == west.getOpposite() )
|
||||
{
|
||||
return ForgeDirection.EAST;
|
||||
return EnumFacing.EAST;
|
||||
}
|
||||
|
||||
return ForgeDirection.UNKNOWN;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBox( RenderBlocks renderer )
|
||||
public void renderInventoryBox( IRenderHelper 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( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), baseBlock, null, Tessellator.instance, this.color, renderer );
|
||||
this.bbr.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), baseBlock, null, this.color, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryFace( IIcon icon, ForgeDirection face, RenderBlocks renderer )
|
||||
public void renderInventoryFace( IAESprite icon, EnumFacing face, IRenderHelper 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( AEBaseBlock baseBlock : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderInvBlock( EnumSet.of( face ), baseBlock, null, Tessellator.instance, this.color, renderer );
|
||||
this.bbr.renderInvBlock( EnumSet.of( AEPartLocation.fromFacing( face ) ), baseBlock, null, this.color, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBlock( int x, int y, int z, RenderBlocks renderer )
|
||||
public void renderBlock( BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
@@ -480,21 +394,21 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
final AEBaseBlock block = (AEBaseBlock) multiPart;
|
||||
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
ForgeDirection forward = BusRenderHelper.INSTANCE.az;
|
||||
ForgeDirection up = BusRenderHelper.INSTANCE.ay;
|
||||
EnumFacing forward = BusRenderHelper.INSTANCE.az;
|
||||
EnumFacing up = BusRenderHelper.INSTANCE.ay;
|
||||
|
||||
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.UP, forward, up ) );
|
||||
renderer.uvRotateBottom = info.getTexture( AEPartLocation.DOWN ).setFlip( BaseBlockRender.getOrientation( EnumFacing.DOWN, forward, up ) );
|
||||
renderer.uvRotateTop = info.getTexture( AEPartLocation.UP ).setFlip( BaseBlockRender.getOrientation( EnumFacing.UP, forward, up ) );
|
||||
|
||||
renderer.uvRotateEast = info.getTexture( ForgeDirection.EAST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( ForgeDirection.WEST ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.WEST, forward, up ) );
|
||||
renderer.uvRotateEast = info.getTexture( AEPartLocation.EAST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.EAST, forward, up ) );
|
||||
renderer.uvRotateWest = info.getTexture( AEPartLocation.WEST ).setFlip( BaseBlockRender.getOrientation( EnumFacing.WEST, forward, up ) );
|
||||
|
||||
renderer.uvRotateNorth = info.getTexture( ForgeDirection.NORTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = info.getTexture( ForgeDirection.SOUTH ).setFlip( BaseBlockRender.getOrientation( ForgeDirection.SOUTH, forward, up ) );
|
||||
renderer.uvRotateNorth = info.getTexture( AEPartLocation.NORTH ).setFlip( BaseBlockRender.getOrientation( EnumFacing.NORTH, forward, up ) );
|
||||
renderer.uvRotateSouth = 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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,19 +423,19 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
throw new MissingDefinition( "Tried to access the multi part block without it being defined." );
|
||||
}
|
||||
|
||||
public void prepareBounds( RenderBlocks renderer )
|
||||
public void prepareBounds( IRenderHelper 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( EnumSet<ForgeDirection> faces )
|
||||
public void setFacesToRender( EnumSet<EnumFacing> faces )
|
||||
{
|
||||
BusRenderer.INSTANCE.renderer.renderFaces = faces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer )
|
||||
public void renderBlockCurrentBounds( BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
@@ -530,12 +444,12 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
|
||||
for( Block block : this.maybeBlock.asSet() )
|
||||
{
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer )
|
||||
public void renderFaceCutout( BlockPos pos, IAESprite ico, EnumFacing face, float edgeThickness, IRenderHelper renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
@@ -562,20 +476,18 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
case WEST:
|
||||
face = this.ax.getOpposite();
|
||||
break;
|
||||
case UNKNOWN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for( AEBaseBlock block : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderCutoutFace( block, ico, x, y, z, renderer, face, edgeThickness );
|
||||
this.bbr.renderCutoutFace( block, ico, pos, renderer, face, edgeThickness );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer )
|
||||
public void renderFace( BlockPos pos, IAESprite ico, EnumFacing face, IRenderHelper renderer )
|
||||
{
|
||||
if( !this.renderThis() )
|
||||
{
|
||||
@@ -603,32 +515,30 @@ public final class BusRenderHelper implements IPartRenderHelper
|
||||
case WEST:
|
||||
face = this.ax.getOpposite();
|
||||
break;
|
||||
case UNKNOWN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for( AEBaseBlock block : this.maybeBaseBlock.asSet() )
|
||||
{
|
||||
this.bbr.renderFace( x, y, z, block, ico, renderer, face );
|
||||
this.bbr.renderFace( pos, block, ico, renderer, face );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldX()
|
||||
public EnumFacing getWorldX()
|
||||
{
|
||||
return this.ax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldY()
|
||||
public EnumFacing getWorldY()
|
||||
{
|
||||
return this.ay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getWorldZ()
|
||||
public EnumFacing getWorldZ()
|
||||
{
|
||||
return this.az;
|
||||
}
|
||||
|
||||
@@ -22,21 +22,20 @@ package appeng.client.render;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.parts.IAlphaPassItem;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -50,7 +49,7 @@ public class BusRenderer implements IItemRenderer
|
||||
|
||||
public static final BusRenderer INSTANCE = new BusRenderer();
|
||||
private static final Map<Integer, IPart> RENDER_PART = new HashMap<Integer, IPart>();
|
||||
public final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
|
||||
public IRenderHelper renderer;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
@@ -113,24 +112,23 @@ public class BusRenderer implements IItemRenderer
|
||||
GL11.glScaled( 1.2, 1.2, 1. );
|
||||
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
|
||||
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.setColorOpaque_F( 1, 1, 1 );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
|
||||
BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 );
|
||||
BusRenderHelper.INSTANCE.setTexture( null );
|
||||
BusRenderHelper.INSTANCE.setInvColor( 0xffffff );
|
||||
this.renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0;
|
||||
this.renderer.useInventoryTint = false;
|
||||
this.renderer.overrideBlockTexture = null;
|
||||
|
||||
if( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
IFacadePart fp = fi.createPartFromItemStack( item, ForgeDirection.SOUTH );
|
||||
IFacadePart fp = fi.createPartFromItemStack( item, AEPartLocation.SOUTH );
|
||||
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
{
|
||||
|
||||
@@ -20,17 +20,19 @@ package appeng.client.render;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
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.parts.BusCollisionHelper;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
@@ -48,19 +50,23 @@ public class CableRenderHelper
|
||||
public void renderStatic( CableBusContainer cableBusContainer, IFacadeContainer iFacadeContainer )
|
||||
{
|
||||
TileEntity te = cableBusContainer.getTile();
|
||||
RenderBlocksWorkaround renderer = BusRenderer.INSTANCE.renderer;
|
||||
IRenderHelper renderer = BusRenderer.INSTANCE.renderer;
|
||||
|
||||
if( renderer.overrideBlockTexture != null )
|
||||
{
|
||||
BusRenderHelper.INSTANCE.setPass( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BusRenderHelper.INSTANCE.setPass( MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT ? 1 : 0 );
|
||||
}
|
||||
|
||||
if( renderer.blockAccess == null )
|
||||
{
|
||||
renderer.blockAccess = Minecraft.getMinecraft().theWorld;
|
||||
}
|
||||
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
for( AEPartLocation s : AEPartLocation.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
@@ -68,14 +74,14 @@ public class CableRenderHelper
|
||||
this.setSide( s );
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
renderer.flipTexture = false;
|
||||
//renderer.flipTexture = false;
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
part.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer );
|
||||
part.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer );
|
||||
|
||||
renderer.faces = EnumSet.allOf( ForgeDirection.class );
|
||||
renderer.calculations = true;
|
||||
renderer.useTextures = true;
|
||||
//renderer.faces = EnumSet.allOf( EnumFacing.class );
|
||||
//renderer.useTextures = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +91,7 @@ public class CableRenderHelper
|
||||
* snag list of boxes...
|
||||
*/
|
||||
List<AxisAlignedBB> boxes = new ArrayList<AxisAlignedBB>();
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
for( AEPartLocation s : AEPartLocation.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
@@ -117,12 +123,12 @@ public class CableRenderHelper
|
||||
}
|
||||
}
|
||||
|
||||
for( ForgeDirection s : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( AEPartLocation s : AEPartLocation.SIDE_LOCATIONS )
|
||||
{
|
||||
IFacadePart fPart = iFacadeContainer.getFacade( s );
|
||||
if( fPart != null )
|
||||
{
|
||||
AxisAlignedBB b = null;
|
||||
AEAxisAlignedBB b = null;
|
||||
fPart.setThinFacades( useThinFacades );
|
||||
AxisAlignedBB pb = fPart.getPrimaryBox();
|
||||
for( AxisAlignedBB bb : boxes )
|
||||
@@ -131,7 +137,7 @@ public class CableRenderHelper
|
||||
{
|
||||
if( b == null )
|
||||
{
|
||||
b = bb;
|
||||
b = AEAxisAlignedBB.fromBounds( bb );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -147,62 +153,62 @@ public class CableRenderHelper
|
||||
|
||||
renderer.flipTexture = false;
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
|
||||
this.setSide( s );
|
||||
fPart.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b, cableBusContainer.getPart( s ) == null );
|
||||
|
||||
fPart.renderStatic( te.getPos(), BusRenderHelper.INSTANCE, renderer, iFacadeContainer, b == null ? null : b.getBoundingBox(), cableBusContainer.getPart( s ) == null );
|
||||
}
|
||||
}
|
||||
|
||||
renderer.isFacade = false;
|
||||
renderer.enableAO = false;
|
||||
renderer.setTexture( null );
|
||||
renderer.calculations = true;
|
||||
//renderer.isFacade = false;
|
||||
//renderer.enableAO = false;
|
||||
// renderer.sett
|
||||
}
|
||||
}
|
||||
|
||||
private void setSide( ForgeDirection s )
|
||||
private void setSide( AEPartLocation s )
|
||||
{
|
||||
ForgeDirection ax;
|
||||
ForgeDirection ay;
|
||||
ForgeDirection az;
|
||||
EnumFacing ax;
|
||||
EnumFacing ay;
|
||||
EnumFacing az;
|
||||
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.NORTH;
|
||||
az = EnumFacing.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.SOUTH;
|
||||
az = EnumFacing.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
ax = EnumFacing.SOUTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
ax = EnumFacing.NORTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
ax = EnumFacing.WEST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -211,52 +217,51 @@ public class CableRenderHelper
|
||||
|
||||
public void renderDynamic( CableBusContainer cableBusContainer, double x, double y, double z )
|
||||
{
|
||||
for( ForgeDirection s : ForgeDirection.values() )
|
||||
for( EnumFacing s : EnumFacing.values() )
|
||||
{
|
||||
IPart part = cableBusContainer.getPart( s );
|
||||
if( part != null )
|
||||
{
|
||||
ForgeDirection ax;
|
||||
ForgeDirection ay;
|
||||
ForgeDirection az;
|
||||
EnumFacing ax;
|
||||
EnumFacing ay;
|
||||
EnumFacing az;
|
||||
|
||||
switch( s )
|
||||
{
|
||||
case DOWN:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.NORTH;
|
||||
az = ForgeDirection.DOWN;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.NORTH;
|
||||
az = EnumFacing.DOWN;
|
||||
break;
|
||||
case UP:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.SOUTH;
|
||||
az = ForgeDirection.UP;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.SOUTH;
|
||||
az = EnumFacing.UP;
|
||||
break;
|
||||
case EAST:
|
||||
ax = ForgeDirection.SOUTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.EAST;
|
||||
ax = EnumFacing.SOUTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.EAST;
|
||||
break;
|
||||
case WEST:
|
||||
ax = ForgeDirection.NORTH;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.WEST;
|
||||
ax = EnumFacing.NORTH;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.WEST;
|
||||
break;
|
||||
case NORTH:
|
||||
ax = ForgeDirection.WEST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.NORTH;
|
||||
ax = EnumFacing.WEST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.NORTH;
|
||||
break;
|
||||
case SOUTH:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
ax = ForgeDirection.EAST;
|
||||
ay = ForgeDirection.UP;
|
||||
az = ForgeDirection.SOUTH;
|
||||
ax = EnumFacing.EAST;
|
||||
ay = EnumFacing.UP;
|
||||
az = EnumFacing.SOUTH;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,613 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.vecmath.Tuple3f;
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.BlockPartRotation;
|
||||
import net.minecraft.client.renderer.block.model.FaceBakery;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelRotation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumFacing.Axis;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.IColoredBakedQuad;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.BaseIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.parts.ItemMultiPart;
|
||||
|
||||
public class IRenderHelper
|
||||
{
|
||||
|
||||
private static final class CachedModel implements IBakedModel
|
||||
{
|
||||
List<BakedQuad>[] faces = new List[6];
|
||||
List<BakedQuad> general;
|
||||
|
||||
public CachedModel()
|
||||
{
|
||||
general = new ArrayList<BakedQuad>();
|
||||
for ( EnumFacing f : EnumFacing.VALUES )
|
||||
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 getTexture()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms()
|
||||
{
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getGeneralQuads()
|
||||
{
|
||||
return general;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getFaceQuads(
|
||||
EnumFacing p_177551_1_ )
|
||||
{
|
||||
return faces[p_177551_1_.ordinal()];
|
||||
}
|
||||
}
|
||||
|
||||
public int uvRotateBottom;
|
||||
public int uvRotateEast;
|
||||
public int uvRotateNorth;
|
||||
public int uvRotateSouth;
|
||||
public int uvRotateTop;
|
||||
public int uvRotateWest;
|
||||
public IAESprite overrideBlockTexture;
|
||||
public boolean renderAllFaces;
|
||||
|
||||
public double renderMinX;
|
||||
public double renderMaxX;
|
||||
|
||||
public double renderMinY;
|
||||
public double renderMaxY;
|
||||
|
||||
public double renderMinZ;
|
||||
public double renderMaxZ;
|
||||
|
||||
public IBlockAccess blockAccess;
|
||||
|
||||
CachedModel generatedModel = new CachedModel();
|
||||
|
||||
// used to create faces...
|
||||
final FaceBakery faceBakery = new FaceBakery();
|
||||
|
||||
float tx=0,ty=0,tz=0;
|
||||
final float[] defUVs = new float[] { 0, 0, 1, 1 };
|
||||
|
||||
public void setRenderBoundsFromBlock(
|
||||
Block block )
|
||||
{
|
||||
if ( block == null ) return;
|
||||
|
||||
renderMinX = block.getBlockBoundsMinX();
|
||||
renderMinY = block.getBlockBoundsMinY();
|
||||
renderMinZ = block.getBlockBoundsMinZ();
|
||||
renderMaxX = block.getBlockBoundsMaxX();
|
||||
renderMaxY = block.getBlockBoundsMaxY();
|
||||
renderMaxZ = block.getBlockBoundsMaxZ();
|
||||
}
|
||||
|
||||
public void setRenderBounds(
|
||||
double d,
|
||||
double e,
|
||||
double f,
|
||||
double g,
|
||||
double h,
|
||||
double i )
|
||||
{
|
||||
renderMinX = d;
|
||||
renderMinY = e;
|
||||
renderMinZ = f;
|
||||
renderMaxX = g;
|
||||
renderMaxY = h;
|
||||
renderMaxZ = i;
|
||||
}
|
||||
|
||||
int color = -1;
|
||||
|
||||
public void setBrightness(
|
||||
int i )
|
||||
{
|
||||
brightness=i;
|
||||
}
|
||||
|
||||
public void setColorRGBA_F(
|
||||
int r,
|
||||
int g,
|
||||
int b,
|
||||
float a )
|
||||
{
|
||||
int alpha = ( int ) ( a * 0xff );
|
||||
color = alpha << 24 |
|
||||
r << 16 |
|
||||
b << 8 |
|
||||
b;
|
||||
}
|
||||
|
||||
public void setColorOpaque_I(
|
||||
int whiteVariant )
|
||||
{
|
||||
int alpha = 0xff;
|
||||
color = //alpha << 24 |
|
||||
whiteVariant;
|
||||
}
|
||||
public void setColorOpaque(
|
||||
int r,
|
||||
int g,
|
||||
int b )
|
||||
{
|
||||
int alpha = 0xff;
|
||||
color =// alpha << 24 |
|
||||
r << 16 |
|
||||
g << 8 |
|
||||
b;
|
||||
}
|
||||
|
||||
public void setColorOpaque_F(
|
||||
int r,
|
||||
int g,
|
||||
int b )
|
||||
{
|
||||
int alpha = 0xff;
|
||||
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(
|
||||
float rf,
|
||||
float bf,
|
||||
float gf )
|
||||
{
|
||||
int r = (int)( rf * 0xff );
|
||||
int g = (int)( gf * 0xff );
|
||||
int b = (int)( bf * 0xff );
|
||||
int alpha = 0xff;
|
||||
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(
|
||||
ItemStack is )
|
||||
{
|
||||
Item it = is.getItem();
|
||||
|
||||
if ( it instanceof ItemMultiPart )
|
||||
return ( (ItemMultiPart) it).getIcon( is);
|
||||
|
||||
Block blk = Block.getBlockFromItem( it );
|
||||
|
||||
if ( blk != null )
|
||||
return getIcon(blk.getStateFromMeta( is.getMetadata() ))[0];
|
||||
|
||||
if ( it instanceof AEBaseItem )
|
||||
{
|
||||
IAESprite ico = ( (AEBaseItem)it ).getIcon(is);
|
||||
if ( ico != null ) return ico;
|
||||
}
|
||||
|
||||
return new MissingIcon( is );
|
||||
}
|
||||
|
||||
|
||||
public IAESprite[] getIcon(
|
||||
IBlockState state )
|
||||
{
|
||||
IAESprite[] out = new IAESprite[6];
|
||||
|
||||
Block blk = state.getBlock();
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
{
|
||||
AEBaseBlock base = (AEBaseBlock)blk;
|
||||
for ( EnumFacing face : EnumFacing.VALUES )
|
||||
out[face.ordinal()] = base.getIcon( face, state );
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
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( IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
IBlockState state = world.getBlockState( pos );
|
||||
Block blk = state.getBlock();
|
||||
|
||||
if ( blk instanceof AEBaseBlock )
|
||||
{
|
||||
IAESprite[] out = new IAESprite[6];
|
||||
|
||||
AEBaseBlock base = (AEBaseBlock)blk;
|
||||
for ( EnumFacing face : EnumFacing.VALUES )
|
||||
out[face.ordinal()] = base.getIcon( world, pos, face );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
return getIcon( state );
|
||||
}
|
||||
|
||||
int point =0;
|
||||
int brightness = -1;
|
||||
float[][] points = new float[4][];
|
||||
|
||||
public void addVertexWithUV(
|
||||
EnumFacing face,
|
||||
double x,
|
||||
double y,
|
||||
double z,
|
||||
double u,
|
||||
double v )
|
||||
{
|
||||
points[point++] = new float[]{ (float)x+tx, (float)y+ty, (float)z+tz, (float)u, (float)v };
|
||||
|
||||
if ( point == 4 )
|
||||
{
|
||||
brightness = -1;
|
||||
int[] vertData = new int[]{
|
||||
Float.floatToRawIntBits( points[0][0] ),
|
||||
Float.floatToRawIntBits( points[0][1] ),
|
||||
Float.floatToRawIntBits( points[0][2] ),
|
||||
brightness,
|
||||
Float.floatToRawIntBits( points[0][3] ),
|
||||
Float.floatToRawIntBits( points[0][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( points[1][0] ),
|
||||
Float.floatToRawIntBits( points[1][1] ),
|
||||
Float.floatToRawIntBits( points[1][2] ),
|
||||
brightness,
|
||||
Float.floatToRawIntBits( points[1][3] ),
|
||||
Float.floatToRawIntBits( points[1][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( points[2][0] ),
|
||||
Float.floatToRawIntBits( points[2][1] ),
|
||||
Float.floatToRawIntBits( points[2][2] ),
|
||||
brightness,
|
||||
Float.floatToRawIntBits( points[2][3] ),
|
||||
Float.floatToRawIntBits( points[2][4] ),
|
||||
0,
|
||||
|
||||
Float.floatToRawIntBits( points[3][0] ),
|
||||
Float.floatToRawIntBits( points[3][1] ),
|
||||
Float.floatToRawIntBits( points[3][2] ),
|
||||
brightness,
|
||||
Float.floatToRawIntBits( points[3][3] ),
|
||||
Float.floatToRawIntBits( points[3][4] ),
|
||||
0,
|
||||
};
|
||||
|
||||
generatedModel.general.add( new IColoredBakedQuad.ColoredBakedQuad( vertData, color, face ));
|
||||
|
||||
point=0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean renderStandardBlock(
|
||||
Block block,
|
||||
BlockPos pos )
|
||||
{
|
||||
//setRenderBoundsFromBlock( block );
|
||||
|
||||
IAESprite[] textures = getIcon( blockAccess,pos );
|
||||
setColorOpaque_I( 0xffffff );
|
||||
|
||||
renderFaceXNeg( block, pos, textures[EnumFacing.WEST.ordinal()] );
|
||||
renderFaceXPos( block, pos, textures[EnumFacing.EAST.ordinal()] );
|
||||
renderFaceYNeg( block, pos, textures[EnumFacing.DOWN.ordinal()] );
|
||||
renderFaceYPos( block, pos, textures[EnumFacing.UP.ordinal()] );
|
||||
renderFaceZNeg( block, pos, textures[EnumFacing.NORTH.ordinal()] );
|
||||
renderFaceZPos( block, pos, textures[EnumFacing.SOUTH.ordinal()] );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTranslation(
|
||||
int x,
|
||||
int y,
|
||||
int z )
|
||||
{
|
||||
tx=x;
|
||||
ty=y;
|
||||
tz=z;
|
||||
}
|
||||
|
||||
public boolean isAlphaPass()
|
||||
{
|
||||
return MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
final float quadsUV[] = new float[] { 0,0,1,1,0,0,1,1};
|
||||
public EnumSet<EnumFacing> renderFaces = EnumSet.allOf(EnumFacing.class);
|
||||
public boolean flipTexture=false;
|
||||
private List<SMFace> faces = new ArrayList();
|
||||
|
||||
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 = new float[] {// :P
|
||||
16.0f * ( quadsUV[0] + quadsUV[2] * from_a + quadsUV[4] * from_b ), // 0
|
||||
16.0f * ( quadsUV[1] + quadsUV[3] * from_a + quadsUV[5] * from_b ), // 1
|
||||
|
||||
16.0f * ( quadsUV[0] + quadsUV[2] * to_a + quadsUV[4] * from_b ), // 2
|
||||
16.0f * ( quadsUV[1] + quadsUV[3] * to_a + quadsUV[5] * from_b ), // 3
|
||||
|
||||
16.0f * ( quadsUV[0] + quadsUV[2] * to_a + quadsUV[4] * to_b ), // 2
|
||||
16.0f * ( quadsUV[1] + quadsUV[3] * to_a + quadsUV[5] * to_b ), // 3
|
||||
|
||||
16.0f * ( quadsUV[0] + quadsUV[2] * from_a + quadsUV[4] * to_b ), // 0
|
||||
16.0f * ( quadsUV[1] + quadsUV[3] * from_a + quadsUV[5] * to_b ), // 1
|
||||
};
|
||||
|
||||
return afloat;
|
||||
}
|
||||
|
||||
public void renderFaceXNeg(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMinX < 0.0001;
|
||||
Vector3f to = new Vector3f( (float)renderMinX* 16.0f, (float)renderMinY* 16.0f, (float)renderMinZ * 16.0f);
|
||||
Vector3f from = new Vector3f( (float)renderMinX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMaxZ * 16.0f);
|
||||
|
||||
final EnumFacing myFace = EnumFacing.WEST;
|
||||
addFace(myFace, isEdge,to,from,defUVs,lights );
|
||||
}
|
||||
|
||||
public void renderFaceYNeg(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMinY < 0.0001;
|
||||
Vector3f to = new Vector3f( (float)renderMinX* 16.0f, (float)renderMinY* 16.0f, (float)renderMinZ* 16.0f );
|
||||
Vector3f from = new Vector3f( (float)renderMaxX* 16.0f, (float)renderMinY* 16.0f, (float)renderMaxZ* 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.DOWN;
|
||||
addFace(myFace, isEdge,to,from,defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceZNeg(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMinZ < 0.0001;
|
||||
Vector3f to = new Vector3f( (float)renderMinX* 16.0f, (float)renderMinY* 16.0f, (float)renderMinZ* 16.0f );
|
||||
Vector3f from = new Vector3f( (float)renderMaxX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMinZ* 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.NORTH;
|
||||
addFace(myFace, isEdge,to,from,defUVs, lights );
|
||||
}
|
||||
|
||||
public void renderFaceYPos(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMaxY > 0.9999;
|
||||
Vector3f to = new Vector3f( (float)renderMinX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMinZ* 16.0f );
|
||||
Vector3f from = new Vector3f( (float)renderMaxX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMaxZ * 16.0f);
|
||||
|
||||
final EnumFacing myFace = EnumFacing.UP;
|
||||
addFace(myFace, isEdge,to,from,defUVs,lights );
|
||||
}
|
||||
|
||||
public void renderFaceZPos(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMaxZ > 0.9999;
|
||||
Vector3f to = new Vector3f( (float)renderMinX* 16.0f, (float)renderMinY* 16.0f, (float)renderMaxZ* 16.0f );
|
||||
Vector3f from = new Vector3f( (float)renderMaxX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMaxZ* 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.SOUTH;
|
||||
addFace(myFace, isEdge,to,from,defUVs,lights );
|
||||
}
|
||||
|
||||
public void renderFaceXPos(
|
||||
Block blk,
|
||||
BlockPos pos,
|
||||
IAESprite lights )
|
||||
{
|
||||
boolean isEdge = renderMaxX > 0.9999;
|
||||
Vector3f to = new Vector3f( (float)renderMaxX * 16.0f, (float)renderMinY* 16.0f, (float)renderMinZ* 16.0f );
|
||||
Vector3f from = new Vector3f( (float)renderMaxX* 16.0f, (float)renderMaxY* 16.0f, (float)renderMaxZ* 16.0f );
|
||||
|
||||
final EnumFacing myFace = EnumFacing.EAST;
|
||||
addFace(myFace, isEdge,to,from,defUVs, lights );
|
||||
}
|
||||
|
||||
private void addFace(
|
||||
EnumFacing face , boolean isEdge,
|
||||
Vector3f to,
|
||||
Vector3f from,
|
||||
float[] defUVs2,
|
||||
IAESprite texture )
|
||||
{
|
||||
if ( overrideBlockTexture != null )
|
||||
texture = overrideBlockTexture;
|
||||
|
||||
faces.add( new SMFace(face,isEdge,color,to,from,defUVs2,new IconUnwrapper(texture)));
|
||||
}
|
||||
|
||||
EnumFacing currentFace = EnumFacing.UP;
|
||||
|
||||
public void setNormal(
|
||||
float x,
|
||||
float y,
|
||||
float z )
|
||||
{
|
||||
if ( x > 0.5 ) currentFace = EnumFacing.EAST;
|
||||
if ( x < -0.5 ) currentFace = EnumFacing.WEST;
|
||||
if ( y > 0.5 ) currentFace = EnumFacing.UP;
|
||||
if ( y < -0.5 ) currentFace = EnumFacing.DOWN;
|
||||
if ( z > 0.5 ) currentFace = EnumFacing.SOUTH;
|
||||
if ( z < -0.5 ) currentFace = EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
public void setOverrideBlockTexture(
|
||||
IAESprite object )
|
||||
{
|
||||
overrideBlockTexture = object;
|
||||
}
|
||||
|
||||
public void finalizeModel( boolean Flip )
|
||||
{
|
||||
ModelRotation mr = ModelRotation.X0_Y0;
|
||||
|
||||
if ( Flip )
|
||||
mr = ModelRotation.X0_Y180;
|
||||
|
||||
for ( SMFace face : faces )
|
||||
{
|
||||
final EnumFacing myFace = face.face;
|
||||
final float[] uvs = getFaceUvs( myFace, face.from, face.to );
|
||||
|
||||
final BlockFaceUV uv = new BlockFaceUV( uvs, 0 );
|
||||
final BlockPartFace bpf = new BlockPartFace( myFace, face.color, "", uv );
|
||||
|
||||
BakedQuad bf = faceBakery.makeBakedQuad( face.to, face.from, bpf, face.spite, myFace, mr, null, true, true );
|
||||
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.color, bf.getFace() );
|
||||
|
||||
if ( face.isEdge )
|
||||
this.generatedModel.getFaceQuads( myFace ).add( bf );
|
||||
else
|
||||
this.generatedModel.getGeneralQuads().add( bf );
|
||||
}
|
||||
}
|
||||
|
||||
public IBakedModel getOutput()
|
||||
{
|
||||
return generatedModel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public interface ISimpleBlockRenderingHandler
|
||||
{
|
||||
|
||||
void renderInventoryBlock(
|
||||
Block block,
|
||||
int metadata,
|
||||
int modelID,
|
||||
IRenderHelper renderer );
|
||||
|
||||
boolean renderWorldBlock(
|
||||
IBlockAccess world,
|
||||
BlockPos pos,
|
||||
Block block,
|
||||
int modelId,
|
||||
IRenderHelper renderer );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import appeng.client.texture.IAESprite;
|
||||
|
||||
|
||||
public class IconUnwrapper extends TextureAtlasSprite
|
||||
{
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
float max_u;
|
||||
float min_u;
|
||||
float min_v;
|
||||
float max_v;
|
||||
|
||||
protected IconUnwrapper(
|
||||
IAESprite src )
|
||||
{
|
||||
super( src.getIconName() );
|
||||
width = src.getIconWidth();
|
||||
height = src.getIconHeight();
|
||||
min_u = src.getMinU();
|
||||
max_u = src.getMaxU();
|
||||
min_v = src.getMinV();
|
||||
max_v = src.getMaxV();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxU()
|
||||
{
|
||||
return max_u;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinV()
|
||||
{
|
||||
return min_v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxV()
|
||||
{
|
||||
return max_v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconName()
|
||||
{
|
||||
return super.getIconName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinU()
|
||||
{
|
||||
return min_u;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedU(double d)
|
||||
{
|
||||
float f = this.max_u - this.min_u;
|
||||
return this.min_u + f * (float)d / 16.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedV(double d)
|
||||
{
|
||||
float f = this.max_v - this.min_v;
|
||||
return this.min_v + f * ((float)d / 16.0F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,11 +19,11 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class ItemRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
@@ -19,711 +19,28 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.parts.ISimplifiedBundle;
|
||||
import appeng.core.AELog;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class RenderBlocksWorkaround extends RenderBlocks
|
||||
public class RenderBlocksWorkaround extends IRenderHelper
|
||||
{
|
||||
|
||||
final int[] lightHashTmp = new int[27];
|
||||
public boolean calculations = true;
|
||||
public EnumSet<ForgeDirection> renderFaces = EnumSet.allOf( ForgeDirection.class );
|
||||
public EnumSet<ForgeDirection> faces = EnumSet.allOf( ForgeDirection.class );
|
||||
public boolean isFacade = false;
|
||||
public boolean useTextures = true;
|
||||
public float opacity = 1.0f;
|
||||
Field fBrightness;
|
||||
Field fColor;
|
||||
private LightingCache lightState = new LightingCache();
|
||||
|
||||
public int getCurrentColor()
|
||||
public boolean flipTexture;
|
||||
public EnumSet<EnumFacing> faces;
|
||||
public boolean useTextures;
|
||||
public EnumSet<EnumFacing> renderFaces;
|
||||
public float opacity;
|
||||
|
||||
public void setTexture(
|
||||
Object object )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.fColor == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.fColor = Tessellator.class.getDeclaredField( "color" );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
this.fColor = Tessellator.class.getDeclaredField( "field_78402_m" );
|
||||
}
|
||||
this.fColor.setAccessible( true );
|
||||
}
|
||||
return (Integer) this.fColor.get( Tessellator.instance );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCurrentBrightness()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.fBrightness == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.fBrightness = Tessellator.class.getDeclaredField( "brightness" );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
this.fBrightness = Tessellator.class.getDeclaredField( "field_78401_l" );
|
||||
}
|
||||
this.fBrightness.setAccessible( true );
|
||||
}
|
||||
return (Integer) this.fBrightness.get( Tessellator.instance );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTexture( IIcon ico )
|
||||
{
|
||||
this.lightState.rXPos = this.lightState.rXNeg = this.lightState.rYPos = this.lightState.rYNeg = this.lightState.rZPos = this.lightState.rZNeg = ico;
|
||||
}
|
||||
|
||||
public void setTexture( IIcon rYNeg, IIcon rYPos, IIcon rZNeg, IIcon rZPos, IIcon rXNeg, IIcon rXPos )
|
||||
{
|
||||
this.lightState.rXPos = rXPos;
|
||||
this.lightState.rXNeg = rXNeg;
|
||||
this.lightState.rYPos = rYPos;
|
||||
this.lightState.rYNeg = rYNeg;
|
||||
this.lightState.rZPos = rZPos;
|
||||
this.lightState.rZNeg = rZNeg;
|
||||
}
|
||||
|
||||
public boolean renderStandardBlockNoCalculations( Block b, int x, int y, int z )
|
||||
{
|
||||
Tessellator.instance.setBrightness( this.lightState.bXPos );
|
||||
this.restoreAO( this.lightState.aoXPos, this.lightState.foXPos );
|
||||
this.renderFaceXPos( b, x, y, z, this.useTextures ? this.lightState.rXPos : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.EAST.ordinal() ) );
|
||||
|
||||
Tessellator.instance.setBrightness( this.lightState.bXNeg );
|
||||
this.restoreAO( this.lightState.aoXNeg, this.lightState.foXNeg );
|
||||
this.renderFaceXNeg( b, x, y, z, this.useTextures ? this.lightState.rXNeg : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.WEST.ordinal() ) );
|
||||
|
||||
Tessellator.instance.setBrightness( this.lightState.bYPos );
|
||||
this.restoreAO( this.lightState.aoYPos, this.lightState.foYPos );
|
||||
this.renderFaceYPos( b, x, y, z, this.useTextures ? this.lightState.rYPos : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.UP.ordinal() ) );
|
||||
|
||||
Tessellator.instance.setBrightness( this.lightState.bYNeg );
|
||||
this.restoreAO( this.lightState.aoYNeg, this.lightState.foYNeg );
|
||||
this.renderFaceYNeg( b, x, y, z, this.useTextures ? this.lightState.rYNeg : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.DOWN.ordinal() ) );
|
||||
|
||||
Tessellator.instance.setBrightness( this.lightState.bZPos );
|
||||
this.restoreAO( this.lightState.aoZPos, this.lightState.foZPos );
|
||||
this.renderFaceZPos( b, x, y, z, this.useTextures ? this.lightState.rZPos : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.SOUTH.ordinal() ) );
|
||||
|
||||
Tessellator.instance.setBrightness( this.lightState.bZNeg );
|
||||
this.restoreAO( this.lightState.aoZNeg, this.lightState.foZNeg );
|
||||
this.renderFaceZNeg( b, x, y, z, this.useTextures ? this.lightState.rZNeg : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.NORTH.ordinal() ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void restoreAO( int[] z, float[] c )
|
||||
{
|
||||
this.brightnessBottomLeft = z[0];
|
||||
this.brightnessBottomRight = z[1];
|
||||
this.brightnessTopLeft = z[2];
|
||||
this.brightnessTopRight = z[3];
|
||||
Tessellator.instance.setColorRGBA_I( z[4], (int) ( this.opacity * 255 ) );
|
||||
|
||||
this.colorRedTopLeft = c[0];
|
||||
this.colorGreenTopLeft = c[1];
|
||||
this.colorBlueTopLeft = c[2];
|
||||
this.colorRedBottomLeft = c[3];
|
||||
this.colorGreenBottomLeft = c[4];
|
||||
this.colorBlueBottomLeft = c[5];
|
||||
this.colorRedBottomRight = c[6];
|
||||
this.colorGreenBottomRight = c[7];
|
||||
this.colorBlueBottomRight = c[8];
|
||||
this.colorRedTopRight = c[9];
|
||||
this.colorGreenTopRight = c[10];
|
||||
this.colorBlueTopRight = c[11];
|
||||
}
|
||||
|
||||
private void saveAO( int[] z, float[] c )
|
||||
{
|
||||
z[0] = this.brightnessBottomLeft;
|
||||
z[1] = this.brightnessBottomRight;
|
||||
z[2] = this.brightnessTopLeft;
|
||||
z[3] = this.brightnessTopRight;
|
||||
z[4] = this.getCurrentColor();
|
||||
|
||||
c[0] = this.colorRedTopLeft;
|
||||
c[1] = this.colorGreenTopLeft;
|
||||
c[2] = this.colorBlueTopLeft;
|
||||
c[3] = this.colorRedBottomLeft;
|
||||
c[4] = this.colorGreenBottomLeft;
|
||||
c[5] = this.colorBlueBottomLeft;
|
||||
c[6] = this.colorRedBottomRight;
|
||||
c[7] = this.colorGreenBottomRight;
|
||||
c[8] = this.colorBlueBottomRight;
|
||||
c[9] = this.colorRedTopRight;
|
||||
c[10] = this.colorGreenTopRight;
|
||||
c[11] = this.colorBlueTopRight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderStandardBlock( Block blk, int x, int y, int z )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.calculations )
|
||||
{
|
||||
this.lightState.lightHash = this.getLightingHash( blk, this.blockAccess, x, y, z );
|
||||
return super.renderStandardBlock( blk, x, y, z );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.enableAO = this.lightState.isAO;
|
||||
boolean out = this.renderStandardBlockNoCalculations( blk, x, y, z );
|
||||
this.enableAO = false;
|
||||
return out;
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
AELog.error( t );
|
||||
// meh
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYNeg( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.DOWN ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( this.renderMinZ * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( this.renderMaxZ * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( 1.0 - this.renderMinX, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMinX, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxX, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxX, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceYNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rYNeg = par8Icon;
|
||||
this.saveAO( this.lightState.aoYNeg, this.lightState.foYNeg );
|
||||
this.lightState.bYNeg = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceYPos( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.UP ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( this.renderMinZ * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( this.renderMaxZ * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( this.renderMaxX, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
this.partialLightingColoring( this.renderMaxX, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
this.partialLightingColoring( this.renderMinX, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
this.partialLightingColoring( this.renderMinX, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d14, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceYPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rYPos = par8Icon;
|
||||
this.saveAO( this.lightState.aoYPos, this.lightState.foYPos );
|
||||
this.lightState.bYPos = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZNeg( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.NORTH ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( 16.0D - this.renderMinX * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( 16.0D - this.renderMaxX * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par4 + this.renderMaxY;
|
||||
double d15 = par6 + this.renderMinZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( this.renderMaxY, 1.0 - this.renderMinX );
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
this.partialLightingColoring( this.renderMaxY, 1.0 - this.renderMaxX );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
this.partialLightingColoring( this.renderMinY, 1.0 - this.renderMaxX );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
this.partialLightingColoring( this.renderMinY, 1.0 - this.renderMinX );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceZNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rZNeg = par8Icon;
|
||||
this.saveAO( this.lightState.aoZNeg, this.lightState.foZNeg );
|
||||
this.lightState.bZNeg = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceZPos( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.SOUTH ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( this.renderMinX * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( this.renderMaxX * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par2 + this.renderMaxX;
|
||||
double d13 = par4 + this.renderMinY;
|
||||
double d14 = par4 + this.renderMaxY;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( 1.0 - this.renderMinX, this.renderMaxY );
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMinX, this.renderMinY );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxX, this.renderMinY );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxX, this.renderMaxY );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d14, d15, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d3, d6 );
|
||||
tessellator.addVertexWithUV( d12, d13, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d12, d14, d15, d4, d5 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceZPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rZPos = par8Icon;
|
||||
this.saveAO( this.lightState.aoZPos, this.lightState.foZPos );
|
||||
this.lightState.bZPos = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXNeg( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.WEST ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( this.renderMinZ * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( this.renderMaxZ * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMinX;
|
||||
double d12 = par4 + this.renderMinY;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( this.renderMaxY, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
this.partialLightingColoring( this.renderMaxY, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
this.partialLightingColoring( this.renderMinY, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
this.partialLightingColoring( this.renderMinY, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceXNeg( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rXNeg = par8Icon;
|
||||
this.saveAO( this.lightState.aoXNeg, this.lightState.foXNeg );
|
||||
this.lightState.bXNeg = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderFaceXPos( Block par1Block, double par2, double par4, double par6, IIcon par8Icon )
|
||||
{
|
||||
if( this.faces.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
if( !this.renderFaces.contains( ForgeDirection.EAST ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.isFacade )
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
double d3 = par8Icon.getInterpolatedU( 16.0D - this.renderMinZ * 16.0D );
|
||||
double d4 = par8Icon.getInterpolatedU( 16.0D - this.renderMaxZ * 16.0D );
|
||||
double d5 = par8Icon.getInterpolatedV( 16.0D - this.renderMaxY * 16.0D );
|
||||
double d6 = par8Icon.getInterpolatedV( 16.0D - this.renderMinY * 16.0D );
|
||||
|
||||
double d11 = par2 + this.renderMaxX;
|
||||
double d12 = par4 + this.renderMinY;
|
||||
double d13 = par4 + this.renderMaxY;
|
||||
double d14 = par6 + this.renderMinZ;
|
||||
double d15 = par6 + this.renderMaxZ;
|
||||
|
||||
if( this.enableAO )
|
||||
{
|
||||
this.partialLightingColoring( 1.0 - this.renderMinY, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMinY, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxY, this.renderMinZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
this.partialLightingColoring( 1.0 - this.renderMaxY, this.renderMaxZ );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertexWithUV( d11, d12, d15, d4, d6 );
|
||||
tessellator.addVertexWithUV( d11, d12, d14, d3, d6 );
|
||||
tessellator.addVertexWithUV( d11, d13, d14, d3, d5 );
|
||||
tessellator.addVertexWithUV( d11, d13, d15, d4, d5 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.renderFaceXPos( par1Block, par2, par4, par6, par8Icon );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lightState.isAO = this.enableAO;
|
||||
this.lightState.rXPos = par8Icon;
|
||||
this.saveAO( this.lightState.aoXPos, this.lightState.foXPos );
|
||||
this.lightState.bXPos = this.getCurrentBrightness();
|
||||
}
|
||||
}
|
||||
|
||||
private void partialLightingColoring( double u, double v )
|
||||
{
|
||||
double rA = this.colorRedTopLeft * u + ( 1.0 - u ) * this.colorRedTopRight;
|
||||
double rB = this.colorRedBottomLeft * u + ( 1.0 - u ) * this.colorRedBottomRight;
|
||||
float r = (float) ( rA * v + rB * ( 1.0 - v ) );
|
||||
|
||||
double gA = this.colorGreenTopLeft * u + ( 1.0 - u ) * this.colorGreenTopRight;
|
||||
double gB = this.colorGreenBottomLeft * u + ( 1.0 - u ) * this.colorGreenBottomRight;
|
||||
float g = (float) ( gA * v + gB * ( 1.0 - v ) );
|
||||
|
||||
double bA = this.colorBlueTopLeft * u + ( 1.0 - u ) * this.colorBlueTopRight;
|
||||
double bB = this.colorBlueBottomLeft * u + ( 1.0 - u ) * this.colorBlueBottomRight;
|
||||
float b = (float) ( bA * v + bB * ( 1.0 - v ) );
|
||||
|
||||
double highA = ( this.brightnessTopLeft >> 16 & 255 ) * u + ( 1.0 - u ) * ( this.brightnessTopRight >> 16 & 255 );
|
||||
double highB = ( this.brightnessBottomLeft >> 16 & 255 ) * u + ( 1.0 - u ) * ( this.brightnessBottomRight >> 16 & 255 );
|
||||
int high = ( (int) ( highA * v + highB * ( 1.0 - v ) ) ) & 255;
|
||||
|
||||
double lowA = ( ( this.brightnessTopLeft & 255 ) ) * u + ( 1.0 - u ) * ( ( this.brightnessTopRight & 255 ) );
|
||||
double lowB = ( ( this.brightnessBottomLeft & 255 ) ) * u + ( 1.0 - u ) * ( ( this.brightnessBottomRight & 255 ) );
|
||||
int low = ( (int) ( lowA * v + lowB * ( 1.0 - v ) ) ) & 255;
|
||||
|
||||
int out = ( high << 16 ) | low;
|
||||
|
||||
Tessellator.instance.setColorRGBA_F( r, g, b, this.opacity );
|
||||
Tessellator.instance.setBrightness( out );
|
||||
}
|
||||
|
||||
public boolean similarLighting( Block blk, IBlockAccess w, int x, int y, int z, ISimplifiedBundle sim )
|
||||
{
|
||||
int lh = this.getLightingHash( blk, w, x, y, z );
|
||||
return ( (LightingCache) sim ).lightHash == lh;
|
||||
}
|
||||
|
||||
private int getLightingHash( Block blk, IBlockAccess w, int x, int y, int z )
|
||||
{
|
||||
int o = 0;
|
||||
|
||||
for( int i = -1; i <= 1; i++ )
|
||||
{
|
||||
for( int j = -1; j <= 1; j++ )
|
||||
{
|
||||
for( int k = -1; k <= 1; k++ )
|
||||
{
|
||||
|
||||
this.lightHashTmp[o] = blk.getMixedBrightnessForBlock( this.blockAccess, x + i, y + j, z + k );
|
||||
o++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Arrays.hashCode( this.lightHashTmp );
|
||||
}
|
||||
|
||||
public void populate( ISimplifiedBundle sim )
|
||||
{
|
||||
this.lightState = new LightingCache( (LightingCache) sim );
|
||||
}
|
||||
|
||||
public ISimplifiedBundle getLightingCache()
|
||||
{
|
||||
return new LightingCache( this.lightState );
|
||||
}
|
||||
|
||||
private static class LightingCache implements ISimplifiedBundle
|
||||
{
|
||||
|
||||
public final int[] aoXPos;
|
||||
public final int[] aoXNeg;
|
||||
public final int[] aoYPos;
|
||||
public final int[] aoYNeg;
|
||||
public final int[] aoZPos;
|
||||
public final int[] aoZNeg;
|
||||
public final float[] foXPos;
|
||||
public final float[] foXNeg;
|
||||
public final float[] foYPos;
|
||||
public final float[] foYNeg;
|
||||
public final float[] foZPos;
|
||||
public final float[] foZNeg;
|
||||
public IIcon rXPos;
|
||||
public IIcon rXNeg;
|
||||
public IIcon rYPos;
|
||||
public IIcon rYNeg;
|
||||
public IIcon rZPos;
|
||||
public IIcon rZNeg;
|
||||
public boolean isAO;
|
||||
public int bXPos;
|
||||
public int bXNeg;
|
||||
public int bYPos;
|
||||
public int bYNeg;
|
||||
public int bZPos;
|
||||
public int bZNeg;
|
||||
public int lightHash;
|
||||
|
||||
public LightingCache( LightingCache secondCSrc )
|
||||
{
|
||||
this.rXPos = secondCSrc.rXPos;
|
||||
this.rXNeg = secondCSrc.rXNeg;
|
||||
this.rYPos = secondCSrc.rYPos;
|
||||
this.rYNeg = secondCSrc.rYNeg;
|
||||
this.rZPos = secondCSrc.rZPos;
|
||||
this.rZNeg = secondCSrc.rZNeg;
|
||||
|
||||
this.isAO = secondCSrc.isAO;
|
||||
|
||||
this.bXPos = secondCSrc.bXPos;
|
||||
this.bXNeg = secondCSrc.bXNeg;
|
||||
this.bYPos = secondCSrc.bYPos;
|
||||
this.bYNeg = secondCSrc.bYNeg;
|
||||
this.bZPos = secondCSrc.bZPos;
|
||||
this.bZNeg = secondCSrc.bZNeg;
|
||||
|
||||
this.aoXPos = secondCSrc.aoXPos.clone();
|
||||
this.aoXNeg = secondCSrc.aoXNeg.clone();
|
||||
this.aoYPos = secondCSrc.aoYPos.clone();
|
||||
this.aoYNeg = secondCSrc.aoYNeg.clone();
|
||||
this.aoZPos = secondCSrc.aoZPos.clone();
|
||||
this.aoZNeg = secondCSrc.aoZNeg.clone();
|
||||
|
||||
this.foXPos = secondCSrc.foXPos.clone();
|
||||
this.foXNeg = secondCSrc.foXNeg.clone();
|
||||
this.foYPos = secondCSrc.foYPos.clone();
|
||||
this.foYNeg = secondCSrc.foYNeg.clone();
|
||||
this.foZPos = secondCSrc.foZPos.clone();
|
||||
this.foZNeg = secondCSrc.foZNeg.clone();
|
||||
|
||||
this.lightHash = secondCSrc.lightHash;
|
||||
}
|
||||
|
||||
public LightingCache()
|
||||
{
|
||||
this.rXPos = null;
|
||||
this.rXNeg = null;
|
||||
this.rYPos = null;
|
||||
this.rYNeg = null;
|
||||
this.rZPos = null;
|
||||
this.rZNeg = null;
|
||||
|
||||
this.isAO = false;
|
||||
|
||||
this.bXPos = 0;
|
||||
this.bXNeg = 0;
|
||||
this.bYPos = 0;
|
||||
this.bYNeg = 0;
|
||||
this.bZPos = 0;
|
||||
this.bZNeg = 0;
|
||||
|
||||
this.aoXPos = new int[5];
|
||||
this.aoXNeg = new int[5];
|
||||
this.aoYPos = new int[5];
|
||||
this.aoYNeg = new int[5];
|
||||
this.aoZPos = new int[5];
|
||||
this.aoZNeg = new int[5];
|
||||
|
||||
this.foXPos = new float[12];
|
||||
this.foXNeg = new float[12];
|
||||
this.foYPos = new float[12];
|
||||
this.foYNeg = new float[12];
|
||||
this.foZPos = new float[12];
|
||||
this.foZNeg = new float[12];
|
||||
|
||||
this.lightHash = 0;
|
||||
}
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class SMFace
|
||||
{
|
||||
|
||||
public final EnumFacing face;
|
||||
public final boolean isEdge;
|
||||
|
||||
public final Vector3f to;
|
||||
public final Vector3f from;
|
||||
|
||||
public final float[] uv;
|
||||
|
||||
public final TextureAtlasSprite spite;
|
||||
|
||||
public final int color;
|
||||
|
||||
public SMFace(
|
||||
EnumFacing face , boolean isEdge,
|
||||
int color,
|
||||
Vector3f to,
|
||||
Vector3f from,
|
||||
float[] defUVs2,
|
||||
TextureAtlasSprite iconUnwrapper )
|
||||
{
|
||||
this.color = color;
|
||||
this.face=face;
|
||||
this.isEdge = isEdge;
|
||||
this.to=to;
|
||||
this.from=from;
|
||||
this.uv = defUVs2;
|
||||
this.spite = iconUnwrapper;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,16 +21,17 @@ package appeng.client.render;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
public class SpatialSkyRender extends IRenderHandler
|
||||
{
|
||||
@@ -74,7 +75,8 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
GL11.glDisable( GL11.GL_BLEND );
|
||||
GL11.glDepthMask( false );
|
||||
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
@@ -105,12 +107,12 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F );
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I( 0 );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
|
||||
tessellator.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
|
||||
tessellator.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
|
||||
worldrenderer.startDrawingQuads();
|
||||
worldrenderer.setColorOpaque_I( 0 );
|
||||
worldrenderer.addVertexWithUV( -100.0D, -100.0D, -100.0D, 0.0D, 0.0D );
|
||||
worldrenderer.addVertexWithUV( -100.0D, -100.0D, 100.0D, 0.0D, 16.0D );
|
||||
worldrenderer.addVertexWithUV( 100.0D, -100.0D, 100.0D, 16.0D, 16.0D );
|
||||
worldrenderer.addVertexWithUV( 100.0D, -100.0D, -100.0D, 16.0D, 0.0D );
|
||||
tessellator.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -142,8 +144,9 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
|
||||
private void renderTwinkles()
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
worldrenderer.startDrawingQuads();
|
||||
|
||||
for( int i = 0; i < 50; ++i )
|
||||
{
|
||||
@@ -183,7 +186,7 @@ public class SpatialSkyRender extends IRenderHandler
|
||||
double d23 = d17 * d12 - d20 * d13;
|
||||
double d24 = d23 * d9 - d21 * d10;
|
||||
double d25 = d21 * d9 + d23 * d10;
|
||||
tessellator.addVertex( x + d24, y + d22, z + d25 );
|
||||
worldrenderer.addVertex( x + d24, y + d22, z + d25 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,14 @@
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
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 cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
@@ -39,7 +37,7 @@ import appeng.tile.AEBaseTile;
|
||||
public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
public final RenderBlocks renderBlocksInstance = new RenderBlocks();
|
||||
public final IRenderHelper renderBlocksInstance = new IRenderHelper();
|
||||
|
||||
private final BaseBlockRender blkRender;
|
||||
private final double maxDistance;
|
||||
@@ -51,7 +49,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void renderTileEntityAt( TileEntity te, double x, double y, double z, float f )
|
||||
public final void renderTileEntityAt( TileEntity te, double x, double y, double z, float f, int something )
|
||||
{
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
@@ -64,14 +62,14 @@ public class TESRWrapper extends TileEntitySpecialRenderer
|
||||
return;
|
||||
}
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
this.renderBlocksInstance.blockAccess = te.getWorldObj();
|
||||
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, this.renderBlocksInstance );
|
||||
this.renderBlocksInstance.blockAccess = te.getWorld();
|
||||
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess.getWorldRenderer(), x, y, z, f, this.renderBlocksInstance );
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -22,16 +22,12 @@ package appeng.client.render;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
|
||||
@@ -42,8 +38,7 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
|
||||
public static final WorldRender INSTANCE = new WorldRender();
|
||||
public final HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
|
||||
final int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
private final RenderBlocks renderer = new RenderBlocks();
|
||||
private final IRenderHelper renderer = new IRenderHelper();
|
||||
boolean hasError = false;
|
||||
|
||||
private WorldRender()
|
||||
@@ -56,29 +51,17 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock( Block block, int metadata, int modelID, RenderBlocks renderer )
|
||||
public void renderInventoryBlock( Block block, int metadata, int modelID, IRenderHelper renderer )
|
||||
{
|
||||
// wtf is this for?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock( IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer )
|
||||
public boolean renderWorldBlock( IBlockAccess world, BlockPos pos, Block block, int modelId, IRenderHelper renderer )
|
||||
{
|
||||
AEBaseBlock blk = (AEBaseBlock) block;
|
||||
renderer.setRenderBoundsFromBlock( block );
|
||||
return this.getRender( blk ).renderInWorld( blk, world, x, y, z, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory( int modelId )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId()
|
||||
{
|
||||
return this.renderID;
|
||||
return this.getRender( blk ).renderInWorld( blk, world, pos, renderer );
|
||||
}
|
||||
|
||||
private BaseBlockRender getRender( AEBaseBlock block )
|
||||
|
||||
@@ -21,26 +21,25 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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.IOrientable;
|
||||
import appeng.block.crafting.BlockMolecularAssembler;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderHelper;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.TaughtIcon;
|
||||
import appeng.parts.networking.PartCable;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
@@ -56,209 +55,204 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockMolecularAssembler blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockMolecularAssembler blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, 0 ) );
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0] );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 14, 0, 14, 16, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 14, 2, 2, 16, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 2, 0, 14, 14, 2, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 0, 2, 16, 2, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 0, 0, 16, 2, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 2, 0, 2, 16, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 0, 2, 2, 2, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 14, 14, 16, 16, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 0, 14, 16, 14, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 14, 0, 16, 16, 14 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 14, 2, 0, 16, 14, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 2, 14, 2, 14, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 1, 1, 15, 15, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, Tessellator.instance, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockMolecularAssembler block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockMolecularAssembler block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
BlockMolecularAssembler blk = (BlockMolecularAssembler) block;
|
||||
TileMolecularAssembler tma = blk.getTileEntity( world, x, y, z );
|
||||
BlockMolecularAssembler blk = block;
|
||||
TileMolecularAssembler tma = blk.getTileEntity( world, pos );
|
||||
|
||||
if( BlockMolecularAssembler.booleanAlphaPass )
|
||||
if ( renderer.isAlphaPass() )
|
||||
{
|
||||
if( tma.isPowered() )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, EnumFacing.WEST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
TaughtIcon lights = new TaughtIcon( ExtraBlockTextures.BlockMolecularAssemblerLights.getIcon(), -2.0f );
|
||||
Tessellator.instance.setColorRGBA_F( 1, 1, 1, 0.3f );
|
||||
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( blk, x, y, z, lights );
|
||||
renderer.renderFaceXPos( blk, x, y, z, lights );
|
||||
renderer.renderFaceYNeg( blk, x, y, z, lights );
|
||||
renderer.renderFaceYPos( blk, x, y, z, lights );
|
||||
renderer.renderFaceZNeg( blk, x, y, z, lights );
|
||||
renderer.renderFaceZPos( blk, x, y, z, lights );
|
||||
renderer.setColorRGBA_F( 1, 1, 1, 0.3f );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( blk, pos, lights );
|
||||
renderer.renderFaceXPos( blk, pos, lights );
|
||||
renderer.renderFaceYNeg( blk, pos, lights );
|
||||
renderer.renderFaceYPos( blk, pos, lights );
|
||||
renderer.renderFaceZNeg( blk, pos, lights );
|
||||
renderer.renderFaceZPos( blk, pos, lights );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
|
||||
renderer = BusRenderer.INSTANCE.renderer;
|
||||
//BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
|
||||
//renderer = BusRenderer.INSTANCE.renderer;
|
||||
BusRenderer.INSTANCE.renderer=renderer;
|
||||
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
IOrientable te = this.getOrientable( block, world, pos );
|
||||
|
||||
tma.lightCache = BusRenderHelper.INSTANCE.useSimplifiedRendering( x, y, z, this, tma.lightCache );
|
||||
|
||||
BusRenderer.INSTANCE.renderer.isFacade = true;
|
||||
IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
|
||||
ForgeDirection fdy = te.getUp();
|
||||
ForgeDirection fdz = te.getForward();
|
||||
ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
EnumFacing fdy = te.getUp();
|
||||
EnumFacing fdz = te.getForward();
|
||||
EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
this.renderCableAt( 0.11D, world, x, y, z, block, renderer, 0.141D, false );
|
||||
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, 0.1875D, true );
|
||||
this.renderCableAt( 0.11D, world, pos, block, renderer, 0.141D, false );
|
||||
this.renderCableAt( 0.188D, world, pos, block, renderer, 0.1875D, true );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( blk.getIcon( 0, 0 ) );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( world.getBlockState( pos ) )[0] );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 14, 0, 14, 16, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 14, 2, 2, 16, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 2, 0, 14, 14, 2, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 0, 2, 16, 2, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
// sides...
|
||||
this.renderBlockBounds( renderer, 0, 0, 0, 16, 2, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 2, 0, 2, 16, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 0, 2, 2, 2, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 14, 14, 16, 16, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 0, 14, 16, 14, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 14, 0, 16, 16, 14, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 14, 2, 0, 16, 14, 2, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 2, 14, 2, 14, 16, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 1, 1, 1, 15, 15, 15, fdx, fdy, fdz );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
|
||||
BusRenderHelper.INSTANCE.normalRendering();
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
BusRenderer.INSTANCE.renderer.isFacade = false;
|
||||
|
||||
this.postRenderInWorld( renderer );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void renderCableAt( double thickness, IBlockAccess world, int x, int y, int z, BlockMolecularAssembler block, RenderBlocks renderer, double pull, boolean covered )
|
||||
public void renderCableAt( double thickness, IBlockAccess world, BlockPos pos, BlockMolecularAssembler block, IRenderHelper renderer, double pull, boolean covered )
|
||||
{
|
||||
IIcon texture = null;
|
||||
IAESprite texture = null;
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.WEST, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.EAST, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.NORTH, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.SOUTH, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.DOWN, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture = this.getConnectedCable( world, x, y, z, ForgeDirection.UP, covered ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
IIcon getConnectedCable( IBlockAccess world, int x, int y, int z, ForgeDirection side, boolean covered )
|
||||
IAESprite getConnectedCable( IBlockAccess world, BlockPos pos, EnumFacing side, boolean covered,IRenderHelper renderer )
|
||||
{
|
||||
final int tileYPos = y + side.offsetY;
|
||||
final int tileYPos = pos.getY() + side.getFrontOffsetY();
|
||||
if( -1 < tileYPos && tileYPos < 256 )
|
||||
{
|
||||
TileEntity ne = world.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
TileEntity ne = world.getTileEntity( pos.offset( side ) );
|
||||
if( ne instanceof IGridHost && ne instanceof IPartHost )
|
||||
{
|
||||
IPartHost ph = (IPartHost) ne;
|
||||
IPart pcx = ph.getPart( ForgeDirection.UNKNOWN );
|
||||
IPart pcx = ph.getPart( AEPartLocation.INTERNAL );
|
||||
if( pcx instanceof PartCable )
|
||||
{
|
||||
PartCable pc = (PartCable) pcx;
|
||||
@@ -266,9 +260,9 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
|
||||
{
|
||||
if( covered )
|
||||
{
|
||||
return pc.getCoveredTexture( pc.getCableColor() );
|
||||
return pc.getCoveredTexture( pc.getCableColor(),renderer );
|
||||
}
|
||||
return pc.getGlassTexture( pc.getCableColor() );
|
||||
return pc.getGlassTexture( pc.getCableColor(),renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,22 +21,24 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
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.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
@@ -52,70 +54,68 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockCharger blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockCharger blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
this.setInvRenderBounds( renderer, 6, 1, 0, 10, 15, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 3, 3, 13, 4, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 12, 3, 13, 13, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockCharger block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockCharger block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
final BlockCharger blk = (BlockCharger) block;
|
||||
final BlockCharger blk = block;
|
||||
|
||||
final IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
final IOrientable te = this.getOrientable( block, world, pos );
|
||||
|
||||
final ForgeDirection fdy = te.getUp();
|
||||
final ForgeDirection fdz = te.getForward();
|
||||
final ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
final EnumFacing fdy = te.getUp();
|
||||
final EnumFacing fdz = te.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
this.renderBlockBounds( renderer, 6, 1, 0, 10, 15, 2, fdx, fdy, fdz );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
blk.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( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 3, 3, 3, 13, 4, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
blk.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( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 3, 12, 3, 13, 13, 13, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
@@ -125,7 +125,7 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockCharger block, TileCharger tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderTile( BlockCharger block, TileCharger tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
ItemStack sis = null;
|
||||
if( tile instanceof IInventory )
|
||||
@@ -140,20 +140,22 @@ public class RenderBlockCharger extends BaseBlockRender<BlockCharger, TileCharge
|
||||
|
||||
try
|
||||
{
|
||||
GL11.glTranslatef( 0.5f, 0.45f, 0.5f );
|
||||
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 && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
/*
|
||||
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.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.networking.BlockController;
|
||||
import appeng.block.networking.BlockController.ControllerBlockState;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
@@ -40,16 +40,16 @@ public class RenderBlockController extends BaseBlockRender<BlockController, Tile
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockController blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockController blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
|
||||
boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y, z ) instanceof TileController;
|
||||
boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1, z ) instanceof TileController;
|
||||
boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y, z + 1 ) instanceof TileController;
|
||||
boolean xx = this.getTileEntity( world, pos.offset( EnumFacing.WEST ) ) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.EAST ) ) instanceof TileController;
|
||||
boolean yy = this.getTileEntity( world, pos.offset( EnumFacing.DOWN ) ) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.UP ) ) instanceof TileController;
|
||||
boolean zz = this.getTileEntity( world, pos.offset( EnumFacing.SOUTH )) instanceof TileController && this.getTileEntity( world, pos.offset( EnumFacing.NORTH ) ) instanceof TileController;
|
||||
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
boolean hasPower = meta > 0;
|
||||
boolean isConflict = meta == 2;
|
||||
BlockController.ControllerBlockState meta = ( ControllerBlockState ) world.getBlockState( pos ).getValue( BlockController.CONTROLLER_STATE );
|
||||
boolean hasPower = meta != BlockController.ControllerBlockState.OFFLINE;
|
||||
boolean isConflict = meta == BlockController.ControllerBlockState.CONFLICTED;
|
||||
|
||||
ExtraBlockTextures lights = null;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class RenderBlockController extends BaseBlockRender<BlockController, Tile
|
||||
}
|
||||
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||
{
|
||||
int v = ( Math.abs( x ) + Math.abs( y ) + Math.abs( z ) ) % 2;
|
||||
int v = ( Math.abs( pos.getX() ) + Math.abs( pos.getY() ) + Math.abs( pos.getZ() ) ) % 2;
|
||||
renderer.uvRotateEast = renderer.uvRotateBottom = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
|
||||
if( v == 0 )
|
||||
@@ -156,17 +156,17 @@ public class RenderBlockController extends BaseBlockRender<BlockController, Tile
|
||||
}
|
||||
}
|
||||
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
if( lights != null )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
Tessellator.instance.setBrightness( 14 << 20 | 14 << 4 );
|
||||
renderer.renderFaceXNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceXPos( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceYNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceYPos( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceZNeg( blk, x, y, z, lights.getIcon() );
|
||||
renderer.renderFaceZPos( blk, x, y, z, lights.getIcon() );
|
||||
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 );
|
||||
@@ -174,11 +174,11 @@ public class RenderBlockController extends BaseBlockRender<BlockController, Tile
|
||||
return out;
|
||||
}
|
||||
|
||||
private TileEntity getTileEntity( IBlockAccess world, int x, int y, int z )
|
||||
private TileEntity getTileEntity( IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
if( y >= 0 )
|
||||
if( pos.getY() >= 0 )
|
||||
{
|
||||
return world.getTileEntity( x, y, z );
|
||||
return world.getTileEntity( pos );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -22,21 +22,23 @@ package appeng.client.render.blocks;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
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.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
|
||||
@@ -55,29 +57,35 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( B blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( B blk, IBlockAccess w, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
IIcon theIcon = null;
|
||||
IAESprite theIcon = null;
|
||||
boolean formed = false;
|
||||
boolean emitsLight = false;
|
||||
|
||||
TileCraftingTile ct = blk.getTileEntity( w, x, y, z );
|
||||
TileCraftingTile ct = blk.getTileEntity( w, pos );
|
||||
if( ct != null && ct.isFormed() )
|
||||
{
|
||||
formed = true;
|
||||
emitsLight = ct.isPowered();
|
||||
}
|
||||
int meta = w.getBlockMetadata( x, y, z ) & 3;
|
||||
|
||||
|
||||
boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
|
||||
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
|
||||
theIcon = renderer.getIcon( w.getBlockState( pos ) )[EnumFacing.SOUTH.ordinal()];// blk.getIcon( AEPartLocation.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
|
||||
|
||||
IIcon nonForward = theIcon;
|
||||
int meta = 1;
|
||||
for( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
if ( craftingBlock == blk )
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
IAESprite nonForward = theIcon;
|
||||
if( isMonitor )
|
||||
{
|
||||
for( Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
|
||||
{
|
||||
nonForward = craftingBlock.getIcon( 0, meta | ( formed ? 8 : 0 ) );
|
||||
nonForward = renderer.getIcon( craftingBlock.getDefaultState() )[EnumFacing.SOUTH.ordinal()]; // craftingBlock.getIcon( 0, meta | ( formed ? 8 : 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,42 +93,32 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
{
|
||||
renderer = BusRenderer.INSTANCE.renderer;
|
||||
BusRenderHelper i = BusRenderHelper.INSTANCE;
|
||||
BusRenderer.INSTANCE.renderer.isFacade = true;
|
||||
|
||||
renderer.blockAccess = w;
|
||||
i.setPass( 0 );
|
||||
i.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
i.setPass( MinecraftForgeClient.getRenderLayer() == EnumWorldBlockLayer.TRANSLUCENT ? 1 : 0 );
|
||||
i.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
try
|
||||
float highX = this.isConnected( w, pos, EnumFacing.EAST ) ? 16 : 13.01f;
|
||||
float lowX = this.isConnected( w, pos, EnumFacing.WEST ) ? 0 : 2.99f;
|
||||
|
||||
float highY = this.isConnected( w, pos, EnumFacing.UP ) ? 16 : 13.01f;
|
||||
float lowY = this.isConnected( w, pos, EnumFacing.DOWN ) ? 0 : 2.99f;
|
||||
|
||||
float highZ = this.isConnected( w, pos, EnumFacing.SOUTH ) ? 16 : 13.01f;
|
||||
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( EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
float highX = this.isConnected( w, x, y, z, ForgeDirection.EAST ) ? 16 : 13.01f;
|
||||
float lowX = this.isConnected( w, x, y, z, ForgeDirection.WEST ) ? 0 : 2.99f;
|
||||
|
||||
float highY = this.isConnected( w, x, y, z, ForgeDirection.UP ) ? 16 : 13.01f;
|
||||
float lowY = this.isConnected( w, x, y, z, ForgeDirection.DOWN ) ? 0 : 2.99f;
|
||||
|
||||
float highZ = this.isConnected( w, x, y, z, ForgeDirection.SOUTH ) ? 16 : 13.01f;
|
||||
float lowZ = this.isConnected( w, x, y, z, ForgeDirection.NORTH ) ? 0 : 2.99f;
|
||||
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.NORTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.EAST, ForgeDirection.SOUTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.NORTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.UP, ForgeDirection.WEST, ForgeDirection.SOUTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.NORTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.SOUTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.NORTH );
|
||||
this.renderCorner( i, renderer, w, x, y, z, ForgeDirection.DOWN, ForgeDirection.WEST, ForgeDirection.SOUTH );
|
||||
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
{
|
||||
i.setBounds( this.fso( side, lowX, ForgeDirection.WEST ), this.fso( side, lowY, ForgeDirection.DOWN ), this.fso( side, lowZ, ForgeDirection.NORTH ), this.fso( side, highX, ForgeDirection.EAST ), this.fso( side, highY, ForgeDirection.UP ), this.fso( side, highZ, ForgeDirection.SOUTH ) );
|
||||
i.setBounds( this.fso( side, lowX, 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;
|
||||
@@ -129,12 +127,11 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
LocalEmit = false;
|
||||
}
|
||||
|
||||
this.handleSide( blk, meta, x, y, z, i, renderer, ct.getForward() == side ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
|
||||
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( ForgeDirection.class ) );
|
||||
i.normalRendering();
|
||||
//BusRenderer.INSTANCE.renderer.isFacade = false;
|
||||
i.setFacesToRender( EnumSet.allOf( EnumFacing.class ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -144,16 +141,16 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
double o = 16.0 / 16.0;
|
||||
renderer.setRenderBounds( a, a, a, o, o, o );
|
||||
|
||||
return renderer.renderStandardBlock( blk, x, y, z );
|
||||
return renderer.renderStandardBlock( blk, pos );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isConnected( IBlockAccess w, int x, int y, int z, ForgeDirection side )
|
||||
private boolean isConnected( IBlockAccess w, BlockPos pos, EnumFacing side )
|
||||
{
|
||||
final int tileYPos = y + side.offsetY;
|
||||
final int tileYPos = pos.getY() + side.getFrontOffsetY();
|
||||
if( 0 <= tileYPos && tileYPos <= 255 )
|
||||
{
|
||||
final TileEntity tile = w.getTileEntity( x + side.offsetX, tileYPos, z + side.offsetZ );
|
||||
final TileEntity tile = w.getTileEntity( pos.offset( side ) );
|
||||
|
||||
return tile instanceof TileCraftingTile;
|
||||
}
|
||||
@@ -163,32 +160,32 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCorner( BusRenderHelper i, RenderBlocks renderer, IBlockAccess w, int x, int y, int z, ForgeDirection up, ForgeDirection east, ForgeDirection south )
|
||||
private void renderCorner( BusRenderHelper i, IRenderHelper renderer, IBlockAccess w, BlockPos pos, EnumFacing up, EnumFacing east, EnumFacing south )
|
||||
{
|
||||
if( this.isConnected( w, x, y, z, up ) )
|
||||
if( this.isConnected( w, pos, up ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( this.isConnected( w, x, y, z, east ) )
|
||||
if( this.isConnected( w, pos, east ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( this.isConnected( w, x, y, z, south ) )
|
||||
if( this.isConnected( w, pos, south ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i.setBounds( this.gso( east, 3, ForgeDirection.WEST ), this.gso( up, 3, ForgeDirection.DOWN ), this.gso( south, 3, ForgeDirection.NORTH ), this.gso( east, 13, ForgeDirection.EAST ), this.gso( up, 13, ForgeDirection.UP ), this.gso( south, 13, ForgeDirection.SOUTH ) );
|
||||
i.setBounds( this.gso( east, 3, 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( x, y, z, renderer );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
|
||||
private float fso( ForgeDirection side, float def, ForgeDirection target )
|
||||
private float fso( EnumFacing side, float def, EnumFacing target )
|
||||
{
|
||||
if( side == target )
|
||||
{
|
||||
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
if( side.getFrontOffsetX() > 0 || side.getFrontOffsetY() > 0 || side.getFrontOffsetZ() > 0 )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
@@ -197,9 +194,9 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
return def;
|
||||
}
|
||||
|
||||
private void handleSide( B blk, int meta, int x, int y, int z, BusRenderHelper i, RenderBlocks renderer, IIcon color, boolean emitsLight, boolean isMonitor, ForgeDirection side, IBlockAccess w )
|
||||
private void handleSide( B blk, int meta, BlockPos pos, BusRenderHelper i, IRenderHelper renderer, IAESprite color, boolean emitsLight, boolean isMonitor, EnumFacing side, IBlockAccess w )
|
||||
{
|
||||
if( this.isConnected( w, x, y, z, side ) )
|
||||
if( this.isConnected( w, pos, side ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +206,7 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
if( meta == 0 && blk.getClass() == BlockCraftingUnit.class )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitFit.getIcon() );
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -222,7 +219,7 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
|
||||
}
|
||||
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
|
||||
if( color != null )
|
||||
{
|
||||
@@ -232,67 +229,68 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
{
|
||||
if( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||
{
|
||||
int b = w.getLightBrightnessForSkyBlocks( x + side.offsetX, y + side.offsetY, z + side.offsetZ, 0 );
|
||||
int b = w.getCombinedLight( pos.offset( side ), 0 );
|
||||
|
||||
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
|
||||
TileCraftingMonitorTile sr = blk.getTileEntity( w, pos );
|
||||
AEColor col = sr.getColor();
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( col.whiteVariant );
|
||||
i.renderFace( x, y, z, color, side, renderer );
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( col.whiteVariant );
|
||||
i.renderFace( pos, color, side, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( col.mediumVariant );
|
||||
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
renderer.setColorOpaque_I( col.mediumVariant );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( col.blackVariant );
|
||||
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
renderer.setColorOpaque_I( col.blackVariant );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( isMonitor )
|
||||
{
|
||||
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
|
||||
TileCraftingMonitorTile sr = blk.getTileEntity( w, pos );
|
||||
AEColor col = sr.getColor();
|
||||
|
||||
renderer.setColorOpaque_I( col.whiteVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, color, side, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( col.whiteVariant );
|
||||
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( x, y, z, color, side, renderer );
|
||||
renderer.setColorOpaque_I( col.mediumVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( col.mediumVariant );
|
||||
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( col.blackVariant );
|
||||
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
renderer.setColorOpaque_I( col.blackVariant );
|
||||
renderer.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( pos, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||
i.renderFace( x, y, z, color, side, renderer );
|
||||
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( ForgeDirection a : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing a : EnumFacing.VALUES )
|
||||
{
|
||||
if( a == side || a == side.getOpposite() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( ( side.offsetX != 0 || side.offsetZ != 0 ) && ( a == ForgeDirection.NORTH || a == ForgeDirection.EAST || a == ForgeDirection.WEST || a == ForgeDirection.SOUTH ) )
|
||||
if( ( side.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.offsetY != 0 ) && ( a == ForgeDirection.EAST || a == ForgeDirection.WEST ) )
|
||||
else if( ( side.getFrontOffsetY() != 0 ) && ( a == EnumFacing.EAST || a == EnumFacing.WEST ) )
|
||||
{
|
||||
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLongRotated.getIcon() );
|
||||
}
|
||||
@@ -303,7 +301,8 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
|
||||
double width = 3.0 / 16.0;
|
||||
|
||||
if( !( i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999 ) )
|
||||
AEPartLocation dir = AEPartLocation.fromFacing( a );
|
||||
if( !( i.getBound( dir ) < 0.001 || i.getBound( dir ) > 15.999 ) )
|
||||
{
|
||||
switch( a )
|
||||
{
|
||||
@@ -344,21 +343,20 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.uvRotateEast = 1;
|
||||
break;
|
||||
case UNKNOWN:
|
||||
default:
|
||||
}
|
||||
|
||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||
i.renderBlockCurrentBounds( pos, renderer );
|
||||
i.prepareBounds( renderer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float gso( ForgeDirection side, float def, ForgeDirection target )
|
||||
private float gso( EnumFacing side, float def, EnumFacing target )
|
||||
{
|
||||
if( side != target )
|
||||
{
|
||||
if( side.offsetX > 0 || side.offsetY > 0 || side.offsetZ > 0 )
|
||||
if( side.getFrontOffsetX() > 0 || side.getFrontOffsetY() > 0 || side.getFrontOffsetZ() > 0 )
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
@@ -19,21 +19,21 @@
|
||||
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.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.block.crafting.BlockCraftingMonitor;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.util.IWideReadableNumberConverter;
|
||||
@@ -57,11 +57,11 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockCraftingMonitor block, TileCraftingMonitorTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderTile( BlockCraftingMonitor block, TileCraftingMonitorTile tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
if( tile instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
TileCraftingMonitorTile cmt = (TileCraftingMonitorTile) tile;
|
||||
TileCraftingMonitorTile cmt = tile;
|
||||
IAEItemStack ais = cmt.getJobProgress();
|
||||
|
||||
if( cmt.dspList == null )
|
||||
@@ -92,11 +92,11 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
||||
}
|
||||
}
|
||||
|
||||
private void tesrRenderScreen( Tessellator tess, TileCraftingMonitorTile cmt, IAEItemStack ais )
|
||||
private void tesrRenderScreen( WorldRenderer tess, TileCraftingMonitorTile cmt, IAEItemStack ais )
|
||||
{
|
||||
ForgeDirection side = cmt.getForward();
|
||||
EnumFacing side = cmt.getForward();
|
||||
|
||||
ForgeDirection walrus = side.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP;
|
||||
EnumFacing walrus = side.getFrontOffsetY() != 0 ? EnumFacing.SOUTH : EnumFacing.UP;
|
||||
int spin = 0;
|
||||
|
||||
int max = 5;
|
||||
@@ -109,43 +109,43 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
||||
max--;
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glTranslated( side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69 );
|
||||
GL11.glTranslated( side.getFrontOffsetX() * 0.69, side.getFrontOffsetY() * 0.69, side.getFrontOffsetZ() * 0.69 );
|
||||
|
||||
float scale = 0.7f;
|
||||
GL11.glScalef( scale, scale, scale );
|
||||
|
||||
if( side == ForgeDirection.UP )
|
||||
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 == ForgeDirection.DOWN )
|
||||
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 == ForgeDirection.EAST )
|
||||
if( side == EnumFacing.EAST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( side == ForgeDirection.WEST )
|
||||
if( side == EnumFacing.WEST )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
|
||||
}
|
||||
|
||||
if( side == ForgeDirection.NORTH )
|
||||
if( side == EnumFacing.NORTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
}
|
||||
|
||||
if( side == ForgeDirection.SOUTH )
|
||||
if( side == EnumFacing.SOUTH )
|
||||
{
|
||||
GL11.glScalef( -1.0f, -1.0f, -1.0f );
|
||||
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
|
||||
@@ -169,7 +169,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
||||
// RenderHelper.enableGUIStandardItemLighting();
|
||||
tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||
|
||||
ClientHelper.proxy.doRenderItem( sis, cmt.getWorldObj() );
|
||||
ClientHelper.proxy.doRenderItem( sis, cmt.getWorld() );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
@@ -184,7 +184,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
|
||||
final long stackSize = ais.getStackSize();
|
||||
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
|
||||
int width = fr.getStringWidth( renderedStackSize );
|
||||
GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f );
|
||||
fr.drawString( renderedStackSize, 0, 0, 0 );
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
|
||||
@@ -45,7 +48,7 @@ public class RenderBlockCrank extends BaseBlockRender<BlockCrank, TileCrank>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockCrank blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockCrank blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
@@ -59,16 +62,16 @@ public class RenderBlockCrank extends BaseBlockRender<BlockCrank, TileCrank>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockCrank imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockCrank imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockCrank blk, TileCrank tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderBlocks )
|
||||
public void renderTile( BlockCrank blk, TileCrank tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderBlocks )
|
||||
{
|
||||
TileCrank tc = (TileCrank) tile;
|
||||
if( tc.getUp() == null || tc.getUp() == ForgeDirection.UNKNOWN )
|
||||
TileCrank tc = tile;
|
||||
if( tc.getUp() == null || tc.getUp() == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -86,28 +89,36 @@ public class RenderBlockCrank extends BaseBlockRender<BlockCrank, TileCrank>
|
||||
}
|
||||
|
||||
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( tc.visibleRotation, 0, 1, 0 );
|
||||
GL11.glScalef( -1, 1, 1 );
|
||||
GL11.glTranslated( -0.5, 0, -0.5 );
|
||||
|
||||
tess.setTranslation( -tc.xCoord, -tc.yCoord, -tc.zCoord );
|
||||
tess.startDrawingQuads();
|
||||
//tess.setTranslation( -tc.getPos().getX(), -tc.getPos().getY(), -tc.getPos().getZ() );
|
||||
//tess.startDrawingQuads();
|
||||
|
||||
RenderItem ri = Minecraft.getMinecraft().getRenderItem();
|
||||
|
||||
ItemStack stack = new ItemStack( blk );
|
||||
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.getWorldObj();
|
||||
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.xCoord, tc.yCoord, tc.zCoord );
|
||||
|
||||
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.xCoord, tc.yCoord, tc.zCoord );
|
||||
renderBlocks.renderStandardBlock( blk, tc.getPos() );
|
||||
*/
|
||||
|
||||
tess.draw();
|
||||
tess.setTranslation( 0, 0, 0 );
|
||||
//Tessellator.getInstance().draw();
|
||||
//tess.setTranslation( 0, 0, 0 );
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RenderBlockEnergyCube extends BaseBlockRender<BlockEnergyCell, Tile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockEnergyCell blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockEnergyCell blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
IAEItemPowerStorage myItem = (IAEItemPowerStorage) is.getItem();
|
||||
double internalCurrentPower = myItem.getAECurrentPower( is );
|
||||
@@ -56,18 +56,16 @@ public class RenderBlockEnergyCube extends BaseBlockRender<BlockEnergyCell, Tile
|
||||
meta = 0;
|
||||
}
|
||||
|
||||
renderer.setOverrideBlockTexture( blk.getIcon( 0, meta ) );
|
||||
renderer.setOverrideBlockTexture( renderer.getIcon( blk.getStateFromMeta( meta ) )[0] );
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
renderer.setOverrideBlockTexture( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockEnergyCell blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockEnergyCell blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
|
||||
renderer.overrideBlockTexture = blk.getIcon( 0, meta );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.overrideBlockTexture = renderer.getIcon( world.getBlockState( pos ) )[0];// blk.getIcon( 0, meta );
|
||||
boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
return out;
|
||||
|
||||
@@ -21,27 +21,30 @@ 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.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AELog;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
@@ -63,38 +66,36 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockInscriber blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockInscriber blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
this.setInvRenderBounds( renderer, 6, 1, 0, 10, 15, 2 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
// sides...
|
||||
this.setInvRenderBounds( renderer, 3, 1, 0, 13, 15, 3 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 0, 1, 0, 3, 15, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 13, 1, 0, 16, 15, 16 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 0, 1, 15, 2, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 1, 14, 1, 15, 16, 15 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
this.setInvRenderBounds( renderer, 3, 13, 3, 13, 15, 13 );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
@@ -104,40 +105,40 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockInscriber block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockInscriber block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
this.preRenderInWorld( block, world, x, y, z, renderer );
|
||||
this.preRenderInWorld( block, world, pos, renderer );
|
||||
|
||||
final BlockInscriber blk = (BlockInscriber) block;
|
||||
final BlockInscriber blk = block;
|
||||
|
||||
final IOrientable te = this.getOrientable( block, world, x, y, z );
|
||||
final IOrientable te = this.getOrientable( block, world, pos );
|
||||
if( te == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ForgeDirection fdy = te.getUp();
|
||||
final ForgeDirection fdz = te.getForward();
|
||||
final ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
final EnumFacing fdy = te.getUp();
|
||||
final EnumFacing fdz = te.getForward();
|
||||
final EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
// sides...
|
||||
this.renderBlockBounds( renderer, 3, 1, 0, 13, 15, 3, fdx, fdy, fdz );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 0, 1, 0, 3, 15, 16, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 13, 1, 0, 16, 15, 16, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
// top bottom..
|
||||
this.renderBlockBounds( renderer, 1, 0, 1, 15, 4, 15, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
this.renderBlockBounds( renderer, 1, 12, 1, 15, 16, 15, fdx, fdy, fdz );
|
||||
out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
@@ -149,9 +150,9 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockInscriber block, TileInscriber tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderTile( BlockInscriber block, TileInscriber tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
TileInscriber inv = (TileInscriber) tile;
|
||||
TileInscriber inv = tile;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
|
||||
@@ -164,7 +165,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
mc.renderEngine.bindTexture( TextureMap.locationBlocksTexture );
|
||||
|
||||
// << 20 | light << 4;
|
||||
final int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
@@ -197,7 +198,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
press -= progress / 5.0f;
|
||||
|
||||
IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
|
||||
IAESprite ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
|
||||
tess.startDrawingQuads();
|
||||
|
||||
middle += 0.02f;
|
||||
@@ -222,7 +223,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
tess.addVertexWithUV( TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
tess.addVertexWithUV( 1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
|
||||
|
||||
tess.draw();
|
||||
Tessellator.getInstance().draw();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
@@ -253,7 +254,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
}
|
||||
|
||||
this.renderItem( is, 0.0f, block, tile, tess, x, y, z, f, renderer );
|
||||
this.renderItem( is, 0.0f, block, tile, tess, x,y,z, f, renderer );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -263,7 +264,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItem( ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderItem( ItemStack sis, float o, AEBaseBlock block, AEBaseTile tile, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
if( sis != null )
|
||||
{
|
||||
@@ -279,17 +280,18 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
|
||||
|
||||
final Block blk = Block.getBlockFromItem( sis.getItem() );
|
||||
|
||||
if( sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d( blk.getRenderType() ) )
|
||||
/*
|
||||
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.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
|
||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
||||
final int var11 = br % 65536;
|
||||
final int var12 = br / 65536;
|
||||
|
||||
|
||||
@@ -19,15 +19,14 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
|
||||
|
||||
@@ -40,18 +39,18 @@ public class RenderBlockInterface extends BaseBlockRender<BlockInterface, TileIn
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockInterface block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockInterface block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileInterface ti = block.getTileEntity( world, x, y, z );
|
||||
TileInterface ti = block.getTileEntity( world, pos );
|
||||
BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if( ti != null && ti.getForward() != ForgeDirection.UNKNOWN )
|
||||
if( ti != null && ti.getForward() != null )
|
||||
{
|
||||
IIcon side = ExtraBlockTextures.BlockInterfaceAlternateArrow.getIcon();
|
||||
info.setTemporaryRenderIcons( ExtraBlockTextures.BlockInterfaceAlternate.getIcon(), block.getIcon( 0, 0 ), side, side, side, side );
|
||||
IAESprite side = ExtraBlockTextures.BlockInterfaceAlternateArrow.getIcon();
|
||||
info.setTemporaryRenderIcons( ExtraBlockTextures.BlockInterfaceAlternate.getIcon(), renderer.getIcon( world.getBlockState( pos ) )[0], side, side, side, side );
|
||||
}
|
||||
|
||||
boolean fz = super.renderInWorld( block, world, x, y, z, renderer );
|
||||
boolean fz = super.renderInWorld( block, world, pos, renderer );
|
||||
|
||||
info.setTemporaryRenderIcon( null );
|
||||
|
||||
|
||||
@@ -21,18 +21,16 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
|
||||
@@ -46,32 +44,33 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockPaint block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockPaint block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockPaint imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockPaint imb, IBlockAccess world, BlockPos pos, IRenderHelper tess )
|
||||
{
|
||||
TilePaint tp = imb.getTileEntity( world, x, y, z );
|
||||
TilePaint tp = imb.getTileEntity( world, pos );
|
||||
boolean out = false;
|
||||
if( tp != null )
|
||||
{
|
||||
// super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
IIcon[] icoSet = new IIcon[] { imb.getIcon( 0, 0 ), ExtraBlockTextures.BlockPaint2.getIcon(), ExtraBlockTextures.BlockPaint3.getIcon() };
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
IAESprite[] icoSet = new IAESprite[] { imb.getIcon( EnumFacing.UP, imb.getDefaultState() ), ExtraBlockTextures.BlockPaint2.getIcon(), ExtraBlockTextures.BlockPaint3.getIcon() };
|
||||
|
||||
int lumen = 14 << 20 | 14 << 4;
|
||||
int brightness = imb.getMixedBrightnessForBlock( world, x, y, z );
|
||||
int brightness = imb.getMixedBrightnessForBlock( world, pos );
|
||||
|
||||
double offsetConstant = 0.001;
|
||||
|
||||
EnumSet<ForgeDirection> validSides = EnumSet.noneOf( ForgeDirection.class );
|
||||
EnumSet<EnumFacing> validSides = EnumSet.noneOf( EnumFacing.class );
|
||||
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
if( tp.isSideValid( side ) )
|
||||
{
|
||||
@@ -108,13 +107,13 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
|
||||
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.side == ForgeDirection.SOUTH || s.side == ForgeDirection.NORTH )
|
||||
if( s.side == EnumFacing.SOUTH || s.side == EnumFacing.NORTH )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += y;
|
||||
}
|
||||
|
||||
else if( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
|
||||
else if( s.side == EnumFacing.UP || s.side == EnumFacing.DOWN )
|
||||
{
|
||||
pos_x += x;
|
||||
pos_y += z;
|
||||
@@ -125,54 +124,55 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
|
||||
pos_x += y;
|
||||
pos_y += z;
|
||||
}
|
||||
|
||||
IIcon ico = icoSet[s.getSeed() % icoSet.length];
|
||||
|
||||
|
||||
IAESprite ico = icoSet[s.getSeed() % icoSet.length];
|
||||
EnumFacing rs = s.side.getOpposite();
|
||||
|
||||
switch( s.side )
|
||||
{
|
||||
case UP:
|
||||
offset = 1.0 - offset;
|
||||
tess.addVertexWithUV( pos_x - buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
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( pos_x + buffer, y + offset, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, y + offset, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, y + offset, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, y + offset, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
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( x + offset, pos_x + buffer, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - buffer, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - buffer, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + buffer, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
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( x + offset, pos_x - buffer, pos_y - buffer, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + buffer, pos_y - buffer, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x + buffer, pos_y + buffer, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( x + offset, pos_x - buffer, pos_y + buffer, ico.getMinU(), ico.getMaxV() );
|
||||
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( pos_x + buffer, pos_y - buffer, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, pos_y - buffer, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, pos_y + buffer, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, pos_y + buffer, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
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( pos_x - buffer, pos_y - buffer, z + offset, ico.getMinU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, pos_y - buffer, z + offset, ico.getMaxU(), ico.getMinV() );
|
||||
tess.addVertexWithUV( pos_x + buffer, pos_y + buffer, z + offset, ico.getMaxU(), ico.getMaxV() );
|
||||
tess.addVertexWithUV( pos_x - buffer, pos_y + buffer, z + offset, ico.getMinU(), ico.getMaxV() );
|
||||
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:
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
|
||||
|
||||
@@ -39,20 +39,20 @@ public class RenderBlockQuartzAccelerator extends BaseBlockRender<BlockQuartzGro
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockQuartzGrowthAccelerator blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockQuartzGrowthAccelerator blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
if( te instanceof TileQuartzGrowthAccelerator )
|
||||
{
|
||||
if( ( (TileQuartzGrowthAccelerator) te ).hasPower )
|
||||
{
|
||||
IIcon top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
|
||||
IIcon side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
|
||||
IAESprite top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
|
||||
IAESprite side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
|
||||
blk.getRendererInstance().setTemporaryRenderIcons( top_Bottom, top_Bottom, side, side, side, side );
|
||||
}
|
||||
}
|
||||
|
||||
boolean out = super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
boolean out = super.renderInWorld( blk, world, pos, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
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.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.block.storage.BlockSkyChest.SkyChestType;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
|
||||
@@ -51,44 +54,44 @@ public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockSkyChest blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockSkyChest blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
//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];
|
||||
//final int metaData = is.getItemDamage();
|
||||
//final ResourceLocation loc = METADATA_TO_TEXTURE[metaData];
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
//Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
final float lidAngle = 0.0f;
|
||||
//final float lidAngle = 0.0f;
|
||||
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glTranslatef( -0.0F, -1.0F, -1.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();
|
||||
//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 );
|
||||
//GL11.glDisable( GL12.GL_RESCALE_NORMAL );
|
||||
//GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockSkyChest blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockSkyChest blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockSkyChest block, TileSkyChest tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
|
||||
public void renderTile( BlockSkyChest block, TileSkyChest tile, WorldRenderer tess, double x, double y, double z, float partialTick, IRenderHelper renderer )
|
||||
{
|
||||
if( !( tile instanceof TileSkyChest ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final TileSkyChest skyChest = (TileSkyChest) tile;
|
||||
final TileSkyChest skyChest = tile;
|
||||
|
||||
if( !skyChest.hasWorldObj() )
|
||||
{
|
||||
@@ -98,8 +101,8 @@ public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyC
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
final int metaData = tile.getWorldObj().getBlockMetadata( tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
final ResourceLocation loc = METADATA_TO_TEXTURE[metaData];
|
||||
final IBlockState metaData = tile.getWorld().getBlockState( tile.getPos() );
|
||||
final ResourceLocation loc = METADATA_TO_TEXTURE[ ((BlockSkyChest)metaData.getBlock()).type == SkyChestType.BLOCK ? 1 : 0 ];
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
|
||||
@@ -19,21 +19,20 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.render.model.ModelCompass;
|
||||
import appeng.hooks.CompassManager;
|
||||
import appeng.hooks.CompassResult;
|
||||
@@ -52,8 +51,9 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockSkyCompass blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockSkyCompass blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
/*
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
boolean isGood = false;
|
||||
@@ -73,7 +73,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glEnable( 32826 ); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/models/compass.png" );
|
||||
@@ -167,25 +167,26 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
GL11.glDisable( 32826 /* GL_RESCALE_NORMAL_EXT */);
|
||||
GL11.glDisable( 32826 ); // GL_RESCALE_NORMAL_EXT
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockSkyCompass blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockSkyCompass blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockSkyCompass block, TileSkyCompass tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
|
||||
public void renderTile( BlockSkyCompass block, TileSkyCompass tile, WorldRenderer tess, double x, double y, double z, float partialTick, IRenderHelper renderer )
|
||||
{
|
||||
if( !( tile instanceof TileSkyCompass ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileSkyCompass skyCompass = (TileSkyCompass) tile;
|
||||
TileSkyCompass skyCompass = tile;
|
||||
|
||||
if( !skyCompass.hasWorldObj() )
|
||||
{
|
||||
@@ -207,9 +208,9 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
CompassResult cr = null;
|
||||
if( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
|
||||
if( skyCompass.getForward() == EnumFacing.UP || skyCompass.getForward() == EnumFacing.DOWN )
|
||||
{
|
||||
cr = CompassManager.INSTANCE.getCompassDirection( 0, tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
cr = CompassManager.INSTANCE.getCompassDirection( 0, tile.getPos().getX(), tile.getPos().getY(),tile.getPos().getZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -225,7 +226,7 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
|
||||
}
|
||||
else
|
||||
{
|
||||
this.model.renderAll( (float) ( skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad ) );
|
||||
this.model.renderAll( (float) ( skyCompass.getForward() == EnumFacing.DOWN ? this.flipidiy( cr.rad ) : cr.rad ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,20 +21,20 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
@@ -43,9 +43,7 @@ import appeng.util.Platform;
|
||||
public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWireless>
|
||||
{
|
||||
|
||||
private int centerX = 0;
|
||||
private int centerY = 0;
|
||||
private int centerZ = 0;
|
||||
BlockPos center;
|
||||
private BlockWireless blk;
|
||||
private boolean hasChan = false;
|
||||
private boolean hasPower = false;
|
||||
@@ -56,60 +54,56 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockWireless blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockWireless blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
this.blk = blk;
|
||||
this.centerX = 0;
|
||||
this.centerY = 0;
|
||||
this.centerZ = 0;
|
||||
center = new BlockPos(0,0,0);
|
||||
this.hasChan = false;
|
||||
this.hasPower = false;
|
||||
BlockRenderInfo ri = blk.getRendererInstance();
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
IIcon r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
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, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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 );
|
||||
|
||||
tess.startDrawingQuads();
|
||||
//renderer.startDrawingQuads();
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
this.renderTorchAtAngle( renderer, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderTorchAtAngle( renderer, EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
super.postRenderInWorld( renderer );
|
||||
tess.draw();
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
|
||||
ForgeDirection[] sides = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN };
|
||||
AEPartLocation[] sides = new AEPartLocation[] { AEPartLocation.EAST, AEPartLocation.WEST, AEPartLocation.UP, AEPartLocation.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for( ForgeDirection side : sides )
|
||||
for( AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection side : sides )
|
||||
for( AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
this.renderBlockBounds( renderer, 8 + ( side.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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockWireless blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockWireless blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileWireless tw = blk.getTileEntity( world, x, y, z );
|
||||
TileWireless tw = blk.getTileEntity( world, pos );
|
||||
this.blk = blk;
|
||||
if( tw != null )
|
||||
{
|
||||
@@ -118,25 +112,23 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
|
||||
BlockRenderInfo ri = blk.getRendererInstance();
|
||||
|
||||
ForgeDirection fdy = tw.getUp();
|
||||
ForgeDirection fdz = tw.getForward();
|
||||
ForgeDirection fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
EnumFacing fdy = tw.getUp();
|
||||
EnumFacing fdz = tw.getForward();
|
||||
EnumFacing fdx = Platform.crossProduct( fdz, fdy ).getOpposite();
|
||||
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
IIcon r = CableBusTextures.PartMonitorSidesStatus.getIcon();
|
||||
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, x, y, z, renderer );
|
||||
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, x, y, z, renderer );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
this.centerX = x;
|
||||
this.centerY = y;
|
||||
this.centerZ = z;
|
||||
center = pos;
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
|
||||
this.renderTorchAtAngle( renderer, fdx, fdy, fdz );
|
||||
@@ -144,21 +136,21 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
|
||||
ri.setTemporaryRenderIcons( r, r, ExtraBlockTextures.BlockWirelessInside.getIcon(), ExtraBlockTextures.BlockWirelessInside.getIcon(), r, r );
|
||||
|
||||
ForgeDirection[] sides = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.UP, ForgeDirection.DOWN };
|
||||
AEPartLocation[] sides = new AEPartLocation[] { AEPartLocation.EAST, AEPartLocation.WEST, AEPartLocation.UP, AEPartLocation.DOWN };
|
||||
|
||||
int s = 1;
|
||||
|
||||
for( ForgeDirection side : sides )
|
||||
for( AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 2 : -2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 2 : -2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 2 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : 2 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : 2 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
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( ForgeDirection side : sides )
|
||||
for( AEPartLocation side : sides )
|
||||
{
|
||||
this.renderBlockBounds( renderer, 8 + ( side.offsetX != 0 ? side.offsetX * 4 : -1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 4 : -1 ), 1 + ( side.offsetZ != 0 ? side.offsetZ * 4 : -1 ) + s, 8 + ( side.offsetX != 0 ? side.offsetX * 5 : 1 ), 8 + ( side.offsetY != 0 ? side.offsetY * 5 : 1 ), 2 + ( side.offsetZ != 0 ? side.offsetZ * 5 : 1 ) + s, fdx, fdy, fdz );
|
||||
super.renderInWorld( blk, world, x, y, z, renderer );
|
||||
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();
|
||||
@@ -169,44 +161,44 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
if( this.hasChan )
|
||||
{
|
||||
int l = 14;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.blackVariant );
|
||||
renderer.setBrightness( l << 20 | l << 4 );
|
||||
renderer.setColorOpaque_I( AEColor.Transparent.blackVariant );
|
||||
}
|
||||
else if( this.hasPower )
|
||||
{
|
||||
int l = 9;
|
||||
Tessellator.instance.setBrightness( l << 20 | l << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( AEColor.Transparent.whiteVariant );
|
||||
renderer.setBrightness( l << 20 | l << 4 );
|
||||
renderer.setColorOpaque_I( AEColor.Transparent.whiteVariant );
|
||||
}
|
||||
else
|
||||
{
|
||||
Tessellator.instance.setBrightness( 0 );
|
||||
Tessellator.instance.setColorOpaque_I( 0x000000 );
|
||||
renderer.setBrightness( 0 );
|
||||
renderer.setColorOpaque_I( 0x000000 );
|
||||
}
|
||||
|
||||
if( ForgeDirection.UP != fdz.getOpposite() )
|
||||
if( EnumFacing.UP != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.UP );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.UP );
|
||||
}
|
||||
if( ForgeDirection.DOWN != fdz.getOpposite() )
|
||||
if( EnumFacing.DOWN != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.DOWN );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.DOWN );
|
||||
}
|
||||
if( ForgeDirection.EAST != fdz.getOpposite() )
|
||||
if( EnumFacing.EAST != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.EAST );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.EAST );
|
||||
}
|
||||
if( ForgeDirection.WEST != fdz.getOpposite() )
|
||||
if( EnumFacing.WEST != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.WEST );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.WEST );
|
||||
}
|
||||
if( ForgeDirection.SOUTH != fdz.getOpposite() )
|
||||
if( EnumFacing.SOUTH != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.SOUTH );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.SOUTH );
|
||||
}
|
||||
if( ForgeDirection.NORTH != fdz.getOpposite() )
|
||||
if( EnumFacing.NORTH != fdz.getOpposite() )
|
||||
{
|
||||
super.renderFace( x, y, z, blk, r, renderer, ForgeDirection.NORTH );
|
||||
super.renderFace( pos, blk, r, renderer, EnumFacing.NORTH );
|
||||
}
|
||||
|
||||
ri.setTemporaryRenderIcon( null );
|
||||
@@ -216,10 +208,10 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderTorchAtAngle( RenderBlocks renderer, ForgeDirection x, ForgeDirection y, ForgeDirection z )
|
||||
private void renderTorchAtAngle( IRenderHelper renderer, EnumFacing x, EnumFacing y, EnumFacing z )
|
||||
{
|
||||
IIcon r = ( this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : this.blk.getIcon( 0, 0 ) );
|
||||
IIcon sides = new OffsetIcon( r, 0.0f, -2.0f );
|
||||
IAESprite r = ( this.hasChan ? CableBusTextures.BlockWirelessOn.getIcon() : renderer.getIcon( blk.getDefaultState() )[0] );
|
||||
IAESprite sides = new OffsetIcon( r, 0.0f, -2.0f );
|
||||
|
||||
switch( z )
|
||||
{
|
||||
@@ -257,16 +249,16 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
|
||||
break;
|
||||
}
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
this.renderBlockBounds( renderer, 0, 7, 1, 16, 9, 16, x, y, z );
|
||||
this.renderFace( this.centerX, this.centerY, this.centerZ, this.blk, sides, renderer, y );
|
||||
this.renderFace( this.centerX, this.centerY, this.centerZ, this.blk, sides, renderer, y.getOpposite() );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
this.renderBlockBounds( renderer, 0, 7, 1, 16, 9, 16, x,y,z );
|
||||
this.renderFace( center, this.blk, sides, renderer, y );
|
||||
this.renderFace( center, this.blk, sides, renderer, y.getOpposite() );
|
||||
|
||||
this.renderBlockBounds( renderer, 7, 0, 1, 9, 16, 16, x, y, z );
|
||||
this.renderFace( this.centerX, this.centerY, this.centerZ, this.blk, sides, renderer, x );
|
||||
this.renderFace( this.centerX, this.centerY, this.centerZ, this.blk, sides, renderer, x.getOpposite() );
|
||||
this.renderFace( center, this.blk, sides, renderer, x );
|
||||
this.renderFace( center, this.blk, sides, renderer, x.getOpposite() );
|
||||
|
||||
this.renderBlockBounds( renderer, 7, 7, 1, 9, 9, 10.6, x, y, z );
|
||||
this.renderFace( this.centerX, this.centerY, this.centerZ, this.blk, r, renderer, z );
|
||||
this.renderFace( center, this.blk, r, renderer, z );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.storage.BlockDrive;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -45,31 +45,30 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockDrive block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockDrive block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.White.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockDrive imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockDrive imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileDrive sp = imb.getTileEntity( world, x, y, z );
|
||||
TileDrive sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
ForgeDirection forward = sp.getForward();
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
EnumFacing up = sp.getUp();
|
||||
EnumFacing forward = sp.getForward();
|
||||
EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
boolean result = super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
Tessellator tess = Tessellator.instance;
|
||||
boolean result = super.renderInWorld( imb, world, pos, renderer );
|
||||
|
||||
IIcon ico = ExtraBlockTextures.MEStorageCellTextures.getIcon();
|
||||
IAESprite ico = ExtraBlockTextures.MEStorageCellTextures.getIcon();
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
int b = world.getCombinedLight( pos.offset( forward ), 0 );
|
||||
|
||||
for( int yy = 0; yy < 5; yy++ )
|
||||
{
|
||||
@@ -80,7 +79,7 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
|
||||
int spin = 0;
|
||||
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 )
|
||||
{
|
||||
case 1:
|
||||
switch( up )
|
||||
@@ -192,6 +191,7 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
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 );
|
||||
@@ -210,49 +210,53 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
double v3 = ico.getInterpolatedV( ( ( spin + 3 ) % 4 < 2 ) ? m : mx );
|
||||
double v4 = ico.getInterpolatedV( ( ( spin ) % 4 < 2 ) ? m : mx );
|
||||
|
||||
tess.setBrightness( b );
|
||||
tess.setColorOpaque_I( 0xffffff );
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
int x= pos.getX();
|
||||
int y= pos.getY();
|
||||
int z= pos.getZ();
|
||||
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 )
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
|
||||
if( ( forward == ForgeDirection.UP && up == ForgeDirection.SOUTH ) || forward == ForgeDirection.DOWN )
|
||||
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 );
|
||||
}
|
||||
@@ -263,7 +267,7 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
|
||||
if( stat != 0 )
|
||||
{
|
||||
IIcon whiteIcon = ExtraBlockTextures.White.getIcon();
|
||||
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 );
|
||||
@@ -276,63 +280,63 @@ public class RenderDrive extends BaseBlockRender<BlockDrive, TileDrive>
|
||||
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
tess.setBrightness( 15 << 20 | 15 << 4 );
|
||||
renderer.setBrightness( 15 << 20 | 15 << 4 );
|
||||
}
|
||||
else
|
||||
{
|
||||
tess.setBrightness( 0 );
|
||||
renderer.setBrightness( 0 );
|
||||
}
|
||||
|
||||
if( stat == 1 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
renderer.setColorOpaque_I( 0x00ff00 );
|
||||
}
|
||||
if( stat == 2 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
renderer.setColorOpaque_I( 0xffaa00 );
|
||||
}
|
||||
if( stat == 3 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
renderer.setColorOpaque_I( 0xff0000 );
|
||||
}
|
||||
|
||||
switch( forward.offsetX + forward.offsetY * 2 + forward.offsetZ * 3 )
|
||||
switch( forward.getFrontOffsetX() + forward.getFrontOffsetY() * 2 + forward.getFrontOffsetZ() * 3 )
|
||||
{
|
||||
case 1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward, x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -1:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case -2:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 2:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMinZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMinZ, u4, v4 );
|
||||
break;
|
||||
case 3:
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
case -3:
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
tess.addVertexWithUV( x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
tess.addVertexWithUV( x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMinY, z + renderer.renderMaxZ, u1, v1 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMinX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u2, v2 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMaxY, z + renderer.renderMaxZ, u3, v3 );
|
||||
renderer.addVertexWithUV( forward,x + renderer.renderMaxX, y + renderer.renderMinY, z + renderer.renderMaxZ, u4, v4 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,21 +21,21 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.storage.BlockChest;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
@@ -50,23 +50,23 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockChest block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockChest block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator.instance.setBrightness( 0 );
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
renderer.setBrightness( 0 );
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.White.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.UP ), block, is, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockChest imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockChest imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileChest sp = imb.getTileEntity( world, x, y, z );
|
||||
TileChest sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
if( sp == null )
|
||||
@@ -74,14 +74,14 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
|
||||
return false;
|
||||
}
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
ForgeDirection forward = sp.getForward();
|
||||
ForgeDirection west = Platform.crossProduct( forward, up );
|
||||
EnumFacing up = sp.getUp();
|
||||
EnumFacing forward = sp.getForward();
|
||||
EnumFacing west = Platform.crossProduct( forward, up );
|
||||
|
||||
this.preRenderInWorld( imb, world, x, y, z, renderer );
|
||||
this.preRenderInWorld( imb, world, pos, renderer );
|
||||
|
||||
int stat = sp.getCellStatus( 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
this.selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 );
|
||||
|
||||
@@ -92,40 +92,40 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
|
||||
offsetV = 3;
|
||||
}
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ, 0 );
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
int b = world.getCombinedLight( pos.offset( forward ), 0 );
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
|
||||
FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
|
||||
if( forward == ForgeDirection.EAST && ( up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH ) )
|
||||
if( forward == EnumFacing.EAST && ( up == EnumFacing.NORTH || up == EnumFacing.SOUTH ) )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.EAST )
|
||||
else if( forward == EnumFacing.NORTH && up == EnumFacing.EAST )
|
||||
{
|
||||
flippableIcon.setFlip( false, true );
|
||||
}
|
||||
else if( forward == ForgeDirection.NORTH && up == ForgeDirection.WEST )
|
||||
else if( forward == EnumFacing.NORTH && up == EnumFacing.WEST )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
else if( forward == ForgeDirection.DOWN && up == ForgeDirection.EAST )
|
||||
else if( forward == EnumFacing.DOWN && up == EnumFacing.EAST )
|
||||
{
|
||||
flippableIcon.setFlip( false, true );
|
||||
}
|
||||
else if( forward == ForgeDirection.DOWN )
|
||||
else if( forward == EnumFacing.DOWN )
|
||||
{
|
||||
flippableIcon.setFlip( true, false );
|
||||
}
|
||||
|
||||
/*
|
||||
* 1.7.2
|
||||
* else if ( forward == ForgeDirection.EAST && up == ForgeDirection.UP ) flippableIcon.setFlip( true, false );
|
||||
* else if ( forward == AEPartLocation.EAST && up == AEPartLocation.UP ) flippableIcon.setFlip( true, false );
|
||||
* else if (
|
||||
* forward == ForgeDirection.NORTH && up == ForgeDirection.UP ) flippableIcon.setFlip( true, false );
|
||||
* forward == AEPartLocation.NORTH && up == AEPartLocation.UP ) flippableIcon.setFlip( true, false );
|
||||
*/
|
||||
|
||||
this.renderFace( x, y, z, imb, flippableIcon, renderer, forward );
|
||||
this.renderFace( pos, imb, flippableIcon, renderer, forward );
|
||||
|
||||
if( stat != 0 )
|
||||
{
|
||||
@@ -135,48 +135,48 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
renderer.setBrightness( b );
|
||||
if( stat == 1 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0x00ff00 );
|
||||
renderer.setColorOpaque_I( 0x00ff00 );
|
||||
}
|
||||
if( stat == 2 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0xffaa00 );
|
||||
renderer.setColorOpaque_I( 0xffaa00 );
|
||||
}
|
||||
if( stat == 3 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( 0xff0000 );
|
||||
renderer.setColorOpaque_I( 0xff0000 );
|
||||
}
|
||||
this.selectFace( renderer, west, up, forward, 9, 10, 11, 12 );
|
||||
this.renderFace( x, y, z, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
|
||||
this.renderFace( pos, imb, ExtraBlockTextures.White.getIcon(), renderer, forward );
|
||||
}
|
||||
|
||||
b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
|
||||
b = world.getCombinedLight( pos.offset( up ), 0 );
|
||||
if( sp.isPowered() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||
IIcon ico = ch == null ? null : ch.getTopTexture_Light();
|
||||
this.renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
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 )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
renderer.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = ch == null ? null : ch.getTopTexture_Medium();
|
||||
this.renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
renderer.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
ico = ch == null ? null : ch.getTopTexture_Dark();
|
||||
this.renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
this.renderFace( pos, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||
}
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ public class RenderNull extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( AEBaseBlock block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,23 +23,23 @@ import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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.block.qnb.BlockQuantumBase;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
{
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockQuantumBase block, ItemStack item, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockQuantumBase block, ItemStack item, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
float minPx = 2.0f / 16.0f;
|
||||
float maxPx = 14.0f / 16.0f;
|
||||
@@ -57,9 +57,9 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockQuantumBase block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockQuantumBase block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileQuantumBridge tqb = block.getTileEntity( world, x, y, z );
|
||||
TileQuantumBridge tqb = block.getTileEntity( world, pos );
|
||||
if( tqb == null )
|
||||
{
|
||||
return false;
|
||||
@@ -77,19 +77,18 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
{
|
||||
if( tqb.isFormed() )
|
||||
{
|
||||
EnumSet<ForgeDirection> sides = tqb.getConnections();
|
||||
EnumSet<AEPartLocation> sides = tqb.getConnections();
|
||||
|
||||
Item transGlassCable = parts.cableGlass().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.11D, world, x, y, z, block, renderer, transGlassCable.getIconIndex( parts.cableGlass().stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
|
||||
this.renderCableAt( 0.11D, world, pos, block, renderer, renderer.getIcon( parts.cableGlass().stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
|
||||
|
||||
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.1875D, sides );
|
||||
this.renderCableAt( 0.188D, world, pos, block, renderer, renderer.getIcon( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.1875D, sides );
|
||||
}
|
||||
|
||||
float renderMin = 2.0f / 16.0f;
|
||||
float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -98,18 +97,18 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
float renderMin = 2.0f / 16.0f;
|
||||
float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
else if( tqb.isCorner() )
|
||||
{
|
||||
Item transCoveredCable = parts.cableCovered().item( AEColor.Transparent );
|
||||
this.renderCableAt( 0.188D, world, x, y, z, block, renderer, transCoveredCable.getIconIndex( parts.cableCovered().stack( AEColor.Transparent, 1 ) ), 0.05D, tqb.getConnections() );
|
||||
this.renderCableAt( 0.188D, world, 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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
@@ -119,11 +118,11 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
for( EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
|
||||
this.renderFace( pos, block, ExtraBlockTextures.BlockQRingCornerLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,13 +131,13 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
float renderMin = 2.0f / 16.0f;
|
||||
float renderMax = 14.0f / 16.0f;
|
||||
renderer.setRenderBounds( 0, renderMin, renderMin, 1, renderMax, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( renderMin, 0, renderMin, renderMax, 1, renderMax );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
renderer.setRenderBounds( renderMin, renderMin, 0, renderMax, renderMax, 1 );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
|
||||
if( tqb.isPowered() )
|
||||
{
|
||||
@@ -147,11 +146,11 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
|
||||
|
||||
int bn = 15;
|
||||
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
|
||||
renderer.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
for( EnumFacing side : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( x, y, z, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
|
||||
this.renderFace( pos, block, ExtraBlockTextures.BlockQRingEdgeLight.getIcon(), renderer, side );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,50 +161,44 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
|
||||
return true;
|
||||
}
|
||||
|
||||
private void renderCableAt( double thickness, IBlockAccess world, int x, int y, int z, BlockQuantumBase block, RenderBlocks renderer, IIcon texture, double pull, Collection<ForgeDirection> connections )
|
||||
private void renderCableAt( double thickness, IBlockAccess world, BlockPos pos, BlockQuantumBase block, IRenderHelper renderer, IAESprite texture, double pull, Collection<AEPartLocation> connections )
|
||||
{
|
||||
block.getRendererInstance().setTemporaryRenderIcon( texture );
|
||||
|
||||
if( connections.contains( ForgeDirection.UNKNOWN ) )
|
||||
{
|
||||
renderer.setRenderBounds( 0.5D - thickness, 0.5D - thickness, 0.5D - thickness, 0.5D + thickness, 0.5D + thickness, 0.5D + thickness );
|
||||
renderer.renderStandardBlock( block, x, y, z );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.WEST ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.EAST ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.NORTH ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.SOUTH ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.DOWN ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
if( connections.contains( ForgeDirection.UP ) )
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( block, pos );
|
||||
}
|
||||
|
||||
block.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
@@ -21,15 +21,15 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.solids.BlockQuartzGlass;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.OffsetIcon;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -58,7 +58,7 @@ public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockQuartzGlass block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockQuartzGlass block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.GlassFrame.getIcon();
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
@@ -67,21 +67,21 @@ public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockQuartzGlass imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockQuartzGlass imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
int cx = Math.abs( x % 10 );
|
||||
int cy = Math.abs( y % 10 );
|
||||
int cz = Math.abs( z % 10 );
|
||||
int cx = Math.abs( pos.getX() % 10 );
|
||||
int cy = Math.abs( pos.getY() % 10 );
|
||||
int cz = Math.abs( pos.getZ() % 10 );
|
||||
|
||||
int u = offsets[cx][cy][cz] % 4;
|
||||
int v = offsets[9 - cx][9 - cy][9 - cz] % 4;
|
||||
|
||||
switch( Math.abs( ( offsets[cx][cy][cz] + ( x + y + z ) ) % 4 ) )
|
||||
switch( Math.abs( ( offsets[cx][cy][cz] + ( pos.getX()+pos.getY()+pos.getZ() ) ) % 4 ) )
|
||||
{
|
||||
case 0:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( imb.getIcon( 0, 0 ), u / 2, v / 2 );
|
||||
renderer.overrideBlockTexture = new OffsetIcon( renderer.getIcon( world.getBlockState( pos ) )[0], u / 2, v / 2 );
|
||||
break;
|
||||
case 1:
|
||||
renderer.overrideBlockTexture = new OffsetIcon( ExtraBlockTextures.BlockQuartzGlassB.getIcon(), u / 2, v / 2 );
|
||||
@@ -94,66 +94,66 @@ public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseT
|
||||
break;
|
||||
}
|
||||
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.EAST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.WEST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.NORTH );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.UP, ForgeDirection.SOUTH );
|
||||
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, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.EAST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.WEST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.NORTH );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.DOWN, ForgeDirection.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, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.UP );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.DOWN );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.NORTH );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.EAST, ForgeDirection.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, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.UP );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.DOWN );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.NORTH );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.WEST, ForgeDirection.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, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.EAST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.WEST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.UP );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.NORTH, ForgeDirection.DOWN );
|
||||
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, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.EAST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.WEST );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.UP );
|
||||
this.renderEdge( imb, world, x, y, z, renderer, ForgeDirection.SOUTH, ForgeDirection.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( BlockQuartzGlass imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer, ForgeDirection side, ForgeDirection direction )
|
||||
private void renderEdge( BlockQuartzGlass imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer, AEPartLocation side, AEPartLocation direction )
|
||||
{
|
||||
if( !this.isFlush( imb, world, x + side.offsetX, y + side.offsetY, z + side.offsetZ ) )
|
||||
if( !this.isFlush( imb, world, pos.getX() + side.xOffset, pos.getY() + side.yOffset, pos.getZ() + side.zOffset ) )
|
||||
{
|
||||
if( !this.isFlush( imb, world, x + direction.offsetX, y + direction.offsetY, z + direction.offsetZ ) )
|
||||
if( !this.isFlush( imb, world, pos.getX() + direction.xOffset, pos.getY() + direction.yOffset, pos.getZ() + direction.zOffset ) )
|
||||
{
|
||||
float minX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
|
||||
float minY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
|
||||
float minZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
|
||||
float maxX = 0.5f + ( side.offsetX + direction.offsetX ) / 2.0f;
|
||||
float maxY = 0.5f + ( side.offsetY + direction.offsetY ) / 2.0f;
|
||||
float maxZ = 0.5f + ( side.offsetZ + direction.offsetZ ) / 2.0f;
|
||||
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.offsetX && 0 == direction.offsetX )
|
||||
if( 0 == side.xOffset && 0 == direction.xOffset )
|
||||
{
|
||||
minX = 0.0f;
|
||||
maxX = 1.0f;
|
||||
}
|
||||
if( 0 == side.offsetY && 0 == direction.offsetY )
|
||||
if( 0 == side.yOffset && 0 == direction.yOffset )
|
||||
{
|
||||
minY = 0.0f;
|
||||
maxY = 1.0f;
|
||||
}
|
||||
if( 0 == side.offsetZ && 0 == direction.offsetZ )
|
||||
if( 0 == side.zOffset && 0 == direction.zOffset )
|
||||
{
|
||||
minZ = 0.0f;
|
||||
maxZ = 1.0f;
|
||||
@@ -190,22 +190,22 @@ public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseT
|
||||
switch( side )
|
||||
{
|
||||
case WEST:
|
||||
renderer.renderFaceXNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceXNeg( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case EAST:
|
||||
renderer.renderFaceXPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceXPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.renderFaceZNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceZNeg( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.renderFaceZPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceZPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.renderFaceYNeg( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceYNeg( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
case UP:
|
||||
renderer.renderFaceYPos( imb, x, y, z, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
renderer.renderFaceYPos( imb, pos, ExtraBlockTextures.GlassFrame.getIcon() );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -216,21 +216,21 @@ public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseT
|
||||
|
||||
private boolean isFlush( BlockQuartzGlass imb, IBlockAccess world, int x, int y, int z )
|
||||
{
|
||||
return this.isGlass( imb, world, x, y, z );
|
||||
return this.isGlass( imb, world, new BlockPos(x, y, z) );
|
||||
}
|
||||
|
||||
private boolean isGlass( BlockQuartzGlass imb, IBlockAccess world, int x, int y, int z )
|
||||
private boolean isGlass( BlockQuartzGlass imb, IBlockAccess world,BlockPos pos)
|
||||
{
|
||||
return this.isQuartzGlass( world, x, y, z ) || this.isVibrantQuartzGlass( world, x, y, z );
|
||||
return this.isQuartzGlass( world, pos ) || this.isVibrantQuartzGlass( world, pos );
|
||||
}
|
||||
|
||||
private boolean isQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
private boolean isQuartzGlass( IBlockAccess world,BlockPos pos)
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, x, y, z );
|
||||
return AEApi.instance().definitions().blocks().quartzGlass().isSameAs( world, pos );
|
||||
}
|
||||
|
||||
private boolean isVibrantQuartzGlass( IBlockAccess world, int x, int y, int z )
|
||||
private boolean isVibrantQuartzGlass( IBlockAccess world,BlockPos pos)
|
||||
{
|
||||
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, x, y, z );
|
||||
return AEApi.instance().definitions().blocks().quartzVibrantGlass().isSameAs( world, pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import appeng.block.solids.OreQuartz;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RenderQuartzOre extends BaseBlockRender<OreQuartz, AEBaseTile>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( OreQuartz blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( OreQuartz blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
super.renderInventory( blk, is, renderer, type, obj );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
|
||||
@@ -48,15 +48,15 @@ public class RenderQuartzOre extends BaseBlockRender<OreQuartz, AEBaseTile>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( OreQuartz block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( OreQuartz block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
OreQuartz blk = (OreQuartz) block;
|
||||
OreQuartz blk = block;
|
||||
blk.setEnhanceBrightness( true );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
super.renderInWorld( block, world, pos, renderer );
|
||||
blk.setEnhanceBrightness( false );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( ExtraBlockTextures.OreQuartzStone.getIcon() );
|
||||
boolean out = super.renderInWorld( block, world, x, y, z, renderer );
|
||||
boolean out = super.renderInWorld( block, world, pos, renderer );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
|
||||
return out;
|
||||
|
||||
@@ -21,19 +21,17 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.block.misc.BlockQuartzTorch;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@@ -46,10 +44,8 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
Tessellator tess = Tessellator.instance;
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
float Point3 = 7.0f / 16.0f;
|
||||
float Point13 = 10.0f / 16.0f;
|
||||
@@ -67,41 +63,39 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
float zOff = 0.0f;
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( Blocks.hopper.getDefaultState() )[0] );
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
|
||||
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
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( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
|
||||
this.renderInvBlock( EnumSet.allOf( AEPartLocation.class ), blk, is, 0xffffff, renderer );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( AEBaseBlock block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
BlockQuartzTorch blk = (BlockQuartzTorch) block;
|
||||
|
||||
IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z );
|
||||
IOrientable te = ( (IOrientableBlock) blk ).getOrientable( world, pos );
|
||||
|
||||
float Point2 = 6.0f / 16.0f;
|
||||
float Point3 = 7.0f / 16.0f;
|
||||
@@ -122,87 +116,87 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
|
||||
renderer.renderAllFaces = true;
|
||||
if( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
xOff = forward.offsetX * -( 4.0f / 16.0f );
|
||||
yOff = forward.offsetY * -( 4.0f / 16.0f );
|
||||
zOff = forward.offsetZ * -( 4.0f / 16.0f );
|
||||
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 );
|
||||
}
|
||||
|
||||
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
int r = ( x + y + z ) % 2;
|
||||
int r = ( pos.getX() + pos.getY() + pos.getZ() ) % 2;
|
||||
if( r == 0 )
|
||||
{
|
||||
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - singlePixel + xOff, renderBottom - singlePixel + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderBottom + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
super.renderInWorld( blk, 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, x, y, z, renderer );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
|
||||
renderer.setRenderBounds( Point12 - singlePixel + xOff, renderTop + yOff, Point12 - singlePixel + zOff, Point12 + xOff, renderTop + singlePixel + yOff, Point12 + zOff );
|
||||
super.renderInWorld( block, world, x, y, z, renderer );
|
||||
super.renderInWorld( blk, world, pos, renderer );
|
||||
}
|
||||
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
|
||||
blk.getRendererInstance().setTemporaryRenderIcon( renderer.getIcon( Blocks.hopper.getDefaultState() )[0] );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
|
||||
boolean out = renderer.renderStandardBlock( blk, x, y, z );
|
||||
boolean out = renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point12 + zOff, Point13 + xOff, top + yOff, Point13 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point3 + zOff, Point3 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
renderer.setRenderBounds( Point12 + xOff, bottom + yOff, Point3 + zOff, Point13 + xOff, top + yOff, Point12 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
|
||||
if( te != null )
|
||||
{
|
||||
ForgeDirection forward = te.getUp();
|
||||
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( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
case WEST:
|
||||
renderer.setRenderBounds( Point13 + xOff, bottom + yOff, bottom + zOff, 1.0, top + yOff, top + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
case NORTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, Point13 + zOff, top + xOff, top + yOff, 1.0 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
case SOUTH:
|
||||
renderer.setRenderBounds( bottom + xOff, bottom + yOff, 0, top + xOff, top + yOff, Point2 + zOff );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
case UP:
|
||||
renderer.setRenderBounds( Point2, 0, Point2, Point3, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point2, 0, Point12, Point3, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point12, 0, Point2, Point13, bottom + yOff, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point12, 0, Point12, Point13, bottom + yOff, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
case DOWN:
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point2, Point3, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point2, top + yOff, Point12, Point3, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point2, Point13, 1.0, Point3 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
renderer.setRenderBounds( Point12, top + yOff, Point12, Point13, 1.0, Point13 );
|
||||
renderer.renderStandardBlock( blk, x, y, z );
|
||||
renderer.renderStandardBlock( blk, pos );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.spatial.BlockSpatialPylon;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockSpatialPylon block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockSpatialPylon block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.BlockSpatialPylon_dim.getIcon();
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
@@ -52,20 +52,20 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockSpatialPylon imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockSpatialPylon imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
TileSpatialPylon sp = imb.getTileEntity( world, x, y, z );
|
||||
TileSpatialPylon sp = imb.getTileEntity( world, pos );
|
||||
|
||||
int displayBits = ( sp == null ) ? 0 : sp.getDisplayBits();
|
||||
ForgeDirection ori = ForgeDirection.UNKNOWN;
|
||||
EnumFacing ori = null;//AEPartLocation.INTERNAL;
|
||||
|
||||
if( displayBits != 0 )
|
||||
{
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_X )
|
||||
{
|
||||
ori = ForgeDirection.EAST;
|
||||
ori = EnumFacing.EAST;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.uvRotateEast = 1;
|
||||
@@ -91,7 +91,7 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_Y )
|
||||
{
|
||||
ori = ForgeDirection.UP;
|
||||
ori = EnumFacing.UP;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.uvRotateNorth = 3;
|
||||
@@ -103,7 +103,7 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
|
||||
else if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_Z )
|
||||
{
|
||||
ori = ForgeDirection.NORTH;
|
||||
ori = EnumFacing.NORTH;
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX )
|
||||
{
|
||||
renderer.uvRotateSouth = 1;
|
||||
@@ -125,27 +125,27 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
|
||||
BlockRenderInfo bri = imb.getRendererInstance();
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
bri.setTemporaryRenderIcons( this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.UP ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.DOWN ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.SOUTH ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.NORTH ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.EAST ), this.getBlockTextureFromSideOutside( imb, sp, displayBits, ori, ForgeDirection.WEST ) );
|
||||
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) );
|
||||
|
||||
boolean r = renderer.renderStandardBlock( imb, x, y, z );
|
||||
boolean r = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_POWERED_ENABLED ) == TileSpatialPylon.DISPLAY_POWERED_ENABLED )
|
||||
{
|
||||
int bn = 15;
|
||||
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
renderer.setBrightness( bn << 20 | bn << 4 );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
|
||||
for( ForgeDirection d : ForgeDirection.VALID_DIRECTIONS )
|
||||
for( EnumFacing d : EnumFacing.VALUES )
|
||||
{
|
||||
this.renderFace( x, y, z, imb, this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, d ), renderer, d );
|
||||
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, ForgeDirection.UP ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.DOWN ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.SOUTH ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.NORTH ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.EAST ), this.getBlockTextureFromSideInside( imb, sp, displayBits, ori, ForgeDirection.WEST ) );
|
||||
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, x, y, z );
|
||||
renderer.renderStandardBlock( imb, pos );
|
||||
}
|
||||
|
||||
bri.setTemporaryRenderIcon( null );
|
||||
@@ -154,22 +154,22 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
return r;
|
||||
}
|
||||
|
||||
renderer.overrideBlockTexture = imb.getIcon( 0, 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
renderer.overrideBlockTexture = renderer.getIcon( world.getBlockState( pos ) )[0];//imb.getIcon( 0, 0 );
|
||||
boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.BlockSpatialPylon_dim.getIcon();
|
||||
result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private IIcon getBlockTextureFromSideOutside( BlockSpatialPylon blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir )
|
||||
private IAESprite getBlockTextureFromSideOutside( BlockSpatialPylon blk, TileSpatialPylon sp, int displayBits, EnumFacing ori, EnumFacing dir, IRenderHelper renderer )
|
||||
{
|
||||
|
||||
if( ori == dir || ori.getOpposite() == dir )
|
||||
{
|
||||
return blk.getRendererInstance().getTexture( dir );
|
||||
return blk.getRendererInstance().getTexture( AEPartLocation.fromFacing( dir ) );
|
||||
}
|
||||
|
||||
if( ( displayBits & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_MIDDLE )
|
||||
@@ -185,10 +185,10 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
return ExtraBlockTextures.BlockSpatialPylonE.getIcon();
|
||||
}
|
||||
|
||||
return blk.getIcon( 0, 0 );
|
||||
return renderer.getIcon( blk.getDefaultState() )[0];// blk.getIcon( 0, 0 );
|
||||
}
|
||||
|
||||
private IIcon getBlockTextureFromSideInside( BlockSpatialPylon blk, TileSpatialPylon sp, int displayBits, ForgeDirection ori, ForgeDirection dir )
|
||||
private IAESprite getBlockTextureFromSideInside( BlockSpatialPylon blk, TileSpatialPylon sp, int displayBits, EnumFacing ori, EnumFacing dir, IRenderHelper renderer )
|
||||
{
|
||||
boolean good = ( displayBits & TileSpatialPylon.DISPLAY_ENABLED ) == TileSpatialPylon.DISPLAY_ENABLED;
|
||||
|
||||
@@ -210,6 +210,6 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
|
||||
return good ? ExtraBlockTextures.BlockSpatialPylonE_dim.getIcon() : ExtraBlockTextures.BlockSpatialPylonE_red.getIcon();
|
||||
}
|
||||
|
||||
return blk.getIcon( 0, 0 );
|
||||
return renderer.getIcon( blk.getDefaultState() )[0];//blk.getIcon( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,18 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.BaseIcon;
|
||||
import appeng.client.texture.FullIcon;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@@ -38,18 +43,20 @@ public class RenderTinyTNT extends BaseBlockRender<BlockTinyTNT, AEBaseTile>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockTinyTNT block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockTinyTNT block, ItemStack is, IRenderHelper renderer, ItemRenderType type, 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( BlockTinyTNT imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockTinyTNT imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
renderer.setOverrideBlockTexture( new FullIcon( Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( Blocks.tnt.getDefaultState() )) );
|
||||
renderer.renderAllFaces = true;
|
||||
renderer.setRenderBounds( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
|
||||
boolean out = super.renderInWorld( imb, world, x, y, z, renderer );
|
||||
boolean out = super.renderInWorld( imb, world, pos, renderer );
|
||||
renderer.renderAllFaces = false;
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -19,18 +19,30 @@
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BusRenderHelper;
|
||||
import appeng.client.render.BusRenderer;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.facade.IFacadeItem;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBus>
|
||||
@@ -42,22 +54,81 @@ public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockCableBus blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockCableBus blk, ItemStack item, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
// nothing.
|
||||
renderer.setColorOpaque_F( 1, 1, 1 );
|
||||
renderer.setBrightness( 14 << 20 | 14 << 4 );
|
||||
|
||||
BusRenderer.INSTANCE.renderer = renderer; // post data to this...
|
||||
BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 );
|
||||
BusRenderHelper.INSTANCE.setTexture( null );
|
||||
BusRenderHelper.INSTANCE.setInvColor( 0xffffff );
|
||||
renderer.blockAccess = ClientHelper.proxy.getWorld();
|
||||
|
||||
BusRenderHelper.INSTANCE.setOrientation( EnumFacing.EAST, EnumFacing.UP, EnumFacing.SOUTH );
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
if( item.getItem() instanceof IFacadeItem )
|
||||
{
|
||||
IFacadeItem fi = (IFacadeItem) item.getItem();
|
||||
IFacadePart fp = fi.createPartFromItemStack( item, AEPartLocation.SOUTH );
|
||||
|
||||
if( fp != null )
|
||||
{
|
||||
fp.renderInventory( BusRenderHelper.INSTANCE, renderer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IPart ip = this.getRenderer( item, (IPartItem) item.getItem() );
|
||||
if( ip != null )
|
||||
{
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
int depth = ip.cableConnectionRenderTo();
|
||||
}
|
||||
|
||||
ip.renderInventory( BusRenderHelper.INSTANCE, renderer );
|
||||
}
|
||||
}
|
||||
|
||||
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockCableBus block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public IPart getRenderer( ItemStack is, IPartItem c )
|
||||
{
|
||||
AEBaseTile t = block.getTileEntity( world, x, y, z );
|
||||
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( BlockCableBus block, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
AEBaseTile t = block.getTileEntity( world, pos );
|
||||
|
||||
if( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.INSTANCE.renderer = renderer; // post data to this...
|
||||
BusRenderer.INSTANCE.renderer.renderAllFaces = true;
|
||||
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
|
||||
BusRenderer.INSTANCE.renderer.overrideBlockTexture = renderer.overrideBlockTexture;
|
||||
( (TileCableBus) t ).cb.renderStatic( x, y, z );
|
||||
( (TileCableBus) t ).cb.renderStatic();
|
||||
BusRenderer.INSTANCE.renderer.renderAllFaces = false;
|
||||
}
|
||||
|
||||
@@ -65,12 +136,12 @@ public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile( BlockCableBus block, TileCableBus t, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
|
||||
public void renderTile( BlockCableBus block, TileCableBus t, WorldRenderer tess, double x, double y, double z, float f, IRenderHelper renderer )
|
||||
{
|
||||
if( t instanceof TileCableBus )
|
||||
{
|
||||
BusRenderer.INSTANCE.renderer.overrideBlockTexture = null;
|
||||
( (TileCableBus) t ).cb.renderDynamic( x, y, z );
|
||||
t.cb.renderDynamic( x, y, z );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,18 +21,18 @@ package appeng.client.render.blocks;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.misc.BlockSecurity;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
|
||||
|
||||
@@ -45,52 +45,52 @@ public class RendererSecurity extends BaseBlockRender<BlockSecurity, TileSecurit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory( BlockSecurity block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
public void renderInventory( BlockSecurity block, ItemStack is, IRenderHelper renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.SOUTH ), block, is, 0x000000, renderer );
|
||||
|
||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
this.renderInvBlock( EnumSet.of( AEPartLocation.UP ), block, is, this.adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ), renderer );
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
super.renderInventory( block, is, renderer, type, obj );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderInWorld( BlockSecurity imb, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
public boolean renderInWorld( BlockSecurity imb, IBlockAccess world, BlockPos pos, IRenderHelper renderer )
|
||||
{
|
||||
TileSecurity sp = imb.getTileEntity( world, x, y, z );
|
||||
TileSecurity sp = imb.getTileEntity( world, pos );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
ForgeDirection up = sp.getUp();
|
||||
EnumFacing up = sp.getUp();
|
||||
|
||||
this.preRenderInWorld( imb, world, x, y, z, renderer );
|
||||
this.preRenderInWorld( imb, world, pos, renderer );
|
||||
|
||||
boolean result = renderer.renderStandardBlock( imb, x, y, z );
|
||||
boolean result = renderer.renderStandardBlock( imb, pos );
|
||||
|
||||
int b = world.getLightBrightnessForSkyBlocks( x + up.offsetX, y + up.offsetY, z + up.offsetZ, 0 );
|
||||
int b = world.getCombinedLight( pos.offset( up ), 0 );
|
||||
if( sp.isActive() )
|
||||
{
|
||||
b = 15 << 20 | 15 << 4;
|
||||
}
|
||||
|
||||
Tessellator.instance.setBrightness( b );
|
||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||
renderer.setBrightness( b );
|
||||
renderer.setColorOpaque_I( 0xffffff );
|
||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||
IIcon ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( x, y, z, imb, ico, renderer, up );
|
||||
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() )
|
||||
{
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
renderer.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( x, y, z, imb, ico, renderer, up );
|
||||
this.renderFace( pos, imb, ico, renderer, up );
|
||||
|
||||
Tessellator.instance.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
renderer.setColorOpaque_I( sp.getColor().blackVariant );
|
||||
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Dark.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||
this.renderFace( x, y, z, imb, ico, renderer, up );
|
||||
this.renderFace( pos, imb, ico, renderer, up );
|
||||
}
|
||||
|
||||
renderer.overrideBlockTexture = null;
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.client.render.effects;
|
||||
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -75,8 +75,8 @@ public class AssemblerFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
public void func_180434_a(WorldRenderer par1Tessellator, Entity p_180434_2_, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
this.time += l;
|
||||
if( this.time > 4.0 )
|
||||
{
|
||||
|
||||
@@ -20,16 +20,15 @@ package appeng.client.render.effects;
|
||||
|
||||
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
@@ -37,7 +36,7 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
public class CraftingFx extends EntityBreakingFX
|
||||
{
|
||||
|
||||
private final IIcon particleTextureIndex;
|
||||
private final TextureAtlasSprite particleTextureIndex;
|
||||
|
||||
private final int startBlkX;
|
||||
private final int startBlkY;
|
||||
@@ -52,7 +51,7 @@ public class CraftingFx extends EntityBreakingFX
|
||||
this.particleRed = 1;
|
||||
this.particleAlpha = 1.3f;
|
||||
this.particleScale = 1.5f;
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon();
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas();
|
||||
this.particleMaxAge /= 1.2;
|
||||
|
||||
this.startBlkX = MathHelper.floor_double( this.posX );
|
||||
@@ -69,8 +68,8 @@ public class CraftingFx extends EntityBreakingFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float partialTick, float x, float y, float z, float rx, float rz )
|
||||
{
|
||||
public void func_180434_a(WorldRenderer par1Tessellator, Entity p_180434_2_, float partialTick, float x, float y, float z, float rx, float rz)
|
||||
{
|
||||
if( partialTick < 0 || partialTick > 1 )
|
||||
{
|
||||
return;
|
||||
@@ -105,11 +104,11 @@ public class CraftingFx extends EntityBreakingFX
|
||||
}
|
||||
}
|
||||
|
||||
public void fromItem( ForgeDirection d )
|
||||
public void fromItem( AEPartLocation d )
|
||||
{
|
||||
this.posX += 0.2 * d.offsetX;
|
||||
this.posY += 0.2 * d.offsetY;
|
||||
this.posZ += 0.2 * d.offsetZ;
|
||||
this.posX += 0.2 * d.xOffset;
|
||||
this.posY += 0.2 * d.yOffset;
|
||||
this.posZ += 0.2 * d.zOffset;
|
||||
this.particleScale *= 0.8f;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,15 @@ package appeng.client.render.effects;
|
||||
|
||||
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
@@ -37,7 +36,7 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
public class EnergyFx extends EntityBreakingFX
|
||||
{
|
||||
|
||||
private final IIcon particleTextureIndex;
|
||||
private final TextureAtlasSprite particleTextureIndex;
|
||||
|
||||
private final int startBlkX;
|
||||
private final int startBlkY;
|
||||
@@ -52,7 +51,7 @@ public class EnergyFx extends EntityBreakingFX
|
||||
this.particleRed = 255;
|
||||
this.particleAlpha = 1.4f;
|
||||
this.particleScale = 3.5f;
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon();
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockEnergyParticle.getIcon().getAtlas();
|
||||
|
||||
this.startBlkX = MathHelper.floor_double( this.posX );
|
||||
this.startBlkY = MathHelper.floor_double( this.posY );
|
||||
@@ -68,8 +67,8 @@ public class EnergyFx extends EntityBreakingFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
|
||||
{
|
||||
public void func_180434_a(WorldRenderer par1Tessellator, Entity p_180434_2_, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
@@ -95,11 +94,11 @@ public class EnergyFx extends EntityBreakingFX
|
||||
}
|
||||
}
|
||||
|
||||
public void fromItem( ForgeDirection d )
|
||||
public void fromItem( AEPartLocation d )
|
||||
{
|
||||
this.posX += 0.2 * d.offsetX;
|
||||
this.posY += 0.2 * d.offsetY;
|
||||
this.posZ += 0.2 * d.offsetZ;
|
||||
this.posX += 0.2 * d.xOffset;
|
||||
this.posY += 0.2 * d.yOffset;
|
||||
this.posZ += 0.2 * d.zOffset;
|
||||
this.particleScale *= 0.8f;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
@@ -83,8 +84,8 @@ public class LightningFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator tess, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
public void func_180434_a(WorldRenderer tess, Entity p_180434_2_, float l, float rX, float rY, float rZ, float rYZ, float rXY )
|
||||
{
|
||||
float j = 1.0f;
|
||||
tess.setColorRGBA_F( this.particleRed * j * 0.9f, this.particleGreen * j * 0.95f, this.particleBlue * j, this.particleAlpha );
|
||||
if( this.particleAge == 3 )
|
||||
@@ -201,7 +202,7 @@ public class LightningFX extends EntityFX
|
||||
this.hasData = false;
|
||||
}
|
||||
|
||||
private void draw( Tessellator tess, double[] a, double[] b, double f6, double f8 )
|
||||
private void draw( WorldRenderer tess, double[] a, double[] b, double f6, double f8 )
|
||||
{
|
||||
if( this.hasData )
|
||||
{
|
||||
|
||||
@@ -20,19 +20,19 @@ package appeng.client.render.effects;
|
||||
|
||||
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
public class MatterCannonFX extends EntityBreakingFX
|
||||
{
|
||||
|
||||
private final IIcon particleTextureIndex;
|
||||
private final TextureAtlasSprite particleTextureIndex;
|
||||
|
||||
public MatterCannonFX( World par1World, double par2, double par4, double par6, Item par8Item )
|
||||
{
|
||||
@@ -46,11 +46,11 @@ public class MatterCannonFX extends EntityBreakingFX
|
||||
this.motionX = 0.0f;
|
||||
this.motionY = 0.0f;
|
||||
this.motionZ = 0.0f;
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockMatterCannonParticle.getIcon();
|
||||
this.particleTextureIndex = ExtraBlockTextures.BlockMatterCannonParticle.getIcon().getAtlas();
|
||||
this.noClip = true;
|
||||
}
|
||||
|
||||
public void fromItem( ForgeDirection d )
|
||||
public void fromItem( AEPartLocation d )
|
||||
{
|
||||
this.particleScale *= 1.2f;
|
||||
}
|
||||
@@ -70,8 +70,8 @@ public class MatterCannonFX extends EntityBreakingFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle( Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7 )
|
||||
{
|
||||
public void func_180434_a(WorldRenderer par1Tessellator, Entity p_180434_2_, float par2, float par3, float par4, float par5, float par6, float par7 )
|
||||
{
|
||||
float f6 = this.particleTextureIndex.getMinU();
|
||||
float f7 = this.particleTextureIndex.getMaxU();
|
||||
float f8 = this.particleTextureIndex.getMinV();
|
||||
|
||||
@@ -21,9 +21,8 @@ package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
|
||||
@@ -1,81 +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.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
|
||||
|
||||
public class ItemEncodedPatternRenderer implements IItemRenderer
|
||||
{
|
||||
|
||||
final RenderItem ri = new RenderItem();
|
||||
boolean recursive;
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
|
||||
|
||||
if( !this.recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
|
||||
{
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
||||
if( iep.getOutput( item ) != null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
this.recursive = true;
|
||||
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
||||
|
||||
ItemStack is = iep.getOutput( item );
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
this.ri.renderItemAndEffectIntoGUI( mc.fontRenderer, mc.getTextureManager(), is, 0, 0 );
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glPopAttrib();
|
||||
|
||||
this.recursive = false;
|
||||
}
|
||||
}
|
||||
@@ -1,129 +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.minecraft.util.IIcon;
|
||||
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( ItemStack item, ItemRenderType type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
|
||||
{
|
||||
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
if( item.getItemDamage() >= 20 )
|
||||
{
|
||||
par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
|
||||
}
|
||||
|
||||
float f4 = par2Icon.getMinU();
|
||||
float f5 = par2Icon.getMaxU();
|
||||
float f6 = par2Icon.getMinV();
|
||||
float f7 = par2Icon.getMaxV();
|
||||
float f12 = 0.0625F;
|
||||
|
||||
ItemPaintBall ipb = (ItemPaintBall) item.getItem();
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
|
||||
AEColor col = ipb.getColor( item );
|
||||
|
||||
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
int r = ( colorValue >> 16 ) & 0xff;
|
||||
int g = ( colorValue >> 8 ) & 0xff;
|
||||
int b = ( colorValue ) & 0xff;
|
||||
|
||||
int full = (int) ( 255 * 0.3 );
|
||||
float fail = 0.7f;
|
||||
|
||||
if( item.getItemDamage() >= 20 )
|
||||
{
|
||||
GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -19,22 +19,11 @@
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
|
||||
|
||||
public class ToolBiometricCardRender implements IItemRenderer
|
||||
public class ToolBiometricCardRender implements IItemRenderer // TileEntityItemStackRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
@@ -52,7 +41,8 @@ public class ToolBiometricCardRender implements IItemRenderer
|
||||
@Override
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
/*
|
||||
TextureAtlasSprite par2Icon = item.getIconIndex();
|
||||
|
||||
float f4 = par2Icon.getMinU();
|
||||
float f5 = par2Icon.getMaxU();
|
||||
@@ -154,5 +144,6 @@ public class ToolBiometricCardRender implements IItemRenderer
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,9 @@
|
||||
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.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
|
||||
|
||||
public class ToolColorApplicatorRender implements IItemRenderer
|
||||
{
|
||||
@@ -50,7 +41,8 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
@Override
|
||||
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
|
||||
{
|
||||
IIcon par2Icon = item.getIconIndex();
|
||||
/*
|
||||
TextureAtlasSprite par2Icon = item.getIconIndex();
|
||||
|
||||
float f4 = par2Icon.getMinU();
|
||||
float f5 = par2Icon.getMaxU();
|
||||
@@ -101,9 +93,9 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
IIcon dark = ExtraItemTextures.ToolColorApplicatorTip_Dark.getIcon();
|
||||
IIcon med = ExtraItemTextures.ToolColorApplicatorTip_Medium.getIcon();
|
||||
IIcon light = ExtraItemTextures.ToolColorApplicatorTip_Light.getIcon();
|
||||
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 )
|
||||
@@ -158,5 +150,6 @@ public class ToolColorApplicatorRender implements IItemRenderer
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user