Search in sources :

Example 1 with ItemOrgShield

use of uk.co.wehavecookies56.kk.common.item.org.ItemOrgShield in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class TESRPedestal method render.

@Override
public void render(TileEntityPedestal te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    if (te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH)) {
        IItemHandler itemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.NORTH);
        GlStateManager.pushAttrib();
        GlStateManager.pushMatrix();
        GlStateManager.translate(x, y, z);
        GlStateManager.disableRescaleNormal();
        this.renderItem = Minecraft.getMinecraft().getRenderItem();
        GlStateManager.pushMatrix();
        {
            int rot = te.getRotation();
            GlStateManager.translate(0.5, 1.3, 0.5);
            GlStateManager.rotate(90 * rot, 0, 1, 0);
            GlStateManager.scale(0.02, 0.02, 0.02);
            te.setKeyblade(itemHandler.getStackInSlot(0));
            Item itemToRender = te.keyblade.getItem();
            GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 128.0F, 128.0F);
            if (itemToRender instanceof ItemKeyblade)
                renderItem.renderItem(new ItemStack(itemToRender), ItemCameraTransforms.TransformType.NONE);
            else if (itemToRender instanceof ItemKeychain)
                renderItem.renderItem(new ItemStack(((ItemKeychain) itemToRender).getKeyblade()), ItemCameraTransforms.TransformType.NONE);
            else if (itemToRender instanceof ItemOrgShield)
                renderItem.renderItem(new ItemStack((itemToRender)), ItemCameraTransforms.TransformType.NONE);
            GL11.glPopAttrib();
        }
        GlStateManager.popMatrix();
        GlStateManager.popMatrix();
        GlStateManager.popAttrib();
    }
    super.render(te, x, y, z, partialTicks, destroyStage, alpha);
}
Also used : Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) IItemHandler(net.minecraftforge.items.IItemHandler) ItemKeychain(uk.co.wehavecookies56.kk.common.item.base.ItemKeychain) ItemOrgShield(uk.co.wehavecookies56.kk.common.item.org.ItemOrgShield) ItemKeyblade(uk.co.wehavecookies56.kk.common.item.base.ItemKeyblade) ItemStack(net.minecraft.item.ItemStack)

Aggregations

RenderItem (net.minecraft.client.renderer.RenderItem)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 IItemHandler (net.minecraftforge.items.IItemHandler)1 ItemKeyblade (uk.co.wehavecookies56.kk.common.item.base.ItemKeyblade)1 ItemKeychain (uk.co.wehavecookies56.kk.common.item.base.ItemKeychain)1 ItemOrgShield (uk.co.wehavecookies56.kk.common.item.org.ItemOrgShield)1