ソースを参照

v1.4 Bug Fixes

Unknown 6 年 前
コミット
9a13eee410
23 ファイル変更268 行追加172 行削除
  1. 3 3
      build.gradle
  2. 25 30
      src/main/java/me/shedaniel/Core.java
  3. 1 1
      src/main/java/me/shedaniel/gui/ConfigGui.java
  4. 32 1
      src/main/java/me/shedaniel/gui/REIRenderHelper.java
  5. 58 47
      src/main/java/me/shedaniel/gui/RecipeGui.java
  6. 8 9
      src/main/java/me/shedaniel/gui/widget/REISlot.java
  7. 0 21
      src/main/java/me/shedaniel/listenerdefinitions/PacketAdder.java
  8. 6 1
      src/main/java/me/shedaniel/listeners/DrawContainerListener.java
  9. 0 14
      src/main/java/me/shedaniel/listeners/ResizeListener.java
  10. 0 33
      src/main/java/me/shedaniel/mixins/MixinMinecraftClient.java
  11. 5 1
      src/main/java/me/shedaniel/network/CheatPacket.java
  12. 33 0
      src/main/java/me/shedaniel/plugin/RandomRecipe.java
  13. 69 0
      src/main/java/me/shedaniel/plugin/TestRandomCategory.java
  14. 16 0
      src/main/java/me/shedaniel/plugin/VanillaPlugin.java
  15. 1 1
      src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java
  16. 1 1
      src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java
  17. 1 1
      src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java
  18. 1 1
      src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java
  19. 1 1
      src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java
  20. 1 1
      src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java
  21. 3 1
      src/main/resources/assets/roughlyenoughitems/lang/en_us.json
  22. 2 2
      src/main/resources/fabric.mod.json
  23. 1 2
      src/main/resources/roughlyenoughitems.client.json

+ 3 - 3
build.gradle

@@ -6,15 +6,15 @@ sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
 archivesBaseName = "RoughlyEnoughItems"
