use of net.silentchaos512.gear.client.model.PartTextures in project Silent-Gear by SilentChaos512.
the class GearModel method getTextures.
@SuppressWarnings("OverlyComplexMethod")
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, UnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
Set<Material> ret = new HashSet<>();
ret.add(new Material(InventoryMenu.BLOCK_ATLAS, SilentGear.getId("item/error")));
// Generic built-in textures
for (PartTextures tex : PartTextures.getTextures(this.gearType)) {
int animationFrames = tex.isAnimated() ? item.getAnimationFrames() : 1;
for (int i = 0; i < animationFrames; ++i) {
MaterialLayer layer = new MaterialLayer(tex, Color.VALUE_WHITE);
ret.add(getTexture(layer, i, false));
ret.add(getTexture(layer, 0, true));
}
}
// Custom textures
for (IMaterialDisplay materialDisplay : GearDisplayManager.getMaterials()) {
for (PartType partType : PartType.getValues()) {
if (item.hasTexturesFor(partType)) {
for (MaterialLayer layer : materialDisplay.getLayerList(gearType, partType, LazyMaterialInstance.of(materialDisplay.getMaterialId()))) {
int animationFrames = layer.isAnimated() ? item.getAnimationFrames() : 1;
ret.addAll(this.getTexturesForAllFrames(layer, animationFrames, false));
ret.addAll(this.getTexturesForAllFrames(layer, 1, true));
}
}
}
}
for (IPartDisplay partDisplay : GearDisplayManager.getParts()) {
for (MaterialLayer layer : partDisplay.getLayers(gearType, FakePartData.of(PartType.NONE))) {
int animationFrames = layer.isAnimated() ? item.getAnimationFrames() : 1;
ret.addAll(this.getTexturesForAllFrames(layer, animationFrames, false));
ret.addAll(this.getTexturesForAllFrames(layer, animationFrames, true));
}
}
if (GearModelOverrideList.isDebugLoggingEnabled()) {
SilentGear.LOGGER.info("Textures for gear model '{}' ({})", getTexturePath(false), this.gearType.getName());
for (Material mat : ret) {
SilentGear.LOGGER.info("- {}", mat.texture());
}
}
return ret;
}
use of net.silentchaos512.gear.client.model.PartTextures in project Silent-Gear by SilentChaos512.
the class MaterialBuilder method displayTip.
public MaterialBuilder displayTip(PartTextures texture, int color) {
display(PartType.TIP, GearType.ALL, new MaterialLayer(texture, color));
display(PartType.TIP, GearType.PART, new MaterialLayer(SilentGear.getId("tip_base"), Color.VALUE_WHITE), new MaterialLayer(SilentGear.getId("tip"), color), new MaterialLayer(SilentGear.getId("tip_shine"), Color.VALUE_WHITE));
return this;
}
use of net.silentchaos512.gear.client.model.PartTextures 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;
}
Aggregations