Search in sources :

Example 1 with HandleMaterial

use of api.materials.HandleMaterial in project Adventurers-Toolbox by the-realest-stu.

the class SpecialToolAbilityHandler method onTooltip.

@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGH)
public void onTooltip(ItemTooltipEvent event) {
    if (event.getItemStack() != null && event.getEntityPlayer() != null) {
        ItemStack stack = event.getItemStack();
        Item item = stack.getItem();
        if (item instanceof ItemATAxe || item instanceof ItemATDagger || item instanceof ItemATHammer || item instanceof ItemATHandpick || item instanceof ItemATHoe || item instanceof ItemATMace || item instanceof ItemATPickaxe || item instanceof ItemATShovel || item instanceof ItemATSword) {
            boolean shift = GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak);
            boolean advanced = event.getFlags().isAdvanced();
            List<String> tooltip = event.getToolTip();
            tooltip.clear();
            String s = stack.getDisplayName();
            s = s + TextFormatting.RESET;
            if (advanced) {
                String s1 = "";
                if (!s.isEmpty()) {
                    s = s + " (";
                    s1 = ")";
                }
                int i = Item.getIdFromItem(item);
                if (stack.getHasSubtypes()) {
                    s = s + String.format("#%04d/%d%s", i, stack.getItemDamage(), s1);
                } else {
                    s = s + String.format("#%04d%s", i, s1);
                }
            }
            tooltip.add(s);
            int i1 = 0;
            if (shift) {
                tooltip.add("");
                if (item instanceof IHeadTool) {
                    HeadMaterial mat = IHeadTool.getHeadMat(stack);
                    tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.head.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                }
                if (item instanceof IBladeTool) {
                    HeadMaterial mat = IBladeTool.getBladeMat(stack);
                    tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.blade.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                }
                if (item instanceof ICrossguardTool) {
                    HeadMaterial mat = ICrossguardTool.getCrossguardMat(stack);
                    tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.crossguard.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                }
                if (item instanceof IHaftTool) {
                    HaftMaterial mat = IHaftTool.getHaftMat(stack);
                    tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.haft.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                }
                if (item instanceof IHandleTool) {
                    HandleMaterial mat = IHandleTool.getHandleMat(stack);
                    tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.handle.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                }
                if (item instanceof IAdornedTool) {
                    AdornmentMaterial mat = IAdornedTool.getAdornmentMat(stack);
                    if (!mat.getName().equals("null")) {
                        tooltip.add(TextFormatting.YELLOW + " " + I18n.translateToLocal("desc.adornment.name") + ": " + I18n.translateToLocal("guide.mat." + mat.getName() + ".name"));
                    }
                }
                tooltip.add("");
            }
            if (stack.hasTagCompound() && stack.getTagCompound().hasKey("HideFlags", 99)) {
                i1 = stack.getTagCompound().getInteger("HideFlags");
            }
            if ((i1 & 32) == 0) {
                item.addInformation(stack, event.getEntityPlayer() == null ? null : event.getEntityPlayer().world, tooltip, event.getFlags());
            }
            if (item instanceof ItemSword && isVoidTool(stack) && CommonProxy.thaumcraftLoaded) {
                tooltip.add(TextFormatting.GOLD + I18n.translateToLocal("enchantment.special.sapless"));
            }
            if (stack.hasTagCompound()) {
                if ((i1 & 1) == 0) {
                    NBTTagList nbttaglist = stack.getEnchantmentTagList();
                    for (int j = 0; j < nbttaglist.tagCount(); ++j) {
                        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(j);
                        int k = nbttagcompound.getShort("id");
                        int l = nbttagcompound.getShort("lvl");
                        Enchantment enchantment = Enchantment.getEnchantmentByID(k);
                        if (enchantment != null) {
                            tooltip.add(enchantment.getTranslatedName(l));
                        }
                    }
                }
                if (stack.getTagCompound().hasKey("display", 10)) {
                    NBTTagCompound nbttagcompound1 = stack.getTagCompound().getCompoundTag("display");
                    if (nbttagcompound1.getTagId("Lore") == 9) {
                        NBTTagList nbttaglist3 = nbttagcompound1.getTagList("Lore", 8);
                        if (!nbttaglist3.hasNoTags()) {
                            for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) {
                                tooltip.add(TextFormatting.DARK_PURPLE + "" + TextFormatting.ITALIC + nbttaglist3.getStringTagAt(l1));
                            }
                        }
                    }
                }
            }
            Multimap<String, AttributeModifier> multimap = stack.getAttributeModifiers(EntityEquipmentSlot.MAINHAND);
            if ((i1 & 2) == 0) {
                if (!tooltip.get(tooltip.size() - 1).isEmpty()) {
                    tooltip.add("");
                }
                if (item instanceof ItemATPickaxe || item instanceof ItemATHandpick || item instanceof ItemATHammer || item instanceof ItemATAxe || item instanceof ItemATShovel) {
                    int harvestLvl = -1;
                    float efficiency = 0F;
                    if (item instanceof ItemATPickaxe) {
                        harvestLvl = ((ItemATPickaxe) item).getHarvestLevel(stack);
                        efficiency = ((ItemATPickaxe) item).getEfficiency(stack);
                    } else if (item instanceof ItemATHandpick) {
                        harvestLvl = ((ItemATHandpick) item).getHarvestLevel(stack);
                        efficiency = ((ItemATHandpick) item).getEfficiency(stack);
                    } else if (item instanceof ItemATHammer) {
                        harvestLvl = ((ItemATHammer) item).getHarvestLevel(stack);
                        efficiency = ((ItemATHammer) item).getEfficiency(stack);
                    } else if (item instanceof ItemATAxe) {
                        harvestLvl = ((ItemATAxe) item).getHarvestLevel(stack);
                        efficiency = ((ItemATAxe) item).getEfficiency(stack);
                    } else if (item instanceof ItemATShovel) {
                        harvestLvl = ((ItemATShovel) item).getHarvestLevel(stack);
                        efficiency = ((ItemATShovel) item).getEfficiency(stack);
                    }
                    tooltip.add(I18n.translateToLocal("desc.harvest_level.name") + ": " + harvestLvl);
                    tooltip.add(I18n.translateToLocal("desc.efficiency.name") + ": " + ItemStack.DECIMALFORMAT.format(efficiency));
                }
                for (Entry<String, AttributeModifier> entry : multimap.entries()) {
                    AttributeModifier attributemodifier = entry.getValue();
                    double d0 = attributemodifier.getAmount();
                    if (event.getEntityPlayer() != null && (shift || item instanceof ItemSword)) {
                        if (attributemodifier.getID() == ItemBase.getAttackDamageUUID()) {
                            d0 = d0 + event.getEntityPlayer().getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue();
                            d0 = d0 + (double) EnchantmentHelper.getModifierForCreature(stack, EnumCreatureAttribute.UNDEFINED);
                            double d1 = d0 * 100.0D;
                            ;
                            if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) {
                                d1 = d0;
                            }
                            tooltip.add(I18n.translateToLocal("desc.attack_damage.name") + ": " + ItemStack.DECIMALFORMAT.format(d1));
                        } else if (attributemodifier.getID() == ItemBase.getAttackSpeedUUID()) {
                            d0 += event.getEntityPlayer().getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getBaseValue();
                            double d1 = d0 * 100.0D;
                            ;
                            if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) {
                                d1 = d0;
                            }
                            tooltip.add(I18n.translateToLocal("desc.attack_speed.name") + ": " + ItemStack.DECIMALFORMAT.format(d1));
                        }
                    }
                }
                if (shift) {
                    tooltip.add(I18n.translateToLocal("desc.enchantability.name") + ": " + item.getItemEnchantability(stack));
                }
                if (stack.isItemDamaged() && stack.isItemStackDamageable()) {
                    tooltip.add(I18n.translateToLocal("desc.durability.name") + ": " + (stack.getMaxDamage() - stack.getItemDamage()) + " / " + ItemStack.DECIMALFORMAT.format(stack.getMaxDamage()));
                } else if (stack.isItemStackDamageable()) {
                    tooltip.add(I18n.translateToLocal("desc.durability.name") + ": " + stack.getMaxDamage());
                }
            }
            if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("Unbreakable") && (i1 & 4) == 0) {
                tooltip.add(TextFormatting.BLUE + I18n.translateToLocal("item.unbreakable"));
            }
            if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CanDestroy", 9) && (i1 & 8) == 0) {
                NBTTagList nbttaglist1 = stack.getTagCompound().getTagList("CanDestroy", 8);
                if (!nbttaglist1.hasNoTags()) {
                    tooltip.add("");
                    tooltip.add(TextFormatting.GRAY + I18n.translateToLocal("item.canBreak"));
                    for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) {
                        Block block = Block.getBlockFromName(nbttaglist1.getStringTagAt(j1));
                        if (block != null) {
                            tooltip.add(TextFormatting.DARK_GRAY + block.getLocalizedName());
                        } else {
                            tooltip.add(TextFormatting.DARK_GRAY + "missingno");
                        }
                    }
                }
            }
            if (advanced) {
                tooltip.add(TextFormatting.DARK_GRAY + ((ResourceLocation) Item.REGISTRY.getNameForObject(item)).toString());
                tooltip.add(TextFormatting.DARK_GRAY + I18n.translateToLocalFormatted("item.nbt_tags", stack.hasTagCompound() ? stack.getTagCompound().getKeySet().size() : 0));
            }
        }
    }
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) ItemATShovel(toolbox.common.items.tools.ItemATShovel) ItemATSword(toolbox.common.items.tools.ItemATSword) IHaftTool(toolbox.common.items.tools.IHaftTool) ItemATHammer(toolbox.common.items.tools.ItemATHammer) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ICrossguardTool(toolbox.common.items.tools.ICrossguardTool) NBTTagList(net.minecraft.nbt.NBTTagList) Item(net.minecraft.item.Item) EntityItem(net.minecraft.entity.item.EntityItem) ItemATAxe(toolbox.common.items.tools.ItemATAxe) HandleMaterial(api.materials.HandleMaterial) ResourceLocation(net.minecraft.util.ResourceLocation) IHeadTool(toolbox.common.items.tools.IHeadTool) ItemSword(net.minecraft.item.ItemSword) ItemATHoe(toolbox.common.items.tools.ItemATHoe) ItemATPickaxe(toolbox.common.items.tools.ItemATPickaxe) HeadMaterial(api.materials.HeadMaterial) IBladeTool(toolbox.common.items.tools.IBladeTool) AttributeModifier(net.minecraft.entity.ai.attributes.AttributeModifier) IHandleTool(toolbox.common.items.tools.IHandleTool) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) ItemATMace(toolbox.common.items.tools.ItemATMace) Enchantment(net.minecraft.enchantment.Enchantment) IAdornedTool(toolbox.common.items.tools.IAdornedTool) ItemATDagger(toolbox.common.items.tools.ItemATDagger) ItemATHandpick(toolbox.common.items.tools.ItemATHandpick) HaftMaterial(api.materials.HaftMaterial) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with HandleMaterial

