Search in sources :

Example 16 with MaterialLayer

use of net.silentchaos512.gear.api.material.MaterialLayer in project Silent-Gear by SilentChaos512.

the class PartsProvider method getParts.

protected Collection<PartBuilder> getParts() {
    Collection<PartBuilder> ret = new ArrayList<>();
    ret.add(part("adornment", GearType.CURIO, PartType.ADORNMENT, ModItems.ADORNMENT));
    ret.add(part("binding", GearType.TOOL, PartType.BINDING, ModItems.BINDING));
    ret.add(part("bowstring", GearType.RANGED_WEAPON, PartType.CORD, ModItems.CORD));
    ret.add(part("coating", GearType.ALL, PartType.COATING, ModItems.COATING).blacklistGearType(GearType.ELYTRA));
    ret.add(part("fletching", GearType.PROJECTILE, PartType.FLETCHING, ModItems.FLETCHING));
    ret.add(part("grip", GearType.TOOL, PartType.GRIP, ModItems.GRIP));
    ret.add(part("lining", GearType.ARMOR, PartType.LINING, ModItems.LINING));
    ret.add(part("long_rod", GearType.TOOL, PartType.ROD, ModItems.LONG_ROD));
    ret.add(part("rod", GearType.TOOL, PartType.ROD, ModItems.ROD));
    ret.add(part("tip", GearType.TOOL, PartType.TIP, ModItems.TIP));
    Registration.getItems(MainPartItem.class).forEach(item -> {
        PartBuilder builder = part(NameUtils.fromItem(item).getPath(), item.getGearType(), item.getPartType(), item);
        ret.add(addHeadStats(builder));
    });
    ret.add(upgradePart("misc/spoon", CraftingItems.SPOON_UPGRADE).upgradeGearTypes(GearType.PICKAXE.getMatcher(false)).stat(ItemStats.DURABILITY, 0.2f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.SPOON, 1).display(GearType.PICKAXE, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("spoon"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/road_maker", CraftingItems.ROAD_MAKER_UPGRADE).upgradeGearTypes(GearType.EXCAVATOR.getMatcher(false)).stat(ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.ROAD_MAKER, 1).display(GearType.EXCAVATOR, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("road_maker"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/wide_plate", CraftingItems.WIDE_PLATE_UPGRADE).upgradeGearTypes(new GearTypeMatcher(false, GearType.HAMMER, GearType.EXCAVATOR)).stat(ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.WIDEN, 1).display(GearType.HAMMER, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("wide_plate"), Color.VALUE_WHITE)).display(GearType.EXCAVATOR, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("wide_plate"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/red_card", CraftingItems.RED_CARD_UPGRADE).upgradeGearTypes(GearTypeMatcher.ALL).stat(ItemStats.RARITY, -5, StatInstance.Operation.ADD).trait(Const.Traits.RED_CARD, 1));
    return ret;
}
Also used : GearTypeMatcher(net.silentchaos512.gear.api.item.GearTypeMatcher) MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer) ArrayList(java.util.ArrayList) MainPartItem(net.silentchaos512.gear.item.MainPartItem)

Example 17 with MaterialLayer

use of net.silentchaos512.gear.api.material.MaterialLayer in project Silent-Gear by SilentChaos512.

the class ColorUtils method getBlendedColor.

public static int getBlendedColor(CompoundMaterialItem item, Collection<? extends IMaterialInstance> materials, int layer) {
    int[] componentSums = new int[3];
    int maxColorSum = 0;
    int colorCount = 0;
    int i = 0;
    for (IMaterialInstance mat : materials) {
        IMaterialDisplay model = mat.getDisplayProperties();
        List<MaterialLayer> layers = model.getLayerList(GearType.ALL, PartType.MAIN, mat).getLayers();
        if (layers.size() > layer) {
            int color = layers.get(layer).getColor();
            int r = (color >> 16) & 0xFF;
            int g = (color >> 8) & 0xFF;
            int b = color & 0xFF;
            int colorWeight = item.getColorWeight(i, materials.size());
            for (int j = 0; j < colorWeight; ++j) {
                maxColorSum += Math.max(r, Math.max(g, b));
                componentSums[0] += r;
                componentSums[1] += g;
                componentSums[2] += b;
                ++colorCount;
            }
            ++i;
        }
    }
    return blendColors(componentSums, maxColorSum, colorCount);
}
Also used : IMaterialInstance(net.silentchaos512.gear.api.material.IMaterialInstance) IMaterialDisplay(net.silentchaos512.gear.api.material.IMaterialDisplay) MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer)

Example 18 with MaterialLayer

use of net.silentchaos512.gear.api.material.MaterialLayer in project Silent-Gear by SilentChaos512.

the class MaterialsProvider method addStones.

@SuppressWarnings("OverlyLongMethod")
private void addStones(Collection<MaterialBuilder> ret) {
    // Basalt
    ret.add(new MaterialBuilder(modId("basalt"), 1, Items.BASALT).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 137).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 4).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 6).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 4).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 1).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.0f).mainStatsArmor(1, 3, 1, 1, 0, // 6
    0).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.1f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.8f).stat(PartType.MAIN, ItemStats.RARITY, 7).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.7f).stat(PartType.ROD, ItemStats.HARVEST_SPEED, 0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.MELEE_DAMAGE, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 7).trait(PartType.MAIN, Const.Traits.BRITTLE, 2).trait(PartType.MAIN, Const.Traits.CHIPPING, 3).trait(PartType.ROD, Const.Traits.BRITTLE, 3).trait(PartType.ROD, Const.Traits.CHIPPING, 2).display(PartType.MAIN, new MaterialLayer(PartTextures.MAIN_GENERIC_LC, 0x4F4B4F), new MaterialLayer(PartTextures.SPLOTCHES, 0x32333D)).display(PartType.MAIN, GearType.ARMOR, PartTextureSet.LOW_CONTRAST, 0x4F4B4F).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x4F4B4F));
    // Blackstone
    ret.add(new MaterialBuilder(modId("blackstone"), 1, Items.BLACKSTONE).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 151).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 4).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 4).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 1).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.0f).mainStatsArmor(1, 2, 1, 1, 0, // 5
    0).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.2f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.8f).stat(PartType.MAIN, ItemStats.RARITY, 9).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.6f).stat(PartType.ROD, ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.HARVEST_SPEED, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 9).trait(PartType.MAIN, Const.Traits.BRITTLE, 1).trait(PartType.MAIN, Const.Traits.JAGGED, 2).trait(PartType.MAIN, Const.Traits.HARD, 2).trait(PartType.ROD, Const.Traits.BRITTLE, 2).trait(PartType.ROD, Const.Traits.JAGGED, 2).trait(PartType.ROD, Const.Traits.HARD, 1).display(PartType.MAIN, new MaterialLayer(PartTextures.MAIN_GENERIC_LC, 0x3C3947), new MaterialLayer(PartTextures.SPLOTCHES, 0x1F121B)).display(PartType.MAIN, GearType.ARMOR, PartTextureSet.LOW_CONTRAST, 0x3C3947).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x3C3947));
    // End Stone
    ret.add(new MaterialBuilder(modId("end_stone"), 1, Tags.Items.END_STONES).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 1164).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15).stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.2f).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 10).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 2).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 7).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 2).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 3).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.1f).mainStatsArmor(3, 5, 4, 3, 1, // 15
    6).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, 0f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.8f).stat(PartType.MAIN, ItemStats.RARITY, 32).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.9f).stat(PartType.ROD, ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.MELEE_DAMAGE, 1, StatInstance.Operation.ADD).stat(PartType.ROD, ItemStats.RARITY, 26).trait(PartType.MAIN, Const.Traits.JAGGED, 3).trait(PartType.MAIN, Const.Traits.ANCIENT, 2).trait(PartType.ROD, Const.Traits.JAGGED, 2).trait(PartType.ROD, Const.Traits.ANCIENT, 4).display(PartType.MAIN, PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, 0xFFFFCC).display(PartType.ROD, PartTextureSet.HIGH_CONTRAST, 0xFFFFCC));
    // Flint
    ret.add(new MaterialBuilder(modId("flint"), 1, Items.FLINT).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 124).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 4).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 3).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 5).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 2).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, -0.1f).mainStatsArmor(0.5f, 2f, 1f, 0.5f, 0, // 4
    0).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 1).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.3f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1.0f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 1.0f).stat(PartType.MAIN, ItemStats.RARITY, 6).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.8f).stat(PartType.ROD, ItemStats.DURABILITY, -0.3f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 2).noStats(PartType.ADORNMENT).trait(PartType.MAIN, Const.Traits.JAGGED, 3).trait(PartType.ROD, Const.Traits.BRITTLE, 3).trait(PartType.ROD, Const.Traits.JAGGED, 2).displayAll(PartTextureSet.HIGH_CONTRAST, 0x969696));
    // Netherrack
    ret.add(new MaterialBuilder(modId("netherrack"), 1, Tags.Items.NETHERRACK).categories(MaterialCategories.ROCK, MaterialCategories.ORGANIC).mainStatsCommon(142, 5, 8, 11, 0.8f).stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.2f).mainStatsHarvest(1, 5).mainStatsMelee(0.5f, 0.5f, 0.0f).mainStatsRanged(0.5f, 0.1f).mainStatsArmor(1, 4, 2, 1, 0, // 8
    4).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 0.8f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 1.0f).stat(PartType.ROD, ItemStats.DURABILITY, -0.2f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 11).trait(PartType.MAIN, Const.Traits.ERODED, 3).trait(PartType.MAIN, Const.Traits.FLEXIBLE, 2).trait(PartType.ROD, Const.Traits.ERODED, 2).trait(PartType.ROD, Const.Traits.FLEXIBLE, 3).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0x854242).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x854242));
    // Obsidian
    ret.add(new MaterialBuilder(modId("obsidian"), 3, Tags.Items.OBSIDIAN).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 3072).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 37).stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.5f).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 7).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 3).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 6).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 3).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 2).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, -0.4f).mainStatsArmor(3, 8, 6, 3, 4, // 20
    8).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.4f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 0.7f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.7f).stat(PartType.MAIN, ItemStats.RARITY, 10).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.6f).stat(PartType.ROD, ItemStats.HARVEST_SPEED, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 5).trait(PartType.MAIN, Const.Traits.JAGGED, 3).trait(PartType.MAIN, Const.Traits.CRUSHING, 2).trait(PartType.ROD, Const.Traits.BRITTLE, 2).trait(PartType.ROD, Const.Traits.CHIPPING, 3).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0x443464).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x443464));
    // Sandstone
    ResourceLocation sgSandstone = modId("sandstone");
    ret.add(new MaterialBuilder(sgSandstone, 1, ExclusionIngredient.of(Tags.Items.SANDSTONE, Items.RED_SANDSTONE, Items.CHISELED_RED_SANDSTONE, Items.CUT_RED_SANDSTONE, Items.SMOOTH_RED_SANDSTONE)).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 117).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 6).stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.1f).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 7).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 4).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 1).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.1f).mainStatsArmor(1, 2, 1, 1, 0, // 5
    0).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.1f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.8f).stat(PartType.MAIN, ItemStats.RARITY, 7).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.7f).stat(PartType.ROD, ItemStats.DURABILITY, -0.2f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.ENCHANTABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 7).displayAll(PartTextureSet.LOW_CONTRAST, 0xE3DBB0));
    // Red sandstone
    ret.add(new MaterialBuilder(modId("sandstone/red"), -1, Ingredient.of(Items.RED_SANDSTONE, Items.CHISELED_RED_SANDSTONE, Items.CUT_RED_SANDSTONE, Items.SMOOTH_RED_SANDSTONE)).parent(sgSandstone).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0xD97B30).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0xD97B30));
    // Stone
    ResourceLocation stone = modId("stone");
    ret.add(new MaterialBuilder(stone, 1, Tags.Items.COBBLESTONE).categories(MaterialCategories.ROCK).partSubstitute(PartType.ROD, ModTags.Items.RODS_STONE).stat(PartType.MAIN, ItemStats.DURABILITY, 131).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 5).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 4).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 1).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.0f).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, GearType.AXE, -0.2f).mainStatsArmor(1, 2, 1, 1, 0, // 5
    0).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.2f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.8f).stat(PartType.MAIN, ItemStats.RARITY, 4).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.5f).stat(PartType.ROD, ItemStats.DURABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.HARVEST_SPEED, 0.2f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 2).trait(PartType.MAIN, Const.Traits.ANCIENT, 1).trait(PartType.ROD, Const.Traits.BRITTLE, 1).trait(PartType.ROD, Const.Traits.CRUSHING, 2).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0x9A9A9A).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x9A9A9A));
    ret.add(new MaterialBuilder(modId("stone/andesite"), -1, Items.ANDESITE).parent(stone).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0x8A8A8E).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x8A8A8E));
    ret.add(new MaterialBuilder(modId("stone/diorite"), -1, Items.DIORITE).parent(stone).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0xFFFFFF).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0xFFFFFF));
    ret.add(new MaterialBuilder(modId("stone/granite"), -1, Items.GRANITE).parent(stone).display(PartType.MAIN, PartTextureSet.LOW_CONTRAST, 0x9F6B58).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0x9F6B58));
    // Terracotta
    ResourceLocation sgTerracotta = modId("terracotta");
    ret.add(new MaterialBuilder(sgTerracotta, 1, Items.TERRACOTTA).categories(MaterialCategories.ROCK).stat(PartType.MAIN, ItemStats.DURABILITY, 165).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 11).stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.1f).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 9).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 1).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 4).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 1.5f).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 0).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.2f).mainStatsArmor(2, 3, 3, 1, 0, // 9
    3).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, -0.2f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 0.9f).stat(PartType.MAIN, ItemStats.RARITY, 7).stat(PartType.ROD, ItemStats.DURABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.ENCHANTABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.MELEE_DAMAGE, 0.1f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.RARITY, 6).trait(PartType.MAIN, Const.Traits.BRITTLE, 1).trait(PartType.MAIN, Const.Traits.CHIPPING, 2).trait(PartType.MAIN, Const.Traits.RUSTIC, 1).trait(PartType.ROD, Const.Traits.BRITTLE, 2).trait(PartType.ROD, Const.Traits.CRUSHING, 1).trait(PartType.ROD, Const.Traits.RUSTIC, 2).displayAll(PartTextureSet.LOW_CONTRAST, 0x985F45));
    ret.add(terracotta(sgTerracotta, "black", Items.BLACK_TERRACOTTA, 0x251610));
    ret.add(terracotta(sgTerracotta, "blue", Items.BLUE_TERRACOTTA, 0x4A3B5B));
    ret.add(terracotta(sgTerracotta, "brown", Items.BROWN_TERRACOTTA, 0x4D3224));
    ret.add(terracotta(sgTerracotta, "cyan", Items.CYAN_TERRACOTTA, 0xD1B1A1));
    ret.add(terracotta(sgTerracotta, "gray", Items.GRAY_TERRACOTTA, 0xD1B1A1));
    ret.add(terracotta(sgTerracotta, "green", Items.GREEN_TERRACOTTA, 0x4B522A));
    ret.add(terracotta(sgTerracotta, "light_blue", Items.LIGHT_BLUE_TERRACOTTA, 0x706C8A));
    ret.add(terracotta(sgTerracotta, "light_gray", Items.LIGHT_GRAY_TERRACOTTA, 0x876A61));
    ret.add(terracotta(sgTerracotta, "lime", Items.LIME_TERRACOTTA, 0x677534));
    ret.add(terracotta(sgTerracotta, "magenta", Items.MAGENTA_TERRACOTTA, 0x95576C));
    ret.add(terracotta(sgTerracotta, "orange", Items.ORANGE_TERRACOTTA, 0xA05325));
    ret.add(terracotta(sgTerracotta, "pink", Items.PINK_TERRACOTTA, 0xA04D4E));
    ret.add(terracotta(sgTerracotta, "purple", Items.PURPLE_TERRACOTTA, 0x764556));
    ret.add(terracotta(sgTerracotta, "red", Items.RED_TERRACOTTA, 0x8E3C2E));
    ret.add(terracotta(sgTerracotta, "white", Items.WHITE_TERRACOTTA, 0xD1B1A1));
    ret.add(terracotta(sgTerracotta, "yellow", Items.YELLOW_TERRACOTTA, 0xB98423));
}
Also used : MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer) ResourceLocation(net.minecraft.resources.ResourceLocation)

Example 19 with MaterialLayer

use of net.silentchaos512.gear.api.material.MaterialLayer in project Silent-Gear by SilentChaos512.

the class GearArmorItem method getArmorTexture.

// endregion
// region Client-side methods and rendering horrors
@Override
public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
    // Empty texture if broken
    if (GearHelper.isBroken(stack))
        return SilentGear.MOD_ID + ":textures/models/armor/empty.png";
    int layer = slot == EquipmentSlot.LEGS ? 2 : 1;
    // Overlay - default to a blank texture
    if ("overlay".equals(type))
        return SilentGear.MOD_ID + ":textures/models/armor/all_layer_" + layer + "_overlay.png";
    // New material-based armor
    MaterialInstance material = GearData.getPrimaryArmorMaterial(stack);
    if (material != null) {
        IMaterialDisplay materialModel = material.getDisplayProperties();
        PartType partType = GearData.hasPartOfType(stack, PartType.COATING) ? PartType.COATING : PartType.MAIN;
        MaterialLayer materialLayer = materialModel.getLayerList(this.getGearType(), partType, material).getFirstLayer();
        if (materialLayer != null) {
            ResourceLocation tex = materialLayer.getTextureId();
            return tex.getNamespace() + ":textures/models/armor/" + tex.getPath() + "_layer_" + layer + (type != null ? "_" + type : "") + ".png";
        }
    }
    return "silentgear:textures/models/armor/main_generic_hc_layer_" + layer + (type != null ? "_" + type : "") + ".png";
}
Also used : PartType(net.silentchaos512.gear.api.part.PartType) IMaterialDisplay(net.silentchaos512.gear.api.material.IMaterialDisplay) MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer) ResourceLocation(net.minecraft.resources.ResourceLocation) MaterialInstance(net.silentchaos512.gear.gear.material.MaterialInstance)

