Unknown 6 ani în urmă
părinte
comite
0c69b3fcfa

+ 3 - 0
CHANGELOG.md

@@ -1,4 +1,7 @@
 View full changelog [here](https://github.com/shedaniel/RoughlyEnoughItems/blob/1.14/CHANGELOG.md).
+## v2.9-beta+build.109 (BETA)
+- Fixed [#92](https://github.com/shedaniel/RoughlyEnoughItems/issues/92): Make REI Buttons use an extra sheet
+- Adds: Support for `{item_name}` in cheating items for getting the path of the item identifier
 ## v2.9-beta+build.108 (BETA)
 - Fixed [#88](https://github.com/shedaniel/RoughlyEnoughItems/issues/88): Stupid Item Search
 ## v2.9-beta+build.107 (BETA)

+ 12 - 12
build.gradle

@@ -50,21 +50,21 @@ dependencies {
     minecraft "com.mojang:minecraft:${project.minecraft_version}"
     mappings "net.fabricmc:yarn:${project.yarn_version}"
     modCompile "net.fabricmc:fabric-loader:${project.fabricloader_version}"
-    modCompile "net.fabricmc:fabric:${project.fabric_version}"
-//    modCompile "net.fabricmc.fabric-api:fabric-keybindings:${project.fabric_keybindings}"
-//    modCompile "net.fabricmc.fabric-api:fabric-lib:${project.fabric_lib}"
-//    modCompile "net.fabricmc.fabric-api:fabric-networking:${project.fabric_networking}"
-//    modCompile "net.fabricmc.fabric-api:fabric-events-lifecycle:${project.fabric_events_lifecycle}"
-//    modCompile "net.fabricmc.fabric-api:fabric-resource-loader:${project.fabric_resource_loader}"
+//    modCompile "net.fabricmc:fabric:${project.fabric_version}"
+    modCompile "net.fabricmc.fabric-api:fabric-keybindings:${project.fabric_keybindings}"
+    modCompile "net.fabricmc.fabric-api:fabric-lib:${project.fabric_lib}"
+    modCompile "net.fabricmc.fabric-api:fabric-networking:${project.fabric_networking}"
+    modCompile "net.fabricmc.fabric-api:fabric-events-lifecycle:${project.fabric_events_lifecycle}"
+    modCompile "net.fabricmc.fabric-api:fabric-resource-loader:${project.fabric_resource_loader}"
     modCompile "cloth:ClothEvents:${cloth_events_version}"
     modCompile "cloth-config:ClothConfig:${cloth_config_version}"
     if (includeDep) {
-        include "net.fabricmc:fabric:${project.fabric_version}"
-//        include "net.fabricmc.fabric-api:fabric-keybindings:${project.fabric_keybindings}"
-//        include "net.fabricmc.fabric-api:fabric-lib:${project.fabric_lib}"
-//        include "net.fabricmc.fabric-api:fabric-networking:${project.fabric_networking}"
-//        include "net.fabricmc.fabric-api:fabric-events-lifecycle:${project.fabric_events_lifecycle}"
-//        include "net.fabricmc.fabric-api:fabric-resource-loader:${project.fabric_resource_loader}"
+//        include "net.fabricmc:fabric:${project.fabric_version}"
+        include "net.fabricmc.fabric-api:fabric-keybindings:${project.fabric_keybindings}"
+        include "net.fabricmc.fabric-api:fabric-lib:${project.fabric_lib}"
+        include "net.fabricmc.fabric-api:fabric-networking:${project.fabric_networking}"
+        include "net.fabricmc.fabric-api:fabric-events-lifecycle:${project.fabric_events_lifecycle}"
+        include "net.fabricmc.fabric-api:fabric-resource-loader:${project.fabric_resource_loader}"
         include "cloth:ClothEvents:${cloth_events_version}"
         include "cloth-config:ClothConfig:${cloth_config_version}"
     }

+ 6 - 6
gradle.properties

@@ -1,4 +1,4 @@
-mod_version=2.9-beta+build.108
+mod_version=2.9-beta+build.109
 minecraft_version=1.14
 yarn_version=1.14+build.5
 fabricloader_version=0.4.6+build.141
@@ -8,8 +8,8 @@ cloth_config_version=0.2.1.14
 modmenu_version=1.4.0-71
 fabric_version=0.2.7+build.127
 
-fabric_keybindings=0.1.0
-fabric_lib=0.1.0
-fabric_networking=0.1.0
-fabric_events_lifecycle=0.1.0
-fabric_resource_loader=0.1.0
+fabric_keybindings=0.1.0+93af775a
+fabric_lib=0.1.0+93af775a
+fabric_networking=0.1.0+93af775a
+fabric_events_lifecycle=0.1.0+93af775a
+fabric_resource_loader=0.1.0+93af775a

+ 1 - 2
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}
      */

+ 5 - 4
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;

+ 0 - 3
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;

+ 1 - 1
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

+ 1 - 5
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

+ 1 - 2
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;

+ 1 - 2
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;
             }