From 2ce52b3a0f93fb2cb6c09d35109e9cc2cfd46ce1 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 12 Oct 2024 20:28:45 +0100 Subject: [PATCH] Fixed red butterfly item texture --- .../com/minelittlepony/unicopia/client/URenderers.java | 10 ++++++++-- .../unicopia/entity/mob/ButterflyEntity.java | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java index 46333fe3..11e798a6 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java @@ -133,8 +133,14 @@ public interface URenderers { ModelPredicateProviderRegistry.register(UItems.GEMSTONE, Identifier.ofVanilla("affinity"), (stack, world, entity, seed) -> EnchantableItem.getSpellKey(stack).getAffinity().getAlignment()); ModelPredicateProviderRegistry.register(UItems.GEMSTONE, Identifier.ofVanilla("shape"), (stack, world, entity, seed) -> EnchantableItem.getSpellKey(stack).getGemShape().getId()); ModelPredicateProviderRegistry.register(UItems.ROCK_CANDY, Identifier.ofVanilla("count"), (stack, world, entity, seed) -> stack.getCount() / (float)stack.getMaxCount()); - ModelPredicateProviderRegistry.register(UItems.BUTTERFLY, Identifier.ofVanilla("variant"), (stack, world, entity, seed) -> (float)BufferflyVariantComponent.get(stack).variant().ordinal() / ButterflyEntity.Variant.VALUES.length); - ModelPredicateProviderRegistry.register(UItems.GIANT_BALLOON, Identifier.ofVanilla("design"), (stack, world, entity, seed) -> (float)BalloonDesignComponent.get(stack).design().ordinal() / AirBalloonEntity.BalloonDesign.VALUES.length); + ModelPredicateProviderRegistry.register(UItems.BUTTERFLY, Identifier.ofVanilla("variant"), (stack, world, entity, seed) -> { + // float operations do be weird like + return BufferflyVariantComponent.get(stack).variant().ordinal() * (1F / ButterflyEntity.Variant.VALUES.length); + }); + ModelPredicateProviderRegistry.register(UItems.GIANT_BALLOON, Identifier.ofVanilla("design"), (stack, world, entity, seed) -> { + // float operations do be weird like + return BalloonDesignComponent.get(stack).design().ordinal() * (1F / AirBalloonEntity.BalloonDesign.VALUES.length); + }); ModelPredicateProviderRegistry.register(Unicopia.id("zap_cycle"), new ClampedModelPredicateProvider() { private double targetAngle; private double lastAngle; diff --git a/src/main/java/com/minelittlepony/unicopia/entity/mob/ButterflyEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/mob/ButterflyEntity.java index f150e91f..b64aed67 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/mob/ButterflyEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/mob/ButterflyEntity.java @@ -387,7 +387,7 @@ public class ButterflyEntity extends AmbientEntity { WHITE_MONARCH, BRIMSTONE; - public static final Variant[] VALUES = Variant.values(); + public static final Variant[] VALUES = values(); @SuppressWarnings("deprecation") public static final EnumCodec CODEC = StringIdentifiable.createCodec(Variant::values);