|
44 | 44 | import org.spongepowered.asm.mixin.Mixin; |
45 | 45 | import org.spongepowered.asm.mixin.Mutable; |
46 | 46 | import org.spongepowered.asm.mixin.Shadow; |
47 | | -import org.spongepowered.asm.mixin.injection.At; |
48 | | -import org.spongepowered.asm.mixin.injection.Inject; |
49 | | -import org.spongepowered.asm.mixin.injection.ModifyArg; |
50 | | -import org.spongepowered.asm.mixin.injection.Redirect; |
51 | 47 | import org.spongepowered.asm.mixin.injection.*; |
52 | 48 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
53 | 49 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
@@ -179,7 +175,7 @@ private Object captureMissingModel(Object model) { |
179 | 175 |
|
180 | 176 | @Inject(method = "loadModel", at = @At(value = "HEAD"), cancellable = true) |
181 | 177 | private void ignoreNonFabricModel(ResourceLocation modelLocation, CallbackInfo ci) throws Exception { |
182 | | - if(this.inTextureGatheringPass && !this.forceLoadModel && !this.injectedModels.contains(modelLocation)) { |
| 178 | + if(this.inTextureGatheringPass && this.blockStateFiles != null && !this.forceLoadModel && !this.injectedModels.contains(modelLocation)) { |
183 | 179 | // Custom model processor, try to avoid loading unwrapped models |
184 | 180 | // First add this to the list of models to scan for textures |
185 | 181 | ResourceLocation blockStateLocation = null; |
@@ -210,7 +206,7 @@ private void ignoreNonFabricModel(ResourceLocation modelLocation, CallbackInfo c |
210 | 206 | this.cacheAndQueueDependencies(modelLocation, this.missingModel); |
211 | 207 | this.forceLoadModel = false; |
212 | 208 | if(this.smallLoadingCache.get(modelLocation) != this.missingModel) { |
213 | | - /* probably a wrapped model, allow it to load normally */ |
| 209 | + // probably a wrapped model, allow it to load normally |
214 | 210 | isWrappedModel = true; |
215 | 211 | } |
216 | 212 | this.smallLoadingCache.clear(); |
@@ -344,6 +340,8 @@ private Object getMissingModel(Map map, Object rl) { |
344 | 340 |
|
345 | 341 | @ModifyVariable(method = "cacheAndQueueDependencies", at = @At("HEAD"), argsOnly = true) |
346 | 342 | private UnbakedModel fireUnbakedEvent(UnbakedModel model, ResourceLocation location) { |
| 343 | + if(this.inTextureGatheringPass) |
| 344 | + return model; |
347 | 345 | for(ModernFixClientIntegration integration : ModernFixClient.CLIENT_INTEGRATIONS) { |
348 | 346 | try { |
349 | 347 | model = integration.onUnbakedModelLoad(location, model, (ModelBakery)(Object)this); |
|
0 commit comments