Invisi-bucket

- Fixed filter slot display issues with Forge's multi-layered item models
This commit is contained in:
simibubi 2021-10-12 00:36:14 +02:00
parent af9d6075ff
commit d1810f5173

View file

@ -16,13 +16,14 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraftforge.client.model.ItemMultiLayerBakedModel;
public class ValueBoxRenderer { public class ValueBoxRenderer {
public static void renderItemIntoValueBox(ItemStack filter, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { public static void renderItemIntoValueBox(ItemStack filter, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer(); ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
IBakedModel modelWithOverrides = itemRenderer.getModel(filter, Minecraft.getInstance().level, null); IBakedModel modelWithOverrides = itemRenderer.getModel(filter, Minecraft.getInstance().level, null);
boolean blockItem = modelWithOverrides.isGui3d(); boolean blockItem = modelWithOverrides.isGui3d() && !(modelWithOverrides instanceof ItemMultiLayerBakedModel);
float scale = (!blockItem ? .5f : 1f) - 1 / 64f; float scale = (!blockItem ? .5f : 1f) - 1 / 64f;
float zOffset = (!blockItem ? -.225f : 0) + customZOffset(filter.getItem()); float zOffset = (!blockItem ? -.225f : 0) + customZOffset(filter.getItem());
ms.scale(scale, scale, scale); ms.scale(scale, scale, scale);