diff --git a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java index 0b66cc57..324fd95b 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java @@ -162,9 +162,9 @@ public interface URenderers { ColorProviderRegistry.BLOCK.register(URenderers::getTintedBlockColor, TintedBlock.REGISTRY.stream().toArray(Block[]::new)); ColorProviderRegistry.ITEM.register((stack, i) -> getTintedBlockColor(Block.getBlockFromItem(stack.getItem()).getDefaultState(), null, null, i), TintedBlock.REGISTRY.stream().map(Block::asItem).filter(i -> i != Items.AIR).toArray(Item[]::new)); - ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : DyedColorComponent.getColor(stack, Colors.WHITE), UItems.FRIENDSHIP_BRACELET); - ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 || !EnchantableItem.isEnchanted(stack) ? -1 : EnchantableItem.getSpellKey(stack).getColor(), UItems.GEMSTONE); - ColorProviderRegistry.ITEM.register((stack, i) -> i == 1 && EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getColor() : -1, UItems.MAGIC_STAFF); + ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 ? -1 : DyedColorComponent.getColor(stack, DyedColorComponent.DEFAULT_COLOR), UItems.FRIENDSHIP_BRACELET); + ColorProviderRegistry.ITEM.register((stack, i) -> i > 0 || !EnchantableItem.isEnchanted(stack) ? Colors.WHITE : EnchantableItem.getSpellKey(stack).getColor() | 0xFF000000, UItems.GEMSTONE); + ColorProviderRegistry.ITEM.register((stack, i) -> i == 1 && EnchantableItem.isEnchanted(stack) ? EnchantableItem.getSpellKey(stack).getColor() | 0xFF000000 : Colors.WHITE, UItems.MAGIC_STAFF); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), UBlocks.TRANSLUCENT_BLOCKS.stream().toArray(Block[]::new)); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(), UBlocks.SEMI_TRANSPARENT_BLOCKS.stream().toArray(Block[]::new)); diff --git a/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java b/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java index be079459..642290ec 100644 --- a/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java +++ b/src/main/java/com/minelittlepony/unicopia/diet/DietProfile.java @@ -82,8 +82,7 @@ public record DietProfile( } @Nullable - public FoodComponent getAdjustedFoodComponent(ItemStack stack) { - var food = stack.get(DataComponentTypes.FOOD); + public FoodComponent getAdjustedFoodComponent(ItemStack stack, FoodComponent food) { if (this == EMPTY) { return food; } diff --git a/src/main/java/com/minelittlepony/unicopia/item/component/TransientComponentMap.java b/src/main/java/com/minelittlepony/unicopia/item/component/TransientComponentMap.java index 3f9e568b..0ae133f9 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/component/TransientComponentMap.java +++ b/src/main/java/com/minelittlepony/unicopia/item/component/TransientComponentMap.java @@ -23,10 +23,7 @@ public class TransientComponentMap { private static final BiFunction DEFAULT = (stack, t) -> t; public static final TransientComponentMap INITIAL = Util.make(new TransientComponentMap(null), map -> { map.set(UDataComponentTypes.DIET_PROFILE, (s, original) -> { - if (original != null) { - return original; - } - return ItemStackDuck.of(s).getTransientComponents().getCarrier() + return original != null ? original : ItemStackDuck.of(s).getTransientComponents().getCarrier() .flatMap(Pony::of) .map(pony -> PonyDiets.getInstance().getDiet(pony)) .orElse(DietProfile.EMPTY); @@ -34,12 +31,12 @@ public class TransientComponentMap { map.set(DataComponentTypes.FOOD, (s, originalFood) -> { DietProfile diet = s.get(UDataComponentTypes.DIET_PROFILE); - if (diet == null) { + if (diet == null || diet == DietProfile.EMPTY) { return originalFood; } if (originalFood != null) { - return diet.getAdjustedFoodComponent(s); + return diet.getAdjustedFoodComponent(s, originalFood); } if (ItemStackDuck.of(s).getTransientComponents().getCarrier()