Skip to content

Commit

Permalink
Use new method for getting missing model (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
lowercasebtw authored and FlorianMichael committed Oct 25, 2024
1 parent 6bdefe8 commit 5995910
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.client.render.item.ItemModels;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedModelManager;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand All @@ -39,12 +40,12 @@ public abstract class MixinItemRenderer {

@Shadow
@Final
private ItemModels models;
private BakedModelManager bakedModelManager;

@Inject(method = "getModel(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)Lnet/minecraft/client/render/model/BakedModel;", at = @At("HEAD"), cancellable = true)
private void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
cir.setReturnValue(this.models.getModel(ItemStack.EMPTY));
cir.setReturnValue(this.bakedModelManager.getMissingModel());
}
}

Expand Down

0 comments on commit 5995910

Please sign in to comment.