Search in sources :

Example 76 with GlobalCoordinate

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

the class BlockProtectorTileEntity method selectBlock.

@Override
public void selectBlock(EntityPlayer player, int x, int y, int z) {
    // This is always called server side.
    if (Math.abs(x - xCoord) > BlockProtectorConfiguration.maxProtectDistance || Math.abs(y - yCoord) > BlockProtectorConfiguration.maxProtectDistance || Math.abs(z - zCoord) > BlockProtectorConfiguration.maxProtectDistance) {
        Logging.message(player, EnumChatFormatting.RED + "Block out of range of the block protector!");
        return;
    }
    GlobalCoordinate gc = new GlobalCoordinate(new Coordinate(x, y, z), worldObj.provider.dimensionId);
    toggleCoordinate(gc);
}
Also used : GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate) Coordinate(mcjty.lib.varia.Coordinate) GlobalCoordinate(mcjty.lib.varia.GlobalCoordinate)

Example 77 with GlobalCoordinate

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

the class BlockProtectors method removeDestination.

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

Example 78 with GlobalCoordinate

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

the class BlockProtectors method writeToNBT.

@Override
public void writeToNBT(NBTTagCompound tagCompound) {
    NBTTagList lst = new NBTTagList();
    for (GlobalCoordinate destination : protectorIdByCoordinate.keySet()) {
        NBTTagCompound tc = new NBTTagCompound();
        Coordinate c = destination.getCoordinate();
        tc.setInteger("x", c.getX());
        tc.setInteger("y", c.getY());
        tc.setInteger("z", c.getZ());
        tc.setInteger("dim", destination.getDimension());
        Integer id = protectorIdByCoordinate.get(new GlobalCoordinate(c, destination.getDimension()));
        tc.setInteger("id", id);
        lst.appendTag(tc);
    }
    tagCompound.setTag("blocks", lst);
    tagCompound.setInteger("lastId", lastId);
}
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)

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