aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client')
-rw-r--r--src/main/java/me/shedaniel/rei/client/ClientHelper.java39
-rw-r--r--src/main/java/me/shedaniel/rei/client/KeyBindHelper.java42
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeHelper.java4
3 files changed, 50 insertions, 35 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/ClientHelper.java b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
index 3afefc48b..7023a4627 100644
--- a/src/main/java/me/shedaniel/rei/client/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/client/ClientHelper.java
@@ -2,7 +2,6 @@ package me.shedaniel.rei.client;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
-import me.shedaniel.rei.RoughlyEnoughItemsCore;
import me.shedaniel.rei.api.IRecipeCategory;
import me.shedaniel.rei.api.IRecipeDisplay;
import me.shedaniel.rei.gui.ContainerGuiOverlay;
@@ -10,15 +9,11 @@ import me.shedaniel.rei.gui.widget.ConfigWidget;
import me.shedaniel.rei.gui.widget.RecipeViewingWidget;
import me.shedaniel.rei.listeners.ClientLoaded;
import me.shedaniel.rei.listeners.IMixinGuiContainer;
-import me.shedaniel.rei.listeners.IMixinKeyBinding;
import me.shedaniel.rei.network.CreateItemsPacket;
import me.shedaniel.rei.network.DeleteItemsPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MouseHelper;
import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Items;
@@ -27,19 +22,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.IRegistry;
-import org.dimdev.rift.listener.client.KeyBindingAdder;
import org.dimdev.riftloader.RiftLoader;
import java.awt.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-public class ClientHelper implements ClientLoaded, KeyBindingAdder {
+public class ClientHelper implements ClientLoaded {
- private static final ResourceLocation RECIPE_KEYBIND = new ResourceLocation("roughlyenoughitems", "recipe_keybind");
- private static final ResourceLocation USAGE_KEYBIND = new ResourceLocation("roughlyenoughitems", "usage_keybind");
- private static final ResourceLocation HIDE_KEYBIND = new ResourceLocation("roughlyenoughitems", "hide_keybind");
- public static KeyBinding RECIPE, USAGE, HIDE;
private static List<ItemStack> itemList;
private static boolean cheating = false;
@@ -78,6 +70,8 @@ public class ClientHelper implements ClientLoaded, KeyBindingAdder {
}
public static boolean isCheating() {
+ if (!Minecraft.getInstance().isSingleplayer())
+ cheating = false;
return cheating;
}
@@ -165,25 +159,4 @@ public class ClientHelper implements ClientLoaded, KeyBindingAdder {
return false;
}
- @Override
- public Collection<? extends KeyBinding> getKeyBindings() {
- String category = "key.rei.category";
- List<KeyBinding> keyBindings = Lists.newArrayList();
- keyBindings.add(RECIPE = createKeyBinding(RECIPE_KEYBIND, InputMappings.Type.KEYSYM, 82, category));
- keyBindings.add(USAGE = createKeyBinding(USAGE_KEYBIND, InputMappings.Type.KEYSYM, 85, category));
- keyBindings.add(HIDE = createKeyBinding(HIDE_KEYBIND, InputMappings.Type.KEYSYM, 79, category));
- addCategoryIfMissing(RECIPE, category);
- return keyBindings;
- }
-
- private void addCategoryIfMissing(KeyBinding keyBinding, String category) {
- if (!((IMixinKeyBinding) keyBinding).hasCategory(category))
- ((IMixinKeyBinding) keyBinding).addCategory(category);
- }
-
- private KeyBinding createKeyBinding(ResourceLocation location, InputMappings.Type inputType, int keyCode, String category) {
- RoughlyEnoughItemsCore.LOGGER.info("Registering: key." + location.toString().replaceAll(":", ".") + " in " + category);
- return new KeyBinding("key." + location.toString().replaceAll(":", "."), inputType, keyCode, category);
- }
-
}
diff --git a/src/main/java/me/shedaniel/rei/client/KeyBindHelper.java b/src/main/java/me/shedaniel/rei/client/KeyBindHelper.java
new file mode 100644
index 000000000..65ce788a1
--- /dev/null
+++ b/src/main/java/me/shedaniel/rei/client/KeyBindHelper.java
@@ -0,0 +1,42 @@
+package me.shedaniel.rei.client;
+
+import com.google.common.collect.Lists;
+import me.shedaniel.rei.RoughlyEnoughItemsCore;
+import me.shedaniel.rei.listeners.IMixinKeyBinding;
+import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.client.util.InputMappings;
+import net.minecraft.util.ResourceLocation;
+import org.dimdev.rift.listener.client.KeyBindingAdder;
+
+import java.util.Collection;
+import java.util.List;
+
+public class KeyBindHelper implements KeyBindingAdder {
+
+ private static final ResourceLocation RECIPE_KEYBIND = new ResourceLocation("roughlyenoughitems", "recipe_keybind");
+ private static final ResourceLocation USAGE_KEYBIND = new ResourceLocation("roughlyenoughitems", "usage_keybind");
+ private static final ResourceLocation HIDE_KEYBIND = new ResourceLocation("roughlyenoughitems", "hide_keybind");
+ public static KeyBinding RECIPE, USAGE, HIDE;
+
+ @Override
+ public Collection<? extends KeyBinding> getKeyBindings() {
+ String category = "key.rei.category";
+ List<KeyBinding> keyBindings = Lists.newArrayList();
+ keyBindings.add(RECIPE = createKeyBinding(RECIPE_KEYBIND, InputMappings.Type.KEYSYM, 82, category));
+ keyBindings.add(USAGE = createKeyBinding(USAGE_KEYBIND, InputMappings.Type.KEYSYM, 85, category));
+ keyBindings.add(HIDE = createKeyBinding(HIDE_KEYBIND, InputMappings.Type.KEYSYM, 79, category));
+ addCategoryIfMissing(RECIPE, category);
+ return keyBindings;
+ }
+
+ private void addCategoryIfMissing(KeyBinding keyBinding, String category) {
+ if (!((IMixinKeyBinding) keyBinding).hasCategory(category))
+ ((IMixinKeyBinding) keyBinding).addCategory(category);
+ }
+
+ private KeyBinding createKeyBinding(ResourceLocation location, InputMappings.Type inputType, int keyCode, String category) {
+ RoughlyEnoughItemsCore.LOGGER.info("Registering: key." + location.toString().replaceAll(":", ".") + " in " + category);
+ return new KeyBinding("key." + location.toString().replaceAll(":", "."), inputType, keyCode, category);
+ }
+
+}
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelper.java b/src/main/java/me/shedaniel/rei/client/RecipeHelper.java
index f52c426df..da0c4aab4 100644
--- a/src/main/java/me/shedaniel/rei/client/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/client/RecipeHelper.java
@@ -152,12 +152,12 @@ public class RecipeHelper implements RecipeSync {
this.categories.clear();
this.speedCraftAreaSupplierMap.clear();
this.speedCraftFunctionalMap.clear();
- List<IRecipePlugin> plugins = new LinkedList<>(RoughlyEnoughItemsCore.getPlugins());
+ List<IRecipePlugin> plugins = new LinkedList<>(RoughlyEnoughItemsPlugin.getPlugins());
plugins.sort((first, second) -> {
return second.getPriority() - first.getPriority();
});
RoughlyEnoughItemsCore.LOGGER.info("Loading %d REI plugins: %s", plugins.size(), String.join(", ", plugins.stream().map(plugin -> {
- ResourceLocation ResourceLocation = RoughlyEnoughItemsCore.getPluginResourceLocation(plugin);
+ ResourceLocation ResourceLocation = RoughlyEnoughItemsPlugin.getPluginResourceLocation(plugin);
return ResourceLocation == null ? "NULL" : ResourceLocation.toString();
}).collect(Collectors.toList())));
Collections.reverse(plugins);