Search in sources :

Example 6 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 7 with EnumColor

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

the class BlockStrengthGlass method getState.

@Override
public IBlockState getState(@Nullable IVariantEnum variant) {
    IBlockState state = getDefaultState();
    if (variant != null) {
        checkVariant(variant);
        state = state.withProperty(COLOR, (EnumColor) variant);
    }
    return state;
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) IBlockState(net.minecraft.block.state.IBlockState)

Example 8 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 9 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 10 with EnumColor

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

the class TilePostEmblem method readPacketData.

@Override
public void readPacketData(@Nonnull RailcraftInputStream data) throws IOException {
    super.readPacketData(data);
    boolean needsUpdate = false;
    EnumFacing f = EnumFacing.getFront(data.readByte());
    if (facing != f) {
        facing = f;
        needsUpdate = true;
    }
    byte cByte = data.readByte();
    if (cByte < 0) {
        if (color != null) {
            color = null;
            needsUpdate = true;
        }
    } else {
        EnumColor c = EnumColor.fromOrdinal(cByte);
        if (color != c) {
            color = c;
            needsUpdate = true;
        }
    }
    emblem = data.readUTF();
    if (needsUpdate)
        markBlockForUpdate();
}
Also used : EnumColor(mods.railcraft.common.plugins.color.EnumColor) EnumFacing(net.minecraft.util.EnumFacing)

Aggregations

EnumColor (mods.railcraft.common.plugins.color.EnumColor)10 ItemStack (net.minecraft.item.ItemStack)3 IBlockState (net.minecraft.block.state.IBlockState)2 GameProfile (com.mojang.authlib.GameProfile)1 LocomotiveModelRenderer (mods.railcraft.api.carts.locomotive.LocomotiveModelRenderer)1 LocomotiveRenderType (mods.railcraft.api.carts.locomotive.LocomotiveRenderType)1 Emblem (mods.railcraft.client.emblems.Emblem)1 EnumDetector (mods.railcraft.common.blocks.detector.EnumDetector)1 EntityLocomotive (mods.railcraft.common.carts.EntityLocomotive)1 EnumFacing (net.minecraft.util.EnumFacing)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 ThaumcraftApi (thaumcraft.api.ThaumcraftApi)1 AspectList (thaumcraft.api.aspects.AspectList)1