44import java .util .HashSet ;
55import java .util .Locale ;
66import java .util .Map ;
7+ import java .util .function .Supplier ;
78import java .util .stream .Collectors ;
89
910import org .apache .logging .log4j .LogManager ;
1011import org .apache .logging .log4j .Logger ;
1112
13+ import com .google .common .collect .MapMaker ;
1214import com .google .gson .Gson ;
1315import com .google .gson .JsonElement ;
1416import com .google .gson .JsonParseException ;
@@ -32,7 +34,8 @@ public class DTNAnimationLoader extends SimpleJsonResourceReloadListener {
3234
3335 public static final Logger LOGGER = LogManager .getLogger (Constants .MOD_ID + "/animationLoader" );
3436
35- private final Map <ResourceLocation , DogAnimationHolder > holderMap = new HashMap <>();
37+ private final Map <ResourceLocation , DogAnimationHolder > holderMap = new MapMaker ()
38+ .concurrencyLevel (1 ).makeMap ();
3639
3740 private DTNAnimationLoader () {
3841 super (new Gson (), createRegistryPath ());
@@ -126,7 +129,7 @@ public DogAnimationHolder getAnim(ResourceLocation id) {
126129 k -> new DogAnimationHolder (null ));
127130 }
128131
129- public static class DogAnimationHolder {
132+ public static class DogAnimationHolder implements Supplier < AnimationDefinition > {
130133
131134 private AnimationDefinition value ;
132135
@@ -141,6 +144,11 @@ public void update(AnimationDefinition newValue) {
141144 public void invalidate () {
142145 this .value = null ;
143146 }
147+
148+ @ Override
149+ public AnimationDefinition get () {
150+ return this .value ;
151+ }
144152 }
145153
146154 public static final DTNAnimationLoader INSTANCE = new DTNAnimationLoader ();
0 commit comments