aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-05-14 01:33:54 +0800
committershedaniel <daniel@shedaniel.me>2020-05-14 01:33:54 +0800
commitc0ab2792b100457f42a63da8bae071feea8253a8 (patch)
tree761fcc6d686dd103b4ff33f91b86582411ae4480 /src
parentd22b619c0d9870df72fb10c153ead3801bf1a971 (diff)
downloadRoughlyEnoughItems-c0ab2792b100457f42a63da8bae071feea8253a8.tar.gz
RoughlyEnoughItems-c0ab2792b100457f42a63da8bae071feea8253a8.tar.bz2
RoughlyEnoughItems-c0ab2792b100457f42a63da8bae071feea8253a8.zip
Update to 20w20a
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java8
-rw-r--r--src/main/java/me/shedaniel/rei/api/ClientHelper.java104
-rw-r--r--src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java4
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java22
-rw-r--r--src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java16
-rw-r--r--src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java8
-rw-r--r--src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java2
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/TextFieldWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/impl/ClientHelperImpl.java320
-rw-r--r--src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java232
-rw-r--r--src/main/java/me/shedaniel/rei/impl/widgets/LabelWidget.java4
-rw-r--r--src/main/java/me/shedaniel/rei/plugin/DefaultPlugin.java4
22 files changed, 502 insertions, 256 deletions
diff --git a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
index 9c90ea21d..d8886e991 100644
--- a/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
+++ b/src/main/java/me/shedaniel/rei/RoughlyEnoughItemsCore.java
@@ -381,15 +381,15 @@ public class RoughlyEnoughItemsCore implements ClientModInitializer {
ClothClientHooks.SCREEN_KEY_PRESSED.register((minecraftClient, screen, i, i1, i2) -> {
if (shouldReturn(screen))
return ActionResult.PASS;
- if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget || (screen.getFocused() instanceof RecipeBookWidget && ((RecipeBookWidget) screen.getFocused()).searchField != null && ((RecipeBookWidget) screen.getFocused()).searchField.isFocused()))
- return ActionResult.PASS;
- if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
- return ActionResult.SUCCESS;
if (screen instanceof ContainerScreen && ConfigObject.getInstance().doesDisableRecipeBook() && ConfigObject.getInstance().doesFixTabCloseContainer())
if (i == 258 && minecraftClient.options.keyInventory.matchesKey(i, i1)) {
minecraftClient.player.closeContainer();
return ActionResult.SUCCESS;
}
+ if (screen.getFocused() != null && screen.getFocused() instanceof TextFieldWidget || (screen.getFocused() instanceof RecipeBookWidget && ((RecipeBookWidget) screen.getFocused()).searchField != null && ((RecipeBookWidget) screen.getFocused()).searchField.isFocused()))
+ return ActionResult.PASS;
+ if (ScreenHelper.getLastOverlay().keyPressed(i, i1, i2))
+ return ActionResult.SUCCESS;
return ActionResult.PASS;
});
}
diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
index 6d9fac19a..67c99be13 100644
--- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
@@ -23,15 +23,23 @@
package me.shedaniel.rei.api;
+import me.shedaniel.rei.gui.RecipeScreen;
import me.shedaniel.rei.impl.ClientHelperImpl;
+import me.shedaniel.rei.utils.CollectionUtils;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Set;
public interface ClientHelper {
@@ -67,15 +75,11 @@ public interface ClientHelper {
*
* @param map the map of recipes
*/
+ @ApiStatus.ScheduledForRemoval
+ @Deprecated
void openRecipeViewingScreen(Map<RecipeCategory<?>, List<RecipeDisplay>> map);
/**
- * Registers REI's keybinds using Fabric API.
- */
- @ApiStatus.Internal
- void registerFabricKeyBinds();
-
- /**
* Tries to cheat stack using either packets or commands.
*
* @param stack the stack to cheat in
@@ -93,8 +97,14 @@ public interface ClientHelper {
* @param stack the stack to find recipe for
* @return whether the stack has any recipes to show
*/
- boolean executeRecipeKeyBind(EntryStack stack);
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default boolean executeRecipeKeyBind(EntryStack stack) {
+ return openView(ViewSearchBuilder.builder().addRecipesFor(stack).setOutputNotice(stack).fillPreferredOpenedCategory());
+ }
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
default boolean executeRecipeKeyBind(ItemStack stack) {
return executeRecipeKeyBind(EntryStack.create(stack));
}
@@ -105,8 +115,14 @@ public interface ClientHelper {
* @param stack the stack to find usage for
* @return whether the stack has any usages to show
*/
- boolean executeUsageKeyBind(EntryStack stack);
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default boolean executeUsageKeyBind(EntryStack stack) {
+ return openView(ViewSearchBuilder.builder().addUsagesFor(stack).setInputNotice(stack).fillPreferredOpenedCategory());
+ }
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
default boolean executeUsageKeyBind(ItemStack stack) {
return executeUsageKeyBind(EntryStack.create(stack));
}
@@ -165,9 +181,75 @@ public interface ClientHelper {
*
* @return whether there are any recipes to show
*/
- boolean executeViewAllRecipesKeyBind();
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default boolean executeViewAllRecipesKeyBind() {
+ return openView(ViewSearchBuilder.builder().addAllCategories().fillPreferredOpenedCategory());
+ }
- boolean executeViewAllRecipesFromCategory(Identifier category);
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default boolean executeViewAllRecipesFromCategory(Identifier category) {
+ return openView(ViewSearchBuilder.builder().addCategory(category).fillPreferredOpenedCategory());
+ }
- boolean executeViewAllRecipesFromCategories(List<Identifier> categories);
+ @Deprecated
+ @ApiStatus.ScheduledForRemoval
+ default boolean executeViewAllRecipesFromCategories(List<Identifier> categories) {
+ return openView(ViewSearchBuilder.builder().addCategories(categories).fillPreferredOpenedCategory());
+ }
+
+ boolean openView(ViewSearchBuilder builder);
+
+ interface ViewSearchBuilder {
+ static ViewSearchBuilder builder() {
+ return new ClientHelperImpl.ViewSearchBuilder();
+ }
+
+ ViewSearchBuilder addCategory(Identifier category);
+
+ ViewSearchBuilder addCategories(Collection<Identifier> categories);
+
+ default ViewSearchBuilder addAllCategories() {
+ return addCategories(CollectionUtils.map(RecipeHelper.getInstance().getAllCategories(), RecipeCategory::getIdentifier));
+ }
+
+ @NotNull Set<Identifier> getCategories();
+
+ ViewSearchBuilder addRecipesFor(EntryStack stack);
+
+ @NotNull List<EntryStack> getRecipesFor();
+
+ ViewSearchBuilder addUsagesFor(EntryStack stack);
+
+ @NotNull List<EntryStack> getUsagesFor();
+
+ ViewSearchBuilder setPreferredOpenedCategory(@Nullable Identifier category);
+
+ @Nullable
+ Identifier getPreferredOpenedCategory();
+
+ default ViewSearchBuilder fillPreferredOpenedCategory() {
+ if (getPreferredOpenedCategory() == null) {
+ Screen currentScreen = MinecraftClient.getInstance().currentScreen;
+ if (currentScreen instanceof RecipeScreen) {
+ setPreferredOpenedCategory(((RecipeScreen) currentScreen).getCurrentCategory());
+ }
+ }
+ return this;
+ }
+
+ ViewSearchBuilder setInputNotice(@Nullable EntryStack stack);
+
+ @Nullable
+ EntryStack getInputNotice();
+
+ ViewSearchBuilder setOutputNotice(@Nullable EntryStack stack);
+
+ @Nullable
+ EntryStack getOutputNotice();
+
+ @NotNull
+ Map<RecipeCategory<?>, List<RecipeDisplay>> buildMap();
+ }
}
diff --git a/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
index 4ee36d11c..05aa96ddf 100644
--- a/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
+++ b/src/main/java/me/shedaniel/rei/api/LiveRecipeGenerator.java
@@ -43,4 +43,8 @@ public interface LiveRecipeGenerator<T extends RecipeDisplay> {
return Optional.empty();
}
+ default Optional<List<T>> getDisplaysGenerated(ClientHelper.ViewSearchBuilder builder) {
+ return Optional.empty();
+ }
+
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index e4b80e915..c1ddc3f13 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -114,6 +114,8 @@ public interface RecipeHelper {
@Deprecated
void registerDisplay(Identifier categoryIdentifier, RecipeDisplay display);
+ Map<RecipeCategory<?>, List<RecipeDisplay>> buildMapFor(ClientHelper.ViewSearchBuilder builder);
+
/**
* Gets a map of recipes for an entry
*
@@ -178,6 +180,8 @@ public interface RecipeHelper {
*/
Map<RecipeCategory<?>, List<RecipeDisplay>> getAllRecipes();
+ Map<RecipeCategory<?>, List<RecipeDisplay>> getAllRecipesNoHandlers();
+
List<RecipeDisplay> getAllRecipesFromCategory(RecipeCategory<?> category);
/**
diff --git a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
index 9388ad352..c0a089327 100644
--- a/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
+++ b/src/main/java/me/shedaniel/rei/gui/ContainerScreenOverlay.java
@@ -560,7 +560,7 @@ public class ContainerScreenOverlay extends WidgetWithBounds {
public void renderTooltip(MatrixStack matrices, List<Text> lines, int mouseX, int mouseY) {
if (lines.isEmpty())
return;
- tooltipWidth = lines.stream().map(font::getStringWidth).max(Integer::compareTo).get();
+ tooltipWidth = lines.stream().map(font::getWidth).max(Integer::compareTo).get();
tooltipHeight = lines.size() <= 1 ? 8 : lines.size() * 10;
tooltipLines = lines;
ScreenHelper.drawHoveringWidget(matrices, mouseX, mouseY, renderTooltipCallback, tooltipWidth, tooltipHeight, 0);
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index f9176405e..ed797d601 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -166,45 +166,45 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen {
}
@Override
- public boolean keyPressed(int int_1, int int_2, int int_3) {
- if (int_1 == 256 && choosePageActivated) {
+ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
+ if (keyCode == 256 && choosePageActivated) {
choosePageActivated = false;
init();
return true;
}
- if (int_1 == 258) {
+ if (keyCode == 258 && !client.options.keyInventory.matchesKey(keyCode, scanCode)) {
boolean boolean_1 = !hasShiftDown();
if (!this.changeFocus(boolean_1))
this.changeFocus(boolean_1);
return true;
}
if (choosePageActivated)
- return recipeChoosePageWidget.keyPressed(int_1, int_2, int_3);
- else if (ConfigObject.getInstance().getNextPageKeybind().matchesKey(int_1, int_2)) {
+ return recipeChoosePageWidget.keyPressed(keyCode, scanCode, modifiers);
+ else if (ConfigObject.getInstance().getNextPageKeybind().matchesKey(keyCode, scanCode)) {
if (recipeNext.isEnabled())
recipeNext.onClick();
return recipeNext.isEnabled();
- } else if (ConfigObject.getInstance().getPreviousPageKeybind().matchesKey(int_1, int_2)) {
+ } else if (ConfigObject.getInstance().getPreviousPageKeybind().matchesKey(keyCode, scanCode)) {
if (recipeBack.isEnabled())
recipeBack.onClick();
return recipeBack.isEnabled();
}
for (Element element : children())
- if (element.keyPressed(int_1, int_2, int_3))
+ if (element.keyPressed(keyCode, scanCode, modifiers))
return true;
- if (int_1 == 256 || this.client.options.keyInventory.matchesKey(int_1, int_2)) {
+ if (keyCode == 256 || this.client.options.keyInventory.matchesKey(keyCode, scanCode)) {
MinecraftClient.getInstance().openScreen(REIHelper.getInstance().getPreviousContainerScreen());
ScreenHelper.getLastOverlay().init();
return true;
}
- if (int_1 == 259) {
+ if (keyCode == 259) {
if (ScreenHelper.hasLastRecipeScreen())
client.openScreen(ScreenHelper.getLastRecipeScreen());
else
client.openScreen(REIHelper.getInstance().getPreviousContainerScreen());
return true;
}
- return super.keyPressed(int_1, int_2, int_3);
+ return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
@@ -441,7 +441,7 @@ public class RecipeViewingScreen extends Screen implements RecipeScreen {
matrices.push();
matrices.translate(0.0D, 0.0D, 480);
Matrix4f matrix4f = matrices.peek().getModel();
- textRenderer.draw(text, bounds.getCenterX() - textRenderer.getStringWidth(text) / 2f, bounds.getCenterY() - 4.5f, 0xff000000, false, matrix4f, immediate, false, 0, 15728880);
+ textRenderer.draw(text, bounds.getCenterX() - textRenderer.getWidth(text) / 2f, bounds.getCenterY() - 4.5f, 0xff000000, false, matrix4f, immediate, false, 0, 15728880);
immediate.draw();
matrices.pop();
} else {
diff --git a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
index 1f653bc72..79068c07b 100644
--- a/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/VillagerRecipeViewingScreen.java
@@ -369,14 +369,14 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
}
@Override
- public boolean keyPressed(int int_1, int int_2, int int_3) {
- if (int_1 == 258) {
+ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
+ if (keyCode == 258 && !client.options.keyInventory.matchesKey(keyCode, scanCode)) {
boolean boolean_1 = !hasShiftDown();
if (!this.changeFocus(boolean_1))
this.changeFocus(boolean_1);
return true;
}
- if (ConfigObject.getInstance().getNextPageKeybind().matchesKey(int_1, int_2)) {
+ if (ConfigObject.getInstance().getNextPageKeybind().matchesKey(keyCode, scanCode)) {
if (categoryMap.get(categories.get(selectedCategoryIndex)).size() > 1) {
selectedRecipeIndex++;
if (selectedRecipeIndex >= categoryMap.get(categories.get(selectedCategoryIndex)).size())
@@ -385,7 +385,7 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
return true;
}
return false;
- } else if (ConfigObject.getInstance().getPreviousPageKeybind().matchesKey(int_1, int_2)) {
+ } else if (ConfigObject.getInstance().getPreviousPageKeybind().matchesKey(keyCode, scanCode)) {
if (categoryMap.get(categories.get(selectedCategoryIndex)).size() > 1) {
selectedRecipeIndex--;
if (selectedRecipeIndex < 0)
@@ -396,21 +396,21 @@ public class VillagerRecipeViewingScreen extends Screen implements RecipeScreen
return false;
}
for (Element element : children())
- if (element.keyPressed(int_1, int_2, int_3))
+ if (element.keyPressed(keyCode, scanCode, modifiers))
return true;
- if (int_1 == 256 || this.client.options.keyInventory.matchesKey(int_1, int_2)) {
+ if (keyCode == 256 || this.client.options.keyInventory.matchesKey(keyCode, scanCode)) {
MinecraftClient.getInstance().openScreen(REIHelper.getInstance().getPreviousContainerScreen());
ScreenHelper.getLastOverlay().init();
return true;
}
- if (int_1 == 259) {
+ if (keyCode == 259) {
if (ScreenHelper.hasLastRecipeScreen())
client.openScreen(ScreenHelper.getLastRecipeScreen());
else
client.openScreen(REIHelper.getInstance().getPreviousContainerScreen());
return true;
}
- return super.keyPressed(int_1, int_2, int_3);
+ return super.keyPressed(keyCode, scanCode, modifiers);
}
}
diff --git a/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java b/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java
index 47065133c..56bfed9a2 100644
--- a/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/WarningAndErrorScreen.java
@@ -233,7 +233,7 @@ public class WarningAndErrorScreen extends Screen {
@Override
public int getWidth() {
- return MinecraftClient.getInstance().textRenderer.getStringWidth(text) + 10;
+ return MinecraftClient.getInstance().textRenderer.getWidth(text) + 10;
}
}
@@ -270,7 +270,7 @@ public class WarningAndErrorScreen extends Screen {
@Override
public int getWidth() {
- return MinecraftClient.getInstance().textRenderer.getWidth(text) + 10;
+ return MinecraftClient.getInstance().textRenderer.getStringWidth(text) + 10;
}
@Override
diff --git a/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java b/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java
index c85bd902c..96176953c 100644
--- a/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java
+++ b/src/main/java/me/shedaniel/rei/gui/config/entry/FilteringEntry.java
@@ -112,21 +112,21 @@ public class FilteringEntry extends AbstractConfigListEntry<List<EntryStack>> {
this.searchField = new OverlaySearchField(0, 0, 0, 0);
{
Text selectAllText = new TranslatableText("config.roughlyenoughitems.filteredEntries.selectAll");
- this.selectAllButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getStringWidth(selectAllText) + 10, 20, selectAllText, button -> {
+ this.selectAllButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getWidth(selectAllText) + 10, 20, selectAllText, button -> {
this.selectionPoint = new Point(-Integer.MAX_VALUE / 2, -Integer.MAX_VALUE / 2);
this.secondPoint = new Point(Integer.MAX_VALUE / 2, Integer.MAX_VALUE / 2);
});
}
{
Text selectNoneText = new TranslatableText("config.roughlyenoughitems.filteredEntries.selectNone");
- this.selectNoneButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getStringWidth(selectNoneText) + 10, 20, selectNoneText, button -> {
+ this.selectNoneButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getWidth(selectNoneText) + 10, 20, selectNoneText, button -> {
this.selectionPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
this.secondPoint = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
});
}
{
Text hideText = new TranslatableText("config.roughlyenoughitems.filteredEntries.hide");
- this.hideButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getStringWidth(hideText) + 10, 20, hideText, button -> {
+ this.hideButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getWidth(hideText) + 10, 20, hideText, button -> {
for (int i = 0; i < entryStacks.size(); i++) {
EntryStack stack = entryStacks.get(i);
EntryListEntry entry = entries.get(i);
@@ -140,7 +140,7 @@ public class FilteringEntry extends AbstractConfigListEntry<List<EntryStack>> {
}
{
Text showText = new TranslatableText("config.roughlyenoughitems.filteredEntries.show");
- this.showButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getStringWidth(showText) + 10, 20, showText, button -> {
+ this.showButton = new ButtonWidget(0, 0, MinecraftClient.getInstance().textRenderer.getWidth(showText) + 10, 20, showText, button -> {
for (int i = 0; i < entryStacks.size(); i++) {
EntryStack stack = entryStacks.get(i);
EntryListEntry entry = entries.get(i);
diff --git a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
index 7277ea383..7bd843d0c 100644
--- a/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/credits/CreditsScreen.java
@@ -104,7 +104,7 @@ public class CreditsScreen extends Screen {
for (StackTraceElement traceElement : exception[0].getStackTrace())
entryListWidget.creditsAddEntry(new TextCreditsItem(new LiteralText(" at " + traceElement)));
} else {
- int maxWidth = translatorsMapped.stream().mapToInt(pair -> textRenderer.getWidth(pair.getLeft())).max().orElse(0) + 5;
+ int maxWidth = translatorsMapped.stream().mapToInt(pair -> textRenderer.getStringWidth(pair.getLeft())).max().orElse(0) + 5;
for (Pair<String, String> pair : translatorsMapped) {
entryListWidget.creditsAddEntry(new TranslationCreditsItem(new TranslatableText(pair.getLeft()), new TranslatableText(pair.getRight()), i - maxWidth - 10, maxWidth));
}
diff --git a/src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java b/src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java
index e70dd9a0f..bd55dee70 100644
--- a/src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java
+++ b/src/main/java/me/shedaniel/rei/gui/modules/entries/GameModeMenuEntry.java
@@ -54,7 +54,7 @@ public class GameModeMenuEntry extends MenuEntry {
private int getTextWidth() {
if (textWidth == -69) {
- this.textWidth = Math.max(0, font.getWidth(text));
+ this.textWidth = Math.max(0, font.getStringWidth(text));
}
return this.textWidth;
}
diff --git a/src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java b/src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java
index f2f8682a6..85e762b4b 100644
--- a/src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java
+++ b/src/main/java/me/shedaniel/rei/gui/modules/entries/SubSubsetsMenuEntry.java
@@ -77,7 +77,7 @@ public class SubSubsetsMenuEntry extends MenuEntry {
private int getTextWidth() {
if (textWidth == -69) {
- this.textWidth = Math.max(0, font.getWidth(text));
+ this.textWidth = Math.max(0, font.getStringWidth(text));
}
return this.textWidth;
}
diff --git a/src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java b/src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java
index 0c050bdf8..ea0d74d54 100644
--- a/src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java
+++ b/src/main/java/me/shedaniel/rei/gui/modules/entries/WeatherMenuEntry.java
@@ -55,7 +55,7 @@ public class WeatherMenuEntry extends MenuEntry {
private int getTextWidth() {
if (textWidth == -69) {
- this.textWidth = Math.max(0, font.getWidth(text));
+ this.textWidth = Math.max(0, font.getStringWidth(text));
}
return this.textWidth;
}
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java
index 2c107db03..0e40830de 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java
@@ -73,7 +73,7 @@ public abstract class ClickableLabelWidget extends LabelWidget {
if (isClickable() && isHovered(mouseX, mouseY))
color = getHoveredColor();
Point pos = getLocation();
- int width = font.getWidth(getText());
+ int width = font.getStringWidth(getText());
if (isCentered()) {
if (isHasShadows())
font.drawWithShadow(matrices, text, pos.x - width / 2f, pos.y, color);
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
index 146b909f8..be76074e1 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/EntryListWidget.java
@@ -259,7 +259,7 @@ public class EntryListWidget extends WidgetWithBounds {
int z = getZ();
setZ(500);
Text debugText = new LiteralText(String.format("%d entries, avg. %.0fns, ttl. %.0fms, %s fps", size, time / (double) size, totalTime / 1000000d, minecraft.fpsDebugString.split(" ")[0]));
- fillGradient(matrices, bounds.x, bounds.y, bounds.x + font.getStringWidth(debugText) + 2, bounds.y + font.fontHeight + 2, -16777216, -16777216);
+ fillGradient(matrices, bounds.x, bounds.y, bounds.x + font.getWidth(debugText) + 2, bounds.y + font.fontHeight + 2, -16777216, -16777216);
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
matrices.push();
matrices.translate(0.0D, 0.0D, getZ());
@@ -380,7 +380,7 @@ public class EntryListWidget extends WidgetWithBounds {
int z = getZ();
setZ(500);
Text debugText = new LiteralText(String.format("%d entries, avg. %.0fns, ttl. %.0fms, %s fps", size, time / (double) size, totalTime / 1000000d, minecraft.fpsDebugString.split(" ")[0]));
- int stringWidth = font.getStringWidth(debugText);
+ int stringWidth = font.getWidth(debugText);
fillGradient(matrices, Math.min(bounds.x, minecraft.currentScreen.width - stringWidth - 2), bounds.y, bounds.x + stringWidth + 2, bounds.y + font.fontHeight + 2, -16777216, -16777216);
VertexConsumerProvider.Immediate immediate = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
matrices.push();
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
index 3834aa43a..6529828a2 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
@@ -157,7 +157,7 @@ public class LabelWidget extends WidgetWithBounds {
@NotNull
@Override
public Rectangle getBounds() {
- int width = font.getStringWidth(text);
+ int width = font.getWidth(text);
Point pos = getLocation();
if (isCentered())
return new Rectangle(pos.x - width / 2 - 1, pos.y - 5, width + 2, 14);
@@ -171,7 +171,7 @@ public class LabelWidget extends WidgetWithBounds {
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
- int width = font.getStringWidth(text);
+ int width = font.getWidth(text);
Point pos = getLocation();
if (isCentered()) {
if (hasShadows)
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java
index 34157de67..92311b6f9 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeChoosePageWidget.java
+++ b/