2018-10-14 17:46:00 +02:00
|
|
|
package de.ellpeck.naturesaura.items;
|
|
|
|
|
2020-01-29 19:04:33 +01:00
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
2019-11-04 19:08:49 +01:00
|
|
|
import de.ellpeck.naturesaura.NaturesAura;
|
2018-11-21 20:36:55 +01:00
|
|
|
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
2020-01-29 19:04:33 +01:00
|
|
|
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;
|
2019-10-20 22:30:49 +02:00
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
import net.minecraft.inventory.EquipmentSlotType;
|
2018-10-21 14:42:30 +02:00
|
|
|
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;
|
2018-10-21 14:42:30 +02:00
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
public class ItemEye extends ItemImpl implements ITrinketItem {
|
2018-10-14 17:46:00 +02:00
|
|
|
|
2020-01-26 01:41:49 +01:00
|
|
|
public ItemEye(String name) {
|
2020-02-07 23:50:16 +01:00
|
|
|
super(name, new Properties().maxStackSize(1));
|
2018-10-14 17:46:00 +02:00
|
|
|
}
|
2018-10-21 14:42:30 +02:00
|
|
|
|
|
|
|
@Override
|
2019-10-20 22:30:49 +02:00
|
|
|
@OnlyIn(Dist.CLIENT)
|
2020-01-29 19:04:33 +01:00
|
|
|
public void render(ItemStack stack, PlayerEntity player, RenderType type, MatrixStack matrices, IRenderTypeBuffer buffer, int packedLight, boolean isHolding) {
|
2018-11-02 21:10:53 +01:00
|
|
|
if (type == RenderType.BODY && !isHolding) {
|
2019-10-20 22:30:49 +02:00
|
|
|
boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty();
|
2020-01-29 19:04:33 +01:00
|
|
|
matrices.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F);
|
|
|
|
matrices.scale(0.3F, 0.3F, 0.3F);
|
|
|
|
matrices.rotate(Vector3f.XP.rotationDegrees(180));
|
|
|
|
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.GROUND, packedLight, OverlayTexture.DEFAULT_LIGHT, matrices, buffer);
|
2018-10-21 14:42:30 +02:00
|
|
|
}
|
|
|
|
}
|
2018-10-14 17:46:00 +02:00
|
|
|
}
|