Browse Source

Fix not being able to move items to grid in survival.

Signed-off-by: shedaniel <daniel@shedaniel.me>
shedaniel 4 years ago
parent
commit
7801f75814

+ 19 - 20
RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java

@@ -59,30 +59,29 @@ public class InputSlotCrafter<C extends Inventory> implements RecipeGridAligner<
         this.player = player;
         this.player = player;
         this.inventoryStacks = this.containerInfo.getInventoryStacks(this);
         this.inventoryStacks = this.containerInfo.getInventoryStacks(this);
         this.gridStacks = this.containerInfo.getGridStacks(this);
         this.gridStacks = this.containerInfo.getGridStacks(this);
-        if (player.isCreative()) {
-            player.skipPacketSlotUpdates = true;
-            // Return the already placed items on the grid
+        
+        player.skipPacketSlotUpdates = true;
+        // Return the already placed items on the grid
+        this.returnInputs();
+        
+        RecipeFinder recipeFinder = new RecipeFinder();
+        this.containerInfo.getRecipeFinderPopulator().populate(this).accept(recipeFinder);
+        DefaultedList<Ingredient> ingredients = DefaultedList.of();
+        map.entrySet().stream().sorted(Comparator.comparingInt(Map.Entry::getKey)).forEach(entry -> {
+            ingredients.add(Ingredient.ofItems(entry.getValue().stream().map(ItemStack::getItem).toArray(Item[]::new)));
+        });
+        
+        if (recipeFinder.findRecipe(ingredients, null)) {
+            this.fillInputSlots(recipeFinder, ingredients, hasShift);
+        } else {
             this.returnInputs();
             this.returnInputs();
-            
-            RecipeFinder recipeFinder = new RecipeFinder();
-            this.containerInfo.getRecipeFinderPopulator().populate(this).accept(recipeFinder);
-            DefaultedList<Ingredient> ingredients = DefaultedList.of();
-            map.entrySet().stream().sorted(Comparator.comparingInt(Map.Entry::getKey)).forEach(entry -> {
-                ingredients.add(Ingredient.ofItems(entry.getValue().stream().map(ItemStack::getItem).toArray(Item[]::new)));
-            });
-            
-            if (recipeFinder.findRecipe(ingredients, null)) {
-                this.fillInputSlots(recipeFinder, ingredients, hasShift);
-            } else {
-                this.returnInputs();
-                player.skipPacketSlotUpdates = false;
-                this.containerInfo.markDirty(this);
-                throw new NotEnoughMaterialsException();
-            }
-            
             player.skipPacketSlotUpdates = false;
             player.skipPacketSlotUpdates = false;
             this.containerInfo.markDirty(this);
             this.containerInfo.markDirty(this);
+            throw new NotEnoughMaterialsException();
         }
         }
+        
+        player.skipPacketSlotUpdates = false;
+        this.containerInfo.markDirty(this);
     }
     }
     
     
     @Override
     @Override

+ 1 - 1
gradle.properties

@@ -1,5 +1,5 @@
 org.gradle.jvmargs=-Xmx3G
 org.gradle.jvmargs=-Xmx3G
-mod_version=5.2.4
+mod_version=5.2.5
 supported_version=1.16.2
 supported_version=1.16.2
 minecraft_version=1.16.2-rc1
 minecraft_version=1.16.2-rc1
 yarn_version=1.16.2-rc1+build.4+legacy.20w09a+build.8
 yarn_version=1.16.2-rc1+build.4+legacy.20w09a+build.8