-version = "1.3-7"
+version = "1.4-7"
 
 minecraft {
 }
 
 dependencies {
 	minecraft "com.mojang:minecraft:18w50a"
-	mappings "net.fabricmc:yarn:18w50a.83"
-	modCompile "net.fabricmc:fabric-loader:0.3.1.82"
+	mappings "net.fabricmc:yarn:18w50a.90"
+	modCompile "net.fabricmc:fabric-loader:0.3.1.84"
 
 	// Fabric API. This is technically optional, but you probably want it anyway.
 	modCompile "net.fabricmc:fabric:0.1.2.63"

+ 25 - 30
src/main/java/me/shedaniel/Core.java

@@ -1,16 +1,16 @@
 package me.shedaniel;
 
 import me.shedaniel.config.REIConfig;
+import me.shedaniel.listenerdefinitions.ClientTickable;
 import me.shedaniel.listenerdefinitions.IEvent;
-import me.shedaniel.listenerdefinitions.PacketAdder;
 import me.shedaniel.listeners.DrawContainerListener;
-import me.shedaniel.listeners.ResizeListener;
 import me.shedaniel.network.CheatPacket;
-import me.shedaniel.network.DeletePacket;
 import me.shedaniel.plugin.VanillaPlugin;
 import net.fabricmc.api.ClientModInitializer;
+import net.fabricmc.fabric.events.client.ClientTickEvent;
 import net.fabricmc.loader.FabricLoader;
-import net.minecraft.network.NetworkSide;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.item.ItemStack;
 
 import java.io.*;
 import java.nio.file.Files;
@@ -21,26 +21,7 @@ import java.util.List;
 /**
  * Created by James on 7/27/2018.
  */
-public class Core implements PacketAdder, ClientModInitializer {
-    @Override
-    public void registerHandshakingPackets(PacketRegistrationReceiver receiver) {
-    }
-    
-    @Override
-    public void registerPlayPackets(PacketRegistrationReceiver receiver) {
-        receiver.registerPacket(NetworkSide.SERVER, CheatPacket.class);
-        receiver.registerPacket(NetworkSide.SERVER, DeletePacket.class);
-    }
-    
-    @Override
-    public void registerStatusPackets(PacketRegistrationReceiver receiver) {
-    
-    }
-    
-    @Override
-    public void registerLoginPackets(PacketRegistrationReceiver receiver) {
-    
-    }
+public class Core implements ClientModInitializer {
     
     private static List<IEvent> events = new LinkedList<>();
     public static final File configFile = new File(FabricLoader.INSTANCE.getConfigDirectory(), "rei.json");
@@ -51,7 +32,8 @@ public class Core implements PacketAdder, ClientModInitializer {
     @Override
     public void onInitializeClient() {
         this.clientListener = new ClientListener();
-        registerEvents();
+        registerSelfEvents();
+        registerFabricEvents();
         try {
             loadConfig();
             centreSearchBox = config.centreSearchBox;
@@ -61,14 +43,23 @@ public class Core implements PacketAdder, ClientModInitializer {
         this.clientListener.onInitializeKeyBind();
     }
     
-    private void registerEvents() {
+    private void registerFabricEvents() {
+        ClientTickEvent.CLIENT.register(minecraftClient -> {
+            getListeners(ClientTickable.class).forEach(ClientTickable::clientTick);
+        });
+    }
+    
+    private void registerSelfEvents() {
         registerEvent(new DrawContainerListener());
-        registerEvent(new ResizeListener());
-        registerEvent(new VanillaPlugin());
         registerEvent(clientListener);
+        registerPlugin(new VanillaPlugin());
+    }
+    
+    public static void registerPlugin(VanillaPlugin vanillaPlugin) {
+        registerEvent(vanillaPlugin);
     }
     
-    public static void registerEvent(IEvent event) {
+    private static void registerEvent(IEvent event) {
         events.add(event);
     }
     
@@ -88,7 +79,7 @@ public class Core implements PacketAdder, ClientModInitializer {
         try {
             InputStream in = Files.newInputStream(configFile.toPath());
             config = REIConfig.GSON.fromJson(new InputStreamReader(in), REIConfig.class);
-        } catch (Exception e){
+        } catch (Exception e) {
             failed = true;
         }
         if (failed || config == null) {
@@ -113,4 +104,8 @@ public class Core implements PacketAdder, ClientModInitializer {
         }
     }
     
+    public static void cheatItems(ItemStack cheatedStack) {
+        MinecraftClient.getInstance().getNetworkHandler().sendPacket(new CheatPacket(cheatedStack));
+    }
+    
 }

+ 1 - 1
src/main/java/me/shedaniel/gui/ConfigGui.java

@@ -87,7 +87,7 @@ public class ConfigGui extends Gui {
     
     @Override
     public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
-        if (p_keyPressed_1_ == 256 && this.canClose()) {
+        if (p_keyPressed_1_ == 256 && this.doesEscapeKeyClose()) {
             this.close();
             if (parent != null)
                 MinecraftClient.getInstance().openGui(parent);

+ 32 - 1
src/main/java/me/shedaniel/gui/REIRenderHelper.java

@@ -17,8 +17,10 @@ import net.minecraft.item.ItemStack;
 
 import java.awt.*;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
 
 /**
@@ -127,7 +129,12 @@ public class REIRenderHelper {
             }
         }
         if (overlayedGui instanceof RecipeGui) {
-            List<Control> controls = ((RecipeGui) overlayedGui).controls;
+            List<Control> controls = new LinkedList<>(((RecipeGui) overlayedGui).controls);
+            if (((RecipeGui) overlayedGui).slots != null)
+                controls.addAll(((RecipeGui) overlayedGui).slots);
+            controls.addAll(reiGui.controls.stream().filter(control -> {
+                return control instanceof REISlot;
+            }).collect(Collectors.toList()));
             Optional<Control> ctrl = controls.stream().filter(Control::isHighlighted).filter(Control::isEnabled).findFirst();
             if (ctrl.isPresent()) {
                 try {
@@ -181,6 +188,30 @@ public class REIRenderHelper {
     public static boolean mouseScrolled(double direction) {
         if (!reiGui.visible)
             return false;
+        if (MinecraftClient.getInstance().currentGui instanceof RecipeGui) {
+            Window window = REIRenderHelper.getResolution();
+            Point mouse = new Point((int) MinecraftClient.getInstance().mouse.getX(), (int) MinecraftClient.getInstance().mouse.getY());
+            int mouseX = (int) (mouse.x * (double) window.getScaledWidth() / (double) window.method_4480());
+            int mouseY = (int) (mouse.y * (double) window.getScaledHeight() / (double) window.method_4507());
+            mouse = new Point(mouseX, mouseY);
+            
+            RecipeGui recipeGui = (RecipeGui) MinecraftClient.getInstance().currentGui;
+            System.out.printf("%b.%b.%b.%b.%b%n", mouse.getX() < window.getScaledWidth() / 2 + recipeGui.guiWidth / 2, mouse.getX() > window.getScaledWidth() / 2 - recipeGui.guiWidth / 2,
+                    mouse.getY() < window.getScaledHeight() / 2 + recipeGui.guiHeight / 2, mouse.getY() > window.getScaledHeight() / 2 - recipeGui.guiHeight / 2,
+                    recipeGui.recipes.get(recipeGui.selectedCategory).size() > 2);
+            if (mouse.getX() < window.getScaledWidth() / 2 + recipeGui.guiWidth / 2 && mouse.getX() > window.getScaledWidth() / 2 - recipeGui.guiWidth / 2 &&
+                    mouse.getY() < window.getScaledHeight() / 2 + recipeGui.guiHeight / 2 && mouse.getY() > window.getScaledHeight() / 2 - recipeGui.guiHeight / 2 &&
+                    recipeGui.recipes.get(recipeGui.selectedCategory).size() > 2) {
+                boolean failed = false;
+                if (direction > 0 && reiGui.buttonLeft.isEnabled())
+                    recipeGui.btnRecipeLeft.onClick.apply(0);
+                else if (direction < 0 && reiGui.buttonRight.isEnabled())
+                    recipeGui.btnRecipeRight.onClick.apply(0);
+                else failed = true;
+                if (!failed)
+                    return true;
+            }
+        }
         if (direction > 0 && reiGui.buttonLeft.isEnabled())
             reiGui.buttonLeft.onClick.apply(0);
         else if (direction < 0 && reiGui.buttonRight.isEnabled())

+ 58 - 47
src/main/java/me/shedaniel/gui/RecipeGui.java

@@ -17,10 +17,7 @@ import net.minecraft.container.Container;
 import net.minecraft.util.Identifier;
 import net.minecraft.util.math.MathHelper;
 
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 public class RecipeGui extends ContainerGui {
     
@@ -29,19 +26,19 @@ public class RecipeGui extends ContainerGui {
     private final Window mainWindow;
     private final Container container;
     private final Gui prevScreen;
-    private final Map<IDisplayCategory, List<IRecipe>> recipes;
-    private int guiWidth = 176;
-    private int guiHeight = 222;
+    public final Map<IDisplayCategory, List<IRecipe>> recipes;
+    public final int guiWidth = 176;
+    public final int guiHeight = 222;
     ArrayList<IDisplayCategory> categories = new ArrayList<>();
     private int categoryTabPage = 0;
-    private IDisplayCategory selectedCategory;
+    public IDisplayCategory selectedCategory;
     private int recipePointer = 0;
-    private List<REISlot> slots;
-    private int cycleCounter = 0;
-    private int[] itemPointer;
+    public List<REISlot> slots;
     List<Control> controls = new LinkedList<>();
     private List<Tab> tabs;
     private boolean tabsEnabled = false;
+    private Button btnCategoryPageLeft, btnCategoryPageRight;
+    public Button btnRecipeLeft, btnRecipeRight;
     
     public RecipeGui(Container p_i1072_1_, Gui prevScreen, Map<IDisplayCategory, List<IRecipe>> recipes) {
         super(new RecipeContainer());
@@ -66,7 +63,12 @@ public class RecipeGui extends ContainerGui {
         for(int i = 0; i < 6; i++)
             tabs.add(new Tab(i, 0, 0, 0, 28, 32));
         tabs.forEach(tab -> tab.setOnClick(i -> {
-            return onClickTab(tab.getId());
+            if (tab.getId() + categoryTabPage * 6 == categories.indexOf(selectedCategory))
+                return false;
+            selectedCategory = categories.get(tab.getId() + categoryTabPage * 6);
+            recipePointer = 0;
+            updateRecipe();
+            return false;
         }));
         updateRecipe();
     }
@@ -100,14 +102,15 @@ public class RecipeGui extends ContainerGui {
     
     private void updateRecipe() {
         int categoryPointer = categories.indexOf(selectedCategory);
+        
         IRecipe recipe = recipes.get(categories.get(categoryPointer)).get(recipePointer);
-        categories.get(categoryPointer).resetRecipes();
-        categories.get(categoryPointer).addRecipe(recipe);
-        slots = categories.get(categoryPointer).setupDisplay(0);
-        if (recipes.get(categories.get(categoryPointer)).size() >= categoryPointer + 2) {
-            IRecipe recipe2 = recipes.get(categories.get(categoryPointer)).get(recipePointer + 1);
-            categories.get(categoryPointer).addRecipe(recipe2);
-            slots.addAll(categories.get(categoryPointer).setupDisplay(1));
+        selectedCategory.resetRecipes();
+        selectedCategory.addRecipe(recipe);
+        slots = selectedCategory.setupDisplay(0);
+        if (recipes.get(selectedCategory).size() >= recipePointer + 2) {
+            IRecipe recipe2 = recipes.get(selectedCategory).get(recipePointer + 1);
+            selectedCategory.addRecipe(recipe2);
+            slots.addAll(selectedCategory.setupDisplay(1));
         }
         
         left = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
@@ -120,10 +123,10 @@ public class RecipeGui extends ContainerGui {
         btnCategoryRight.onClick = this::btnCategoryRight;
         btnCategoryLeft.onClick = this::btnCategoryLeft;
         
-        Button btnRecipeLeft = new Button(left + 10, top + 28, 15, 20, "<");
-        Button btnRecipeRight = new Button(left + guiWidth - 25, top + 28, 15, 20, ">");
-        btnRecipeLeft.setEnabled(recipes.get(categories.get(categoryPointer)).size() > 1 && recipePointer > 0);
-        btnRecipeRight.setEnabled(recipes.get(categories.get(categoryPointer)).size() > 1 && getCurrentPage() + 1 < getTotalPages());
+        btnRecipeLeft = new Button(left + 10, top + 28, 15, 20, "<");
+        btnRecipeRight = new Button(left + guiWidth - 25, top + 28, 15, 20, ">");
+        btnRecipeLeft.setEnabled(recipes.get(selectedCategory).size() > 2);
+        btnRecipeRight.setEnabled(recipes.get(selectedCategory).size() > 2);
         btnRecipeRight.onClick = this::btnRecipeRight;
         btnRecipeLeft.onClick = this::btnRecipeLeft;
         
@@ -133,19 +136,33 @@ public class RecipeGui extends ContainerGui {
         if (categories.size() <= 1) {
             btnCategoryLeft.setEnabled(false);
             btnCategoryRight.setEnabled(false);
+        } else if (categories.size() > 6) {
+            btnCategoryPageLeft = new Button(left, top - 52, 20, 20, "<");
+            btnCategoryPageRight = new Button(left + guiWidth - 20, top - 52, 20, 20, ">");
+            btnCategoryPageLeft.setOnClick(i -> {
+                categoryTabPage--;
+                if (categoryTabPage <= 0)
+                    categoryTabPage = MathHelper.ceil(categories.size() / 6d);
+                updateRecipe();
+                return true;
+            });
+            btnCategoryPageRight.setOnClick(i -> {
+                categoryTabPage++;
+                if (categoryTabPage >= MathHelper.ceil(categories.size() / 6d))
+                    categoryTabPage = 0;
+                updateRecipe();
+                return true;
+            });
+            if (top - 52 >= 2)
+                controls.addAll(Arrays.asList(btnCategoryPageLeft, btnCategoryPageRight));
         }
         
         controls.add(btnRecipeLeft);
         controls.add(btnRecipeRight);
         
-        itemPointer = new int[9];
-        for(int i = 0; i < itemPointer.length; i++) {
-            itemPointer[i] = 0;
-        }
-        
         List<Control> newControls = new LinkedList<>();
         categories.get(categoryPointer).addWidget(newControls, 0);
-        if (recipes.get(categories.get(categoryPointer)).size() >= categoryPointer + 2)
+        if (recipes.get(categories.get(categoryPointer)).size() >= recipePointer + 2)
             categories.get(categoryPointer).addWidget(newControls, 1);
         newControls.forEach(f -> f.move(left, top));
         controls.addAll(newControls);
@@ -167,14 +184,6 @@ public class RecipeGui extends ContainerGui {
         }
     }
     
-    private boolean onClickTab(int index) {
-        if (index + categoryTabPage * 6 == categories.indexOf(selectedCategory))
-            return false;
-        selectedCategory = categories.get(index + categoryTabPage * 6);
-        updateRecipe();
-        return false;
-    }
-    
     @Override
     protected void drawBackground(float v, int i, int i1) {
         //Tabs
@@ -187,13 +196,18 @@ public class RecipeGui extends ContainerGui {
         
         drawBackground();
         GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+        GuiLighting.disable();
         this.client.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
         
         int lvt_4_1_ = (int) ((mainWindow.getScaledWidth() / 2 - this.guiWidth / 2));
         int lvt_5_1_ = (int) ((mainWindow.getScaledHeight() / 2 - this.guiHeight / 2));
         
         this.drawTexturedRect(lvt_4_1_, lvt_5_1_, 0, 0, this.guiWidth, this.guiHeight);
-        slots.forEach(REISlot::draw);
+        slots.forEach(reiSlot -> {
+            GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
+            GuiLighting.disable();
+            reiSlot.draw();
+        });
         
         if (tabsEnabled)
             tabs.stream().filter(tab -> tab.getId() + categoryTabPage * 6 != categories.indexOf(selectedCategory)).forEach(tab -> {
@@ -210,7 +224,6 @@ public class RecipeGui extends ContainerGui {
             this.client.openGui(prevScreen);
             return true;
         }
-        
         return super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_);
     }
     
@@ -218,7 +231,7 @@ public class RecipeGui extends ContainerGui {
         recipePointer = 0;
         int categoryPointer = categories.indexOf(selectedCategory);
         categoryPointer--;
-        if (categoryPointer < 0)
+        if (categoryPointer <= 0)
             categoryPointer = categories.size() - 1;
         selectedCategory = categories.get(categoryPointer);
         categoryTabPage = categoryPointer / 6;
@@ -240,27 +253,25 @@ public class RecipeGui extends ContainerGui {
     
     private boolean btnRecipeLeft(int button) {
         recipePointer -= 2;
-        if (recipePointer < 0) {
-            recipePointer = (getTotalPages() - 1) * 2;
-        }
+        if (recipePointer <= 0)
+            recipePointer = MathHelper.floor((recipes.get(selectedCategory).size() - 1) / 2d) * 2;
         updateRecipe();
         return true;
     }
     
     private boolean btnRecipeRight(int button) {
         recipePointer += 2;
-        if (recipePointer >= recipes.get(selectedCategory).size()) {
+        if (recipePointer >= recipes.get(selectedCategory).size())
             recipePointer = 0;
-        }
         updateRecipe();
         return true;
     }
     
     private int riseDoublesToInt(double i) {
-        return (int) (i + (i % 1 == 0 ? 0 : 1));
+        return MathHelper.ceil(i);
     }
     
     private int getTotalPages() {
-        return MathHelper.clamp(riseDoublesToInt(recipes.get(selectedCategory).size() / 2), 1, Integer.MAX_VALUE);
+        return MathHelper.clamp(riseDoublesToInt(recipes.get(selectedCategory).size() / 2d), 1, Integer.MAX_VALUE);
     }
 }

+ 8 - 9
src/main/java/me/shedaniel/gui/widget/REISlot.java

@@ -1,9 +1,9 @@
 package me.shedaniel.gui.widget;
 
 import com.google.common.collect.Lists;
+import me.shedaniel.Core;
 import me.shedaniel.gui.REIRenderHelper;
 import me.shedaniel.listenerdefinitions.IMixinContainerGui;
-import me.shedaniel.network.CheatPacket;
 import me.shedaniel.network.DeletePacket;
 import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.ContainerGui;
@@ -16,6 +16,7 @@ import net.minecraft.util.registry.Registry;
 import java.awt.*;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * Created by James on 7/28/2018.
@@ -122,7 +123,7 @@ public class REISlot extends Control {
                 if (button == 1) {
                     cheatedStack.setAmount(cheatedStack.getMaxAmount());
                 }
-                MinecraftClient.getInstance().getNetworkHandler().sendPacket(new CheatPacket(cheatedStack));
+                Core.cheatItems(cheatedStack);
                 return true;
             }
         } else {
@@ -158,18 +159,16 @@ public class REISlot extends Control {
     }
     
     protected List<String> getTooltip() {
+        final String modString = "§9§o" + getMod();
         MinecraftClient mc = MinecraftClient.getInstance();
         ContainerGui gui = REIRenderHelper.getOverlayedGui();
         List<String> toolTip = Lists.newArrayList();
-        if (gui != null) {
-            toolTip = gui.getStackTooltip(getStack());
-        } else {
+        if (gui != null)
+            toolTip = gui.getStackTooltip(getStack()).stream().filter(s -> !s.equals(modString)).collect(Collectors.toList());
+        else
             toolTip.add(getStack().getDisplayName().getFormattedText());
-        }
-        if (extraTooltip != null) {
+        if (extraTooltip != null)
             toolTip.add(extraTooltip);
-        }
-        
         return toolTip;
     }
     

+ 0 - 21
src/main/java/me/shedaniel/listenerdefinitions/PacketAdder.java

@@ -1,21 +0,0 @@
-package me.shedaniel.listenerdefinitions;
-
-import net.minecraft.network.NetworkSide;
-import net.minecraft.network.NetworkState;
-import net.minecraft.network.Packet;
-
-public interface PacketAdder extends IEvent {
-    
-    interface PacketRegistrationReceiver {
-        NetworkState registerPacket(NetworkSide direction, Class<? extends Packet<?>> packetClass);
-    }
-    
-    void registerHandshakingPackets(PacketRegistrationReceiver receiver);
-    
-    void registerPlayPackets(PacketRegistrationReceiver receiver);
-    
-    void registerStatusPackets(PacketRegistrationReceiver receiver);
-    
-    void registerLoginPackets(PacketRegistrationReceiver receiver);
-    
-}

+ 6 - 1
src/main/java/me/shedaniel/listeners/DrawContainerListener.java

@@ -12,7 +12,7 @@ import net.minecraft.item.ItemGroup;
 /**
  * Created by James on 7/27/2018.
  */
-public class DrawContainerListener implements DrawContainer, GuiCickListener, GuiKeyDown, CharInput, ClientTickable, MouseScrollListener {
+public class DrawContainerListener implements DrawContainer, GuiCickListener, GuiKeyDown, CharInput, ClientTickable, MouseScrollListener, MinecraftResize {
     
     @Override
     public void draw(int x, int y, float dunno, ContainerGui gui) {
@@ -58,4 +58,9 @@ public class DrawContainerListener implements DrawContainer, GuiCickListener, Gu
     public void clientTick() {
         REIRenderHelper.tick();
     }
+    
+    @Override
+    public void resize(int scaledWidth, int scaledHeight) {
+        REIRenderHelper.resize(scaledWidth, scaledHeight);
+    }
 }

+ 0 - 14
src/main/java/me/shedaniel/listeners/ResizeListener.java

@@ -1,14 +0,0 @@
-package me.shedaniel.listeners;
-
-import me.shedaniel.gui.REIRenderHelper;
-import me.shedaniel.listenerdefinitions.MinecraftResize;
-
-/**
- * Created by James on 7/28/2018.
- */
-public class ResizeListener implements MinecraftResize {
-    @Override
-    public void resize(int scaledWidth, int scaledHeight) {
-        REIRenderHelper.resize(scaledWidth, scaledHeight);
-    }
-}

+ 0 - 33
src/main/java/me/shedaniel/mixins/MixinMinecraftClient.java

@@ -1,33 +0,0 @@
-package me.shedaniel.mixins;
-
-import me.shedaniel.Core;
-import me.shedaniel.listenerdefinitions.ClientTickable;
-import me.shedaniel.listenerdefinitions.KeybindHandler;
-import net.minecraft.class_3689;
-import net.minecraft.client.MinecraftClient;
-import org.spongepowered.asm.mixin.Final;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(MinecraftClient.class)
-public class MixinMinecraftClient {
-    
-    @Shadow
-    @Final
-    private class_3689 profiler;
-    
-    @Inject(method = "tick", at = @At("RETURN"))
-    private void onTick(CallbackInfo ci) {
-        profiler.begin("mods");
-        for(ClientTickable tickable : Core.getListeners(ClientTickable.class)) {
-            profiler.begin(() -> tickable.getClass().getCanonicalName().replace('.', '/'));
-            tickable.clientTick();
-            profiler.end();
-        }
-        profiler.end();
-    }
-    
-}

+ 5 - 1
src/main/java/me/shedaniel/network/CheatPacket.java

@@ -5,6 +5,8 @@ import net.minecraft.nbt.CompoundTag;
 import net.minecraft.network.Packet;
 import net.minecraft.server.network.ServerPlayNetworkHandler;
 import net.minecraft.server.network.ServerPlayerEntity;
+import net.minecraft.sortme.ChatMessageType;
+import net.minecraft.text.TranslatableTextComponent;
 import net.minecraft.util.PacketByteBuf;
 
 import java.io.IOException;
@@ -39,7 +41,9 @@ public class CheatPacket implements Packet<ServerPlayNetworkHandler> {
     public void apply(ServerPlayNetworkHandler iNetHandlerPlayServer) {
         ServerPlayNetworkHandler server = (ServerPlayNetworkHandler) iNetHandlerPlayServer;
         ServerPlayerEntity player = server.player;
-        player.inventory.addPickBlock(stack);
+        if (player.inventory.insertStack(stack.copy()))
+            player.sendChatMessage(new TranslatableTextComponent("text.rei.cheat_items", stack.getDisplayName().getFormattedText(), stack.getAmount(), player.getEntityName()), ChatMessageType.SYSTEM);
+        else player.sendChatMessage(new TranslatableTextComponent("text.rei.failed_cheat_items"), ChatMessageType.SYSTEM);
     }
     
 }

+ 33 - 0
src/main/java/me/shedaniel/plugin/RandomRecipe.java

@@ -0,0 +1,33 @@
+package me.shedaniel.plugin;
+
+import me.shedaniel.api.IRecipe;
+import net.minecraft.block.Blocks;
+import net.minecraft.item.ItemStack;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+public class RandomRecipe implements IRecipe<ItemStack> {
+    
+    private String id;
+    
+    public RandomRecipe(String id) {
+        this.id = id;
+    }
+    
+    @Override
+    public String getId() {
+        return id;
+    }
+    
+    @Override
+    public List<ItemStack> getOutput() {
+        return new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.BEETROOTS.getItem())}));
+    }
+    
+    @Override
+    public List<List<ItemStack>> getInput() {
+        return new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(new ItemStack[]{new ItemStack(Blocks.OAK_LOG.getItem())}))));
+    }
+}

+ 69 - 0
src/main/java/me/shedaniel/plugin/TestRandomCategory.java

@@ -0,0 +1,69 @@
+package me.shedaniel.plugin;
+
+import me.shedaniel.api.IDisplayCategory;
+import me.shedaniel.gui.widget.Control;
+import me.shedaniel.gui.widget.REISlot;
+import net.minecraft.item.ItemStack;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+public class TestRandomCategory implements IDisplayCategory<RandomRecipe> {
+    
+    private String id;
+    private List<RandomRecipe> recipes;
+    private ItemStack item;
+    
+    public TestRandomCategory(String id, ItemStack item) {
+        this.id = id;
+        this.item = item;
+    }
+    
+    @Override
+    public String getId() {
+        return id;
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return id;
+    }
+    
+    @Override
+    public void addRecipe(RandomRecipe recipe) {
+        if (this.recipes == null)
+            this.recipes = new ArrayList<>();
+        this.recipes.add(recipe);
+    }
+    
+    @Override
+    public void resetRecipes() {
+        this.recipes = new ArrayList<>();
+    }
+    
+    @Override
+    public List<REISlot> setupDisplay(int number) {
+        return new LinkedList<>();
+    }
+    
+    @Override
+    public boolean canDisplay(RandomRecipe recipe) {
+        return false;
+    }
+    
+    @Override
+    public void drawExtras() {
+    
+    }
+    
+    @Override
+    public void addWidget(List<Control> controls, int number) {
+    
+    }
+    
+    @Override
+    public ItemStack getCategoryIcon() {
+        return item;
+    }
+}

+ 16 - 0
src/main/java/me/shedaniel/plugin/VanillaPlugin.java

@@ -30,6 +30,8 @@ import net.minecraft.recipe.smelting.SmeltingRecipe;
 import net.minecraft.recipe.smelting.SmokingRecipe;
 import net.minecraft.util.registry.Registry;
 
+import java.lang.reflect.Array;
+import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -46,7 +48,15 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
         List<VanillaBlastFurnaceRecipe> blastFurnaceRecipes = new LinkedList<>();
         REIRecipeManager.instance().addDisplayAdapter(new VanillaCraftingCategory());
         REIRecipeManager.instance().addDisplayAdapter(new VanillaFurnaceCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new VanillaSmokerCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new VanillaBlastFurnaceCategory());
         REIRecipeManager.instance().addDisplayAdapter(new VanillaPotionCategory());
+        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("a", new ItemStack(Items.ITEM_FRAME)));
+        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("b", new ItemStack(Items.ITEM_FRAME)));
+        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("c", new ItemStack(Items.ITEM_FRAME)));
+        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("d", new ItemStack(Items.ITEM_FRAME)));
+        REIRecipeManager.instance().addDisplayAdapter(new TestRandomCategory("e", new ItemStack(Items.ITEM_FRAME)));
+        
         
         for(Recipe recipe : REIRecipeManager.instance().recipeManager.values()) {
             if (recipe instanceof ShapelessRecipe) {
@@ -80,11 +90,17 @@ public class VanillaPlugin implements IREIPlugin, PotionCraftingAdder {
         REIRecipeManager.instance().addRecipe("smoker", smokerRecipes);
         REIRecipeManager.instance().addRecipe("potion", potionRecipes.stream().distinct().collect(Collectors.toList()));
         REIRecipeManager.instance().addRecipe("blastingfurnace", blastFurnaceRecipes);
+        REIRecipeManager.instance().addRecipe("a", Arrays.asList(new RandomRecipe("a")));
+        REIRecipeManager.instance().addRecipe("b", Arrays.asList(new RandomRecipe("b")));
+        REIRecipeManager.instance().addRecipe("c", Arrays.asList(new RandomRecipe("c")));
+        REIRecipeManager.instance().addRecipe("d", Arrays.asList(new RandomRecipe("d")));
+        REIRecipeManager.instance().addRecipe("e", Arrays.asList(new RandomRecipe("e")));
     }
     
     
     @Override
     public void addPotionRecipe(Potion inputType, Item reagent, Potion outputType) {
+        System.out.printf("%s%s%n", inputType.getName(""), outputType.getName(""));
         potionRecipes.add(new VanillaPotionRecipe(new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), inputType)},
                 Ingredient.ofItems(reagent).getStackArray(),
                 new ItemStack[]{PotionUtil.setPotion(new ItemStack(Items.POTION), outputType)}));

+ 1 - 1
src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceCategory.java

@@ -80,7 +80,7 @@ public class VanillaBlastFurnaceCategory implements IDisplayCategory<VanillaBlas
     }
     
     private List<ItemStack> getFuel() {
-        return BlastFurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
+        return BlastFurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
     }
     
     @Override

+ 1 - 1
src/main/java/me/shedaniel/plugin/blastfurnace/VanillaBlastFurnaceRecipe.java

@@ -41,7 +41,7 @@ public class VanillaBlastFurnaceRecipe implements IRecipe<ItemStack> {
             List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
             input.add(ingredients);
         }
-        input.add(BlastFurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        input.add(BlastFurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
         return input;
     }
 }

+ 1 - 1
src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceCategory.java

@@ -79,7 +79,7 @@ public class VanillaFurnaceCategory implements IDisplayCategory<VanillaFurnaceRe
     }
     
     private List<ItemStack> getFuel() {
-        return FurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
+        return FurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
     }
     
     @Override