use of api.materials.HandleMaterial in project Adventurers-Toolbox by the-realest-stu.

the class SwordModel method getTextures.

@Override
public Collection<ResourceLocation> getTextures() {
    ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
    for (HeadMaterial mat : Materials.head_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/sword/blade_" + mat.getName()));
    }
    for (HeadMaterial mat : Materials.head_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/sword/crossguard_" + mat.getName()));
    }
    for (HandleMaterial mat : Materials.handle_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/sword/handle_" + mat.getName()));
    }
    for (AdornmentMaterial mat : Materials.adornment_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/sword/adornment_" + mat.getName()));
    }
    Collection textures = builder.build();
    return textures;
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) HandleMaterial(api.materials.HandleMaterial) ImmutableList(com.google.common.collect.ImmutableList) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) HeadMaterial(api.materials.HeadMaterial) Collection(java.util.Collection) ItemOverride(net.minecraft.client.renderer.block.model.ItemOverride)

Example 3 with HandleMaterial

use of api.materials.HandleMaterial in project Adventurers-Toolbox by the-realest-stu.

the class GuiBook method initPages.

public static void initPages() {
    BookPageContents home = new BookPageContents("guide.page.home.name");
    home.addLink(new ChapterLink("guide.chapter.misc.name", "misc"));
    home.addLink(new ChapterLink("guide.chapter.mat.name", "mat"));
    home.addLink(new ChapterLink("guide.chapter.tool.name", "tool"));
    home.addLink(new ChapterLink("guide.chapter.weapon.name", "weapon"));
    BookPageContents matHome = new BookPageContents("guide.page.mat.name");
    matHome.addLink(new ChapterLink("guide.chapter.head_mat.name", "head_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.haft_mat.name", "haft_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.handle_mat.name", "handle_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.adornment_mat.name", "adornment_mat"));
    chapters.put("home", new BookChapter("home"));
    chapters.put("misc", new BookChapter("misc", "home"));
    chapters.put("mat", new BookChapter("mat", "home"));
    chapters.put("tool", new BookChapter("tool", "home"));
    chapters.put("weapon", new BookChapter("weapon", "home"));
    chapters.put("head_mat", new BookChapter("head_mat", "mat"));
    chapters.put("haft_mat", new BookChapter("haft_mat", "mat"));
    chapters.put("handle_mat", new BookChapter("handle_mat", "mat"));
    chapters.put("adornment_mat", new BookChapter("adornment_mat", "mat"));
    chapters.get("home").addPage(home);
    chapters.get("mat").addPage(matHome);
    chapters.get("misc").addPage(new BookPageText("guide.page.misc.name", "guide.page.misc.text"));
    for (HeadMaterial mat : Materials.head_registry.values()) {
        boolean hideUnavailables = true;
        // hideUnavailables = Config.HIDE_UNCRAFTABLE_HEADS;
        if (!hideUnavailables || (OreDictionary.getOres(mat.getCraftingItem()).size() > 0 && OreDictionary.getOres(mat.getSmallCraftingItem()).size() > 0)) {
            BookPageMat page = new BookPageMat(mat);
            chapters.get("head_mat").addPage(page);
        }
    }
    for (HaftMaterial mat : Materials.haft_registry.values()) {
        if (!ModRecipes.haft_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("haft_mat").addPage(page);
    }
    for (HandleMaterial mat : Materials.handle_registry.values()) {
        if (!ModRecipes.handle_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("handle_mat").addPage(page);
    }
    for (AdornmentMaterial mat : Materials.adornment_registry.values()) {
        if (mat == ModMaterials.ADORNMENT_NULL) {
            continue;
        }
        if (!ModRecipes.adornment_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("adornment_mat").addPage(page);
    }
    chapters.get("tool").addPage(new BookPageTool("guide.tool.pickaxe.name", "guide.tool.pickaxe.desc", ModItems.pickaxe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.axe.name", "guide.tool.axe.desc", ModItems.axe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.shovel.name", "guide.tool.shovel.desc", ModItems.shovel));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.hoe.name", "guide.tool.hoe.desc", ModItems.hoe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.handpick.name", "guide.tool.handpick.desc", ModItems.handpick));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.hammer.name", "guide.tool.hammer.desc", ModItems.hammer));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.sword.name", "guide.weapon.sword.desc", ModItems.sword));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.dagger.name", "guide.weapon.dagger.desc", ModItems.dagger));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.mace.name", "guide.weapon.mace.desc", ModItems.mace));
    for (BookChapter chapter : chapters.values()) {
        if (chapter.getPageCount() <= 0) {
            chapter.addPage(new BookPage(chapter.getName()));
        }
    }
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) BookPageMat(api.guide.BookPageMat) HandleMaterial(api.materials.HandleMaterial) BookPageText(api.guide.BookPageText) BookChapter(api.guide.BookChapter) HeadMaterial(api.materials.HeadMaterial) BookPage(api.guide.BookPage) BookPageTool(api.guide.BookPageTool) ChapterLink(api.guide.ChapterLink) BookPageContents(api.guide.BookPageContents) HaftMaterial(api.materials.HaftMaterial)

