Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent 1ea48fb389
commit 500fc47490
463 changed files with 5670 additions and 3757 deletions
@@ -19,6 +19,8 @@
package appeng.client.render;
import javax.annotation.Nonnull;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer;
@@ -46,7 +48,7 @@ public class AppEngRenderItem extends RenderItem
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
public IAEItemStack aeStack;
private IAEItemStack aeStack = null;
@Override
public void renderItemOverlayIntoGUI( final FontRenderer fontRenderer, final TextureManager textureManager, final ItemStack is, final int par4, final int par5, final String par6Str )
@@ -141,4 +143,14 @@ public class AppEngRenderItem extends RenderItem
return WIDE_CONVERTER.toWideReadableForm( originalSize );
}
}
public IAEItemStack getAeStack()
{
return this.aeStack;
}
public void setAeStack( @Nonnull final IAEItemStack aeStack )
{
this.aeStack = aeStack;
}
}
@@ -76,7 +76,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
setOriMap();
}
public static void setOriMap()
private static void setOriMap()
{
// pointed up...
ORIENTATION_MAP[0][3][1] = 0;
@@ -275,7 +275,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
return ( r << 16 ) | ( g << 8 ) | b;
}
public double getTesrRenderDistance()
double getTesrRenderDistance()
{
return this.renderDistance;
}
@@ -312,7 +312,7 @@ 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( final ForgeDirection in, final ForgeDirection forward, final ForgeDirection up )
static int getOrientation( final ForgeDirection in, final ForgeDirection forward, final ForgeDirection up )
{
if( in == null || in == ForgeDirection.UNKNOWN // 1
|| forward == null || forward == ForgeDirection.UNKNOWN // 2
@@ -391,7 +391,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
}
}
public IIcon firstNotNull( final IIcon... s )
private IIcon firstNotNull( final IIcon... s )
{
for( final IIcon o : s )
{
@@ -29,7 +29,7 @@ import appeng.client.texture.TmpFlippableIcon;
public class BlockRenderInfo
{
public final BaseBlockRender rendererInstance;
private final BaseBlockRender rendererInstance;
private final TmpFlippableIcon tmpTopIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpBottomIcon = new TmpFlippableIcon();
private final TmpFlippableIcon tmpSouthIcon = new TmpFlippableIcon();
@@ -132,8 +132,13 @@ public class BlockRenderInfo
return this.topIcon;
}
public boolean isValid()
boolean isValid()
{
return this.topIcon != null && this.bottomIcon != null && this.southIcon != null && this.northIcon != null && this.eastIcon != null && this.westIcon != null;
}
public BaseBlockRender getRendererInstance()
{
return this.rendererInstance;
}
}
@@ -253,7 +253,7 @@ public final class BusRenderHelper implements IPartRenderHelper
this.renderingForPass = pass;
}
public boolean renderThis()
private boolean renderThis()
{
if( this.renderingForPass == this.currentPass || this.noAlphaPass )
{
@@ -266,23 +266,23 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void normalRendering()
{
final RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
rbw.calculations = true;
rbw.useTextures = true;
final RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.getRenderer();
rbw.setCalculations( true );
rbw.setUseTextures( true );
rbw.enableAO = false;
}
@Override
public ISimplifiedBundle useSimplifiedRendering( final int x, final int y, final int z, final IBoxProvider p, final ISimplifiedBundle sim )
{
final RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.renderer;
final RenderBlocksWorkaround rbw = BusRenderer.INSTANCE.getRenderer();
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;
rbw.setFaces( EnumSet.allOf( ForgeDirection.class ) );
rbw.setCalculations( false );
rbw.setUseTextures( false );
return sim;
}
@@ -290,8 +290,8 @@ public final class BusRenderHelper implements IPartRenderHelper
{
final boolean allFaces = rbw.renderAllFaces;
rbw.renderAllFaces = true;
rbw.calculations = true;
rbw.faces.clear();
rbw.setCalculations( true );
rbw.getFaces().clear();
this.bbc.started = false;
if( p == null )
@@ -339,10 +339,10 @@ public final class BusRenderHelper implements IPartRenderHelper
rbw.renderStandardBlock( block, x, y, z );
}
rbw.faces = EnumSet.allOf( ForgeDirection.class );
rbw.setFaces( EnumSet.allOf( ForgeDirection.class ) );
rbw.renderAllFaces = allFaces;
rbw.calculations = false;
rbw.useTextures = false;
rbw.setCalculations( false );
rbw.setUseTextures( false );
return rbw.getLightingCache();
}
@@ -392,7 +392,7 @@ public final class BusRenderHelper implements IPartRenderHelper
}
}
public ForgeDirection mapRotation( final ForgeDirection dir )
private ForgeDirection mapRotation( final ForgeDirection dir )
{
final ForgeDirection forward = this.az;
final ForgeDirection up = this.ay;
@@ -518,7 +518,7 @@ public final class BusRenderHelper implements IPartRenderHelper
@Override
public void setFacesToRender( final EnumSet<ForgeDirection> faces )
{
BusRenderer.INSTANCE.renderer.renderFaces = faces;
BusRenderer.INSTANCE.getRenderer().setRenderFaces( faces );
}
@Override
@@ -51,7 +51,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();
private final RenderBlocksWorkaround renderer = new RenderBlocksWorkaround();
@Override
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
@@ -120,13 +120,13 @@ public class BusRenderer implements IItemRenderer
BusRenderHelper.INSTANCE.setBounds( 0, 0, 0, 1, 1, 1 );
BusRenderHelper.INSTANCE.setTexture( null );
BusRenderHelper.INSTANCE.setInvColor( 0xffffff );
this.renderer.blockAccess = ClientHelper.proxy.getWorld();
this.getRenderer().blockAccess = ClientHelper.proxy.getWorld();
BusRenderHelper.INSTANCE.setOrientation( ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.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;
this.getRenderer().uvRotateBottom = this.getRenderer().uvRotateEast = this.getRenderer().uvRotateNorth = this.getRenderer().uvRotateSouth = this.getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;
this.getRenderer().useInventoryTint = false;
this.getRenderer().overrideBlockTexture = null;
if( item.getItem() instanceof IFacadeItem )
{
@@ -141,7 +141,7 @@ public class BusRenderer implements IItemRenderer
if( fp != null )
{
fp.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
fp.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() );
}
}
else
@@ -155,18 +155,18 @@ public class BusRenderer implements IItemRenderer
GL11.glTranslatef( 0.0f, 0.0f, -0.04f * ( 8 - depth ) - 0.06f );
}
ip.renderInventory( BusRenderHelper.INSTANCE, this.renderer );
ip.renderInventory( BusRenderHelper.INSTANCE, this.getRenderer() );
}
}
this.renderer.uvRotateBottom = this.renderer.uvRotateEast = this.renderer.uvRotateNorth = this.renderer.uvRotateSouth = this.renderer.uvRotateTop = this.renderer.uvRotateWest = 0;
this.getRenderer().uvRotateBottom = this.getRenderer().uvRotateEast = this.getRenderer().uvRotateNorth = this.getRenderer().uvRotateSouth = this.getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@Nullable
public IPart getRenderer( final ItemStack is, final IPartItem c )
private IPart getRenderer( final ItemStack is, final IPartItem c )
{
final int id = ( Item.getIdFromItem( is.getItem() ) << Platform.DEF_OFFSET ) | is.getItemDamage();
@@ -182,4 +182,9 @@ public class BusRenderer implements IItemRenderer
return part;
}
public RenderBlocksWorkaround getRenderer()
{
return this.renderer;
}
}
@@ -48,7 +48,7 @@ public class CableRenderHelper
public void renderStatic( final CableBusContainer cableBusContainer, final IFacadeContainer iFacadeContainer )
{
final TileEntity te = cableBusContainer.getTile();
final RenderBlocksWorkaround renderer = BusRenderer.INSTANCE.renderer;
final RenderBlocksWorkaround renderer = BusRenderer.INSTANCE.getRenderer();
if( renderer.overrideBlockTexture != null )
{
@@ -73,9 +73,9 @@ public class CableRenderHelper
part.renderStatic( te.xCoord, te.yCoord, te.zCoord, BusRenderHelper.INSTANCE, renderer );
renderer.faces = EnumSet.allOf( ForgeDirection.class );
renderer.calculations = true;
renderer.useTextures = true;
renderer.setFaces( EnumSet.allOf( ForgeDirection.class ) );
renderer.setCalculations( true );
renderer.setUseTextures( true );
}
}
@@ -153,10 +153,10 @@ public class CableRenderHelper
}
}
renderer.isFacade = false;
renderer.setFacade( false );
renderer.enableAO = false;
renderer.setTexture( null );
renderer.calculations = true;
renderer.setCalculations( true );
}
}
@@ -261,7 +261,7 @@ public class CableRenderHelper
}
BusRenderHelper.INSTANCE.setOrientation( ax, ay, az );
part.renderDynamic( x, y, z, BusRenderHelper.INSTANCE, BusRenderer.INSTANCE.renderer );
part.renderDynamic( x, y, z, BusRenderHelper.INSTANCE, BusRenderer.INSTANCE.getRenderer() );
}
}
}
@@ -22,6 +22,7 @@ package appeng.client.render;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
@@ -41,18 +42,18 @@ import appeng.core.AELog;
public class RenderBlocksWorkaround extends RenderBlocks
{
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 final int[] lightHashTmp = new int[27];
private boolean calculations = true;
private EnumSet<ForgeDirection> renderFaces = EnumSet.allOf( ForgeDirection.class );
private EnumSet<ForgeDirection> faces = EnumSet.allOf( ForgeDirection.class );
private boolean isFacade = false;
private boolean useTextures = true;
private float opacity = 1.0f;
private Field fBrightness = null;
private Field fColor = null;
private LightingCache lightState = new LightingCache();
public int getCurrentColor()
private int getCurrentColor()
{
try
{
@@ -76,7 +77,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
}
}
public int getCurrentBrightness()
private int getCurrentBrightness()
{
try
{
@@ -100,7 +101,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
}
}
public void setTexture( final IIcon ico )
void setTexture( final IIcon ico )
{
this.lightState.rXPos = this.lightState.rXNeg = this.lightState.rYPos = this.lightState.rYNeg = this.lightState.rZPos = this.lightState.rZNeg = ico;
}
@@ -115,31 +116,31 @@ public class RenderBlocksWorkaround extends RenderBlocks
this.lightState.rZNeg = rZNeg;
}
public boolean renderStandardBlockNoCalculations( final Block b, final int x, final int y, final int z )
private boolean renderStandardBlockNoCalculations( final Block b, final int x, final int y, final 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() ) );
this.renderFaceXPos( b, x, y, z, this.isUseTextures() ? 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() ) );
this.renderFaceXNeg( b, x, y, z, this.isUseTextures() ? 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() ) );
this.renderFaceYPos( b, x, y, z, this.isUseTextures() ? 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() ) );
this.renderFaceYNeg( b, x, y, z, this.isUseTextures() ? 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() ) );
this.renderFaceZPos( b, x, y, z, this.isUseTextures() ? 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() ) );
this.renderFaceZNeg( b, x, y, z, this.isUseTextures() ? this.lightState.rZNeg : this.getBlockIcon( b, this.blockAccess, x, y, z, ForgeDirection.NORTH.ordinal() ) );
return true;
}
@@ -150,7 +151,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
this.brightnessBottomRight = z[1];
this.brightnessTopLeft = z[2];
this.brightnessTopRight = z[3];
Tessellator.instance.setColorRGBA_I( z[4], (int) ( this.opacity * 255 ) );
Tessellator.instance.setColorRGBA_I( z[4], (int) ( this.getOpacity() * 255 ) );
this.colorRedTopLeft = c[0];
this.colorGreenTopLeft = c[1];
@@ -193,7 +194,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
{
try
{
if( this.calculations )
if( this.isCalculations() )
{
this.lightState.lightHash = this.getLightingHash( blk, this.blockAccess, x, y, z );
return super.renderStandardBlock( blk, x, y, z );
@@ -217,14 +218,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceYNeg( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.DOWN ) )
if( this.getFaces().contains( ForgeDirection.DOWN ) )
{
if( !this.renderFaces.contains( ForgeDirection.DOWN ) )
if( !this.getRenderFaces().contains( ForgeDirection.DOWN ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -275,14 +276,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceYPos( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.UP ) )
if( this.getFaces().contains( ForgeDirection.UP ) )
{
if( !this.renderFaces.contains( ForgeDirection.UP ) )
if( !this.getRenderFaces().contains( ForgeDirection.UP ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -333,14 +334,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceZNeg( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.NORTH ) )
if( this.getFaces().contains( ForgeDirection.NORTH ) )
{
if( !this.renderFaces.contains( ForgeDirection.NORTH ) )
if( !this.getRenderFaces().contains( ForgeDirection.NORTH ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -391,14 +392,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceZPos( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.SOUTH ) )
if( this.getFaces().contains( ForgeDirection.SOUTH ) )
{
if( !this.renderFaces.contains( ForgeDirection.SOUTH ) )
if( !this.getRenderFaces().contains( ForgeDirection.SOUTH ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -449,14 +450,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceXNeg( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.WEST ) )
if( this.getFaces().contains( ForgeDirection.WEST ) )
{
if( !this.renderFaces.contains( ForgeDirection.WEST ) )
if( !this.getRenderFaces().contains( ForgeDirection.WEST ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -507,14 +508,14 @@ public class RenderBlocksWorkaround extends RenderBlocks
@Override
public void renderFaceXPos( final Block par1Block, final double par2, final double par4, final double par6, final IIcon par8Icon )
{
if( this.faces.contains( ForgeDirection.EAST ) )
if( this.getFaces().contains( ForgeDirection.EAST ) )
{
if( !this.renderFaces.contains( ForgeDirection.EAST ) )
if( !this.getRenderFaces().contains( ForgeDirection.EAST ) )
{
return;
}
if( this.isFacade )
if( this.isFacade() )
{
final Tessellator tessellator = Tessellator.instance;
@@ -586,7 +587,7 @@ public class RenderBlocksWorkaround extends RenderBlocks
final int out = ( high << 16 ) | low;
Tessellator.instance.setColorRGBA_F( r, g, b, this.opacity );
Tessellator.instance.setColorRGBA_F( r, g, b, this.getOpacity() );
Tessellator.instance.setBrightness( out );
}
@@ -626,6 +627,66 @@ public class RenderBlocksWorkaround extends RenderBlocks
return new LightingCache( this.lightState );
}
Set<ForgeDirection> getFaces()
{
return this.faces;
}
public void setFaces( final EnumSet<ForgeDirection> faces )
{
this.faces = faces;
}
private boolean isCalculations()
{
return this.calculations;
}
public void setCalculations( final boolean calculations )
{
this.calculations = calculations;
}
private boolean isUseTextures()
{
return this.useTextures;
}
void setUseTextures( final boolean useTextures )
{
this.useTextures = useTextures;
}
private boolean isFacade()
{
return this.isFacade;
}
public void setFacade( final boolean isFacade )
{
this.isFacade = isFacade;
}
private float getOpacity()
{
return this.opacity;
}
public void setOpacity( final float opacity )
{
this.opacity = opacity;
}
private EnumSet<ForgeDirection> getRenderFaces()
{
return this.renderFaces;
}
void setRenderFaces( final EnumSet<ForgeDirection> renderFaces )
{
this.renderFaces = renderFaces;
}
private static class LightingCache implements ISimplifiedBundle
{
@@ -39,7 +39,7 @@ import appeng.tile.AEBaseTile;
public class TESRWrapper extends TileEntitySpecialRenderer
{
public final RenderBlocks renderBlocksInstance = new RenderBlocks();
private final RenderBlocks renderBlocksInstance = new RenderBlocks();
private final BaseBlockRender blkRender;
private final double maxDistance;
@@ -41,10 +41,10 @@ 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 HashMap<AEBaseBlock, BaseBlockRender> blockRenders = new HashMap<AEBaseBlock, BaseBlockRender>();
private final int renderID = RenderingRegistry.getNextAvailableRenderId();
private final RenderBlocks renderer = new RenderBlocks();
boolean hasError = false;
private boolean hasError = false;
private WorldRender()
{
@@ -83,10 +83,10 @@ public final class WorldRender implements ISimpleBlockRenderingHandler
private BaseBlockRender getRender( final AEBaseBlock block )
{
return block.getRendererInstance().rendererInstance;
return block.getRendererInstance().getRendererInstance();
}
public void renderItemBlock( final ItemStack item, final ItemRenderType type, final Object[] data )
void renderItemBlock( final ItemStack item, final ItemRenderType type, final Object[] data )
{
final Block blk = Block.getBlockFromItem( item.getItem() );
if( blk instanceof AEBaseBlock )
@@ -107,7 +107,7 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
{
final TileMolecularAssembler tma = maBlock.getTileEntity( world, x, y, z );
if( BlockMolecularAssembler.booleanAlphaPass )
if( BlockMolecularAssembler.isBooleanAlphaPass() )
{
if( tma.isPowered() )
{
@@ -126,14 +126,14 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
return false;
}
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
renderer = BusRenderer.INSTANCE.renderer;
BusRenderer.INSTANCE.getRenderer().blockAccess = renderer.blockAccess;
renderer = BusRenderer.INSTANCE.getRenderer();
this.preRenderInWorld( maBlock, world, x, y, z, renderer );
tma.lightCache = BusRenderHelper.INSTANCE.useSimplifiedRendering( x, y, z, this, tma.lightCache );
tma.setLightCache( BusRenderHelper.INSTANCE.useSimplifiedRendering( x, y, z, this, tma.getLightCache() ) );
BusRenderer.INSTANCE.renderer.isFacade = true;
BusRenderer.INSTANCE.getRenderer().setFacade( true );
final IOrientable te = this.getOrientable( maBlock, world, x, y, z );
final ForgeDirection fdy = te.getUp();
@@ -192,14 +192,14 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
maBlock.getRendererInstance().setTemporaryRenderIcon( null );
renderer.renderAllFaces = false;
BusRenderer.INSTANCE.renderer.isFacade = false;
BusRenderer.INSTANCE.getRenderer().setFacade( false );
this.postRenderInWorld( renderer );
return true;
}
public void renderCableAt( final double thickness, final IBlockAccess world, final int x, final int y, final int z, final BlockMolecularAssembler block, final RenderBlocks renderer, final double pull, final boolean covered )
private void renderCableAt( final double thickness, final IBlockAccess world, final int x, final int y, final int z, final BlockMolecularAssembler block, final RenderBlocks renderer, final double pull, final boolean covered )
{
IIcon texture = null;
@@ -248,7 +248,7 @@ public class RenderBlockAssembler extends BaseBlockRender<BlockMolecularAssemble
block.getRendererInstance().setTemporaryRenderIcon( null );
}
IIcon getConnectedCable( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side, final boolean covered )
private IIcon getConnectedCable( final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection side, final boolean covered )
{
final int tileYPos = y + side.offsetY;
if( -1 < tileYPos && tileYPos < 256 )
@@ -82,9 +82,9 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
if( formed && renderer.overrideBlockTexture == null )
{
renderer = BusRenderer.INSTANCE.renderer;
renderer = BusRenderer.INSTANCE.getRenderer();
final BusRenderHelper i = BusRenderHelper.INSTANCE;
BusRenderer.INSTANCE.renderer.isFacade = true;
BusRenderer.INSTANCE.getRenderer().setFacade( true );
renderer.blockAccess = w;
i.setPass( 0 );
@@ -92,7 +92,7 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
try
{
ct.lightCache = i.useSimplifiedRendering( x, y, z, null, ct.lightCache );
ct.setLightCache( i.useSimplifiedRendering( x, y, z, null, ct.getLightCache() ) );
}
catch( final Throwable ignored )
{
@@ -131,7 +131,7 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
this.handleSide( blk, meta, x, y, z, i, renderer, ct.getForward() == side ? theIcon : nonForward, LocalEmit, isMonitor, side, w );
}
BusRenderer.INSTANCE.renderer.isFacade = false;
BusRenderer.INSTANCE.getRenderer().setFacade( false );
i.setFacesToRender( EnumSet.allOf( ForgeDirection.class ) );
i.normalRendering();
@@ -63,10 +63,10 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
{
final IAEItemStack ais = tile.getJobProgress();
if( tile.dspList == null )
if( tile.getDisplayList() == null )
{
tile.updateList = true;
tile.dspList = GLAllocation.generateDisplayLists( 1 );
tile.setUpdateList( true );
tile.setDisplayList( GLAllocation.generateDisplayLists( 1 ) );
}
if( ais != null )
@@ -74,16 +74,16 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU<BlockC
GL11.glPushMatrix();
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 );
if( tile.updateList )
if( tile.isUpdateList() )
{
tile.updateList = false;
GL11.glNewList( tile.dspList, GL11.GL_COMPILE_AND_EXECUTE );
tile.setUpdateList( false );
GL11.glNewList( tile.getDisplayList(), GL11.GL_COMPILE_AND_EXECUTE );
this.tesrRenderScreen( tess, tile, ais );
GL11.glEndList();
}
else
{
GL11.glCallList( tile.dspList );
GL11.glCallList( tile.getDisplayList() );
}
GL11.glPopMatrix();
@@ -89,7 +89,7 @@ public class RenderBlockCrank extends BaseBlockRender<BlockCrank, TileCrank>
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
GL11.glTranslated( 0.5, 0, 0.5 );
GL11.glRotatef( tile.visibleRotation, 0, 1, 0 );
GL11.glRotatef( tile.getVisibleRotation(), 0, 1, 0 );
GL11.glTranslated( -0.5, 0, -0.5 );
tess.setTranslation( -tile.xCoord, -tile.yCoord, -tile.zCoord );
@@ -169,13 +169,13 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
long absoluteProgress = 0;
if( tile.smash )
if( tile.isSmash() )
{
final long currentTime = System.currentTimeMillis();
absoluteProgress = currentTime - tile.clientStart;
absoluteProgress = currentTime - tile.getClientStart();
if( absoluteProgress > 800 )
{
tile.smash = false;
tile.setSmash( false );
}
}
@@ -261,7 +261,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
}
}
public void renderItem( ItemStack sis, final float o, final AEBaseBlock block, final AEBaseTile tile, final Tessellator tess, final double x, final double y, final double z, final float f, final RenderBlocks renderer )
private void renderItem( ItemStack sis, final float o, final AEBaseBlock block, final AEBaseTile tile, final Tessellator tess, final double x, final double y, final double z, final float f, final RenderBlocks renderer )
{
if( sis != null )
{
@@ -79,19 +79,19 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
final int lumen = 14 << 20 | 14 << 4;
for( final Splotch s : tp.getDots() )
{
if( !validSides.contains( s.side ) )
if( !validSides.contains( s.getSide() ) )
{
continue;
}
if( s.lumen )
if( s.isLumen() )
{
tess.setColorOpaque_I( s.color.whiteVariant );
tess.setColorOpaque_I( s.getColor().whiteVariant );
tess.setBrightness( lumen );
}
else
{
tess.setColorOpaque_I( s.color.mediumVariant );
tess.setColorOpaque_I( s.getColor().mediumVariant );
tess.setBrightness( brightness );
}
@@ -106,13 +106,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.getSide() == ForgeDirection.SOUTH || s.getSide() == ForgeDirection.NORTH )
{
pos_x += x;
pos_y += y;
}
else if( s.side == ForgeDirection.UP || s.side == ForgeDirection.DOWN )
else if( s.getSide() == ForgeDirection.UP || s.getSide() == ForgeDirection.DOWN )
{
pos_x += x;
pos_y += z;
@@ -126,7 +126,7 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
final IIcon ico = icoSet[s.getSeed() % icoSet.length];
switch( s.side )
switch( s.getSide() )
{
case UP:
offset = 1.0 - offset;
@@ -44,7 +44,7 @@ public class RenderBlockQuartzAccelerator extends BaseBlockRender<BlockQuartzGro
final TileEntity te = world.getTileEntity( x, y, z );
if( te instanceof TileQuartzGrowthAccelerator )
{
if( ( (TileQuartzGrowthAccelerator) te ).hasPower )
if( ( (TileQuartzGrowthAccelerator) te ).isPowered() )
{
final IIcon top_Bottom = ExtraBlockTextures.BlockQuartzGrowthAcceleratorOn.getIcon();
final IIcon side = ExtraBlockTextures.BlockQuartzGrowthAcceleratorSideOn.getIcon();
@@ -85,7 +85,7 @@ public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyC
@Override
public void renderTile( final BlockSkyChest block, final TileSkyChest skyChest, final Tessellator tess, final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer )
{
if( skyChest == null )
if( skyChest == null )
{
return;
}
@@ -109,28 +109,28 @@ public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyC
GL11.glTranslatef( -0.0F, -1.0F, -1.0F );
final long now = System.currentTimeMillis();
final long distance = now - skyChest.lastEvent;
final long distance = now - skyChest.getLastEvent();
if( skyChest.playerOpen > 0 )
if( skyChest.getPlayerOpen() > 0 )
{
skyChest.lidAngle += distance * 0.0001;
skyChest.setLidAngle( skyChest.getLidAngle() + distance * 0.0001f );
}
else
{
skyChest.lidAngle -= distance * 0.0001;
skyChest.setLidAngle( skyChest.getLidAngle() - distance * 0.0001f );
}
if( skyChest.lidAngle > 0.5f )
if( skyChest.getLidAngle() > 0.5f )
{
skyChest.lidAngle = 0.5f;
skyChest.setLidAngle( 0.5f );
}
if( skyChest.lidAngle < 0.0f )
if( skyChest.getLidAngle() < 0.0f )
{
skyChest.lidAngle = 0.0f;
skyChest.setLidAngle( 0.0f );
}
float lidAngle = skyChest.lidAngle;
float lidAngle = skyChest.getLidAngle();
lidAngle = 1.0F - lidAngle;
lidAngle = 1.0F - lidAngle * lidAngle * lidAngle;
@@ -44,8 +44,7 @@ import appeng.tile.misc.TileSkyCompass;
public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, TileSkyCompass>
{
final ModelCompass model = new ModelCompass();
float r = 0;
private final ModelCompass model = new ModelCompass();
public RenderBlockSkyCompass()
{
@@ -133,9 +132,9 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
}
}
if( cr.hasResult )
if( cr.isValidResult() )
{
if( cr.spin )
if( cr.isSpin() )
{
now %= 100000;
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
@@ -146,13 +145,13 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
{
final float offRads = rYaw / 180.0f * (float) Math.PI;
final float adjustment = (float) Math.PI * 0.74f;
this.model.renderAll( (float) this.flipidiy( cr.rad + offRads + adjustment ) );
this.model.renderAll( (float) this.flipidiy( cr.getRad() + offRads + adjustment ) );
}
else
{
final float offRads = rYaw / 180.0f * (float) Math.PI;
final float adjustment = (float) Math.PI * -0.74f;
this.model.renderAll( (float) this.flipidiy( cr.rad + offRads + adjustment ) );
this.model.renderAll( (float) this.flipidiy( cr.getRad() + offRads + adjustment ) );
}
}
}
@@ -216,16 +215,16 @@ public class RenderBlockSkyCompass extends BaseBlockRender<BlockSkyCompass, Tile
cr = new CompassResult( false, true, 0 );
}
if( cr.hasResult )
if( cr.isValidResult() )
{
if( cr.spin )
if( cr.isSpin() )
{
now %= 100000;
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
}
else
{
this.model.renderAll( (float) ( skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.rad ) : cr.rad ) );
this.model.renderAll( (float) ( skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy( cr.getRad() ) : cr.getRad() ) );
}
}
else
@@ -113,8 +113,8 @@ public class RenderBlockWireless extends BaseBlockRender<BlockWireless, TileWire
this.blk = blk;
if( tw != null )
{
this.hasChan = ( tw.clientFlags & ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG ) ) == ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG );
this.hasPower = ( tw.clientFlags & TileWireless.POWERED_FLAG ) == TileWireless.POWERED_FLAG;
this.hasChan = ( tw.getClientFlags() & ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG ) ) == ( TileWireless.POWERED_FLAG | TileWireless.CHANNEL_FLAG );
this.hasPower = ( tw.getClientFlags() & TileWireless.POWERED_FLAG ) == TileWireless.POWERED_FLAG;
final BlockRenderInfo ri = blk.getRendererInstance();
@@ -38,7 +38,7 @@ import appeng.tile.AEBaseTile;
public class RenderQuartzGlass extends BaseBlockRender<BlockQuartzGlass, AEBaseTile>
{
static byte[][][] offsets;
private static byte[][][] offsets;
public RenderQuartzGlass()
{
@@ -54,11 +54,11 @@ public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBu
if( t instanceof TileCableBus )
{
BusRenderer.INSTANCE.renderer.renderAllFaces = true;
BusRenderer.INSTANCE.renderer.blockAccess = renderer.blockAccess;
BusRenderer.INSTANCE.renderer.overrideBlockTexture = renderer.overrideBlockTexture;
( (TileCableBus) t ).cb.renderStatic( x, y, z );
BusRenderer.INSTANCE.renderer.renderAllFaces = false;
BusRenderer.INSTANCE.getRenderer().renderAllFaces = true;
BusRenderer.INSTANCE.getRenderer().blockAccess = renderer.blockAccess;
BusRenderer.INSTANCE.getRenderer().overrideBlockTexture = renderer.overrideBlockTexture;
( (TileCableBus) t ).getCableBus().renderStatic( x, y, z );
BusRenderer.INSTANCE.getRenderer().renderAllFaces = false;
}
return BusRenderHelper.INSTANCE.getItemsRendered() > 0;
@@ -69,8 +69,8 @@ public class RendererCableBus extends BaseBlockRender<BlockCableBus, TileCableBu
{
if( cableBus != null )
{
BusRenderer.INSTANCE.renderer.overrideBlockTexture = null;
cableBus.cb.renderDynamic( x, y, z );
BusRenderer.INSTANCE.getRenderer().overrideBlockTexture = null;
cableBus.getCableBus().renderDynamic( x, y, z );
}
}
}
@@ -32,10 +32,9 @@ import appeng.entity.EntityFloatingItem;
public class AssemblerFX extends EntityFX
{
final IAEItemStack item;
final EntityFloatingItem fi;
final float speed;
float time = 0;
private final EntityFloatingItem fi;
private final float speed;
private float time = 0;
public AssemblerFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final float speed, final IAEItemStack is )
{
@@ -43,7 +42,6 @@ public class AssemblerFX extends EntityFX
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
this.item = is;
this.speed = speed;
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
w.spawnEntityInWorld( this.fi );
@@ -28,9 +28,9 @@ public class LightningArcFX extends LightningFX
{
private static final Random RANDOM_GENERATOR = new Random();
final double rx;
final double ry;
final double rz;
private final double rx;
private final double ry;
private final double rz;
public LightningArcFX( final World w, final double x, final double y, final double z, final double ex, final double ey, final double ez, final double r, final double g, final double b )
{
@@ -47,17 +47,19 @@ public class LightningArcFX extends LightningFX
@Override
protected void regen()
{
final double i = 1.0 / ( this.steps - 1 );
final double i = 1.0 / ( this.getSteps() - 1 );
final double lastDirectionX = this.rx * i;
final double lastDirectionY = this.ry * i;
final double lastDirectionZ = this.rz * i;
final double len = Math.sqrt( lastDirectionX * lastDirectionX + lastDirectionY * lastDirectionY + lastDirectionZ * lastDirectionZ );
for( int s = 0; s < this.steps; s++ )
for( int s = 0; s < this.getSteps(); s++ )
{
this.Steps[s][0] = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][1] = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][2] = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
final double[][] localSteps = this.getPrecomputedSteps();
localSteps[s][0] = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
localSteps[s][1] = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
localSteps[s][2] = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
}
}
}
@@ -33,12 +33,12 @@ public class LightningFX extends EntityFX
{
private static final Random RANDOM_GENERATOR = new Random();
final int steps = this.getSteps();
final double[][] Steps;
private static final int STEPS = 5;
private final double[][] precomputedSteps;
private final double[] vertices = new double[3];
private final double[] verticesWithUV = new double[3];
float currentPoint = 0;
boolean hasData = false;
private boolean hasData = false;
public LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b )
{
@@ -49,7 +49,7 @@ public class LightningFX extends EntityFX
protected LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b, final int maxAge )
{
super( w, x, y, z, r, g, b );
this.Steps = new double[this.steps][3];
this.precomputedSteps = new double[LightningFX.STEPS][3];
this.motionX = 0;
this.motionY = 0;
this.motionZ = 0;
@@ -62,17 +62,17 @@ public class LightningFX extends EntityFX
double lastDirectionX = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionY = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
double lastDirectionZ = ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9;
for( int s = 0; s < this.steps; s++ )
for( int s = 0; s < LightningFX.STEPS; s++ )
{
this.Steps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.Steps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.precomputedSteps[s][0] = lastDirectionX = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.precomputedSteps[s][1] = lastDirectionY = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
this.precomputedSteps[s][2] = lastDirectionZ = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * 0.9 ) / 2.0;
}
}
private int getSteps()
protected int getSteps()
{
return 5;
return LightningFX.STEPS;
}
@Override
@@ -140,11 +140,11 @@ public class LightningFX extends EntityFX
double y = ( this.prevPosY + ( this.posY - this.prevPosY ) * l - interpPosY ) - offY;
double z = ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * l - interpPosZ ) - offZ;
for( int s = 0; s < this.steps; s++ )
for( int s = 0; s < LightningFX.STEPS; s++ )
{
final double xN = x + this.Steps[s][0];
final double yN = y + this.Steps[s][1];
final double zN = z + this.Steps[s][2];
final double xN = x + this.precomputedSteps[s][0];
final double yN = y + this.precomputedSteps[s][1];
final double zN = z + this.precomputedSteps[s][2];
final double xD = xN - x;
final double yD = yN - y;
@@ -169,7 +169,7 @@ public class LightningFX extends EntityFX
oz = ( xD * 0 ) - ( 1 * yD );
}
final double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( (double) this.steps - (double) s ) / this.steps ) * scale );
final double ss = Math.sqrt( ox * ox + oy * oy + oz * oz ) / ( ( ( (double) LightningFX.STEPS - (double) s ) / LightningFX.STEPS ) * scale );
ox /= ss;
oy /= ss;
oz /= ss;
@@ -217,4 +217,9 @@ public class LightningFX extends EntityFX
this.verticesWithUV[x] = b[x];
}
}
protected double[][] getPrecomputedSteps()
{
return this.precomputedSteps;
}
}
@@ -34,8 +34,8 @@ import appeng.items.misc.ItemEncodedPattern;
public class ItemEncodedPatternRenderer implements IItemRenderer
{
final RenderItem ri = new RenderItem();
boolean recursive;
private final RenderItem ri = new RenderItem();
private boolean recursive = false;
@Override
public boolean handleRenderType( final ItemStack item, final ItemRenderType type )
@@ -26,14 +26,14 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelCompass extends ModelBase
{
final ModelRenderer Ring1;
final ModelRenderer Ring2;
final ModelRenderer Ring3;
final ModelRenderer Ring4;
final ModelRenderer Middle;
final ModelRenderer Base;
private final ModelRenderer Ring1;
private final ModelRenderer Ring2;
private final ModelRenderer Ring3;
private final ModelRenderer Ring4;
private final ModelRenderer Middle;
private final ModelRenderer Base;
final ModelRenderer Pointer;
private final ModelRenderer Pointer;
public ModelCompass()
{