NaturesAura/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java

31 lines
1.1 KiB
Java
Raw Normal View History

2018-10-14 17:46:00 +02:00
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.render.ITrinketItem;
2019-10-20 22:30:49 +02:00
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
2019-10-20 22:30:49 +02:00
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemEye extends ItemImpl implements ITrinketItem {
2018-10-14 17:46:00 +02:00
2018-12-25 19:38:25 +01:00
public ItemEye(String name) {
super(name);
2018-10-20 21:19:08 +02:00
this.setMaxStackSize(1);
2018-10-14 17:46:00 +02:00
}
@Override
2019-10-20 22:30:49 +02:00
@OnlyIn(Dist.CLIENT)
public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) {
if (type == RenderType.BODY && !isHolding) {
2019-10-20 22:30:49 +02:00
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
2018-11-07 23:57:47 +01:00
GlStateManager.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
GlStateManager.scale(0.15F, 0.15F, 0.15F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
Helper.renderItemInWorld(stack);
}
}
2018-10-14 17:46:00 +02:00
}