Example 4 with HandleMaterial

use of api.materials.HandleMaterial in project Adventurers-Toolbox by the-realest-stu.

the class GuiBook method renderMatPage.

private void renderMatPage(BookPageMat page, int mouseX, int mouseY) {
    display = page.getDisplayStack();
    GlStateManager.pushMatrix();
    float itemScale = 2F;
    int itemX = left + (WIDTH - 32) / 2;
    int itemY = top + 24;
    GlStateManager.scale(itemScale, itemScale, itemScale);
    RenderHelper.enableGUIStandardItemLighting();
    this.itemRender.renderItemAndEffectIntoGUI(display, (int) (itemX / itemScale), (int) (itemY / itemScale));
    RenderHelper.disableStandardItemLighting();
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    float textScale = 0.5F;
    GlStateManager.scale(textScale, textScale, textScale);
    int i = 58;
    int increment = (int) (2 + fontRenderer.FONT_HEIGHT * textScale);
    if (page.getMat() instanceof HeadMaterial) {
        HeadMaterial mat = (HeadMaterial) page.getMat();
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.harvest_level.name") + TextFormatting.RESET + ": " + mat.getHarvestLevel(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.efficiency.name") + TextFormatting.RESET + ": " + mat.getEfficiency(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.durability.name") + TextFormatting.RESET + ": " + mat.getDurability(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.attack_damage.name") + TextFormatting.RESET + ": " + mat.getAttackDamage(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.enchantability.name") + TextFormatting.RESET + ": " + mat.getEnchantability(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
    } else if (page.getMat() instanceof HaftMaterial) {
        HaftMaterial mat = (HaftMaterial) page.getMat();
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.harvest_level_mod.name") + TextFormatting.RESET + ": " + mat.getHarvestLevelMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.efficiency_mod.name") + TextFormatting.RESET + ": " + mat.getEfficiencyMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.durability_mod.name") + TextFormatting.RESET + ": " + mat.getDurabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.attack_damage_mod.name") + TextFormatting.RESET + ": " + mat.getAttackDamageMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.enchantability_mod.name") + TextFormatting.RESET + ": " + mat.getEnchantabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
    } else if (page.getMat() instanceof HandleMaterial) {
        HandleMaterial mat = (HandleMaterial) page.getMat();
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.efficiency_mod.name") + TextFormatting.RESET + ": " + mat.getEfficiencyMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.durability_mod.name") + TextFormatting.RESET + ": " + mat.getDurabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.enchantability_mod.name") + TextFormatting.RESET + ": " + mat.getEnchantabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
    } else if (page.getMat() instanceof AdornmentMaterial) {
        AdornmentMaterial mat = (AdornmentMaterial) page.getMat();
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.harvest_level_mod.name") + TextFormatting.RESET + ": " + mat.getHarvestLevelMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.efficiency_mod.name") + TextFormatting.RESET + ": " + mat.getEfficiencyMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.durability_mod.name") + TextFormatting.RESET + ": " + mat.getDurabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.attack_damage_mod.name") + TextFormatting.RESET + ": " + mat.getAttackDamageMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
        this.fontRenderer.drawString(TextFormatting.UNDERLINE + I18n.format("guide.mat.stat.enchantability_mod.name") + TextFormatting.RESET + ": " + mat.getEnchantabilityMod(), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), 0);
        i += increment;
    }
    if (!I18n.format(page.getDescription()).equals(page.getDescription())) {
        i += 6;
        this.fontRenderer.drawSplitString(TextFormatting.DARK_RED + I18n.format(page.getDescription()), (int) ((left + 18) / textScale), (int) ((top + i) / textScale), (int) ((WIDTH - (18 * 2)) / textScale), 0);
    }
    GlStateManager.popMatrix();
    if (mouseX >= itemX && mouseY >= itemY && mouseX <= itemX + (16 * itemScale) && mouseY <= itemY + (16 * itemScale)) {
        GlStateManager.pushMatrix();
        float toolTipScale = 0.5F;
        GlStateManager.scale(toolTipScale, toolTipScale, toolTipScale);
        this.renderToolTip(display, (int) (mouseX / toolTipScale), (int) (mouseY / toolTipScale));
        RenderHelper.disableStandardItemLighting();
        GlStateManager.popMatrix();
    }
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) HandleMaterial(api.materials.HandleMaterial) HeadMaterial(api.materials.HeadMaterial) HaftMaterial(api.materials.HaftMaterial)

