Search in sources :

Example 1 with TEAlchemicCalcinator

use of WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator in project BloodMagic by WayofTime.

the class RenderAlchemicCalcinator method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
    if (tileEntity instanceof TEAlchemicCalcinator) {
        TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity;
        GL11.glPushMatrix();
        GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
        ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
        GL11.glPushMatrix();
        GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
        this.modelConduit.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        if (tileAltar.getStackInSlot(1) != null) {
            boolean fancySaved = Minecraft.isFancyGraphicsEnabled();
            Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
            float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(1));
            EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
            ghostEntityItem.hoverStart = 0.0F;
            ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(1));
            float displacement = 0.2F;
            if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) {
                GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
            } else {
                GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f);
            }
            GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
            if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) {
                GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
            }
            customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
            Minecraft.getMinecraft().gameSettings.fancyGraphics = fancySaved;
        }
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        if (tileAltar.getStackInSlot(0) != null) {
            boolean fancySaved = Minecraft.isFancyGraphicsEnabled();
            Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
            float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
            EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
            ghostEntityItem.hoverStart = 0.0F;
            ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
            float displacement = -0.5F;
            if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) {
                GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
            } else {
                GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f);
            }
            GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
            if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) {
                GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
            }
            customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
            Minecraft.getMinecraft().gameSettings.fancyGraphics = fancySaved;
        }
        GL11.glPopMatrix();
        ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
        if (info.length >= 1 && info[0] != null) {
            ReagentStack reagentStack = info[0].reagent;
            int capacity = info[0].capacity;
            if (reagentStack != null && reagentStack.reagent != null) {
                Reagent reagent = reagentStack.reagent;
                this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
            }
        }
    }
}
Also used : TEAlchemicCalcinator(WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator) ReagentContainerInfo(WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo) ResourceLocation(net.minecraft.util.ResourceLocation) ReagentStack(WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack) ItemBlock(net.minecraft.item.ItemBlock) Reagent(WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent) EntityItem(net.minecraft.entity.item.EntityItem)

Example 2 with TEAlchemicCalcinator

use of WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator in project BloodMagic by WayofTime.

the class BlockAlchemicCalcinator method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
    TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
    if (tileEntity == null || player.isSneaking()) {
        return false;
    }
    ItemStack playerItem = player.getCurrentEquippedItem();
    if (playerItem != null) {
        if (playerItem.getItem() instanceof IReagentManipulator) {
            return false;
        }
        if (playerItem.getItem() instanceof IBloodOrb) {
            if (tileEntity.getStackInSlot(0) == null) {
                ItemStack newItem = playerItem.copy();
                newItem.stackSize = 1;
                --playerItem.stackSize;
                tileEntity.setInventorySlotContents(0, newItem);
            }
        } else if (tileEntity.getStackInSlot(1) == null) {
            ItemStack newItem = playerItem.copy();
            newItem.stackSize = 1;
            --playerItem.stackSize;
            tileEntity.setInventorySlotContents(1, newItem);
        }
    } else {
        if (tileEntity.getStackInSlot(1) != null) {
            player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
            tileEntity.setInventorySlotContents(1, null);
        } else if (tileEntity.getStackInSlot(0) != null) {
            player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
            tileEntity.setInventorySlotContents(0, null);
        }
    }
    tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
    return true;
}
Also used : TEAlchemicCalcinator(WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator) IBloodOrb(WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb) IReagentManipulator(WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TEAlchemicCalcinator (WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator)2 Reagent (WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent)1 ReagentContainerInfo (WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo)1 ReagentStack (WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack)1 IBloodOrb (WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb)1 IReagentManipulator (WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemBlock (net.minecraft.item.ItemBlock)1 ItemStack (net.minecraft.item.ItemStack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1