Cache Lighting Data.

This commit is contained in:
AlgorithmX2 2014-02-15 00:30:06 -06:00
parent ae35411d33
commit 644217baf5
15 changed files with 236 additions and 100 deletions

View file

@ -11,6 +11,7 @@ import appeng.api.AEApi;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollsionHelper; import appeng.api.parts.IPartCollsionHelper;
import appeng.api.parts.IPartRenderHelper; import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -112,23 +113,38 @@ public class BusRenderHelper implements IPartRenderHelper
} }
@Override @Override
public void useSimpliedRendering(int x, int y, int z, IPart p) public ISimplifiedBundle useSimpliedRendering(int x, int y, int z, IPart p, ISimplifiedBundle sim)
{ {
RenderBlocksWorkaround rbw = BusRenderer.instance.renderer; RenderBlocksWorkaround rbw = BusRenderer.instance.renderer;
rbw.calculations = true;
rbw.faces.clear();
bbc.started = false; if ( sim != null && rbw.similarLighting( blk, rbw.blockAccess, x, y, z, sim ) )
p.getBoxes( bbc ); {
rbw.populate( sim );
rbw.faces = EnumSet.allOf( ForgeDirection.class );
rbw.calculations = false;
rbw.useTextures = false;
setBounds( bbc.minX, bbc.minY, bbc.minZ, bbc.maxX, bbc.maxY, bbc.maxZ ); return sim;
}
else
{
rbw.calculations = true;
rbw.faces.clear();
bbr.renderBlockBounds( rbw, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az ); bbc.started = false;
rbw.renderStandardBlock( blk, x, y, z ); p.getBoxes( bbc );
rbw.faces = EnumSet.allOf( ForgeDirection.class ); setBounds( bbc.minX, bbc.minY, bbc.minZ, bbc.maxX, bbc.maxY, bbc.maxZ );
rbw.calculations = false;
rbw.useTextures = false; bbr.renderBlockBounds( rbw, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az );
rbw.renderStandardBlock( blk, x, y, z );
rbw.faces = EnumSet.allOf( ForgeDirection.class );
rbw.calculations = false;
rbw.useTextures = false;
return rbw.getLightingCache();
}
} }
@Override @Override

View file

