aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/shedaniel/rei/api/ClientHelper.java3
-rw-r--r--src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java9
-rw-r--r--src/main/java/me/shedaniel/rei/client/ConfigObject.java3
-rw-r--r--src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java2
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java6
-rw-r--r--src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java3
-rw-r--r--src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java3
7 files changed, 10 insertions, 19 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
index a6531d08b..e0fbfbed3 100644
--- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
@@ -6,7 +6,6 @@
package me.shedaniel.rei.api;
import me.shedaniel.rei.client.ClientHelperImpl;
-import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -15,7 +14,7 @@ import net.minecraft.util.Identifier;
import java.util.List;
import java.util.Map;
-public interface ClientHelper extends ClientModInitializer {
+public interface ClientHelper {
/**
* @return the api instance of {@link ClientHelperImpl}
*/
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
index 5271f1c2d..b127a2461 100644
--- a/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/ClientHelperImpl.java
@@ -17,6 +17,7 @@ import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.gui.PreRecipeViewingScreen;
import me.shedaniel.rei.gui.RecipeViewingScreen;
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
+import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.keybinding.FabricKeyBinding;
import net.fabricmc.fabric.api.network.ClientSidePacketRegistry;
import net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl;
@@ -41,7 +42,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
-public class ClientHelperImpl implements ClientHelper {
+public class ClientHelperImpl implements ClientHelper, ClientModInitializer {
public static ClientHelperImpl instance;
private final Identifier recipeKeybind = new Identifier("roughlyenoughitems", "recipe_keybind");
@@ -150,10 +151,10 @@ public class ClientHelperImpl implements ClientHelper {
Identifier identifier = Registry.ITEM.getId(cheatedStack.getItem());
String tagMessage = cheatedStack.copy().getTag() != null && !cheatedStack.copy().getTag().isEmpty() ? cheatedStack.copy().getTag().asString() : "";
String og = cheatedStack.getAmount() != 1 ? RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand.replaceAll(" \\{count}", "").replaceAll("\\{count}", "") : RoughlyEnoughItemsCore.getConfigManager().getConfig().giveCommand;
- String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
+ String madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", tagMessage).replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
if (madeUpCommand.length() > 256) {
- madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
- MinecraftClient.getInstance().player.addChatMessage(new TranslatableTextComponent("text.rei" + ".too_long_nbt"), false);
+ madeUpCommand = og.replaceAll("\\{player_name}", MinecraftClient.getInstance().player.getEntityName()).replaceAll("\\{item_name}", identifier.getPath()).replaceAll("\\{item_identifier}", identifier.toString()).replaceAll("\\{nbt}", "").replaceAll("\\{count}", String.valueOf(cheatedStack.getAmount()));
+ MinecraftClient.getInstance().player.addChatMessage(new TranslatableTextComponent("text.rei.too_long_nbt"), false);
}
MinecraftClient.getInstance().player.sendChatMessage(madeUpCommand);
return true;
diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
index 609f4d1e8..254f9ace8 100644
--- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java
+++ b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
@@ -44,9 +44,6 @@ public class ConfigObject {
public boolean preferVisibleRecipes = false;
- // @Comment("Enable support for old REI plugins which uses registerSpeedCraft")
- // public boolean enableLegacySpeedCraftSupport = false;
-
@Comment("Force enable 2019 REI April Fools' joke") public boolean aprilFoolsFish2019 = false;
public ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE;
diff --git a/src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java b/src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java
index bb0b165b8..93419651e 100644
--- a/src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/DisplayHelperImpl.java
@@ -23,7 +23,7 @@ public class DisplayHelperImpl implements DisplayHelper {
private static final DisplayBoundsHandler EMPTY = new DisplayBoundsHandler() {
@Override
public Class getBaseSupportedClass() {
- return Object.class;
+ return null;
}
@Override
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
index cf8acd66e..80db040d1 100644
--- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
@@ -35,7 +35,6 @@ public class RecipeHelperImpl implements RecipeHelper {
VISIBILITY_HANDLER_COMPARATOR = comparator.reversed();
}
- private final List<Recipe> sortedRecipes = new ArrayList<>();
private final AtomicInteger recipeCount = new AtomicInteger();
private final Map<Identifier, List<RecipeDisplay>> recipeCategoryListMap = Maps.newHashMap();
private final Map<Identifier, DisplaySettings> categoryDisplaySettingsMap = Maps.newHashMap();
@@ -199,7 +198,6 @@ public class RecipeHelperImpl implements RecipeHelper {
this.speedCraftFunctionalMap.clear();
this.categoryDisplaySettingsMap.clear();
this.displayVisibilityHandlers.clear();
- this.sortedRecipes.clear();
((DisplayHelperImpl) RoughlyEnoughItemsCore.getDisplayHelper()).resetCache();
BaseBoundsHandler baseBoundsHandler = new BaseBoundsHandlerImpl();
RoughlyEnoughItemsCore.getDisplayHelper().registerBoundsHandler(baseBoundsHandler);
@@ -253,9 +251,7 @@ public class RecipeHelperImpl implements RecipeHelper {
@Override
public List<Recipe> getVanillaSortedRecipes() {
- if (sortedRecipes.isEmpty())
- sortedRecipes.addAll(getRecipeManager().values().stream().sorted(RECIPE_COMPARATOR).collect(Collectors.toSet()));
- return sortedRecipes;
+ return getRecipeManager().values().stream().sorted(RECIPE_COMPARATOR).collect(Collectors.toList());
}
@Override
diff --git a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
index 3d2c1f12a..d067d4378 100644
--- a/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
+++ b/src/main/java/me/shedaniel/rei/gui/RecipeViewingScreen.java
@@ -35,9 +35,8 @@ import java.util.function.Supplier;
public class RecipeViewingScreen extends Screen {
- public static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui" + "/recipecontainer.png");
+ public static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png");
public static final Color SUB_COLOR = new Color(159, 159, 159);
- private static final Identifier CREATIVE_INVENTORY_TABS = new Identifier("textures/gui/container" + "/creative_inventory/tabs.png");
private final List<Widget> widgets;
private final List<TabWidget> tabs;
private final Map<RecipeCategory, List<RecipeDisplay>> categoriesMap;
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java
index 9baf62c12..f5442eb14 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/SearchFieldWidget.java
@@ -9,7 +9,6 @@ import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.audio.PositionedSoundInstance;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.sound.SoundEvents;
-import org.lwjgl.glfw.GLFW;
public class SearchFieldWidget extends TextFieldWidget {
@@ -59,7 +58,7 @@ public class SearchFieldWidget extends TextFieldWidget {
@Override
public boolean keyPressed(int int_1, int int_2, int int_3) {
if (this.isVisible() && this.isFocused())
- if (int_1 == GLFW.GLFW_KEY_ENTER || int_1 == GLFW.GLFW_KEY_KP_ENTER) {
+ if (int_1 == 257 || int_1 == 335) {
setFocused(false);
return true;
}