Skip to content

Commit 30e91f2

Browse files
committed
Merge remote-tracking branch 'origin/1.20' into 1.21
2 parents beccbef + 66ef304 commit 30e91f2

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

common/src/main/java/org/embeddedt/modernfix/world/IntegratedWatchdog.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public void run() {
3838
return;
3939
}
4040
if(lastTickStart.getAsLong() < 0) {
41+
try {
42+
Thread.sleep(10000);
43+
} catch(InterruptedException ignored) {}
4144
continue;
4245
}
4346
long curTime = Util.getMillis();

neoforge/src/main/java/org/embeddedt/modernfix/neoforge/dynresources/ModelBakeEventHelper.java

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.google.common.collect.ForwardingMap;
44
import com.google.common.collect.ImmutableSet;
5+
import com.google.common.collect.Iterators;
56
import com.google.common.collect.Sets;
67
import com.google.common.graph.GraphBuilder;
78
import com.google.common.graph.MutableGraph;
@@ -151,6 +152,11 @@ public boolean containsKey(@Nullable Object key) {
151152
return ourModelLocations.contains(key) || super.containsKey(key);
152153
}
153154

155+
@Override
156+
public Set<Entry<ModelResourceLocation, BakedModel>> entrySet() {
157+
return new DynamicModelEntrySet(this, ourModelLocations);
158+
}
159+
154160
@Override
155161
public void replaceAll(BiFunction<? super ModelResourceLocation, ? super BakedModel, ? extends BakedModel> function) {
156162
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 void replaceAll(BiFunction<? super ModelResourceLocation, ? super BakedMo
178184
}
179185
};
180186
}
187+
188+
private static class DynamicModelEntrySet extends AbstractSet<Map.Entry<ModelResourceLocation, BakedModel>> {
189+
private final Map<ModelResourceLocation, BakedModel> modelRegistry;
190+
private final Set<ModelResourceLocation> modelLocations;
191+
192+
private DynamicModelEntrySet(Map<ModelResourceLocation, BakedModel> modelRegistry, Set<ModelResourceLocation> modelLocations) {
193+
this.modelRegistry = modelRegistry;
194+
this.modelLocations = modelLocations;
195+
}
196+
197+
@Override
198+
public Iterator<Map.Entry<ModelResourceLocation, BakedModel>> iterator() {
199+
return Iterators.transform(Iterators.unmodifiableIterator(this.modelLocations.iterator()), DynamicModelEntry::new);
200+
}
201+
202+
@Override
203+
public boolean contains(Object o) {
204+
if(o instanceof Map.Entry entry) {
205+
return modelRegistry.containsKey(entry.getKey());
206+
} else {
207+
return false;
208+
}
209+
}
210+
211+
@Override
212+
public int size() {
213+
return modelRegistry.size();
214+
}
215+
216+
@Override
217+
public boolean removeAll(Collection<?> c) {
218+
throw new UnsupportedOperationException();
219+
}
220+
221+
private class DynamicModelEntry implements Map.Entry<ModelResourceLocation, BakedModel> {
222+
private final ModelResourceLocation location;
223+
224+
private DynamicModelEntry(ModelResourceLocation location) {
225+
this.location = location;
226+
}
227+
228+
@Override
229+
public ModelResourceLocation getKey() {
230+
return this.location;
231+
}
232+
233+
@Override
234+
public BakedModel getValue() {
235+
return modelRegistry.get(this.location);
236+
}
237+
238+
@Override
239+
public BakedModel setValue(BakedModel value) {
240+
return modelRegistry.put(this.location, value);
241+
}
242+
}
243+
}
181244
}

neoforge/src/main/resources/META-INF/neoforge.mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ side = "BOTH"
6464
modId = "jei"
6565
type = "optional"
6666
# This version range declares a minimum of the current minecraft version up to but not including the next major version
67-
versionRange = "[13,)"
67+
versionRange = "[15.8.0.11,)"
6868
ordering = "BEFORE"
6969
side = "CLIENT"

0 commit comments

Comments
 (0)