Examples of WorldCoordinate


Examples of mods.railcraft.api.core.WorldCoordinate

        if (data.readBoolean()) {
            int dim = data.readInt();
            int x = data.readInt();
            int y = data.readInt();
            int z = data.readInt();
            lastMarker = new WorldCoordinate(dim, x, y, z);
        }
    }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

            TileEntity tile = world.getTileEntity(x, y, z);
            if (tile instanceof TileHidden) {
                TileHidden hidden = (TileHidden) tile;
                hidden.timestamp = System.currentTimeMillis();
                hidden.colorSeed = Railcraft.proxy.getPlayerUsername(player).hashCode() * 50021L;
                WorldCoordinate last = lastPosition.get(player);
                if (last != null)
                    hidden.lastMarker = last;
                hidden.sendUpdateToClient();
                lastPosition.put(player, new WorldCoordinate(world.provider.dimensionId, x, y, z));
                return true;
            }
        }
        return block == BlockHidden.getBlock();
    }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    @Override
    public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10) {
        TileEntity tile = world.getTileEntity(i, j, k);
        if (tile != null) {
            WorldCoordinate cPos = null;
            NBTTagCompound data = item.getTagCompound();
            if (data != null) {
                int cDim = data.getInteger("controllerDim");
                int cx = data.getInteger("controllerX");
                int cy = data.getInteger("controllerY");
                int cz = data.getInteger("controllerZ");
                cPos = new WorldCoordinate(cDim, cx, cy, cz);
            }
            if (tile instanceof IReceiverTile && cPos != null) {
                if (Game.isHost(world)) {
                    SignalReceiver receiver = ((IReceiverTile) tile).getReceiver();
                    if (i != cPos.x || j != cPos.y || k != cPos.z) {
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    public static WorldCoordinate findBlock(World world, int x, int y, int z, int distance, Block block, int meta) {
        for (int yy = y - distance; yy < y + distance; yy++) {
            for (int xx = x - distance; xx < x + distance; xx++) {
                for (int zz = z - distance; zz < z + distance; zz++) {
                    if (block == getBlock(world, xx, yy, zz) && meta == getBlockMetadata(world, xx, yy, zz))
                        return new WorldCoordinate(world.provider.dimensionId, xx, yy, zz);
                }
            }
        }
        return null;
    }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    public boolean blockActivated(EntityPlayer player, int side) {
        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, xCoord, yCoord, zCoord)) {
                WorldCoordinate target = TileAnchorWorld.getTarget(player);
                if (target == null)
                    TileAnchorWorld.setTarget(this, player);
                else if (worldObj.provider.dimensionId != target.dimension)
                    ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.dimension", getName());
                else if (new WorldCoordinate(this).equals(target)) {
                    TileAnchorWorld.removeTarget(player);
                    ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.cancel", getName());
                } else {
                    TileEntity tile = TileAnchorWorld.getTargetAt(player, this, target);
                    if (tile instanceof TileAnchorWorld)
                        ((TileAnchorWorld) tile).setSentinel(player, new WorldCoordinate(this));
                    else if (tile != null)
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.invalid", getName());
                }
                crowbar.onWhack(player, current, xCoord, yCoord, zCoord);
                return true;
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

        ItemStack current = player.getCurrentEquippedItem();
        if (current != null && current.getItem() instanceof IToolCrowbar) {
            IToolCrowbar crowbar = (IToolCrowbar) current.getItem();
            if (crowbar.canWhack(player, current, xCoord, yCoord, zCoord)) {
                if (Game.isHost(worldObj)) {
                    WorldCoordinate target = sentinelPairingMap.get(player);
                    if (target == null)
                        setTarget(this, player);
                    else if (worldObj.provider.dimensionId != target.dimension)
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.fail.dimension", getName());
                    else if (new WorldCoordinate(this).equals(target)) {
                        removeTarget(player);
                        ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.gui.anchor.pair.cancel", getName());
                    } else
                        setSentinel(player, target);
                    crowbar.onWhack(player, current, xCoord, yCoord, zCoord);
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    public static WorldCoordinate getTarget(EntityPlayer player) {
        return sentinelPairingMap.get(player);
    }

    public static void setTarget(RailcraftTileEntity tile, EntityPlayer player) {
        sentinelPairingMap.put(player, new WorldCoordinate(tile));
        ChatPlugin.sendLocalizedChatFromClient(player, "railcraft.gui.anchor.pair.start", tile.getName());
    }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

//        super.startPairing();
//    }
    public boolean createSignalBlock(SignalBlock other) {
        locateTrack();
        other.locateTrack();
        WorldCoordinate tA = getTrackLocation();
        WorldCoordinate tB = other.getTrackLocation();
        if (tA == null || tB == null)
            return false;
        if (!TrackTools.areTracksConnectedAlongAxis(tile.getWorldObj(), tA.x, tA.y, tA.z, tB.x, tB.y, tB.z))
            return false;
        addPairing(other.getCoords());
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

        SignalAspect myAspect = determineMyAspect(otherCoord);
        return SignalAspect.mostRestrictive(myAspect, otherAspect);
    }

    private SignalAspect determineMyAspect(WorldCoordinate otherCoord) {
        WorldCoordinate myTrack = getTrackLocation();
        if (myTrack == null)
            return SignalAspect.RED;
        WorldCoordinate otherTrack = getOtherTrackLocation(otherCoord);
        if (otherTrack == null)
            return SignalAspect.YELLOW;
        int x1 = Math.min(myTrack.x, otherTrack.x);
        int y1 = Math.min(myTrack.y, otherTrack.y);
        int z1 = Math.min(myTrack.z, otherTrack.z);
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    }

    protected WorldCoordinate getOtherTrackLocation(WorldCoordinate otherCoord) {
        SignalBlock other = getSignalAt(otherCoord);
        if (other != null) {
            WorldCoordinate track = other.getTrackLocation();
            trackCache.put(otherCoord, track);
            return track;
        }
        return trackCache.get(otherCoord);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.