Example 20 with MaterialLayer

use of net.silentchaos512.gear.api.material.MaterialLayer in project Silent-Gear by SilentChaos512.

the class ColorUtils method getBlendedColor.

public static int getBlendedColor(CompoundPartItem item, Collection<? extends IMaterialInstance> materials, int layer) {
    int[] componentSums = new int[3];
    int maxColorSum = 0;
    int colorCount = 0;
    int i = 0;
    for (IMaterialInstance mat : materials) {
        IMaterialDisplay model = mat.getDisplayProperties();
        List<MaterialLayer> layers = model.getLayerList(item.getGearType(), item.getPartType(), mat).getLayers();
        if (layers.size() > layer) {
            int color = model.getLayerColor(item.getGearType(), item.getPartType(), mat, layer);
            int r = (color >> 16) & 0xFF;
            int g = (color >> 8) & 0xFF;
            int b = color & 0xFF;
            int colorWeight = item.getColorWeight(i, materials.size());
            for (int j = 0; j < colorWeight; ++j) {
                maxColorSum += Math.max(r, Math.max(g, b));
                componentSums[0] += r;
                componentSums[1] += g;
                componentSums[2] += b;
                ++colorCount;
            }
            ++i;
        }
    }
    return blendColors(componentSums, maxColorSum, colorCount);
}
Also used : IMaterialInstance(net.silentchaos512.gear.api.material.IMaterialInstance) IMaterialDisplay(net.silentchaos512.gear.api.material.IMaterialDisplay) MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer)

