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;
}
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;
}
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));
}
}
}
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;
}
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();
}
Aggregations