how bout we make it not crash, my dude

This commit is contained in:
Ellpeck 2018-10-21 14:51:07 +02:00
parent baea1d91a9
commit 1d76a5a135
3 changed files with 4 additions and 5 deletions

View file

@ -1,6 +1,5 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import baubles.api.render.IRenderBauble;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.aura.Capabilities; import de.ellpeck.naturesaura.aura.Capabilities;
import de.ellpeck.naturesaura.aura.container.IAuraContainer; import de.ellpeck.naturesaura.aura.container.IAuraContainer;
@ -103,7 +102,6 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
public void render(ItemStack stack, EntityPlayer player, RenderType type) { public void render(ItemStack stack, EntityPlayer player, RenderType type) {
if (type == RenderType.BODY) { if (type == RenderType.BODY) {
boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty();
IRenderBauble.Helper.rotateIfSneaking(player);
GlStateManager.translate(-0.15F, 0.65F, armor ? -0.195F : -0.13F); GlStateManager.translate(-0.15F, 0.65F, armor ? -0.195F : -0.13F);
GlStateManager.scale(0.25F, 0.25F, 0.25F); GlStateManager.scale(0.25F, 0.25F, 0.25F);
GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.rotate(180F, 1F, 0F, 0F);

View file

@ -1,9 +1,7 @@
package de.ellpeck.naturesaura.items; package de.ellpeck.naturesaura.items;
import baubles.api.render.IRenderBauble;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.renderers.ITrinketItem; import de.ellpeck.naturesaura.renderers.ITrinketItem;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets.RenderType; import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets.RenderType;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -24,7 +22,6 @@ public class ItemEye extends ItemImpl implements ITrinketItem {
public void render(ItemStack stack, EntityPlayer player, RenderType type) { public void render(ItemStack stack, EntityPlayer player, RenderType type) {
if (type == RenderType.BODY) { if (type == RenderType.BODY) {
boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty(); boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty();
IRenderBauble.Helper.rotateIfSneaking(player);
GlStateManager.translate(0.1F, 0.19F, armor ? -0.195F : -0.13F); GlStateManager.translate(0.1F, 0.19F, armor ? -0.195F : -0.13F);
GlStateManager.scale(0.15F, 0.15F, 0.15F); GlStateManager.scale(0.15F, 0.15F, 0.15F);
GlStateManager.rotate(180F, 1F, 0F, 0F); GlStateManager.rotate(180F, 1F, 0F, 0F);

View file

@ -59,6 +59,10 @@ public class PlayerLayerTrinkets implements LayerRenderer<EntityPlayer> {
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(); GlStateManager.pushMatrix();
if (type == RenderType.BODY && player.isSneaking()) {
GlStateManager.translate(0F, 0.2F, 0F);
GlStateManager.rotate(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
}
((ITrinketItem) item).render(stack, player, type); ((ITrinketItem) item).render(stack, player, type);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
this.alreadyRendered.add(item); this.alreadyRendered.add(item);