Aggregations

MaterialLayer (net.silentchaos512.gear.api.material.MaterialLayer)27 IMaterialDisplay (net.silentchaos512.gear.api.material.IMaterialDisplay)12 IMaterial (net.silentchaos512.gear.api.material.IMaterial)9 ResourceLocation (net.minecraft.resources.ResourceLocation)6 MaterialInstance (net.silentchaos512.gear.gear.material.MaterialInstance)6 ArrayList (java.util.ArrayList)4 ImmutableList (com.google.common.collect.ImmutableList)3 Transformation (com.mojang.math.Transformation)3 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)3 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)3 IMaterialInstance (net.silentchaos512.gear.api.material.IMaterialInstance)3 StaticLayer (net.silentchaos512.gear.api.material.StaticLayer)3 PartType (net.silentchaos512.gear.api.part.PartType)3 BakedPerspectiveModel (net.silentchaos512.gear.client.model.BakedPerspectiveModel)3 LazyMaterialInstance (net.silentchaos512.gear.gear.material.LazyMaterialInstance)3 GearType (net.silentchaos512.gear.api.item.GearType)2 MaterialLayerList (net.silentchaos512.gear.api.material.MaterialLayerList)2 IPartDisplay (net.silentchaos512.gear.api.part.IPartDisplay)2 PartTextures (net.silentchaos512.gear.client.model.PartTextures)2 PartData (net.silentchaos512.gear.gear.part.PartData)2