1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-07-03 02:23:20 +00:00

Merge pull request #293 from Lignum/fix-warning

Fix generic-related compiler warning
This commit is contained in:
Daniel Ratcliffe 2017-05-29 16:56:30 +01:00 committed by GitHub
commit 26077cbced

View File

@ -14,7 +14,9 @@
import javax.vecmath.Matrix4f; import javax.vecmath.Matrix4f;
import javax.vecmath.Point3f; import javax.vecmath.Point3f;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
public class TurtleMultiModel implements IBakedModel public class TurtleMultiModel implements IBakedModel
{ {
@ -25,7 +27,7 @@ public class TurtleMultiModel implements IBakedModel
private IBakedModel m_rightUpgradeModel; private IBakedModel m_rightUpgradeModel;
private Matrix4f m_rightUpgradeTransform; private Matrix4f m_rightUpgradeTransform;
private List<BakedQuad> m_generalQuads; private List<BakedQuad> m_generalQuads;
private List<BakedQuad>[] m_faceQuads; private Map<EnumFacing, List<BakedQuad>> m_faceQuads;
public TurtleMultiModel( IBakedModel baseModel, IBakedModel overlayModel, IBakedModel leftUpgradeModel, Matrix4f leftUpgradeTransform, IBakedModel rightUpgradeModel, Matrix4f rightUpgradeTransform ) public TurtleMultiModel( IBakedModel baseModel, IBakedModel overlayModel, IBakedModel leftUpgradeModel, Matrix4f leftUpgradeTransform, IBakedModel rightUpgradeModel, Matrix4f rightUpgradeTransform )
{ {
@ -37,7 +39,7 @@ public TurtleMultiModel( IBakedModel baseModel, IBakedModel overlayModel, IBaked
m_rightUpgradeModel = rightUpgradeModel; m_rightUpgradeModel = rightUpgradeModel;
m_rightUpgradeTransform = rightUpgradeTransform; m_rightUpgradeTransform = rightUpgradeTransform;
m_generalQuads = null; m_generalQuads = null;
m_faceQuads = new List[6]; m_faceQuads = new HashMap<EnumFacing, List<BakedQuad>>();
} }
@Nonnull @Nonnull
@ -46,7 +48,7 @@ public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
{ {
if( side != null ) if( side != null )
{ {
if( m_faceQuads[ side.ordinal() ] == null ) if( !m_faceQuads.containsKey( side ) )
{ {
ArrayList<BakedQuad> quads = new ArrayList<BakedQuad>(); ArrayList<BakedQuad> quads = new ArrayList<BakedQuad>();
if( m_overlayModel != null ) if( m_overlayModel != null )
@ -62,9 +64,9 @@ public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
quads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) ); quads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) );
} }
quads.trimToSize(); quads.trimToSize();
m_faceQuads[ side.ordinal() ] = quads; m_faceQuads.put( side, quads );
} }
return m_faceQuads[ side.ordinal() ]; return m_faceQuads.get( side );
} }
else else
{ {