Skip to content

Commit

Permalink
fix: Allow loadModel to auto-resolve once present on Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Feb 20, 2024
1 parent 539a798 commit d764fbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public DeferredObject<BakedModel> loadModel(final ResourceLocation identifier) {
public BakedModel resolve(ModelBakery bakery, BiFunction<ResourceLocation, Material, TextureAtlasSprite> spriteBiFunction) {
return modelBakery.getBakedTopLevelModels().get(identifier);
}

@Override
public boolean canResolve() {
return modelBakery.getBakedTopLevelModels().containsKey(identifier);
}
};
additionalModels.add(identifier);
return deferredModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ protected void set(T object) {
this.object = object;
}

public boolean canResolve() {
return canResolveFunc.get();
}

public T resolve() {
if (object == null) {
object = supplier.get();
Expand All @@ -37,7 +41,7 @@ public T resolve() {

public T get() {
if (object == null) {
if (canResolveFunc.get()) {
if (canResolve()) {
return resolve();
}

Expand Down

0 comments on commit d764fbd

Please sign in to comment.