Skip to content

Commit 36673f2

Browse files
committed
Tweak dynamic resources injection point on Forge
Related: #252
1 parent 2710a02 commit 36673f2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/dynamic_resources/ModelBakeryMixin.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import java.util.*;
5353
import java.util.concurrent.TimeUnit;
5454
import java.util.function.BiConsumer;
55+
import java.util.function.Consumer;
5556
import java.util.function.Function;
5657
import java.util.stream.Stream;
5758

@@ -209,13 +210,11 @@ private void gatherModelMaterials(Set<Material> materialSet) {
209210
loadedModels.put(MISSING_MODEL_LOCATION, missingModel);
210211
}
211212

212-
@Inject(method = "uploadTextures", at = @At(value = "FIELD", target = "Lnet/minecraft/client/resources/model/ModelBakery;topLevelModels:Ljava/util/Map;", ordinal = 0), cancellable = true)
213-
private void skipBake(TextureManager resourceManager, ProfilerFiller profiler, CallbackInfoReturnable<AtlasSet> cir) {
214-
profiler.pop();
213+
@Redirect(method = "uploadTextures", at = @At(value = "INVOKE", target = "Ljava/util/Set;forEach(Ljava/util/function/Consumer;)V", ordinal = 0))
214+
private void skipBake(Set instance, Consumer consumer, TextureManager resourceManager, ProfilerFiller profiler) {
215215
// ensure missing model is a permanent override
216216
this.bakedTopLevelModels.put(MISSING_MODEL_LOCATION, this.getBakedModel(MISSING_MODEL_LOCATION, BlockModelRotation.X0_Y0, this.atlasSet::getSprite));
217217
DynamicBakedModelProvider.currentInstance = (DynamicBakedModelProvider)this.bakedTopLevelModels;
218-
cir.setReturnValue(atlasSet);
219218
}
220219

221220
/**

0 commit comments

Comments
 (0)