Search in sources :

Example 1 with TeleportDestinationClientInfo

use of mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo in project RFTools by McJty.

the class GuiTeleportProbe method teleport.

private void teleport(int index) {
    TeleportDestinationClientInfo destination = destinationList.get(index);
    BlockPos c = destination.getCoordinate();
    RFToolsMessages.sendToServer(CommandHandler.CMD_FORCE_TELEPORT, Arguments.builder().value(destination.getDimension()).value(c));
}
Also used : TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with TeleportDestinationClientInfo

use of mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo in project RFTools by McJty.

the class GuiTeleportProbe method populateList.

private void populateList() {
    if (serverDestinationList == null) {
        return;
    }
    if (serverDestinationList.equals(destinationList)) {
        return;
    }
    destinationList = new ArrayList<>(serverDestinationList);
    list.removeChildren();
    for (TeleportDestinationClientInfo destination : destinationList) {
        BlockPos coordinate = destination.getCoordinate();
        int dim = destination.getDimension();
        Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(destination.getName()).setDesiredWidth(100));
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(BlockPosTools.toString(coordinate)).setDesiredWidth(75));
        panel.addChild(new Label(mc, this).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("Id " + dim).setDesiredWidth(75));
        list.addChild(panel);
    }
}
Also used : TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) BlockPos(net.minecraft.util.math.BlockPos) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 3 with TeleportDestinationClientInfo

use of mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo in project RFTools by McJty.

the class PacketAllReceiversReady method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    int size = buf.readInt();
    destinationList = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        destinationList.add(new TeleportDestinationClientInfo(buf));
    }
}
Also used : TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo)

Example 4 with TeleportDestinationClientInfo

use of mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo in project RFTools by McJty.

the class CmdListReceivers method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    TeleportDestinations destinations = TeleportDestinations.getDestinations(sender.getEntityWorld());
    Collection<TeleportDestinationClientInfo> validDestinations = destinations.getValidDestinations(sender.getEntityWorld(), null);
    for (TeleportDestinationClientInfo clientInfo : validDestinations) {
        int id = clientInfo.getDimension();
        ITextComponent component = new TextComponentString("    Receiver: dimension=" + id + ", location=" + BlockPosTools.toString(clientInfo.getCoordinate()));
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
    }
}
Also used : TeleportDestinations(mcjty.rftools.blocks.teleporter.TeleportDestinations) TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

TeleportDestinationClientInfo (mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo)4 BlockPos (net.minecraft.util.math.BlockPos)2 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)1 TeleportDestinations (mcjty.rftools.blocks.teleporter.TeleportDestinations)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 TextComponentString (net.minecraft.util.text.TextComponentString)1