Example 5 with HandleMaterial

use of api.materials.HandleMaterial in project Adventurers-Toolbox by the-realest-stu.

the class AxeModel method getTextures.

@Override
public Collection<ResourceLocation> getTextures() {
    ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
    for (HeadMaterial mat : Materials.head_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/axe/head_" + mat.getName()));
    }
    for (HaftMaterial mat : Materials.haft_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/axe/haft_" + mat.getName()));
    }
    for (HandleMaterial mat : Materials.handle_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/axe/handle_" + mat.getName()));
    }
    for (AdornmentMaterial mat : Materials.adornment_registry.values()) {
        builder.add(new ResourceLocation(mat.getModId(), "items/axe/adornment_" + mat.getName()));
    }
    Collection textures = builder.build();
    return textures;
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) HandleMaterial(api.materials.HandleMaterial) ImmutableList(com.google.common.collect.ImmutableList) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) HeadMaterial(api.materials.HeadMaterial) Collection(java.util.Collection) HaftMaterial(api.materials.HaftMaterial) ItemOverride(net.minecraft.client.renderer.block.model.ItemOverride)

Aggregations

HandleMaterial (api.materials.HandleMaterial)19 AdornmentMaterial (api.materials.AdornmentMaterial)12 HeadMaterial (api.materials.HeadMaterial)12 HaftMaterial (api.materials.HaftMaterial)10 ResourceLocation (net.minecraft.util.ResourceLocation)10 ImmutableList (com.google.common.collect.ImmutableList)9 Collection (java.util.Collection)9 ItemOverride (net.minecraft.client.renderer.block.model.ItemOverride)9 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)9 ItemStack (net.minecraft.item.ItemStack)8 ArrayList (java.util.ArrayList)7 BookChapter (api.guide.BookChapter)1 BookPage (api.guide.BookPage)1 BookPageContents (api.guide.BookPageContents)1 BookPageMat (api.guide.BookPageMat)1 BookPageText (api.guide.BookPageText)1 BookPageTool (api.guide.BookPageTool)1 ChapterLink (api.guide.ChapterLink)1 Block (net.minecraft.block.Block)1 Enchantment (net.minecraft.enchantment.Enchantment)1