1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-14 12:10:30 +00:00

Merge pull request #463 from josephcsible/ComputerCraft/notnull

Remove some unnecessary null checks
This commit is contained in:
SquidDev 2017-11-14 22:58:36 +00:00
commit 5253ab3e58

View File

@ -116,20 +116,12 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
// Setup the transform // Setup the transform
Vec3d offset; Vec3d offset;
float yaw; float yaw;
if( turtle != null )
{
offset = turtle.getRenderOffset( f ); offset = turtle.getRenderOffset( f );
yaw = turtle.getRenderYaw( f ); yaw = turtle.getRenderYaw( f );
}
else
{
offset = new Vec3d( 0.0, 0.0, 0.0 );
yaw = 0.0f;
}
GlStateManager.translate( posX + offset.x, posY + offset.y, posZ + offset.z ); GlStateManager.translate( posX + offset.x, posY + offset.y, posZ + offset.z );
// Render the label // Render the label
IComputer computer = (turtle != null) ? turtle.getComputer() : null; IComputer computer = turtle.getComputer();
String label = (computer != null) ? computer.getLabel() : null; String label = (computer != null) ? computer.getLabel() : null;
if( label != null ) if( label != null )
{ {
@ -145,18 +137,9 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
int colour; int colour;
ComputerFamily family; ComputerFamily family;
ResourceLocation overlay; ResourceLocation overlay;
if( turtle != null )
{
colour = turtle.getColour(); colour = turtle.getColour();
family = turtle.getFamily(); family = turtle.getFamily();
overlay = turtle.getOverlay(); overlay = turtle.getOverlay();
}
else
{
colour = -1;
family = ComputerFamily.Normal;
overlay = null;
}
renderModel( state, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } ); renderModel( state, getTurtleModel( family, colour != -1 ), colour == -1 ? null : new int[] { colour } );
@ -183,12 +166,9 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
} }
// Render the upgrades // Render the upgrades
if( turtle != null )
{
renderUpgrade( state, turtle, TurtleSide.Left, f ); renderUpgrade( state, turtle, TurtleSide.Left, f );
renderUpgrade( state, turtle, TurtleSide.Right, f ); renderUpgrade( state, turtle, TurtleSide.Right, f );
} }
}
finally finally
{ {
GlStateManager.popMatrix(); GlStateManager.popMatrix();