fixed all the rendering yeees

This commit is contained in:
Ellpeck 2020-01-29 19:04:33 +01:00
parent 161e38187e
commit e8e3457b34
6 changed files with 99 additions and 82 deletions

View file

@ -1,5 +1,7 @@
package de.ellpeck.naturesaura.api.render; package de.ellpeck.naturesaura.api.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -11,6 +13,6 @@ public interface ITrinketItem {
} }
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding); void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding);
} }

View file

@ -1,6 +1,8 @@
package de.ellpeck.naturesaura.compat.jei; package de.ellpeck.naturesaura.compat.jei;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.constants.VanillaTypes;
@ -11,9 +13,14 @@ import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory; import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.SpawnEggItem; import net.minecraft.item.SpawnEggItem;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -85,31 +92,48 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
} }
float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight())); float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
float rot = (minecraft.world.getGameTime() + minecraft.getRenderPartialTicks()) % 360F; renderEntity(35, 55, 100F / size * 0.4F, 40, size * 0.5F, (LivingEntity) entity);
renderEntity(entity, 35, 28, rot, 100F / size * 0.4F, size * 0.5F);
String name = recipe.entity.getName().getFormattedText(); String name = recipe.entity.getName().getFormattedText();
minecraft.fontRenderer.drawStringWithShadow(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF); minecraft.fontRenderer.drawStringWithShadow(name, 36 - minecraft.fontRenderer.getStringWidth(name) / 2F, 55, 0xFFFFFF);
} }
private static void renderEntity(Entity entity, float x, float y, float rotation, float renderScale, float offset) { private static void renderEntity(int x, int y, float scale, float yaw, float pitch, LivingEntity entity) {
// TODO Render entity float f = (float) Math.atan(yaw / 40.0F);
/*GlStateManager.enableColorMaterial(); float f1 = (float) Math.atan(pitch / 40.0F);
GlStateManager.pushMatrix(); RenderSystem.pushMatrix();
GlStateManager.color3f(1F, 1F, 1F); RenderSystem.translatef((float) x, (float) y, 1050.0F);
GlStateManager.translatef(x, y, 50.0F); RenderSystem.scalef(1.0F, 1.0F, -1.0F);
GlStateManager.scalef(-renderScale, renderScale, renderScale); MatrixStack matrixstack = new MatrixStack();
GlStateManager.translatef(0F, offset, 0F); matrixstack.translate(0.0D, 0.0D, 1000.0D);
GlStateManager.rotatef(180.0F, 0.0F, 0.0F, 1.0F); matrixstack.scale(scale, scale, scale);
GlStateManager.rotatef(rotation, 0.0F, 1.0F, 0.0F); Quaternion quaternion = Vector3f.ZP.rotationDegrees(180.0F);
RenderHelper.enableStandardItemLighting(); Quaternion quaternion1 = Vector3f.XP.rotationDegrees(f1 * 20.0F);
Minecraft.getInstance().getRenderManager().playerViewY = 180.0F; quaternion.multiply(quaternion1);
Minecraft.getInstance().getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); matrixstack.rotate(quaternion);
GlStateManager.popMatrix(); float f2 = entity.renderYawOffset;
RenderHelper.disableStandardItemLighting(); float f3 = entity.rotationYaw;
GlStateManager.disableRescaleNormal(); float f4 = entity.rotationPitch;
GlStateManager.activeTexture(GLX.GL_TEXTURE1); float f5 = entity.prevRotationYawHead;
GlStateManager.disableTexture(); float f6 = entity.rotationYawHead;
GlStateManager.activeTexture(GLX.GL_TEXTURE0);*/ entity.renderYawOffset = 180.0F + f * 20.0F;
entity.rotationYaw = 180.0F + f * 40.0F;
entity.rotationPitch = -f1 * 20.0F;
entity.rotationYawHead = entity.rotationYaw;
entity.prevRotationYawHead = entity.rotationYaw;
EntityRendererManager entityrenderermanager = Minecraft.getInstance().getRenderManager();
quaternion1.conjugate();
entityrenderermanager.setCameraOrientation(quaternion1);
entityrenderermanager.setRenderShadow(false);
IRenderTypeBuffer.Impl buff = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
entityrenderermanager.renderEntityStatic(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, matrixstack, buff, 15728880);
buff.finish();
entityrenderermanager.setRenderShadow(true);
entity.renderYawOffset = f2;
entity.rotationYaw = f3;
entity.rotationPitch = f4;
entity.prevRotationYawHead = f5;
entity.rotationYawHead = f6;
RenderSystem.popMatrix();
} }
} }

