Search in sources :

Example 11 with EnumColor

use of mods.railcraft.common.plugins.color.EnumColor in project Railcraft by Railcraft.

the class TileTankBase method recolourBlock.

@Override
public boolean recolourBlock(EnumDyeColor cID) {
    EnumColor c = EnumColor.fromDye(cID);
    if (color != c) {
        color = c;
        markBlockForUpdate();
        return true;
    }
    return false;
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor)

Example 12 with EnumColor

use of mods.railcraft.common.plugins.color.EnumColor in project Railcraft by Railcraft.

the class ItemLocomotive method addInformation.

//    @Override
//    @SideOnly(Side.CLIENT)
//    public IIcon getIcon(ItemStack stack, int pass) {
//        String rendererTag = getModel(stack);
//        LocomotiveModelRenderer renderer = renderType.getRenderer(rendererTag);
//        if (renderer == null)
//            return RenderTools.getMissingTexture();
//        IIcon[] icons = renderer.getItemIcons();
//        if (pass >= icons.length || icons[pass] == null)
//            return blankIcon;
//        return renderer.getItemIcons()[pass];
//    }
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean adv) {
    super.addInformation(stack, player, info, adv);
    GameProfile owner = getOwner(stack);
    if (owner.getName() != null && !owner.getName().equals("[Unknown]")) {
        String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.owner");
        info.add(String.format(format, owner.getName()));
    }
    String model = getModel(stack);
    LocomotiveModelRenderer renderer = renderType.getRenderer(model);
    String modelName;
    if (renderer != null)
        modelName = renderer.getDisplayName();
    else
        modelName = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.model.default");
    String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.model");
    info.add(String.format(format, modelName));
    EnumColor primary = getPrimaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.primary");
    info.add(String.format(format, primary.getTranslatedName()));
    EnumColor secondary = getSecondaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.secondary");
    info.add(String.format(format, secondary.getTranslatedName()));
    float whistle = getWhistlePitch(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.whistle");
    info.add(String.format(format, whistle < 0 ? "???" : String.format("%.2f", whistle)));
    String emblemIdent = getEmblem(stack);
    if (emblemIdent != null && !emblemIdent.isEmpty() && EmblemToolsClient.packageManager != null) {
        Emblem emblem = EmblemToolsClient.packageManager.getEmblem(emblemIdent);
        if (emblem != null) {
            format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.emblem");
            info.add(String.format(format, emblem.displayName));
        }
    }
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) GameProfile(com.mojang.authlib.GameProfile) Emblem(mods.railcraft.client.emblems.Emblem) LocomotiveModelRenderer(mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer)

Example 13 with EnumColor

use of mods.railcraft.common.plugins.color.EnumColor in project Railcraft by Railcraft.

the class LocomotiveRenderer method render.

@Override
public boolean render(ICartRenderer renderer, EntityMinecart cart, float light, float time) {
    EntityLocomotive loco = (EntityLocomotive) cart;
    EnumColor pColor = SeasonPlugin.isGhostTrain(cart) ? EnumColor.SILVER : EnumColor.fromDye(loco.getPrimaryColor());
    EnumColor sColor = SeasonPlugin.isGhostTrain(cart) ? EnumColor.SILVER : EnumColor.fromDye(loco.getSecondaryColor());
    int primaryColor = pColor.getHexColor();
    int secondaryColor = sColor.getHexColor();
    String emblem = loco.getEmblem();
    ResourceLocation emblemTexture = null;
    if (!StringUtils.isNullOrEmpty(emblem) && EmblemToolsClient.packageManager != null)
        emblemTexture = EmblemToolsClient.packageManager.getEmblemTextureLocation(emblem);
    LocomotiveRenderType renderType = loco.getRenderType();
    mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer locoRenderer = renderType.getRenderer(loco.getModel());
    locoRenderer.renderLocomotive(renderer, loco, primaryColor, secondaryColor, emblemTexture, light, time);
    return false;
}
Also used : LocomotiveRenderType(mods.railcraft.api.carts.locomotive.LocomotiveRenderType) EnumColor(mods.railcraft.common.plugins.color.EnumColor) ResourceLocation(net.minecraft.util.ResourceLocation) EntityLocomotive(mods.railcraft.common.carts.EntityLocomotive)

Example 14 with EnumColor

use of mods.railcraft.common.plugins.color.EnumColor in project Railcraft by Railcraft.

the class BlockTankMetal method addColorRecipes.

private void addColorRecipes() {
    for (EnumColor color : EnumColor.VALUES) {
        ItemStack output = getStack(8, color);
        CraftingPlugin.addShapedRecipe(output, "OOO", "ODO", "OOO", 'O', getWildcard(), 'D', color.getDyeOreDictTag());
    }
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) ItemStack(net.minecraft.item.ItemStack)

Example 15 with EnumColor

use of mods.railcraft.common.plugins.color.EnumColor in project Railcraft by Railcraft.

the class ItemLocomotive method addInformation.

// @Override
// @SideOnly(Side.CLIENT)
// public IIcon getIcon(ItemStack stack, int pass) {
// String rendererTag = getModel(stack);
// LocomotiveModelRenderer renderer = renderType.getRenderer(rendererTag);
// if (renderer == null)
// return RenderTools.getMissingTexture();
// IIcon[] icons = renderer.getItemIcons();
// if (pass >= icons.length || icons[pass] == null)
// return blankIcon;
// return renderer.getItemIcons()[pass];
// }
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable World world, List<String> info, ITooltipFlag adv) {
    super.addInformation(stack, world, info, adv);
    GameProfile owner = getOwner(stack);
    if (owner.getName() != null && !RailcraftConstantsAPI.UNKNOWN_PLAYER.equalsIgnoreCase(owner.getName())) {
        String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.owner");
        info.add(String.format(format, owner.getName()));
    }
    String model = getModel(stack);
    LocomotiveModelRenderer renderer = renderType.getRenderer(model);
    String modelName = renderer.getDisplayName();
    String format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.model");
    info.add(String.format(format, modelName));
    EnumColor primary = getPrimaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.primary");
    info.add(String.format(format, primary.getTranslatedName()));
    EnumColor secondary = getSecondaryColor(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.secondary");
    info.add(String.format(format, secondary.getTranslatedName()));
    float whistle = getWhistlePitch(stack);
    format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.whistle");
    info.add(String.format(format, whistle < 0 ? "???" : String.format("%.2f", whistle)));
    String emblemIdent = getEmblem(stack);
    if (!Strings.isEmpty(emblemIdent) && EmblemToolsClient.packageManager != null) {
        Emblem emblem = EmblemToolsClient.packageManager.getEmblem(emblemIdent);
        if (emblem != null) {
            format = LocalizationPlugin.translate("gui.railcraft.locomotive.tips.item.emblem");
            info.add(String.format(format, emblem.displayName));
        }
    }
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) GameProfile(com.mojang.authlib.GameProfile) Emblem(mods.railcraft.client.emblems.Emblem) LocomotiveModelRenderer(mods.railcraft.client.render.carts.LocomotiveModelRenderer) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EnumColor (mods.railcraft.common.plugins.color.EnumColor)21 ItemStack (net.minecraft.item.ItemStack)7 IBlockState (net.minecraft.block.state.IBlockState)4 GameProfile (com.mojang.authlib.GameProfile)2 Emblem (mods.railcraft.client.emblems.Emblem)2 EntityLocomotive (mods.railcraft.common.carts.EntityLocomotive)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 LocomotiveModelRenderer (mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer)1 LocomotiveRenderType (mods.railcraft.api.carts.locomotive.LocomotiveRenderType)1 LocomotiveModelRenderer (mods.railcraft.client.render.carts.LocomotiveModelRenderer)1 EnumDetector (mods.railcraft.common.blocks.detector.EnumDetector)1 Ingredient (net.minecraft.item.crafting.Ingredient)1 EnumFacing (net.minecraft.util.EnumFacing)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 ThaumcraftApi (thaumcraft.api.ThaumcraftApi)1 AspectList (thaumcraft.api.aspects.AspectList)1