1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-20 15:24:49 +00:00

Improve turtles by 200%

Every other mod has some fun feature, so should we. And yes, this was
worth the 400 lines it took to implement.
This commit is contained in:
SquidDev
2017-11-21 00:34:35 +00:00
parent ce7923d248
commit 35da60543e
4 changed files with 80 additions and 34 deletions

View File

@@ -9,7 +9,6 @@ package dan200.computercraft.client.render;
import dan200.computercraft.api.turtle.ITurtleUpgrade;
import dan200.computercraft.api.turtle.TurtleSide;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.computer.core.IComputer;
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import dan200.computercraft.shared.turtle.entity.TurtleVisionCamera;
import dan200.computercraft.shared.util.Holiday;
@@ -129,18 +128,22 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
GlStateManager.translate( posX + offset.x, posY + offset.y, posZ + offset.z );
// Render the label
IComputer computer = (turtle != null) ? turtle.getComputer() : null;
String label = (computer != null) ? computer.getLabel() : null;
String label = turtle.getLabel();
if( label != null )
{
renderLabel( turtle.getAccess().getPosition(), label );
}
// Render the turtle
GlStateManager.translate( 0.5f, 0.0f, 0.5f );
GlStateManager.translate( 0.5f, 0.5f, 0.5f );
GlStateManager.rotate( 180.0f - yaw, 0.0f, 1.0f, 0.0f );
GlStateManager.translate( -0.5f, 0.0f, -0.5f );
if( label != null && (label.equals( "Dinnerbone" ) || label.equals( "Grumm" )) )
{
// Flip the model and swap the cull face as winding order will have changed.
GlStateManager.scale( 1.0f, -1.0f, 1.0f );
GlStateManager.cullFace( GlStateManager.CullFace.FRONT );
}
GlStateManager.translate( -0.5f, -0.5f, -0.5f );
// Render the turtle
int colour;
ComputerFamily family;
@@ -192,6 +195,7 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
finally
{
GlStateManager.popMatrix();
GlStateManager.cullFace( GlStateManager.CullFace.BACK );
}
}