Search in sources :

Example 1 with PacketUseItem

use of pneumaticCraft.common.network.PacketUseItem 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 2 with PacketUseItem

use of pneumaticCraft.common.network.PacketUseItem in project PneumaticCraft by MineMaarten.

the class NetworkConnectionPlayerHandler method mouseClicked.

public void mouseClicked(int x, int y, int mouseButton, Slot slot) {
    if (slot != null) {
        if (mouseButton == 0)
            tryToHackSlot(slot.slotNumber);
        if (mouseButton == 1 && slotHacked[slot.slotNumber]) {
            boolean alreadyFortifying = false;
            for (GuiStatBalloon balloon : balloons) {
                if (balloon.slotNumber == slot.slotNumber) {
                    alreadyFortifying = true;
                    break;
                }
            }
            if (!alreadyFortifying) {
                balloons.add(new GuiStatBalloon(slot.xDisplayPosition + gui.getGuiLeft() + 8, slot.yDisplayPosition + gui.getGuiTop() - 5, slot.slotNumber));
            }
        }
        if (mouseButton == 2 && !slotHacked[slot.slotNumber] && ((GuiSecurityStationHacking) gui).hasNukeViruses()) {
            int linesBefore = lineList.size();
            if (tryToHackSlot(slot.slotNumber)) {
                EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
                NetworkHandler.sendToServer(new PacketUseItem(Itemss.nukeVirus, 1));
                player.inventory.consumeInventoryItem(Itemss.nukeVirus);
                for (int i = linesBefore; i < lineList.size(); i++) {
                    RenderProgressingLine line = lineList.get(i);
                    line.setProgress(1);
                    slotHacked[slot.slotNumber] = true;
                    onSlotHack(slot.slotNumber, true);
                }
            }
        }
    }
}
Also used : RenderProgressingLine(pneumaticCraft.client.render.RenderProgressingLine) EntityPlayer(net.minecraft.entity.player.EntityPlayer) PacketUseItem(pneumaticCraft.common.network.PacketUseItem)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 PacketUseItem (pneumaticCraft.common.network.PacketUseItem)2 RenderProgressingLine (pneumaticCraft.client.render.RenderProgressingLine)1