From 076b454c8f1aa3d881e84d62011b47e02c22bb5a Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Wed, 6 Oct 2021 18:40:33 +0100 Subject: [PATCH] Also convert the turtle model key to a record --- .../client/render/TurtleSmartItemModel.java | 54 +++---------------- 1 file changed, 8 insertions(+), 46 deletions(-) diff --git a/src/main/java/dan200/computercraft/client/render/TurtleSmartItemModel.java b/src/main/java/dan200/computercraft/client/render/TurtleSmartItemModel.java index 528c0a223..dc6022b4c 100644 --- a/src/main/java/dan200/computercraft/client/render/TurtleSmartItemModel.java +++ b/src/main/java/dan200/computercraft/client/render/TurtleSmartItemModel.java @@ -5,7 +5,6 @@ */ package dan200.computercraft.client.render; -import com.google.common.base.Objects; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Transformation; import dan200.computercraft.api.client.TransformedModel; @@ -50,52 +49,15 @@ public class TurtleSmartItemModel implements BakedModel flip = new Transformation( stack.last().pose() ); } - private static class TurtleModelCombination + private static record TurtleModelCombination( + boolean colour, + ITurtleUpgrade leftUpgrade, + ITurtleUpgrade rightUpgrade, + ResourceLocation overlay, + boolean christmas, + boolean flip + ) { - final boolean colour; - final ITurtleUpgrade leftUpgrade; - final ITurtleUpgrade rightUpgrade; - final ResourceLocation overlay; - final boolean christmas; - final boolean flip; - - TurtleModelCombination( boolean colour, ITurtleUpgrade leftUpgrade, ITurtleUpgrade rightUpgrade, ResourceLocation overlay, boolean christmas, boolean flip ) - { - this.colour = colour; - this.leftUpgrade = leftUpgrade; - this.rightUpgrade = rightUpgrade; - this.overlay = overlay; - this.christmas = christmas; - this.flip = flip; - } - - @Override - public boolean equals( Object other ) - { - if( other == this ) return true; - if( !(other instanceof TurtleModelCombination otherCombo) ) return false; - - return otherCombo.colour == colour && - otherCombo.leftUpgrade == leftUpgrade && - otherCombo.rightUpgrade == rightUpgrade && - Objects.equal( otherCombo.overlay, overlay ) && - otherCombo.christmas == christmas && - otherCombo.flip == flip; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 0; - result = prime * result + (colour ? 1 : 0); - result = prime * result + (leftUpgrade != null ? leftUpgrade.hashCode() : 0); - result = prime * result + (rightUpgrade != null ? rightUpgrade.hashCode() : 0); - result = prime * result + (overlay != null ? overlay.hashCode() : 0); - result = prime * result + (christmas ? 1 : 0); - result = prime * result + (flip ? 1 : 0); - return result; - } } private final BakedModel familyModel;