Search in sources :

Example 21 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class GuiTeleportProbe method teleport.

private void teleport(int index) {
    TeleportDestinationClientInfo destination = destinationList.get(index);
    Coordinate c = destination.getCoordinate();
    RFToolsMessages.INSTANCE.sendToServer(new PacketForceTeleport(c.getX(), c.getY(), c.getZ(), destination.getDimension()));
}
Also used : Coordinate(mcjty.lib.varia.Coordinate) TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo)

Example 22 with Coordinate

use of mcjty.lib.varia.Coordinate 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<TeleportDestinationClientInfo>(serverDestinationList);
    list.removeChildren();
    for (TeleportDestinationClientInfo destination : destinationList) {
        Coordinate 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(coordinate.toString()).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 : Panel(mcjty.lib.gui.widgets.Panel) Coordinate(mcjty.lib.varia.Coordinate) TeleportDestinationClientInfo(mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 23 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class SmartWrenchItem method getCurrentBlock.

public static GlobalCoordinate getCurrentBlock(ItemStack itemStack) {
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null && tagCompound.hasKey("selectedX")) {
        int x = tagCompound.getInteger("selectedX");
        int y = tagCompound.getInteger("selectedY");
        int z = tagCompound.getInteger("selectedZ");
        int dim = tagCompound.getInteger("selectedDim");
        return new GlobalCoordinate(new Coordinate(x, y, z), dim);
    }
    return null;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 24 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class ShapeCardItem method composePrism.

private static void composePrism(World worldObj, Coordinate thisCoord, Coordinate dimension, Coordinate offset, Collection<Coordinate> blocks, int maxSize, boolean forquarry, ChunkCoordIntPair chunk) {
    int xCoord = thisCoord.getX();
    int yCoord = thisCoord.getY();
    int zCoord = thisCoord.getZ();
    int dx = dimension.getX();
    int dy = dimension.getY();
    int dz = dimension.getZ();
    Coordinate tl = new Coordinate(xCoord - dx / 2 + offset.getX(), yCoord - dy / 2 + offset.getY(), zCoord - dz / 2 + offset.getZ());
    for (int oy = 0; oy < dy; oy++) {
        int y = tl.getY() + oy;
        if (y >= 0 && y < 255) {
            int yoffset = oy;
            for (int ox = 0; ox < dx; ox++) {
                if (ox >= yoffset && ox < dx - yoffset) {
                    int x = tl.getX() + ox;
                    if (xInChunk(x, chunk)) {
                        for (int oz = yoffset; oz < dz - yoffset; oz++) {
                            int z = tl.getZ() + oz;
                            if (zInChunk(z, chunk)) {
                                if (ox == yoffset || oy == 0 || oz == yoffset || ox == (dx - yoffset - 1) || oz == (dz - yoffset - 1)) {
                                    placeBlockIfPossible(worldObj, blocks, maxSize, x, y, z, forquarry);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate)

Example 25 with Coordinate

use of mcjty.lib.varia.Coordinate in project RFTools by McJty.

the class ShapeCardItem method getCurrentBlock.

public static GlobalCoordinate getCurrentBlock(ItemStack itemStack) {
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null && tagCompound.hasKey("selectedX")) {
        int x = tagCompound.getInteger("selectedX");
        int y = tagCompound.getInteger("selectedY");
        int z = tagCompound.getInteger("selectedZ");
        int dim = tagCompound.getInteger("selectedDim");
        return new GlobalCoordinate(new Coordinate(x, y, z), dim);
    }
    return null;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Aggregations

Coordinate (mcjty.lib.varia.Coordinate)181 GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)63 TileEntity (net.minecraft.tileentity.TileEntity)30 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)19 Block (net.minecraft.block.Block)14 HashMap (java.util.HashMap)13 Map (java.util.Map)13 GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)13 World (net.minecraft.world.World)12 NBTTagList (net.minecraft.nbt.NBTTagList)11 Callback (li.cil.oc.api.machine.Callback)10 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)10 Panel (mcjty.lib.gui.widgets.Panel)10 ItemStack (net.minecraft.item.ItemStack)10 ArrayList (java.util.ArrayList)9 Label (mcjty.lib.gui.widgets.Label)8 BlockInfo (mcjty.rftools.BlockInfo)7 SyncedCoordinate (mcjty.lib.entity.SyncedCoordinate)5 ChoiceEvent (mcjty.lib.gui.events.ChoiceEvent)4 TeleportDestinationClientInfo (mcjty.rftools.blocks.teleporter.TeleportDestinationClientInfo)4