+ 1 - 1
src/main/java/me/shedaniel/plugin/furnace/VanillaFurnaceRecipe.java

@@ -38,7 +38,7 @@ public class VanillaFurnaceRecipe implements IRecipe<ItemStack> {
             List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
             input.add(ingredients);
         }
-        input.add(FurnaceBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        input.add(FurnaceBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
         return input;
     }
 }

+ 1 - 1
src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerCategory.java

@@ -79,7 +79,7 @@ public class VanillaSmokerCategory implements IDisplayCategory<VanillaSmokerReci
     }
     
     private List<ItemStack> getFuel() {
-        return SmokerBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
+        return SmokerBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList());
     }
     
     @Override

+ 1 - 1
src/main/java/me/shedaniel/plugin/smoker/VanillaSmokerRecipe.java

@@ -38,7 +38,7 @@ public class VanillaSmokerRecipe implements IRecipe<ItemStack> {
             List<ItemStack> ingredients = Arrays.asList(ingredient.getStackArray());
             input.add(ingredients);
         }
-        input.add(SmokerBlockEntity.getBurnTimeMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
+        input.add(SmokerBlockEntity.createBurnableMap().keySet().stream().map(Item::getDefaultStack).collect(Collectors.toList()));
         return input;
     }
 }

+ 3 - 1
src/main/resources/assets/roughlyenoughitems/lang/en_us.json

