Merge remote-tracking branch 'origin/1.20' into 1.21
This commit is contained in:
commit
30e91f2056
|
|
@ -38,6 +38,9 @@ public class IntegratedWatchdog extends Thread {
|
|||
return;
|
||||
}
|
||||
if(lastTickStart.getAsLong() < 0) {
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch(InterruptedException ignored) {}
|
||||
continue;
|
||||
}
|
||||
long curTime = Util.getMillis();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.neoforge.dynresources;
|
|||
|
||||
import com.google.common.collect.ForwardingMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.graph.GraphBuilder;
|
||||
import com.google.common.graph.MutableGraph;
|
||||
|
|
@ -151,6 +152,11 @@ public class ModelBakeEventHelper {
|
|||
return ourModelLocations.contains(key) || super.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<ModelResourceLocation, BakedModel>> entrySet() {
|
||||
return new DynamicModelEntrySet(this, ourModelLocations);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceAll(BiFunction<? super ModelResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
|
||||
ModernFix.LOGGER.warn("Mod '{}' is calling replaceAll on the model registry. Some hacks will be used to keep this fast, but they may not be 100% compatible.", modId);
|
||||
|
|
@ -178,4 +184,61 @@ public class ModelBakeEventHelper {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static class DynamicModelEntrySet extends AbstractSet<Map.Entry<ModelResourceLocation, BakedModel>> {
|
||||
private final Map<ModelResourceLocation, BakedModel> modelRegistry;
|
||||
private final Set<ModelResourceLocation> modelLocations;
|
||||
|
||||
private DynamicModelEntrySet(Map<ModelResourceLocation, BakedModel> modelRegistry, Set<ModelResourceLocation> modelLocations) {
|
||||
this.modelRegistry = modelRegistry;
|
||||
this.modelLocations = modelLocations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Map.Entry<ModelResourceLocation, BakedModel>> iterator() {
|
||||
return Iterators.transform(Iterators.unmodifiableIterator(this.modelLocations.iterator()), DynamicModelEntry::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if(o instanceof Map.Entry entry) {
|
||||
return modelRegistry.containsKey(entry.getKey());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return modelRegistry.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private class DynamicModelEntry implements Map.Entry<ModelResourceLocation, BakedModel> {
|
||||
private final ModelResourceLocation location;
|
||||
|
||||
private DynamicModelEntry(ModelResourceLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getKey() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel getValue() {
|
||||
return modelRegistry.get(this.location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BakedModel setValue(BakedModel value) {
|
||||
return modelRegistry.put(this.location, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,6 @@ side = "BOTH"
|
|||
modId = "jei"
|
||||
type = "optional"
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange = "[13,)"
|
||||
versionRange = "[15.8.0.11,)"
|
||||
ordering = "BEFORE"
|
||||
side = "CLIENT"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user