Skip to content

Commit

Permalink
Ensure that sprites isn't null
Browse files Browse the repository at this point in the history
  • Loading branch information
BluSpring committed Jul 26, 2023
1 parent 3d3186b commit e33d08b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ public BakedModel bake(ResourceLocation loc, ModelState state, Function<Material
return atlasSet;
}

@Inject(method = "bake", at = @At("HEAD"))
public void kilt$checkIfSpritesAreEmpty(ResourceLocation location, ModelState transform, CallbackInfoReturnable<BakedModel> cir) {
if (this.sprites.get() == null) {
this.sprites.set(this.atlasSet::getSprite);
}
}

@ModifyArgs(method = "bake", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/block/model/ItemModelGenerator;generateBlockModel(Ljava/util/function/Function;Lnet/minecraft/client/renderer/block/model/BlockModel;)Lnet/minecraft/client/renderer/block/model/BlockModel;"))
public void kilt$useForgeSpritesForBlockModel(Args args) {
args.set(0, this.sprites.get());
Expand Down

0 comments on commit e33d08b

Please sign in to comment.