Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -39,40 +40,42 @@ import appeng.hooks.CompassResult;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
|
||||
|
||||
public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
{
|
||||
|
||||
float r = 0;
|
||||
final ModelCompass model = new ModelCompass();
|
||||
float r = 0;
|
||||
|
||||
public RenderBlockSkyCompass() {
|
||||
public RenderBlockSkyCompass()
|
||||
{
|
||||
super( true, 80 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||
public void renderInventory( AEBaseBlock blk, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj )
|
||||
{
|
||||
if ( type == ItemRenderType.INVENTORY )
|
||||
if( type == ItemRenderType.INVENTORY )
|
||||
{
|
||||
boolean isGood = false;
|
||||
|
||||
IInventory inv = Minecraft.getMinecraft().thePlayer.inventory;
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
if ( inv.getStackInSlot( x ) == is )
|
||||
for( int x = 0; x < inv.getSizeInventory(); x++ )
|
||||
if( inv.getStackInSlot( x ) == is )
|
||||
isGood = true;
|
||||
|
||||
if ( !isGood )
|
||||
if( !isGood )
|
||||
type = ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
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" );
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
|
||||
|
||||
if ( type == ItemRenderType.ENTITY )
|
||||
if( type == ItemRenderType.ENTITY )
|
||||
{
|
||||
GL11.glRotatef( -90.0f, 0.0f, 0.0f, 1.0f );
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
@@ -81,25 +84,25 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glRotatef( 15.3f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
GL11.glScalef( 1.0F, -1F, -1F );
|
||||
GL11.glScalef( 2.5f, 2.5f, 2.5f );
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
GL11.glTranslatef( 0.3F, -1.65F, -0.19F );
|
||||
else
|
||||
GL11.glTranslatef( 0.2F, -1.65F, -0.19F );
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
EntityPlayer p = Minecraft.getMinecraft().thePlayer;
|
||||
float rYaw = p.rotationYaw;
|
||||
|
||||
if ( type == ItemRenderType.EQUIPPED )
|
||||
if( type == ItemRenderType.EQUIPPED )
|
||||
{
|
||||
p = (EntityPlayer) obj[1];
|
||||
rYaw = p.renderYawOffset;
|
||||
@@ -110,20 +113,20 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
int z = (int) p.posZ;
|
||||
CompassResult cr = CompassManager.INSTANCE.getCompassDirection( 0, x, y, z );
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < 3; j++)
|
||||
for( int i = 0; i < 3; i++ )
|
||||
for( int j = 0; j < 3; j++ )
|
||||
CompassManager.INSTANCE.getCompassDirection( 0, x + i - 1, y, z + j - 1 );
|
||||
|
||||
if ( cr.hasResult )
|
||||
if( cr.hasResult )
|
||||
{
|
||||
if ( cr.spin )
|
||||
if( cr.spin )
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 50000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
if( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||
{
|
||||
float offRads = rYaw / 180.0f * (float) Math.PI;
|
||||
float adjustment = (float) Math.PI * 0.74f;
|
||||
@@ -140,38 +143,37 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
else
|
||||
{
|
||||
now %= 1000000;
|
||||
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 500000.0f ) * (float) Math.PI * 500.0f );
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
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(AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer)
|
||||
public boolean renderInWorld( AEBaseBlock blk, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTile(AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer)
|
||||
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float partialTick, RenderBlocks renderer )
|
||||
{
|
||||
if ( !(tile instanceof TileSkyCompass) )
|
||||
if( !( tile instanceof TileSkyCompass ) )
|
||||
return;
|
||||
|
||||
TileSkyCompass skyCompass = (TileSkyCompass) tile;
|
||||
|
||||
if ( !skyCompass.hasWorldObj() )
|
||||
if( !skyCompass.hasWorldObj() )
|
||||
return;
|
||||
|
||||
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" );
|
||||
@@ -186,33 +188,32 @@ public class RenderBlockSkyCompass extends BaseBlockRender
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
CompassResult cr = null;
|
||||
if ( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
|
||||
if( skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN )
|
||||
cr = CompassManager.INSTANCE.getCompassDirection( 0, tile.xCoord, tile.yCoord, tile.zCoord );
|
||||
else
|
||||
cr = new CompassResult( false, true, 0 );
|
||||
|
||||
if ( cr.hasResult )
|
||||
if( cr.hasResult )
|
||||
{
|
||||
if ( cr.spin )
|
||||
if( cr.spin )
|
||||
{
|
||||
now %= 100000;
|
||||
this.model.renderAll( (now / 50000.0f) * (float) Math.PI * 500.0f );
|
||||
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.rad ) : cr.rad ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
now %= 1000000;
|
||||
this.model.renderAll( (now / 500000.0f) * (float) Math.PI * 500.0f );
|
||||
this.model.renderAll( ( now / 500000.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 );
|
||||
}
|
||||
|
||||
private double flipidiy(double rad)
|
||||
private double flipidiy( double rad )
|
||||
{
|
||||
double x = Math.cos( rad );
|
||||
double y = Math.sin( rad );
|
||||
|
||||
Reference in New Issue
Block a user