Skip to content

Commit

Permalink
Fix wrong stack being used for testing the component
Browse files Browse the repository at this point in the history
  • Loading branch information
HyCraftHD committed Aug 1, 2024
1 parent 272d80b commit eed7cb6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ default void addTooltip(ItemStack stack, TooltipContext context, List<Component>
tooltip.add(TooltipCreator.create(UsefulBackpacksReference.MODID, "backpack", "filter_applied", 0).withStyle(ChatFormatting.AQUA));

filters.stream().filter(filterStack -> filterStack.getItem() instanceof ItemFilterItem).forEach(filterStack -> {
final ItemFilterComponent itemComponent = stack.get(UsefulBackpacksDataComponentTypes.ITEM_FILTER_COMPONENT.get());
final ItemFilterComponent itemComponent = filterStack.get(UsefulBackpacksDataComponentTypes.ITEM_FILTER_COMPONENT.get());
if (itemComponent != null && itemComponent.isPresent() && !itemComponent.getStack().isEmpty()) {
final MutableComponent component = TooltipCreator.create(UsefulBackpacksReference.MODID, "backpack", "filter_applied_item", 0, Component.translatable(itemComponent.getStack().getDescriptionId()).withStyle(ChatFormatting.YELLOW));
if (itemComponent.isStrict()) {
Expand All @@ -71,7 +71,7 @@ default void addTooltip(ItemStack stack, TooltipContext context, List<Component>
});

filters.stream().filter(filterStack -> filterStack.getItem() instanceof TagFilterItem).forEach(filterStack -> {
final TagFilterComponent itemComponent = stack.get(UsefulBackpacksDataComponentTypes.TAG_FILTER_COMPONENT.get());
final TagFilterComponent itemComponent = filterStack.get(UsefulBackpacksDataComponentTypes.TAG_FILTER_COMPONENT.get());
if (itemComponent != null && itemComponent.isPresent()) {
final MutableComponent component = TooltipCreator.create(UsefulBackpacksReference.MODID, "backpack", "filter_applied_tag", 0, Component.literal(itemComponent.getTag().location().toString()).withStyle(ChatFormatting.YELLOW)).withStyle(ChatFormatting.GRAY);
tooltip.add(component);
Expand Down

0 comments on commit eed7cb6

Please sign in to comment.