Search in sources :

Example 11 with EntityPlayer

use of net.minecraft.entity.player.EntityPlayer in project PneumaticCraft by MineMaarten.

the class GuiSearcher method updateScreen.

@Override
public void updateScreen() {
    EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
    if (parentScreen instanceof GuiHelmetMainScreen) {
        if (player.getCurrentArmor(3) == null || player.getCurrentArmor(3).getItem() != Itemss.pneumaticHelmet) {
            mc.displayGuiScreen(parentScreen);
            onGuiClosed();
        }
    }
}
Also used : GuiHelmetMainScreen(pneumaticCraft.client.gui.pneumaticHelmet.GuiHelmetMainScreen) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 12 with EntityPlayer

use of net.minecraft.entity.player.EntityPlayer in project PneumaticCraft by MineMaarten.

the class GuiSecurityStationHacking method mouseClicked.

@Override
protected void mouseClicked(int par1, int par2, int par3) {
    if (par3 != 2)
        super.mouseClicked(par1, par2, par3);
    hackerBridges.mouseClicked(par1, par2, par3, getSlotAtPosition(par1, par2));
    if (aiBridges.isTracing() && par1 >= guiLeft + 155 && par1 <= guiLeft + 171 && par2 >= guiTop + 55 && par2 <= guiTop + 75) {
        EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
        NetworkHandler.sendToServer(new PacketUseItem(Itemss.stopWorm, 1));
        player.inventory.consumeInventoryItem(Itemss.stopWorm);
        aiBridges.applyStopWorm();
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) PacketUseItem(pneumaticCraft.common.network.PacketUseItem)

Example 13 with EntityPlayer

use of net.minecraft.entity.player.EntityPlayer in project PneumaticCraft by MineMaarten.

the class GuiSecurityStationHacking method renderConsumables.

private void renderConsumables(int x, int y) {
    stopWorms = 0;
    nukeViruses = 0;
    EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
    for (ItemStack stack : player.inventory.mainInventory) {
        if (stack != null) {
            if (stack.getItem() == Itemss.stopWorm)
                stopWorms += stack.stackSize;
            if (stack.getItem() == Itemss.nukeVirus)
                nukeViruses += stack.stackSize;
        }
    }
    GuiUtils.drawItemStack(nukeVirus, 155, 30);
    GuiUtils.drawItemStack(stopWorm, 155, 55);
    fontRendererObj.drawString(PneumaticCraftUtils.convertAmountToString(nukeViruses), 155, 45, 0xFFFFFFFF);
    fontRendererObj.drawString(PneumaticCraftUtils.convertAmountToString(stopWorms), 155, 70, 0xFFFFFFFF);
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack)

Example 14 with EntityPlayer

use of net.minecraft.entity.player.EntityPlayer in project PneumaticCraft by MineMaarten.

the class HUDHandler method render2D.

private void render2D(float partialTicks) {
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    EntityPlayer player = minecraft.thePlayer;
    ItemStack helmetStack = player.inventory.armorInventory[3];
    if (helmetStack != null && minecraft.inGameHasFocus && helmetStack.getItem() == Itemss.pneumaticHelmet) {
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPushMatrix();
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glColor4d(0, 1, 0, 0.8D);
        CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
        if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime()) {
            // blockTrackInfo = null;
            gaveEmptyWarning = false;
            gaveNearlyEmptyWarning = false;
            RenderProgressBar.render(sr.getScaledWidth() / 2, 10, sr.getScaledWidth() - 10, 30, -90F, comHudHandler.ticksExisted * 100 / comHudHandler.getStartupTime());
        } else {
            if (comHudHandler.helmetPressure < 0.05F && !gaveEmptyWarning) {
                addMessage(new ArmorMessage("The helmet is out of air!", new ArrayList<String>(), 100, 0x70FF0000));
                gaveEmptyWarning = true;
            }
            if (comHudHandler.helmetPressure > 0.2F && comHudHandler.helmetPressure < 0.5F && !gaveNearlyEmptyWarning) {
                addMessage(new ArmorMessage("The helmet almost out of air!", new ArrayList<String>(), 60, 0x70FF0000));
                gaveNearlyEmptyWarning = true;
            }
            if (GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked) {
                for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
                    IUpgradeRenderHandler upgradeRenderHandler = UpgradeRenderHandlerList.instance().upgradeRenderers.get(i);
                    if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + upgradeRenderHandler.getUpgradeName()).checked) {
                        IGuiAnimatedStat stat = upgradeRenderHandler.getAnimatedStat();
                        if (stat != null) {
                            stat.render(-1, -1, partialTicks);
                        }
                        upgradeRenderHandler.render2D(partialTicks, comHudHandler.helmetPressure > 0F);
                    }
                }
            }
        }
        // render every item in the list.
        for (ArmorMessage message : messageList) {
            message.renderMessage(minecraft.fontRenderer, partialTicks);
        }
        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if (comHudHandler.ticksExisted <= comHudHandler.getStartupTime())
            minecraft.fontRenderer.drawString(CommonHUDHandler.getHandlerForPlayer().ticksExisted * 100 / comHudHandler.getStartupTime() + "%", sr.getScaledWidth() * 3 / 4 - 8, 16, 0x000000);
    } else if (helmetStack == null) {
        messageList.clear();
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) IUpgradeRenderHandler(pneumaticCraft.api.client.pneumaticHelmet.IUpgradeRenderHandler) CommonHUDHandler(pneumaticCraft.common.CommonHUDHandler) ArrayList(java.util.ArrayList) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) IGuiAnimatedStat(pneumaticCraft.api.client.IGuiAnimatedStat)