@@ -18,5 +18,7 @@
   "text.rei.config": "Config",
   "text.rei.listeningkey": "Listening Key",
   "text.rei.centre_searchbox": "Center Search Box: %s%b",
-  "text.rei.centre_searchbox.tooltip": "Please restart Minecraft after editing\nthis config to apply the changes"
+  "text.rei.centre_searchbox.tooltip": "Please restart Minecraft after editing\nthis config to apply the changes",
+  "text.rei.cheat_items": "Given [%s] x%d to %s.",
+  "text.rei.failed_cheat_items": "§cFailed to give items."
 }

+ 2 - 2
src/main/resources/fabric.mod.json

@@ -2,7 +2,7 @@
   "id": "roughlyenoughitems",
   "name": "RoughlyEnoughItems",
   "description": "To allow players to view items and recipes.",
-  "version": "1.3",
+  "version": "1.4",
   "side": "client",
   "authors": [
     "Danielshe"
@@ -11,7 +11,7 @@
     "me.shedaniel.Core"
   ],
   "requires": {
-
+    "fabric": "*"
   },
   "mixins": {
     "client": "roughlyenoughitems.client.json"

+ 1 - 2
src/main/resources/roughlyenoughitems.client.json

@@ -9,8 +9,7 @@
     "MixinMinecraftResize",
     "MixinKeyboardListener",
     "MixinRecipeManager",
-    "MixinCreativePlayerInventoryGui",
-    "MixinMinecraftClient"
+    "MixinCreativePlayerInventoryGui"
   ],
   "injectors": {
     "defaultRequire": 1