Search in sources :

Example 26 with GlobalCoordinate

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

the class SmartWrenchItem method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    GlobalCoordinate b = getCurrentBlock(itemStack);
    if (b != null) {
        list.add(EnumChatFormatting.GREEN + "Block: " + b.getCoordinate().toString() + " at dimension " + b.getDimension());
    }
    SmartWrenchMode mode = getCurrentMode(itemStack);
    list.add(EnumChatFormatting.WHITE + "Right-click on air to change mode.");
    list.add(EnumChatFormatting.GREEN + "Mode: " + mode.getName());
    if (mode == SmartWrenchMode.MODE_WRENCH) {
        list.add(EnumChatFormatting.WHITE + "Use as a normal wrench:");
        list.add(EnumChatFormatting.WHITE + "    Sneak-right-click to pick up machines.");
        list.add(EnumChatFormatting.WHITE + "    Right-click to rotate machines.");
    } else if (mode == SmartWrenchMode.MODE_SELECT) {
        list.add(EnumChatFormatting.WHITE + "Use as a block selector:");
        list.add(EnumChatFormatting.WHITE + "    Sneak-right-click select master block.");
        list.add(EnumChatFormatting.WHITE + "    Right-click to associate blocks with master.");
    }
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 27 with GlobalCoordinate

use of mcjty.lib.varia.GlobalCoordinate 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)

Example 28 with GlobalCoordinate

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

the class MatterReceiverTileEntity method getOrCalculateID.

public int getOrCalculateID() {
    if (id == -1) {
        TeleportDestinations destinations = TeleportDestinations.getDestinations(worldObj);
        GlobalCoordinate gc = new GlobalCoordinate(new Coordinate(xCoord, yCoord, zCoord), worldObj.provider.dimensionId);
        id = destinations.getNewId(gc);
        destinations.save(worldObj);
        setId(id);
    }
    return id;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 29 with GlobalCoordinate

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

the class MatterReceiverTileEntity method updateDestination.

/**
 * This method is called after putting down a receiver that was earlier wrenched. We need to fix the data in
 * the destination.
 */
public void updateDestination() {
    TeleportDestinations destinations = TeleportDestinations.getDestinations(worldObj);
    GlobalCoordinate gc = new GlobalCoordinate(new Coordinate(xCoord, yCoord, zCoord), worldObj.provider.dimensionId);
    TeleportDestination destination = destinations.getDestination(gc.getCoordinate(), gc.getDimension());
    if (destination != null) {
        destination.setName(name);
        if (id == -1) {
            id = destinations.getNewId(gc);
            markDirty();
        } else {
            destinations.assignId(gc, id);
        }
        destinations.save(worldObj);
    }
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 30 with GlobalCoordinate

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

the class MatterTransmitterTileEntity method getTeleportDestination.

public TeleportDestination getTeleportDestination() {
    if (teleportId != null) {
        TeleportDestinations teleportDestinations = TeleportDestinations.getDestinations(worldObj);
        GlobalCoordinate gc = teleportDestinations.getCoordinateForId(teleportId);
        if (gc == null) {
            return null;
        } else {
            return teleportDestinations.getDestination(gc.getCoordinate(), gc.getDimension());
        }
    }
    return teleportDestination;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Aggregations

GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)78 Coordinate (mcjty.lib.varia.Coordinate)33 TileEntity (net.minecraft.tileentity.TileEntity)15 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)14 World (net.minecraft.world.World)13 NBTTagList (net.minecraft.nbt.NBTTagList)7 ItemStack (net.minecraft.item.ItemStack)6 BlockPos (net.minecraft.util.math.BlockPos)6 ArrayList (java.util.ArrayList)5 TeleportDestination (mcjty.rftools.blocks.teleporter.TeleportDestination)5 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)4 TeleportDestinations (mcjty.rftools.blocks.teleporter.TeleportDestinations)4 MovingSound (net.minecraft.client.audio.MovingSound)4 BlockProtectorTileEntity (mcjty.rftools.blocks.blockprotector.BlockProtectorTileEntity)3 PlayerExtendedProperties (mcjty.rftools.playerprops.PlayerExtendedProperties)3 IBlockState (net.minecraft.block.state.IBlockState)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 WorldServer (net.minecraft.world.WorldServer)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3