Search in sources :

Example 71 with GlobalCoordinate

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

the class TeleportDestinations method removeDestination.

public void removeDestination(Coordinate coordinate, int dimension) {
    GlobalCoordinate key = new GlobalCoordinate(coordinate, dimension);
    destinations.remove(key);
    Integer id = destinationIdByCoordinate.get(key);
    if (id != null) {
        destinationById.remove(id);
        destinationIdByCoordinate.remove(key);
    }
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 72 with GlobalCoordinate

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

the class TeleportDestinations method readDestinationsFromNBT.

private void readDestinationsFromNBT(NBTTagCompound tagCompound) {
    NBTTagList lst = tagCompound.getTagList("destinations", Constants.NBT.TAG_COMPOUND);
    for (int i = 0; i < lst.tagCount(); i++) {
        NBTTagCompound tc = lst.getCompoundTagAt(i);
        Coordinate c = new Coordinate(tc.getInteger("x"), tc.getInteger("y"), tc.getInteger("z"));
        int dim = tc.getInteger("dim");
        String name = tc.getString("name");
        TeleportDestination destination = new TeleportDestination(c, dim);
        destination.setName(name);
        GlobalCoordinate gc = new GlobalCoordinate(c, dim);
        destinations.put(gc, destination);
        int id;
        if (tc.hasKey("id")) {
            id = tc.getInteger("id");
            destinationById.put(id, gc);
            destinationIdByCoordinate.put(gc, id);
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 73 with GlobalCoordinate

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

the class PeacefulEModule method tick.

@Override
public void tick(World world, int x, int y, int z, int radius, int miny, int maxy, EnvironmentalControllerTileEntity controllerTileEntity) {
    if (!isActive()) {
        return;
    }
    super.tick(world, x, y, z, radius, miny, maxy, controllerTileEntity);
    PeacefulAreaManager.markArea(new GlobalCoordinate(new Coordinate(x, y, z), world.provider.dimensionId), radius, miny, maxy);
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 74 with GlobalCoordinate

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

the class BlockProtectorBlock method onBlockPlaced.

@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float sx, float sy, float sz, int meta) {
    int rc = super.onBlockPlaced(world, x, y, z, side, sx, sy, sz, meta);
    if (world.isRemote) {
        return rc;
    }
    BlockProtectors protectors = BlockProtectors.getProtectors(world);
    GlobalCoordinate gc = new GlobalCoordinate(new Coordinate(x, y, z), world.provider.dimensionId);
    protectors.getNewId(gc);
    protectors.save(world);
    return rc;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 75 with GlobalCoordinate

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

the class BlockProtectorBlock method wrenchSneakSelect.

@Override
protected boolean wrenchSneakSelect(World world, int x, int y, int z, EntityPlayer player) {
    if (!world.isRemote) {
        GlobalCoordinate currentBlock = SmartWrenchItem.getCurrentBlock(player.getHeldItem());
        if (currentBlock == null) {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(), new GlobalCoordinate(new Coordinate(x, y, z), world.provider.dimensionId));
            Logging.message(player, EnumChatFormatting.YELLOW + "Selected block");
        } else {
            SmartWrenchItem.setCurrentBlock(player.getHeldItem(), null);
            Logging.message(player, EnumChatFormatting.YELLOW + "Cleared selected block");
        }
    }
    return true;
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) 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