Search in sources :

Example 1 with PacketTargetList

use of crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTargetList in project EnderIO by SleepyTrousers.

the class GuiTargetList method elementClicked.

@Override
protected boolean elementClicked(int elementIndex, boolean doubleClick, int elX, int elY) {
    TelepadTarget target = getSelectedElement();
    Rectangle iconBounds = getIconBounds(0);
    if (iconBounds.contains(elX, elY)) {
        PacketHandler.INSTANCE.sendToServer(new PacketTargetList(te, target, false));
        if (selectedIndex >= getNumElements()) {
            setSelection(getNumElements() - 1);
        }
        return false;
    }
    return true;
}
Also used : PacketTargetList(crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTargetList) TelepadTarget(crazypants.enderio.base.item.coordselector.TelepadTarget) Rectangle(java.awt.Rectangle)

Example 2 with PacketTargetList

use of crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTargetList in project EnderIO by SleepyTrousers.

the class TileDialingDevice method processTasks.

@Override
public boolean processTasks(boolean redstoneCheck) {
    getEnergy().useEnergy();
    if (!getInventory().getSlot("INPUT").isEmpty() && getInventory().getSlot("OUTPUT").isEmpty() && getEnergy().useEnergy(CapacitorKey.DIALING_DEVICE_POWER_USE_PAPER)) {
        ItemStack stack = getInventory().getSlot("INPUT").get();
        TelepadTarget newTarg = TelepadTarget.readFromNBT(stack);
        if (newTarg != null && !targets.contains(newTarg)) {
            addTarget(newTarg);
            PacketHandler.sendToAllAround(new PacketTargetList(this, newTarg, true), this);
        }
        getInventory().getSlot("INPUT").clear();
        getInventory().getSlot("OUTPUT").set(stack);
    }
    return false;
}
Also used : PacketTargetList(crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTargetList) TelepadTarget(crazypants.enderio.base.item.coordselector.TelepadTarget) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TelepadTarget (crazypants.enderio.base.item.coordselector.TelepadTarget)2 PacketTargetList (crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTargetList)2 Rectangle (java.awt.Rectangle)1 ItemStack (net.minecraft.item.ItemStack)1