Get Continuity working on Fabric
This commit is contained in:
parent
1b10ed3f66
commit
9d7f897dae
|
|
@ -7,8 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple forwarding map implementation that allows layering multiple maps together, with the last layer being
|
* Simple forwarding map implementation that allows layering multiple maps together.
|
||||||
* mutable.
|
|
||||||
*/
|
*/
|
||||||
public class LayeredForwardingMap<K, V> implements Map<K, V> {
|
public class LayeredForwardingMap<K, V> implements Map<K, V> {
|
||||||
private final Map<K, V>[] layers;
|
private final Map<K, V>[] layers;
|
||||||
|
|
@ -70,7 +69,14 @@ public class LayeredForwardingMap<K, V> implements Map<K, V> {
|
||||||
public V put(K key, V value) {
|
public V put(K key, V value) {
|
||||||
if(value == null)
|
if(value == null)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
return layers[layers.length - 1].put(key, value);
|
V originalValue = null;
|
||||||
|
for(Map<K, V> map : layers) {
|
||||||
|
V oldVal = map.remove(key);
|
||||||
|
if(originalValue == null)
|
||||||
|
originalValue = oldVal;
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return originalValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -87,7 +93,9 @@ public class LayeredForwardingMap<K, V> implements Map<K, V> {
|
||||||
if(value == null)
|
if(value == null)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
layers[layers.length - 1].putAll(m);
|
for(Map<K, V> map : layers) {
|
||||||
|
map.putAll(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,10 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery {
|
||||||
} else
|
} else
|
||||||
ibakedmodel = iunbakedmodel.bake((ModelBakery) (Object) this, textureGetter, arg2, arg);
|
ibakedmodel = iunbakedmodel.bake((ModelBakery) (Object) this, textureGetter, arg2, arg);
|
||||||
}
|
}
|
||||||
|
if(ibakedmodel == null) {
|
||||||
|
ModernFix.LOGGER.error("Model {} returned null baked model", arg);
|
||||||
|
ibakedmodel = bakedMissingModel;
|
||||||
|
}
|
||||||
// TODO event
|
// TODO event
|
||||||
this.bakedCache.put(triple, ibakedmodel);
|
this.bakedCache.put(triple, ibakedmodel);
|
||||||
cir.setReturnValue(ibakedmodel);
|
cir.setReturnValue(ibakedmodel);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user