Package mods.railcraft.api.tracks

Examples of mods.railcraft.api.tracks.TrackSpec


    @Override
    public void readFromNBT(NBTTagCompound data) {
        super.readFromNBT(data);

        if (data.hasKey("trackTag")) {
            TrackSpec spec = TrackRegistry.getTrackSpec(data.getString("trackTag"));
            track = spec.createInstanceFromSpec();
        } else if (data.hasKey("trackId")) {
            TrackSpec spec = TrackRegistry.getTrackSpec(data.getInteger("trackId"));
            track = spec.createInstanceFromSpec();
        }
        track.setTile(this);

        track.readFromNBT(data);
    }
View Full Code Here


        return getIconIndex(stack);
    }

    @Override
    public IIcon getIconIndex(ItemStack stack) {
        TrackSpec trackSpec = getTrackSpec(stack);
        if (trackSpec == null)
            return Blocks.rail.getIcon(0, 0);
        return trackSpec.getItemIcon();
    }
View Full Code Here

    @Override
    public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
        super.addInformation(stack, player, list, advanced);
        try {
            TrackSpec spec = getTrackSpec(stack);
            List<String> tips = spec.getItemToolTip();
            if (tips != null)
                list.addAll(tips);
        } catch (Throwable error) {
            Game.logErrorAPI("Railcraft", error, TrackSpec.class);
        }
View Full Code Here

            return false;
        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

    public void getSubBlocks(Item item, CreativeTabs tab, List list) {
        Map<Short, TrackSpec> specs = TrackRegistry.getTrackSpecIDs();

        Set<TrackSpec> railcraftSpecs = new HashSet<TrackSpec>();
        for (EnumTrack track : EnumTrack.getCreativeList()) {
            TrackSpec spec = specs.get((short) track.ordinal());
            if (spec == null)
                continue;
            railcraftSpecs.add(spec);
            if (track.isEnabled())
                list.add(spec.getItem());
        }

        Set<TrackSpec> otherSpecs = new HashSet<TrackSpec>(specs.values());
        otherSpecs.removeAll(railcraftSpecs);
        otherSpecs.remove(TrackRegistry.getTrackSpec("Railcraft:default"));
        for (TrackSpec spec : otherSpecs) {
            list.add(spec.getItem());
        }
    }
View Full Code Here

* @author CovertJaguar <http://www.railcraft.info>
*/
public class TrackFactory {

    public static TileTrack makeTrackTile(int trackID) {
        TrackSpec spec = TrackRegistry.getTrackSpec(trackID);
        if (spec == null) {
            Game.log(Level.ERROR, "Attempted to create Track Tile with invalid Track ID {0}", trackID);
            return null;
        }
        return makeTrackTile(spec.createInstanceFromSpec());
    }
View Full Code Here

TOP

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

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.