There's no Map.getOrDefault in java6.

This commit is contained in:
RainWarrior 2015-06-23 17:03:19 +03:00
parent 8f65678b99
commit 74501f509f
2 changed files with 6 additions and 3 deletions

View file

@ -52,7 +52,9 @@ public interface IPerspectiveState extends IModelState
public IModelState forPerspective(TransformType type)
{
return states.getOrDefault(type, TRSRTransformation.identity());
IModelState state = states.get(type);
if(state == null) state = TRSRTransformation.identity();
return state;
}
}
}

View file

@ -144,8 +144,9 @@ public class ItemLayerModel implements IRetexturableModel {
@Override
public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType)
{
TRSRTransformation tr = transforms.getOrDefault(cameraTransformType, TRSRTransformation.identity());
Matrix4f mat = tr == TRSRTransformation.identity() ? null : tr.getMatrix();
TRSRTransformation tr = transforms.get(cameraTransformType);
Matrix4f mat = null;
if(tr != null && tr != TRSRTransformation.identity()) mat = tr.getMatrix();
return Pair.of((IBakedModel)this, mat);
}
}