View file

@ -1,6 +1,6 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
@ -9,6 +9,11 @@ import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer;
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import de.ellpeck.naturesaura.enchant.ModEnchantments; import de.ellpeck.naturesaura.enchant.ModEnchantments;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -110,14 +115,14 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { public void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty(); boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty();
GlStateManager.translatef(-0.15F, 0.65F, chest ? -0.195F : legs ? -0.165F : -0.1475F); matrices.translate(-0.15F, 0.65F, chest ? -0.195F : legs ? -0.165F : -0.1475F);
GlStateManager.scalef(0.25F, 0.25F, 0.25F); matrices.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotatef(180F, 1F, 0F, 0F); matrices.rotate(Vector3f.XP.rotationDegrees(180F));
//Helper.renderItemInWorld(stack); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer);
} }
} }
} }

View file

@ -1,9 +1,13 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -18,13 +22,13 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { public void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
GlStateManager.translatef(0.1F, 0.225F, armor ? -0.195F : -0.1475F); matrices.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
GlStateManager.scalef(0.15F, 0.15F, 0.15F); matrices.scale(0.3F, 0.3F, 0.3F);
GlStateManager.rotatef(180F, 1F, 0F, 0F); matrices.rotate(Vector3f.XP.rotationDegrees(180));
//Helper.renderItemInWorld(stack); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer);
} }
} }
} }

View file

@ -1,6 +1,6 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
@ -11,8 +11,10 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -22,7 +24,6 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance; import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects; import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -34,8 +35,6 @@ import java.util.List;
public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
private static final ResourceLocation RES_WORN = new ResourceLocation(NaturesAura.MOD_ID, "textures/items/shockwave_creator_player.png");
public ItemShockwaveCreator() { public ItemShockwaveCreator() {
super("shockwave_creator", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB)); super("shockwave_creator", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
} }
@ -109,24 +108,13 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { public void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) { if (type == RenderType.BODY && !isHolding) {
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
GlStateManager.translatef(-0.1675F, -0.05F, armor ? -0.195F : -0.1475F); matrices.translate(0, 0.125F, armor ? -0.195F : -0.1475F);
GlStateManager.scalef(0.021F, 0.021F, 0.021F); matrices.scale(0.3F, 0.3F, 0.3F);
matrices.rotate(Vector3f.XP.rotationDegrees(180));
GlStateManager.pushMatrix(); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer);
GlStateManager.disableLighting();
GlStateManager.pushTextureAttributes();
GlStateManager.pushLightingAttributes();
RenderHelper.enableStandardItemLighting();
Minecraft.getInstance().getTextureManager().bindTexture(RES_WORN);
Screen.blit(0, 0, 0, 0, 16, 16, 16, 16);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttributes();
GlStateManager.popAttributes();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
} }
} }
} }

View file

