Search in sources :

Example 1 with IVariantEnum

use of mods.railcraft.api.core.IVariantEnum in project Railcraft by Railcraft.

the class ItemBlockRailcraftSubtyped method getUnlocalizedName.

@Override
public String getUnlocalizedName(ItemStack stack) {
    IVariantEnum variant = getVariant(stack);
    if (variant == null)
        return getUnlocalizedName();
    String tag = getUnlocalizedName() + RailcraftConstants.SEPERATOR + variant.getResourcePathSuffix();
    return LocalizationPlugin.convertTag(tag);
}
Also used : IVariantEnum(mods.railcraft.api.core.IVariantEnum)

Example 2 with IVariantEnum

use of mods.railcraft.api.core.IVariantEnum in project Railcraft by Railcraft.

the class IRailcraftBlock method registerTextures.

@SideOnly(Side.CLIENT)
default default void registerTextures(TextureMap textureMap) {
    TextureAtlasSheet.unstitchIcons(textureMap, getBlockTexture(), getTextureDimensions());
    IVariantEnum[] variants = getVariants();
    if (variants != null) {
        for (IVariantEnum variant : variants) {
            if (variant instanceof IVariantEnumBlock)
                TextureAtlasSheet.unstitchIcons(textureMap, new ResourceLocation(getRegistryName() + "_" + variant.getResourcePathSuffix()), ((IVariantEnumBlock) variant).getTextureDimensions());
        }
    }
}
Also used : IVariantEnum(mods.railcraft.api.core.IVariantEnum) ResourceLocation(net.minecraft.util.ResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with IVariantEnum

use of mods.railcraft.api.core.IVariantEnum in project Railcraft by Railcraft.

the class IRailcraftItemSimple method initializeClient.

@Override
@SideOnly(Side.CLIENT)
default default void initializeClient() {
    IVariantEnum[] variants = getVariants();
    if (variants != null) {
        for (int i = 0, variantsLength = variants.length; i < variantsLength; i++) {
            IVariantEnum variant = variants[i];
            ModelManager.registerItemModel(getObject(), i, getResourcePath() + RailcraftConstants.SEPERATOR + variant.getResourcePathSuffix());
        }
    } else {
        ModelManager.registerItemModel(getObject(), 0);
    }
}
Also used : IVariantEnum(mods.railcraft.api.core.IVariantEnum) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with IVariantEnum

use of mods.railcraft.api.core.IVariantEnum in project Railcraft by Railcraft.

the class RailcraftConfig method loadBlocks.

private static void loadBlocks() {
    configBlocks.addCustomCategoryComment(CAT_BLOCKS, "Here you can disable entire blocks.\n" + "Changing these will have adverse effects on existing worlds.\n" + "For the list of which sub-blocks are on each ID see the sub-block section below.");
    configBlocks.addCustomCategoryComment(CAT_SUB_BLOCKS, "Here is were you can enable/disable various sub-blocks.\n" + "Railcraft will attempt to compensate for any missing component by providing alternatives (usually).");
    for (RailcraftBlocks block : RailcraftBlocks.VALUES) {
        loadBlockProperty(block.getBaseTag());
        Class<? extends IVariantEnum> variantClass = block.getVariantClass();
        if (variantClass != null)
            for (IVariantEnum variant : variantClass.getEnumConstants()) {
                String tag = block.getBaseTag() + RailcraftConstants.SEPERATOR + variant.getResourcePathSuffix();
                loadBlockFeature(tag);
            }
    }
    loadBlockProperty("fluid.creosote");
    loadBlockProperty("fluid.steam");
    // TODO: Move to own file?
    for (TrackKits type : TrackKits.VALUES) {
        //            if (type.isDeprecated())
        //                continue;
        loadBlockFeature(type.getRegistryName());
    }
    Map<String, Property> blocks = configBlocks.getCategory(CAT_BLOCKS);
    blocks.keySet().retainAll(enabledBlocks.keySet());
    Map<String, Property> subBlocks = configBlocks.getCategory(CAT_SUB_BLOCKS);
    subBlocks.keySet().retainAll(enabledSubBlocks.keySet());
//        for (EnumGeneric type : EnumGeneric.VALUES) {
//            loadBlockFeature(type.getTag());
//        }
//
//        for (EnumPost type : EnumPost.VALUES) {
//            loadBlockFeature(type.getTag());
//        }
//        for (EnumWallAlpha type : EnumWallAlpha.VALUES) {
//            loadBlockFeature(type.getTag());
//        }
//
//        for (EnumWallBeta type : EnumWallBeta.VALUES) {
//            loadBlockFeature(type.getTag());
//        }
//        for (BlockMaterial mat : BlockMaterial.STAIR_MATS) {
//            loadBlockFeature(BlockRailcraftStairs.getTag(mat));
//        }
//
//        for (BlockMaterial mat : BlockMaterial.SLAB_MATS) {
//            loadBlockFeature(BlockRailcraftSlab.getTag(mat));
//        }
//        for (BlockMaterial mat : BlockLantern.STONE_LANTERN.values()) {
//            loadBlockFeature(BlockLantern.getTag(mat));
//        }
//
//        for (BlockMaterial mat : BlockLantern.METAL_LANTERN.values()) {
//            loadBlockFeature(BlockLantern.getTag(mat));
//        }
//        for (EnumOre type : EnumOre.values()) {
//            if (!type.isDeprecated())
//                loadBlockFeature(type.getTag());
//        }
//        Set<IEnumMachine<?>> machineVariants = new HashSet<>();
//        machineVariants.addAll(Arrays.asList(EnumMachineAlpha.VALUES));
//        machineVariants.addAll(Arrays.asList(EnumMachineBeta.values()));
//        machineVariants.addAll(Arrays.asList(EnumMachineGamma.values()));
//        machineVariants.addAll(Arrays.asList(EnumMachineDelta.values()));
//        machineVariants.addAll(Arrays.asList(EnumMachineEpsilon.values()));
//
//        for (IEnumMachine<?> type : machineVariants) {
//            loadBlockFeature(type.getTag());
//        }
//
//        for (EnumSignal type : EnumSignal.values()) {
//            if (type.getModule() != null)
//                loadBlockFeature(type.getTag());
//        }
}
Also used : RailcraftBlocks(mods.railcraft.common.blocks.RailcraftBlocks) TrackKits(mods.railcraft.common.blocks.tracks.outfitted.TrackKits) IVariantEnum(mods.railcraft.api.core.IVariantEnum) Property(net.minecraftforge.common.config.Property)

Aggregations

IVariantEnum (mods.railcraft.api.core.IVariantEnum)4 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 RailcraftBlocks (mods.railcraft.common.blocks.RailcraftBlocks)1 TrackKits (mods.railcraft.common.blocks.tracks.outfitted.TrackKits)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 Property (net.minecraftforge.common.config.Property)1