use of net.silentchaos512.gear.api.material.StaticLayer in project Silent-Gear by SilentChaos512.
the class CompoundPartModel method buildFakeModel.
private void buildFakeModel(Function<Material, TextureAtlasSprite> spriteGetter, ImmutableList.Builder<BakedQuad> builder, Transformation rotation, IMaterial material) {
// This method will display an example item for items with no data (ie, for advancements)
MaterialInstance mat = MaterialInstance.of(material);
IMaterialDisplay model = mat.getDisplayProperties();
MaterialLayer exampleMain = model.getLayerList(this.gearType, this.partType, mat).getFirstLayer();
if (exampleMain != null) {
builder.addAll(getQuadsForSprite(0, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, exampleMain.getTexture(this.texturePath, 0))), rotation, exampleMain.getColor()));
}
builder.addAll(getQuadsForSprite(0, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(PART_MARKER_TEXTURE).getTexture(this.gearType, 0))), rotation, Color.VALUE_WHITE));
}
use of net.silentchaos512.gear.api.material.StaticLayer in project Silent-Gear by SilentChaos512.
the class MaterialsProvider method addVanillaMetals.
private void addVanillaMetals(Collection<MaterialBuilder> ret) {
// Copper
ret.add(new MaterialBuilder(modId("copper"), 2, Items.COPPER_INGOT).categories(MaterialCategories.METAL).mainStatsCommon(151, 12, 15, 12, 1.3f).mainStatsHarvest(1, 5).mainStatsMelee(1.5f, 1.0f, 0.1f).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, GearType.AXE, -0.1f).mainStatsRanged(0.1f, 0.0f).mainStatsArmor(2, 4, 3, 1, 0, // 10
8).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, 15).trait(PartType.MAIN, Const.Traits.SOFT, 1, new MaterialRatioTraitCondition(0.5f)).trait(PartType.ROD, Const.Traits.SOFT, 3).displayAll(PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, 0xFD804C));
// Gold
ret.add(new MaterialBuilder(modId("gold"), 2, Tags.Items.INGOTS_GOLD).categories(MaterialCategories.METAL).stat(PartType.MAIN, ItemStats.DURABILITY, 32).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 7).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 22).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 0).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 12).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 0).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 4).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.0f).mainStatsArmor(2, 5, 3, 1, 0, // 11
8).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 0).stat(PartType.MAIN, ItemStats.RANGED_SPEED, 0.3f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1.1f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 1.0f).stat(PartType.MAIN, ItemStats.RARITY, 50).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 1.2f).stat(PartType.ROD, ItemStats.DURABILITY, 0.05f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.ENCHANTABILITY, 3, StatInstance.Operation.ADD).stat(PartType.ROD, ItemStats.RARITY, 40).stat(PartType.TIP, ItemStats.DURABILITY, 16, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.ARMOR_DURABILITY, 1, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.HARVEST_SPEED, 6, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.MAGIC_DAMAGE, 2, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.RANGED_SPEED, 0.2f, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.RARITY, 30, StatInstance.Operation.ADD).stat(PartType.COATING, ItemStats.DURABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.ARMOR_DURABILITY, -0.1f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(PartType.MAIN, Const.Traits.BRILLIANT, 1, new MaterialRatioTraitCondition(0.7f)).trait(PartType.MAIN, Const.Traits.MALLEABLE, 1).trait(PartType.MAIN, Const.Traits.SOFT, 3).trait(PartType.ROD, Const.Traits.MALLEABLE, 1, new MaterialRatioTraitCondition(0.5f)).trait(PartType.TIP, Const.Traits.MALLEABLE, 1).trait(PartType.TIP, Const.Traits.SOFT, 3).trait(PartType.COATING, Const.Traits.BRILLIANT, 1).trait(PartType.COATING, Const.Traits.SOFT, 3).display(PartType.MAIN, PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, 0xFDFF70).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0xFDFF70).displayTip(PartTextures.TIP_SMOOTH, 0xFDFF70).displayCoating(PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, 0xFDFF70));
// Iron
ret.add(new MaterialBuilder(modId("iron"), 2, Tags.Items.INGOTS_IRON).categories(MaterialCategories.METAL).partSubstitute(PartType.ROD, ModTags.Items.RODS_IRON).stat(PartType.MAIN, ItemStats.DURABILITY, 250).stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15).stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 14).stat(PartType.MAIN, ItemStats.HARVEST_LEVEL, 2).stat(PartType.MAIN, ItemStats.HARVEST_SPEED, 6).stat(PartType.MAIN, ItemStats.MELEE_DAMAGE, 2).stat(PartType.MAIN, ItemStats.MAGIC_DAMAGE, 1).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, 0.0f).stat(PartType.MAIN, ItemStats.ATTACK_SPEED, GearType.AXE, -0.1f).mainStatsArmor(2, 6, 5, 2, 0, // 15
6).stat(PartType.MAIN, ItemStats.RANGED_DAMAGE, 1).stat(PartType.MAIN, ItemStats.RANGED_SPEED, 0.1f).stat(PartType.MAIN, ItemStats.PROJECTILE_SPEED, 1.0f).stat(PartType.MAIN, ItemStats.PROJECTILE_ACCURACY, 1.1f).stat(PartType.MAIN, ItemStats.RARITY, 20).stat(PartType.MAIN, ItemStats.CHARGEABILITY, 0.7f).stat(PartType.ROD, ItemStats.DURABILITY, 0.15f, StatInstance.Operation.MUL2).stat(PartType.ROD, ItemStats.ENCHANTABILITY, -2, StatInstance.Operation.ADD).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, 20).stat(PartType.TIP, ItemStats.DURABILITY, 128, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.ARMOR_DURABILITY, 4, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.HARVEST_LEVEL, 2, StatInstance.Operation.MAX).stat(PartType.TIP, ItemStats.HARVEST_SPEED, 1, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.MELEE_DAMAGE, 1, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.RANGED_SPEED, 0.2f, StatInstance.Operation.ADD).stat(PartType.TIP, ItemStats.RARITY, 8, StatInstance.Operation.ADD).trait(PartType.MAIN, Const.Traits.MALLEABLE, 3).trait(PartType.MAIN, Const.Traits.MAGNETIC, 1, new MaterialRatioTraitCondition(0.66f)).trait(PartType.ROD, Const.Traits.MAGNETIC, 3, new MaterialRatioTraitCondition(0.5f)).trait(PartType.TIP, Const.Traits.MALLEABLE, 2).display(PartType.MAIN, PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, Color.VALUE_WHITE).display(PartType.ROD, PartTextureSet.LOW_CONTRAST, 0xD8D8D8).displayTip(PartTextures.TIP_SHARP, Color.VALUE_WHITE));
// Netherite
ret.add(new MaterialBuilder(modId("netherite"), 4, Items.NETHERITE_INGOT).categories(MaterialCategories.METAL).namePrefix(TextUtil.translate("material", "netherite")).stat(PartType.COATING, ItemStats.DURABILITY, 0.3f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.DURABILITY, 2, StatInstance.Operation.ADD).stat(PartType.COATING, ItemStats.ARMOR_DURABILITY, 37f / 33f - 1f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.HARVEST_SPEED, 0.125f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.HARVEST_LEVEL, 4, StatInstance.Operation.MAX).stat(PartType.COATING, ItemStats.MELEE_DAMAGE, 1f / 3f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.MAGIC_DAMAGE, 1f / 3f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.RANGED_DAMAGE, 1f / 3f, StatInstance.Operation.MUL2).stat(PartType.COATING, ItemStats.ARMOR_TOUGHNESS, 4, StatInstance.Operation.ADD).stat(PartType.COATING, ItemStats.KNOCKBACK_RESISTANCE, 1f, StatInstance.Operation.ADD).stat(PartType.COATING, ItemStats.ENCHANTABILITY, 5, StatInstance.Operation.ADD).trait(PartType.COATING, Const.Traits.FIREPROOF, 1).displayCoating(PartTextureSet.HIGH_CONTRAST_WITH_HIGHLIGHT, 0x867B86).display(PartType.COATING, GearType.ARMOR, new StaticLayer(new ResourceLocation("netherite"))).displayFragment(PartTextures.DUST, 0x867B86));
}
use of net.silentchaos512.gear.api.material.StaticLayer in project Silent-Gear by SilentChaos512.
the class CompoundPartModel method getTextures.
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, UnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
Set<Material> ret = new HashSet<>();
if (this.gearType == GearType.SHIELD) {
// Unobtainable part items, no need for textures
return ret;
}
// Generic built-in textures
for (PartTextures tex : PartTextures.getTextures(this.gearType)) {
ret.add(getTexture(tex.getTexture()));
}
// Custom textures
for (IMaterialDisplay materialDisplay : GearDisplayManager.getMaterials()) {
for (MaterialLayer layer : materialDisplay.getLayerList(this.gearType, this.partType, LazyMaterialInstance.of(materialDisplay.getMaterialId()))) {
ret.add(getTexture(layer));
}
}
for (ResourceLocation texture : this.extraLayers) {
ret.add(getTexture(new StaticLayer(texture)));
}
ret.add(getTexture(new StaticLayer(PART_MARKER_TEXTURE)));
ret.add(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
if (CompoundPartModelOverrideList.isDebugLoggingEnabled()) {
SilentGear.LOGGER.info("Textures for compound part model '{}'", PartGearKey.of(this.gearType, this.partType));
for (Material mat : ret) {
SilentGear.LOGGER.info("- {}", mat.texture());
}
}
return ret;
}
use of net.silentchaos512.gear.api.material.StaticLayer in project Silent-Gear by SilentChaos512.
the class CompoundPartModel method bake.
@SuppressWarnings("MethodWithTooManyParameters")
public BakedModel bake(List<MaterialLayer> layers, String transformVariant, IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelTransform, ItemOverrides overrideList, ResourceLocation modelLocation) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Transformation rotation = modelTransform.getRotation();
ImmutableMap<ItemTransforms.TransformType, Transformation> transforms = PerspectiveMapWrapper.getTransforms(modelTransform);
for (int i = 0; i < layers.size(); i++) {
MaterialLayer layer = layers.get(i);
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, layer.getTexture(this.texturePath, 0)));
builder.addAll(getQuadsForSprite(i, texture, rotation, layer.getColor()));
}
// No layers?
if (layers.isEmpty()) {
if (Const.Materials.EXAMPLE.isPresent()) {
buildFakeModel(spriteGetter, builder, rotation, Const.Materials.EXAMPLE.get());
} else {
// Shouldn't happen, but...
SilentGear.LOGGER.error("Example material is missing?");
TextureAtlasSprite texture = spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
builder.addAll(getQuadsForSprite(0, texture, rotation, Color.VALUE_WHITE));
}
}
// Extras
for (int i = 0; i < this.extraLayers.size(); i++) {
ResourceLocation texture = this.extraLayers.get(i);
builder.addAll(getQuadsForSprite(layers.size() + i, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(texture).getTexture())), rotation, Color.VALUE_WHITE));
}
builder.addAll(getQuadsForSprite(layers.size(), spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(PART_MARKER_TEXTURE).getTexture())), rotation, Color.LIGHTSKYBLUE.getColor()));
TextureAtlasSprite particle = spriteGetter.apply(owner.resolveTexture("particle"));
return new BakedPerspectiveModel(builder.build(), particle, transforms, overrideList, rotation.isIdentity(), owner.isSideLit(), getCameraTransforms(transformVariant));
}
Aggregations