Search in sources :

Example 11 with Color

use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.

the class ModParts method init.

public static void init() {
    // Head and deco
    ToolPartRegistry.putPart(new ToolPartFlint());
    // ToolPartRegistry.putPart(new ToolPartGlass());
    for (EnumGem gem : EnumGem.values()) ToolPartRegistry.putPart(new ToolPartGem(gem, false));
    for (EnumGem gem : EnumGem.values()) ToolPartRegistry.putPart(new ToolPartGem(gem, true));
    // Rods @formatter:off
    ToolPartRegistry.putPart(new ToolPartRodGems("RodWood", EnumMaterialTier.MUNDANE, new ItemStack(Items.STICK), 0x896727, "stickWood", 1.0f, 1.0f, 1.0f, 1.0f, 0.8f));
    ToolPartRegistry.putPart(new ToolPartRodGems("RodBone", EnumMaterialTier.MUNDANE, new ItemStack(Items.BONE), 0xFFFDE9, 1.1f, 1.0f, 1.1f, 0.9f, 1.0f));
    ToolPartRegistry.putPart(new ToolPartRodGems("RodIron", EnumMaterialTier.REGULAR, ModItems.craftingMaterial.toolRodIron, 0xA2A2A2, "stickIron", 1.25f, 1.0f, 1.0f, 1.0f, 0.9f));
    ToolPartRegistry.putPart(new ToolPartRodGems("RodGold", EnumMaterialTier.SUPER, ModItems.craftingMaterial.toolRodGold, 0xC8AE09, "stickGold", 1.15f, 1.0f, 1.15f, 1.0f, 1.0f));
    ToolPartRegistry.putPart(new ToolPartRodGems("RodSilver", EnumMaterialTier.SUPER, ModItems.craftingMaterial.toolRodSilver, 0xF2F2F2, "stickSilver", 1.0f, 1.15f, 1.0f, 1.15f, // @formatter:on
    1.0f));
    // Tips
    ToolPartRegistry.putPart(new ToolPartTipGems("TipIron", EnumTipUpgrade.IRON));
    ToolPartRegistry.putPart(new ToolPartTipGems("TipGold", EnumTipUpgrade.GOLD));
    ToolPartRegistry.putPart(new ToolPartTipGems("TipDiamond", EnumTipUpgrade.DIAMOND));
    ToolPartRegistry.putPart(new ToolPartTipGems("TipEmerald", EnumTipUpgrade.EMERALD));
    // Wool
    for (EnumDyeColor color : EnumDyeColor.values()) {
        ToolPartRegistry.putPart(new ToolPartWool(color));
    }
}
Also used : EnumGem(net.silentchaos512.gems.lib.EnumGem) ItemStack(net.minecraft.item.ItemStack) EnumDyeColor(net.minecraft.item.EnumDyeColor)

Example 12 with Color

use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.

the class ItemTeleporterLinker method renderGameOverlay.