@ -1,16 +1,16 @@
package de.ellpeck.naturesaura.renderers; package de.ellpeck.naturesaura.renderers;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType; import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
import net.minecraft.client.entity.player.AbstractClientPlayerEntity; import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.entity.IEntityRenderer; import net.minecraft.client.renderer.entity.IEntityRenderer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.client.renderer.entity.model.PlayerModel; import net.minecraft.client.renderer.entity.model.PlayerModel;
import net.minecraft.entity.Pose;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -33,7 +33,6 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
super(entityRendererIn); super(entityRendererIn);
} }
// TODO Fix this
@Override @Override
public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (player.getActivePotionEffect(Effects.INVISIBILITY) != null) if (player.getActivePotionEffect(Effects.INVISIBILITY) != null)
@ -42,26 +41,21 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
ItemStack second = player.getHeldItemOffhand(); ItemStack second = player.getHeldItemOffhand();
this.alreadyRendered.clear(); this.alreadyRendered.clear();
RenderSystem.pushMatrix(); matrixStackIn.push();
RenderSystem.pushLightingAttributes(); this.render(player, RenderType.BODY, main, second, matrixStackIn, bufferIn, packedLightIn);
RenderSystem.pushTextureAttributes();
RenderSystem.color4f(1F, 1F, 1F, 1F);
this.render(player, RenderType.BODY, main, second);
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
RenderSystem.rotatef(yawOffset, 0, -1, 0); matrixStackIn.rotate(Vector3f.YN.rotationDegrees(yawOffset));
RenderSystem.rotatef(yaw - 270, 0, 1, 0); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(yaw - 270));
RenderSystem.rotatef(pitch, 0, 0, 1); matrixStackIn.rotate(Vector3f.ZP.rotationDegrees(pitch));
this.render(player, RenderType.HEAD, main, second); this.render(player, RenderType.HEAD, main, second, matrixStackIn, bufferIn, packedLightIn);
RenderSystem.popAttributes(); matrixStackIn.pop();
RenderSystem.popAttributes();
RenderSystem.popMatrix();
} }
private void render(PlayerEntity player, RenderType type, ItemStack main, ItemStack second) { private void render(PlayerEntity player, RenderType type, ItemStack main, ItemStack second, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight) {
for (int i = 0; i < player.inventory.getSizeInventory(); i++) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
this.renderStack(player.inventory.getStackInSlot(i), player, type, main, second); this.renderStack(player.inventory.getStackInSlot(i), player, type, main, second, matrices, buffer, packedLight);
} }
if (Compat.hasCompat("curios")) { if (Compat.hasCompat("curios")) {
@ -69,24 +63,24 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
if (handler != null) { if (handler != null) {
for (IItemHandler items : handler.getCurioMap().values()) { for (IItemHandler items : handler.getCurioMap().values()) {
for (int i = 0; i < items.getSlots(); i++) { for (int i = 0; i < items.getSlots(); i++) {
this.renderStack(items.getStackInSlot(i), player, type, main, second); this.renderStack(items.getStackInSlot(i), player, type, main, second, matrices, buffer, packedLight);
} }
} }
} }
} }
} }
private void renderStack(ItemStack stack, PlayerEntity player, RenderType type, ItemStack main, ItemStack second) { private void renderStack(ItemStack stack, PlayerEntity player, RenderType type, ItemStack main, ItemStack second, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight) {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
Item item = stack.getItem(); Item item = stack.getItem();
if (item instanceof ITrinketItem && !this.alreadyRendered.contains(item)) { if (item instanceof ITrinketItem && !this.alreadyRendered.contains(item)) {
GlStateManager.pushMatrix(); matrices.push();
if (type == RenderType.BODY && player.isShiftKeyDown()) { if (type == RenderType.BODY && player.getPose() == Pose.CROUCHING) {
GlStateManager.translatef(0F, 0.2F, 0F); matrices.translate(0F, 0.2F, 0F);
GlStateManager.rotatef(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F); matrices.rotate(Vector3f.XP.rotationDegrees(90F / (float) Math.PI));
} }
((ITrinketItem) item).render(stack, player, type, stack == main || stack == second); ((ITrinketItem) item).render(stack, player, type, matrices, buffer, packedLight, stack == main || stack == second);
GlStateManager.popMatrix(); matrices.pop();
this.alreadyRendered.add(item); this.alreadyRendered.add(item);
} }
} }