@ -1,13 +1,16 @@
package appeng.client.render; package appeng.client.render;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.ISimplifiedBundle;
import appeng.core.AELog; import appeng.core.AELog;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -19,35 +22,112 @@ public class RenderBlocksWorkaround extends RenderBlocks
public boolean calculations = true; public boolean calculations = true;
public EnumSet<ForgeDirection> faces = EnumSet.allOf( ForgeDirection.class ); public EnumSet<ForgeDirection> faces = EnumSet.allOf( ForgeDirection.class );
private IIcon rXPos = null; private class LightingCache implements ISimplifiedBundle
private IIcon rXNeg = null; {
private IIcon rYPos = null;
private IIcon rYNeg = null;
private IIcon rZPos = null;
private IIcon rZNeg = null;
private boolean isAO = false; public IIcon rXPos;
public IIcon rXNeg;
public IIcon rYPos;
public IIcon rYNeg;
public IIcon rZPos;
public IIcon rZNeg;
private int bXPos = 0; public boolean isAO;
private int bXNeg = 0;
private int bYPos = 0;
private int bYNeg = 0;
private int bZPos = 0;
private int bZNeg = 0;
private int aoXPos[] = new int[5]; public int bXPos;
private int aoXNeg[] = new int[5]; public int bXNeg;
private int aoYPos[] = new int[5]; public int bYPos;
private int aoYNeg[] = new int[5]; public int bYNeg;
private int aoZPos[] = new int[5]; public int bZPos;
private int aoZNeg[] = new int[5]; public int bZNeg;
private float foXPos[] = new float[12]; public int aoXPos[];
private float foXNeg[] = new float[12]; public int aoXNeg[];
private float foYPos[] = new float[12]; public int aoYPos[];
private float foYNeg[] = new float[12]; public int aoYNeg[];
private float foZPos[] = new float[12]; public int aoZPos[];
private float foZNeg[] = new float[12]; public int aoZNeg[];
public float foXPos[];
public float foXNeg[];
public float foYPos[];
public float foYNeg[];
public float foZPos[];
public float foZNeg[];
public int lightHash;
public LightingCache(LightingCache secondCSrc) {
rXPos = secondCSrc.rXPos;
rXNeg = secondCSrc.rXNeg;
rYPos = secondCSrc.rYPos;
rYNeg = secondCSrc.rYNeg;
rZPos = secondCSrc.rZPos;
rZNeg = secondCSrc.rZNeg;
isAO = secondCSrc.isAO;
bXPos = secondCSrc.bXPos;
bXNeg = secondCSrc.bXNeg;
bYPos = secondCSrc.bYPos;
bYNeg = secondCSrc.bYNeg;
bZPos = secondCSrc.bZPos;
bZNeg = secondCSrc.bZNeg;
aoXPos = secondCSrc.aoXPos.clone();
aoXNeg = secondCSrc.aoXNeg.clone();
aoYPos = secondCSrc.aoYPos.clone();
aoYNeg = secondCSrc.aoYNeg.clone();
aoZPos = secondCSrc.aoZPos.clone();
aoZNeg = secondCSrc.aoZNeg.clone();
foXPos = secondCSrc.foXPos.clone();
foXNeg = secondCSrc.foXNeg.clone();
foYPos = secondCSrc.foYPos.clone();
foYNeg = secondCSrc.foYNeg.clone();
foZPos = secondCSrc.foZPos.clone();
foZNeg = secondCSrc.foZNeg.clone();
lightHash = secondCSrc.lightHash;
}
public LightingCache() {
rXPos = null;
rXNeg = null;
rYPos = null;
rYNeg = null;
rZPos = null;
rZNeg = null;
isAO = false;
bXPos = 0;
bXNeg = 0;
bYPos = 0;
bYNeg = 0;
bZPos = 0;
bZNeg = 0;
aoXPos = new int[5];
aoXNeg = new int[5];
aoYPos = new int[5];
aoYNeg = new int[5];
aoZPos = new int[5];
aoZNeg = new int[5];
foXPos = new float[12];
foXNeg = new float[12];
foYPos = new float[12];
foYNeg = new float[12];
foZPos = new float[12];
foZNeg = new float[12];
lightHash = 0;
}
};
private LightingCache lightState = new LightingCache();
public boolean isFacade = false; public boolean isFacade = false;
public boolean useTextures = true; public boolean useTextures = true;
@ -105,44 +185,44 @@ public class RenderBlocksWorkaround extends RenderBlocks
public void setTexture(IIcon ico) public void setTexture(IIcon ico)
{ {
rXPos = rXNeg = rYPos = rYNeg = rZPos = rZNeg = ico; lightState.rXPos = lightState.rXNeg = lightState.rYPos = lightState.rYNeg = lightState.rZPos = lightState.rZNeg = ico;
} }
public void setTexture(IIcon rYNeg, IIcon rYPos, IIcon rZNeg, IIcon rZPos, IIcon rXNeg, IIcon rXPos) public void setTexture(IIcon rYNeg, IIcon rYPos, IIcon rZNeg, IIcon rZPos, IIcon rXNeg, IIcon rXPos)
{ {
this.rXPos = rXPos; lightState.rXPos = rXPos;
this.rXNeg = rXNeg; lightState.rXNeg = rXNeg;
this.rYPos = rYPos; lightState.rYPos = rYPos;
this.rYNeg = rYNeg; lightState.rYNeg = rYNeg;
this.rZPos = rZPos; lightState.rZPos = rZPos;
this.rZNeg = rZNeg; lightState.rZNeg = rZNeg;
} }
public boolean renderStandardBlockNoCalculations(Block b, int x, int y, int z) public boolean renderStandardBlockNoCalculations(Block b, int x, int y, int z)
{ {
Tessellator.instance.setBrightness( bXPos ); Tessellator.instance.setBrightness( lightState.bXPos );
restoreAO( aoXPos, foXPos ); restoreAO( lightState.aoXPos, lightState.foXPos );
renderFaceXPos( b, x, y, z, useTextures ? rXPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.EAST.ordinal() ) ); renderFaceXPos( b, x, y, z, useTextures ? lightState.rXPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.EAST.ordinal() ) );
Tessellator.instance.setBrightness( bXNeg ); Tessellator.instance.setBrightness( lightState.bXNeg );
restoreAO( aoXNeg, foXNeg ); restoreAO( lightState.aoXNeg, lightState.foXNeg );
renderFaceXNeg( b, x, y, z, useTextures ? rXNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.WEST.ordinal() ) ); renderFaceXNeg( b, x, y, z, useTextures ? lightState.rXNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.WEST.ordinal() ) );
Tessellator.instance.setBrightness( bYPos ); Tessellator.instance.setBrightness( lightState.bYPos );
restoreAO( aoYPos, foYPos ); restoreAO( lightState.aoYPos, lightState.foYPos );
renderFaceYPos( b, x, y, z, useTextures ? rYPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.UP.ordinal() ) ); renderFaceYPos( b, x, y, z, useTextures ? lightState.rYPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.UP.ordinal() ) );
Tessellator.instance.setBrightness( bYNeg ); Tessellator.instance.setBrightness( lightState.bYNeg );
restoreAO( aoYNeg, foYNeg ); restoreAO( lightState.aoYNeg, lightState.foYNeg );
renderFaceYNeg( b, x, y, z, useTextures ? rYNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.DOWN.ordinal() ) ); renderFaceYNeg( b, x, y, z, useTextures ? lightState.rYNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.DOWN.ordinal() ) );
Tessellator.instance.setBrightness( bZPos ); Tessellator.instance.setBrightness( lightState.bZPos );
restoreAO( aoZPos, foZPos ); restoreAO( lightState.aoZPos, lightState.foZPos );
renderFaceZPos( b, x, y, z, useTextures ? rZPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.SOUTH.ordinal() ) ); renderFaceZPos( b, x, y, z, useTextures ? lightState.rZPos : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.SOUTH.ordinal() ) );
Tessellator.instance.setBrightness( bZNeg ); Tessellator.instance.setBrightness( lightState.bZNeg );
restoreAO( aoZNeg, foZNeg ); restoreAO( lightState.aoZNeg, lightState.foZNeg );
renderFaceZNeg( b, x, y, z, useTextures ? rZNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.NORTH.ordinal() ) ); renderFaceZNeg( b, x, y, z, useTextures ? lightState.rZNeg : getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.NORTH.ordinal() ) );
return true; return true;
} }
@ -192,16 +272,19 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
@Override @Override
public boolean renderStandardBlock(Block par1Block, int par2, int par3, int par4) public boolean renderStandardBlock(Block blk, int x, int y, int z)
{ {
try try
{ {
if ( calculations ) if ( calculations )
return super.renderStandardBlock( par1Block, par2, par3, par4 ); {
lightState.lightHash = getLightingHash( blk, this.blockAccess, x, y, z );
return super.renderStandardBlock( blk, x, y, z );
}
else else
{ {
enableAO = isAO; enableAO = lightState.isAO;
boolean out = renderStandardBlockNoCalculations( par1Block, par2, par3, par4 ); boolean out = renderStandardBlockNoCalculations( blk, x, y, z );
enableAO = false; enableAO = false;
return out; return out;
} }
@ -258,10 +341,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rXNeg = par8Icon; lightState.rXNeg = par8Icon;
saveAO( aoXNeg, foXNeg ); saveAO( lightState.aoXNeg, lightState.foXNeg );
bXNeg = getCurrentBrightness(); lightState.bXNeg = getCurrentBrightness();
} }
} }
@ -309,10 +392,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rXPos = par8Icon; lightState.rXPos = par8Icon;
saveAO( aoXPos, foXPos ); saveAO( lightState.aoXPos, lightState.foXPos );
bXPos = getCurrentBrightness(); lightState.bXPos = getCurrentBrightness();
} }
} }
@ -388,10 +471,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rYNeg = par8Icon; lightState.rYNeg = par8Icon;
saveAO( aoYNeg, foYNeg ); saveAO( lightState.aoYNeg, lightState.foYNeg );
bYNeg = getCurrentBrightness(); lightState.bYNeg = getCurrentBrightness();
} }
} }
@ -439,10 +522,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rYPos = par8Icon; lightState.rYPos = par8Icon;
saveAO( aoYPos, foYPos ); saveAO( lightState.aoYPos, lightState.foYPos );
bYPos = getCurrentBrightness(); lightState.bYPos = getCurrentBrightness();
} }
} }
@ -490,10 +573,10 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rZNeg = par8Icon; lightState.rZNeg = par8Icon;
saveAO( aoZNeg, foZNeg ); saveAO( lightState.aoZNeg, lightState.foZNeg );
bZNeg = getCurrentBrightness(); lightState.bZNeg = getCurrentBrightness();
} }
} }
@ -541,10 +624,41 @@ public class RenderBlocksWorkaround extends RenderBlocks
} }
else else
{ {
isAO = enableAO; lightState.isAO = enableAO;
rZPos = par8Icon; lightState.rZPos = par8Icon;
saveAO( aoZPos, foZPos ); saveAO( lightState.aoZPos, lightState.foZPos );
bZPos = getCurrentBrightness(); lightState.bZPos = getCurrentBrightness();
} }
} }
public boolean similarLighting(Block blk, IBlockAccess w, int x, int y, int z, ISimplifiedBundle sim)
{
int lh = getLightingHash( blk, w, x, y, z );
return ((LightingCache) sim).lightHash == lh;
}
int lightHashTmp[] = new int[7];
private int getLightingHash(Block blk, IBlockAccess w, int x, int y, int z)
{
lightHashTmp[0] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z );
lightHashTmp[1] = blk.getMixedBrightnessForBlock( this.blockAccess, x + 1, y, z );
lightHashTmp[2] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y + 1, z );
lightHashTmp[3] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z + 1 );
lightHashTmp[4] = blk.getMixedBrightnessForBlock( this.blockAccess, x - 1, y, z );
lightHashTmp[5] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y - 1, z );
lightHashTmp[6] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z - 1 );
return Arrays.hashCode( lightHashTmp );
}
public void populate(ISimplifiedBundle sim)
{
lightState = new LightingCache( (LightingCache) sim );
}
public ISimplifiedBundle getLightingCache()
{
return new LightingCache( lightState );
}
} }