@SideOnly(Side.CLIENT)
public void renderGameOverlay(RenderGameOverlayEvent event) {
    if (event.getType() != ElementType.TEXT) {
        return;
    }
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.player;
    ItemStack heldItem = mc.player.getHeldItem(EnumHand.MAIN_HAND);
    if (StackHelper.isEmpty(heldItem)) {
        heldItem = mc.player.getHeldItem(EnumHand.OFF_HAND);
    }
    if (StackHelper.isValid(heldItem) && heldItem.getItem() == this) {
        ScaledResolution res = new ScaledResolution(mc);
        FontRenderer fontRender = mc.fontRendererObj;
        int width = res.getScaledWidth();
        int height = res.getScaledHeight();
        String str;
        if (isLinked(heldItem)) {
            DimensionalPosition pos = getLinkedPosition(heldItem);
            double x = pos.x - player.posX;
            double z = pos.z - player.posZ;
            int distance = (int) Math.sqrt(x * x + z * z);
            LocalizationHelper loc = SilentGems.instance.localizationHelper;
            str = loc.getItemSubText(itemName, "Distance", distance);
            int textX = width / 2 - fontRender.getStringWidth(str) / 2;
            int textY = height * 3 / 5;
            // Text colored differently depending on situation.
            // Outside free range, same dimension
            int color = 0xffff00;
            if (pos.dim != player.dimension) {
                // Different dimension
                color = 0xff6600;
                str = loc.getItemSubText(itemName, "DifferentDimension");
            } else if (distance < GemsConfig.TELEPORTER_FREE_RANGE) {
                // Inside free range
                color = 0x00aaff;
            }
            fontRender.drawStringWithShadow(str, textX, textY, color);
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) DimensionalPosition(net.silentchaos512.lib.util.DimensionalPosition) EntityPlayer(net.minecraft.entity.player.EntityPlayer) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) LocalizationHelper(net.silentchaos512.lib.util.LocalizationHelper) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 13 with Color

use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.

the class GuiMaterialGrader method drawDebugInfo.

private void drawDebugInfo() {
    if (!(tileInventory instanceof TileMaterialGrader)) {
        return;
    }
    TileMaterialGrader tile = (TileMaterialGrader) tileInventory;
    FontRenderer fontRender = mc.fontRendererObj;
    int x = 5;
    int y = 5;
    int yIncrement = 10;
    int color = 0xFFFFFF;
    GlStateManager.pushMatrix();
    float scale = 1f;
    GlStateManager.scale(scale, scale, 1f);
    for (String str : tile.getDebugLines()) {
        fontRender.drawStringWithShadow(str, x, y, color);
        y += yIncrement;
    }
    GlStateManager.popMatrix();
}
Also used : FontRenderer(net.minecraft.client.gui.FontRenderer) TileMaterialGrader(net.silentchaos512.gems.tile.TileMaterialGrader)

Example 14 with Color

use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.

the class ArmorModelRenderer method setRenderColor.

protected void setRenderColor(int color) {
    Color c = new Color(color);
    GlStateManager.color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
}
Also used : Color(net.silentchaos512.lib.util.Color)

Example 15 with Color

use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.

the class GuiChaosBar method onRenderGameOverlay.

@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
    if (event.isCancelable() || event.getType() != ElementType.TEXT) {
        return;
    }
    currentTime = ClientTickHandler.ticksInGame;
    if (currentTime > lastUpdateTime + POPUP_TIME) {
        return;
    }
    ScaledResolution res = new ScaledResolution(mc);
    int posX, posY;
    float scale;
    final Color color = new Color(1f, 1f, 1f, 0.75f);
    final int barWidth = 80;
    final int barHeight = 8;
    final float xOffset = 0.5f;
    final float yOffset = 0.15f;
    final float fraction = (float) currentChaos / maxChaos;
    GlStateManager.disableLighting();
    GlStateManager.enableBlend();
    scale = 1.0f;
    if (scale > 0f) {
        GlStateManager.pushMatrix();
        posX = (int) (res.getScaledWidth() / scale * xOffset - barWidth / 2);
        posY = (int) (res.getScaledHeight() / scale * yOffset);
        GlStateManager.scale(scale, scale, 1);
        drawBar(posX, posY + 0.5f, barWidth, barHeight - 1f, color, fraction);
        drawBarFrame(posX, posY, barWidth, barHeight, new Color(1f, 1f, 1f, 1f));
        // String line = "" + currentChaos;
        // int lineWidth = mc.fontRendererObj.getStringWidth(line);
        // mc.fontRendererObj.drawStringWithShadow(line, res.getScaledWidth() * xOffset - lineWidth / 2,
        // res.getScaledHeight() * (yOffset + 0.025f), 0xFFFFFF);
        GlStateManager.popMatrix();
    }
// GlStateManager.disableBlend();
// GlStateManager.enableLighting();
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Color(net.silentchaos512.lib.util.Color) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

Color (net.silentchaos512.lib.util.Color)12 Color (net.silentchaos512.utils.Color)9 LocalizationHelper (net.silentchaos512.lib.util.LocalizationHelper)8 EnumMaterialGrade (net.silentchaos512.gems.api.lib.EnumMaterialGrade)7 TextComponent (net.minecraft.network.chat.TextComponent)6 TextFormatting (net.minecraft.util.text.TextFormatting)6 MaterialLayer (net.silentchaos512.gear.api.material.MaterialLayer)6 ToolPart (net.silentchaos512.gems.api.tool.part.ToolPart)6 MutableComponent (net.minecraft.network.chat.MutableComponent)4 TranslatableComponent (net.minecraft.network.chat.TranslatableComponent)4 Random (java.util.Random)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 Item (net.minecraft.item.Item)3 IMaterialDisplay (net.silentchaos512.gear.api.material.IMaterialDisplay)3 IMaterialInstance (net.silentchaos512.gear.api.material.IMaterialInstance)3 StatInstance (net.silentchaos512.gear.api.stats.StatInstance)3 ItemGemBow (net.silentchaos512.gems.item.tool.ItemGemBow)3 UUID (java.util.UUID)2 Minecraft (net.minecraft.client.Minecraft)2 FontRenderer (net.minecraft.client.gui.FontRenderer)2