Example 15 with EntityPlayer

use of net.minecraft.entity.player.EntityPlayer in project PneumaticCraft by MineMaarten.

the class HUDHandler method renderWorldLastEvent.

@SubscribeEvent
public void renderWorldLastEvent(RenderWorldLastEvent event) {
    if (!GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade.coreComponents").checked)
        return;
    Minecraft mc = FMLClientHandler.instance().getClient();
    EntityPlayer player = mc.thePlayer;
    double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.partialTicks;
    double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.partialTicks;
    double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.partialTicks;
    GL11.glPushMatrix();
    GL11.glTranslated(-playerX, -playerY, -playerZ);
    ItemStack helmetStack = player.inventory.armorInventory[3];
    if (helmetStack != null && helmetStack.getItem() == Itemss.pneumaticHelmet) {
        if (((IPressurizable) helmetStack.getItem()).getPressure(helmetStack) > 0F) {
            CommonHUDHandler comHudHandler = CommonHUDHandler.getHandlerForPlayer(player);
            if (comHudHandler.ticksExisted > comHudHandler.getStartupTime()) {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                for (int i = 0; i < UpgradeRenderHandlerList.instance().upgradeRenderers.size(); i++) {
                    if (comHudHandler.upgradeRenderersInserted[i] && GuiKeybindCheckBox.trackedCheckboxes.get("pneumaticHelmet.upgrade." + UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).getUpgradeName()).checked)
                        UpgradeRenderHandlerList.instance().upgradeRenderers.get(i).render3D(event.partialTicks);
                }
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }
        }
    }
    GL11.glPopMatrix();
}
Also used : CommonHUDHandler(pneumaticCraft.common.CommonHUDHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)625 ItemStack (net.minecraft.item.ItemStack)169 EntityLivingBase (net.minecraft.entity.EntityLivingBase)104 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)81 Entity (net.minecraft.entity.Entity)77 World (net.minecraft.world.World)73 BlockPos (net.minecraft.util.math.BlockPos)61 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)49 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)44 TileEntity (net.minecraft.tileentity.TileEntity)43 PotionEffect (net.minecraft.potion.PotionEffect)41 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)38 EntityItem (net.minecraft.entity.item.EntityItem)37 Block (net.minecraft.block.Block)36 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)35 ArrayList (java.util.ArrayList)33 IBlockState (net.minecraft.block.state.IBlockState)33 List (java.util.List)28 TextComponentString (net.minecraft.util.text.TextComponentString)27 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)23