Added some more guardian variants

This commit is contained in:
Sollace 2023-07-09 21:30:14 +01:00
parent 891aa73254
commit 385d09e0f5
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
5 changed files with 8 additions and 2 deletions

View file

@ -32,11 +32,11 @@ public class SeaponyRenderer extends GuardianEntityRenderer {
}
public static SeaponyRenderer guardian(EntityRendererFactory.Context context) {
return new SeaponyRenderer(context, TextureSupplier.ofPool(SEAPONY_TEXTURES, TextureSupplier.of(SEAPONY)), 1);
return new SeaponyRenderer(context, TextureSupplier.ofVariations(SEAPONY_TEXTURES, TextureSupplier.of(SEAPONY)), 1);
}
public static SeaponyRenderer elder(EntityRendererFactory.Context context) {
return new SeaponyRenderer(context, TextureSupplier.ofPool(ELDER_SEAPONY_TEXTURES, TextureSupplier.of(SEAPONY)), ElderGuardianEntity.SCALE);
return new SeaponyRenderer(context, TextureSupplier.ofVariations(ELDER_SEAPONY_TEXTURES, TextureSupplier.of(ELDER_SEAPONY)), ElderGuardianEntity.SCALE);
}
@Override

View file

@ -25,6 +25,12 @@ public interface TextureSupplier<T> extends Function<T, Identifier> {
return key -> new Identifier(domain, String.format(path, key));
}
static <T extends LivingEntity> TextureSupplier<T> ofVariations(Identifier poolId, TextureSupplier<T> fallback) {
return entity -> {
return MineLittlePony.getInstance().getVariatedTextures().get(poolId).getId(entity.getUuid()).orElse(fallback.apply(entity));
};
}
static <T extends LivingEntity> TextureSupplier<T> ofPool(Identifier poolId, TextureSupplier<T> fallback) {
final Function<T, Identifier> cache = FunctionUtil.memoize(entity -> {
return MineLittlePony.getInstance().getVariatedTextures()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB