Package mods.railcraft.api.tracks

Examples of mods.railcraft.api.tracks.ITrackInstance


    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderblocks) {
        int meta = ((BlockRailBase) block).getBasicRailMetadata(world, null, x, y, z);

        IIcon icon;
        TileEntity tile = world.getTileEntity(x, y, z);
        ITrackInstance track = null;
        if (tile instanceof TileTrack) {
            track = ((TileTrack) tile).getTrackInstance();
            icon = renderblocks.getIconSafe(track.getIcon());
        } else {
            icon = Blocks.rail.getIcon(0, 0);
        }

        if (renderblocks.hasOverrideBlockTexture()) {
View Full Code Here


            resetPipe();
            if (worldObj != null) {
                TileEntity tile = worldObj.getTileEntity(xCoord, yCoord - 2, zCoord);
                if (tile instanceof TileTrack) {
                    TileTrack trackTile = (TileTrack) tile;
                    ITrackInstance track = trackTile.getTrackInstance();
                    if (track instanceof ITrackLockdown) {
                        ((ITrackLockdown) track).releaseCart();
                    }
                }
            }
View Full Code Here

        refreshLogic();
        boolean shouldSwitch = false;
        for (byte side = 2; side < 6; side++) {
            TileEntity tile = tileCache.getTileOnSide(ForgeDirection.getOrientation(side));
            if (tile instanceof TileTrack) {
                ITrackInstance track = ((TileTrack) tile).getTrackInstance();
                shouldSwitch |= track instanceof ITrackSwitch && isRoutedCartApproaching((ITrackSwitch) track);
            } else
                shouldSwitch |= tile instanceof ITrackSwitch && isRoutedCartApproaching((ITrackSwitch) tile);
        }
        switchTrack(shouldSwitch);
View Full Code Here

            return ((TileTrack) tile).getTrackInstance();
        return null;
    }

    public static boolean isHighSpeedTrackAt(World world, int x, int y, int z) {
        ITrackInstance track = getTrackInstanceAt(world, x, y, z);
        if (track instanceof TrackBaseRailcraft)
            return ((TrackBaseRailcraft) track).speedController instanceof SpeedControllerHighSpeed;
        return false;
    }
View Full Code Here

        if (j >= world.getHeight() - 1)
            return false;
        if (stack == null || !(stack.getItem() instanceof ItemTrack))
            return false;
        TrackSpec spec = getTrackSpec(stack);
        ITrackInstance track = spec.createInstanceFromSpec();
        boolean canPlace = world.canPlaceEntityOnSide(blockTrack, i, j, k, true, side, null, stack);
        if (track instanceof ITrackCustomPlaced)
            canPlace &= ((ITrackCustomPlaced) track).canPlaceRailAt(world, i, j, k);
        else
            canPlace &= world.isSideSolid(i, j - 1, k, ForgeDirection.UP);
View Full Code Here

        return true;
    }

    public void migrateTrack(TrackNextGenLocking.LockingProfileType type) {
        Game.log(Level.WARN, "Migrating Legacy Track Type to new implementation: <{0}, {1}, {2}> {3} -> {4}", getX(), getY(), getZ(), getTrackSpec().getTrackTag(), EnumTrack.LOCKING.getTag());
        ITrackInstance track = EnumTrack.LOCKING.getTrackSpec().createInstanceFromSpec();
        TrackNextGenLocking trackLocking = (TrackNextGenLocking) track;
        trackLocking.setProfile(type);
        TileEntity te = TrackFactory.makeTrackTile(track);
        getWorld().setTileEntity(getX(), getY(), getZ(), te);
        getWorld().markBlockForUpdate(getX(), getY(), getZ());
View Full Code Here

    private void findTrack() {
        for (byte side = 2; side < 6; side++) {
            TileEntity tile = tileCache.getTileOnSide(ForgeDirection.getOrientation(side));
            if (tile instanceof TileTrack) {
                ITrackInstance track = ((TileTrack) tile).getTrackInstance();
                if (track instanceof ITrackSwitch) {
                    if (facing != side) {
                        facing = side;
                        sendUpdateToClient();
                    }
View Full Code Here

    protected void switchTrack(boolean switched) {
        for (byte side = 2; side < 6; side++) {
            TileEntity tile = tileCache.getTileOnSide(ForgeDirection.getOrientation(side));
            if (tile instanceof TileTrack) {
                ITrackInstance track = ((TileTrack) tile).getTrackInstance();
                if (track instanceof ITrackSwitch)
                    ((ITrackSwitch) track).setSwitched(switched);
            } else if (tile instanceof ITrackSwitch)
                ((ITrackSwitch) tile).setSwitched(switched);
        }
View Full Code Here

    @Override
    public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
        TileEntity tile = world.getTileEntity(x, y, z);
        if (tile instanceof TileTrack) {
            ITrackInstance track = ((TileTrack) tile).getTrackInstance();
            return track.getTrackSpec().getItem();
        }
        return null;
    }
View Full Code Here

    @Override
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
        TileEntity tile = world.getTileEntity(i, j, k);
        if (tile instanceof TileTrack) {
            ITrackInstance track = ((TileTrack) tile).getTrackInstance();
            if (track instanceof ITrackCustomShape)
                return ((ITrackCustomShape) track).getCollisionBoundingBoxFromPool();
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of mods.railcraft.api.tracks.ITrackInstance

Copyright © 2018 www.massapicom. 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.