View file

@ -28,6 +28,7 @@ import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollsionHelper; import appeng.api.parts.IPartCollsionHelper;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper; import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.api.parts.PartItemStack; import appeng.api.parts.PartItemStack;
import appeng.api.util.AECableType; import appeng.api.util.AECableType;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
@ -43,6 +44,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradeableHost public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradeableHost
{ {
protected ISimplifiedBundle renderCache = null;
protected AENetworkProxy proxy; protected AENetworkProxy proxy;
protected TileEntity tile = null; protected TileEntity tile = null;
protected IPartHost host = null; protected IPartHost host = null;

View file

@ -94,7 +94,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG);
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(),
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : is.getIconIndex(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : is.getIconIndex(),
CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -77,7 +77,7 @@ public class PartExportBus extends PartSharedItemBus implements IGridTickable
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -62,7 +62,7 @@ public class PartFormationPlane extends PartBasicState
boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG); boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG);
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(),
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : is.getIconIndex(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : is.getIconIndex(),
CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -98,7 +98,7 @@ public class PartImportBus extends PartSharedItemBus implements IGridTickable, I
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -23,6 +23,7 @@ import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollsionHelper; import appeng.api.parts.IPartCollsionHelper;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper; import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.ISimplifiedBundle;
import appeng.api.parts.PartItemStack; import appeng.api.parts.PartItemStack;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -30,6 +31,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartCableAnchor implements IPart public class PartCableAnchor implements IPart
{ {
protected ISimplifiedBundle renderCache = null;
ItemStack is = null; ItemStack is = null;
ForgeDirection mySide = ForgeDirection.UP; ForgeDirection mySide = ForgeDirection.UP;
@ -41,6 +43,7 @@ public class PartCableAnchor implements IPart
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
IIcon myIcon = is.getIconIndex(); IIcon myIcon = is.getIconIndex();
rh.setTexture( myIcon ); rh.setTexture( myIcon );
rh.setBounds( 7, 7, 10, 9, 9, 16 ); rh.setBounds( 7, 7, 10, 9, 9, 16 );

View file

@ -84,7 +84,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -283,7 +283,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );

View file

@ -165,7 +165,7 @@ public class PartToggleBus extends PartBasicState
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( is.getIconIndex() ); rh.setTexture( is.getIconIndex() );
rh.setBounds( 6, 6, 14, 10, 10, 16 ); rh.setBounds( 6, 6, 14, 10, 10, 16 );

View file

@ -752,7 +752,7 @@ public class PartCable extends AEBasePart implements IPartCable
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
boolean useCovered = false; boolean useCovered = false;
boolean requireDetailed = false; boolean requireDetailed = false;

View file

@ -138,7 +138,7 @@ public class PartCableCovered extends PartCable
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( getTexture( getCableColor() ) ); rh.setTexture( getTexture( getCableColor() ) );
EnumSet<ForgeDirection> sides = connections.clone(); EnumSet<ForgeDirection> sides = connections.clone();

View file

@ -156,7 +156,7 @@ public class PartCableSmart extends PartCable
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( getTexture( getCableColor() ) ); rh.setTexture( getTexture( getCableColor() ) );
EnumSet<ForgeDirection> sides = connections.clone(); EnumSet<ForgeDirection> sides = connections.clone();

View file

@ -285,7 +285,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{ {
rh.useSimpliedRendering( x, y, z, this ); renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache );
rh.setTexture( getTypeTexture() ); rh.setTexture( getTypeTexture() );
rh.setBounds( 2, 2, 14, 14, 14, 16 ); rh.setBounds( 2, 2, 14, 14, 14, 16 );