Fixed Facade Code for colored items, this fixes mekanisms plastic blocks, sadly no luck with XU.

This commit is contained in:
AlgorithmX2 2014-07-27 00:49:56 -05:00
parent efae157a3b
commit e936b53fdf
3 changed files with 30 additions and 4 deletions

View file

@ -430,4 +430,18 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
{
return cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
}
int myColorMultiplier = 0xffffff;
public void setRenderColor(int color)
{
myColorMultiplier = color;
}
@Override
public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_)
{
return myColorMultiplier;
}
}

View file

@ -13,6 +13,7 @@ import appeng.api.parts.IPartCollsionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.block.AEBaseBlock;
import appeng.block.networking.BlockCableBus;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import cpw.mods.fml.relauncher.Side;
@ -352,6 +353,12 @@ public class BusRenderHelper implements IPartRenderHelper
return AEApi.instance().blocks().blockMultiPart.block();
}
public void setRenderColor(int color)
{
BlockCableBus blk = (BlockCableBus) AEApi.instance().blocks().blockMultiPart.block();
blk.setRenderColor( color );
}
public void prepareBounds(RenderBlocks renderer)
{
bbr.renderBlockBounds( renderer, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az );

View file

@ -141,10 +141,11 @@ public class FacadePart implements IFacadePart
instance.renderForPass( 1 );
}
int color = 0xffffff;
try
{
int color = ib.getColorFromItemStack( randomItem, 0 );
Tessellator.instance.setColorOpaque_I( color );
color = ib.getColorFromItemStack( randomItem, 0 );
}
catch (Throwable error)
{
@ -161,7 +162,9 @@ public class FacadePart implements IFacadePart
rbw.calculations = true;
rbw.faces = EnumSet.noneOf( ForgeDirection.class );
rbw.renderStandardBlock( blk, x, y, z );
instance.setRenderColor( color );
rbw.renderStandardBlock( instance.getBlock(), x, y, z );
instance.setRenderColor( 0xffffff );
rbw.calculations = false;
rbw.faces = calculateFaceOpenFaces( rbw.blockAccess, fc, x, y, z, side );
@ -403,11 +406,13 @@ public class FacadePart implements IFacadePart
float r = (color >> 16 & 0xff) / 255F;
float g = (color >> 8 & 0xff) / 255F;
float b = (color & 0xff) / 255F;
GL11.glColor4f( r, g, b, 1.0F );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( color );
}
catch (Throwable error)
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( 0xffffff );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );