diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/CookingForBlockheads.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/CookingForBlockheads.java index 49dfd62e..88996fe6 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/CookingForBlockheads.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/CookingForBlockheads.java @@ -32,8 +32,6 @@ public class CookingForBlockheads { - // TODO search doesn't do anything - public static final String MOD_ID = "cookingforblockheads"; public static final Logger logger = LogManager.getLogger(MOD_ID); diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/api/ISortButton.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/api/ISortButton.java index 8694bf86..fd1ce9c9 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/api/ISortButton.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/api/ISortButton.java @@ -1,6 +1,7 @@ package net.blay09.mods.cookingforblockheads.api; import net.blay09.mods.cookingforblockheads.crafting.RecipeWithStatus; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -9,7 +10,7 @@ public interface ISortButton { ResourceLocation getIcon(); - String getTooltip(); + Component getTooltip(); Comparator getComparator(Player player); diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/HungerSortButton.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/HungerSortButton.java index b4069905..8f7fa5a7 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/HungerSortButton.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/HungerSortButton.java @@ -4,6 +4,7 @@ import net.blay09.mods.cookingforblockheads.api.ISortButton; import net.blay09.mods.cookingforblockheads.crafting.RecipeWithStatus; import net.blay09.mods.cookingforblockheads.menu.comparator.ComparatorHunger; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -19,8 +20,8 @@ public ResourceLocation getIcon() { } @Override - public String getTooltip() { - return "tooltip.cookingforblockheads.sort_by_hunger"; + public Component getTooltip() { + return Component.translatable("tooltip.cookingforblockheads.sort_by_hunger"); } @Override diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/NameSortButton.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/NameSortButton.java index 5131e49f..a3617722 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/NameSortButton.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/NameSortButton.java @@ -4,6 +4,7 @@ import net.blay09.mods.cookingforblockheads.api.ISortButton; import net.blay09.mods.cookingforblockheads.crafting.RecipeWithStatus; import net.blay09.mods.cookingforblockheads.menu.comparator.ComparatorName; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -19,8 +20,8 @@ public ResourceLocation getIcon() { } @Override - public String getTooltip() { - return "tooltip.cookingforblockheads.sort_by_name"; + public Component getTooltip() { + return Component.translatable("tooltip.cookingforblockheads.sort_by_name"); } @Override diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SaturationSortButton.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SaturationSortButton.java index b86a17a3..7c9a5947 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SaturationSortButton.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SaturationSortButton.java @@ -4,6 +4,7 @@ import net.blay09.mods.cookingforblockheads.api.ISortButton; import net.blay09.mods.cookingforblockheads.crafting.RecipeWithStatus; import net.blay09.mods.cookingforblockheads.menu.comparator.ComparatorSaturation; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -19,8 +20,8 @@ public ResourceLocation getIcon() { } @Override - public String getTooltip() { - return "tooltip.cookingforblockheads.sort_by_saturation"; + public Component getTooltip() { + return Component.translatable("tooltip.cookingforblockheads.sort_by_saturation"); } @Override diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SortButton.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SortButton.java index 4a303765..ed93780e 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SortButton.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/SortButton.java @@ -1,26 +1,23 @@ package net.blay09.mods.cookingforblockheads.client.gui; -import com.google.common.collect.Lists; import net.blay09.mods.cookingforblockheads.api.ISortButton; import net.blay09.mods.cookingforblockheads.crafting.RecipeWithStatus; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Tooltip; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; import java.util.Comparator; -import java.util.List; public class SortButton extends Button { private final ISortButton button; - private final List tooltipLines = Lists.newArrayList(); - public SortButton(int x, int y, ISortButton button, OnPress onPress) { super(x, y, 20, 20, Component.empty(), onPress, Button.DEFAULT_NARRATION); this.button = button; - this.tooltipLines.add(Component.translatable(this.button.getTooltip())); + setTooltip(Tooltip.create(this.button.getTooltip())); } @Override @@ -38,10 +35,6 @@ public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float guiGraphics.blit(button.getIcon(), getX(), getY(), button.getIconTextureX(), texY, width, height); } - public List getTooltipLines() { - return tooltipLines; - } - public Comparator getComparator(Player player) { return button.getComparator(player); } diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/screen/KitchenScreen.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/screen/KitchenScreen.java index 368a05ae..80cce929 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/screen/KitchenScreen.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/client/gui/screen/KitchenScreen.java @@ -315,12 +315,6 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia matrixSlot.updateSlot(partialTicks); } - for (Button sortButton : this.sortButtons) { - if (sortButton instanceof SortButton && sortButton.isMouseOver(mouseX, mouseY) && sortButton.active) { - guiGraphics.renderTooltip(font, ((SortButton) sortButton).getTooltipLines(), Optional.empty(), mouseX, mouseY); - } - } - this.renderTooltip(guiGraphics, mouseX, mouseY); } diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/menu/KitchenMenu.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/menu/KitchenMenu.java index 3e377b5b..2a5366eb 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/menu/KitchenMenu.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/menu/KitchenMenu.java @@ -487,7 +487,7 @@ public void setScrollOffset(int scrollOffset) { public void search(@Nullable String term) { this.currentSearch = term; - updateCraftableSlots(); + updateFilteredRecipes(); setScrollOffset(0); }