aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-runtime
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2024-07-20 18:39:18 +0900
committershedaniel <daniel@shedaniel.me>2024-07-22 18:52:22 +0900
commite6c8d55feaee1b3d6042e9a5283668d0ab29da53 (patch)
tree9d7ad8fb053b5ab5c96de21c33c9f34d59cc310a /RoughlyEnoughItems-runtime
parentcd45e2d3a28d44fb52dbdc0eb5b730ecf1ee1133 (diff)
downloadRoughlyEnoughItems-e6c8d55feaee1b3d6042e9a5283668d0ab29da53.tar.gz
RoughlyEnoughItems-e6c8d55feaee1b3d6042e9a5283668d0ab29da53.tar.bz2
RoughlyEnoughItems-e6c8d55feaee1b3d6042e9a5283668d0ab29da53.zip
Check slots before modification
Diffstat (limited to 'RoughlyEnoughItems-runtime')
-rw-r--r--RoughlyEnoughItems-runtime/build.gradle2
-rw-r--r--RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java15
2 files changed, 15 insertions, 2 deletions
diff --git a/RoughlyEnoughItems-runtime/build.gradle b/RoughlyEnoughItems-runtime/build.gradle
index 870d044d0..7e31ac1a0 100644
--- a/RoughlyEnoughItems-runtime/build.gradle
+++ b/RoughlyEnoughItems-runtime/build.gradle
@@ -9,6 +9,6 @@ loom {
}
dependencies {
- compile project(path: ':RoughlyEnoughItems-api', configuration: 'dev')
+ compileOnly project(path: ':RoughlyEnoughItems-api', configuration: 'dev')
modCompileOnly("alexiil.mc.lib:libblockattributes-fluids:0.8.3-pre.3")
} \ No newline at end of file
diff --git a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java
index 9e51a158d..c26068f1d 100644
--- a/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java
+++ b/RoughlyEnoughItems-runtime/src/main/java/me/shedaniel/rei/server/InputSlotCrafter.java
@@ -109,6 +109,10 @@ public class InputSlotCrafter<C extends Container> implements RecipeGridAligner<
}
takenStack.setCount(1);
+ if (!slot.canPlace(takenStack)) {
+ return;
+ }
+
if (slot.getItemStack().isEmpty()) {
slot.setItemStack(takenStack);
} else {
@@ -161,13 +165,22 @@ public class InputSlotCrafter<C extends Container> implements RecipeGridAligner<
}
public int method_7371(ItemStack itemStack) {
+ boolean rejectedModification = false;
for (int i = 0; i < inventoryStacks.size(); i++) {
ItemStack itemStack1 = this.inventoryStacks.get(i).getItemStack();
if (!itemStack1.isEmpty() && areItemsEqual(itemStack, itemStack1) && !itemStack1.isDamaged() && !itemStack1.isEnchanted() && !itemStack1.hasCustomHoverName()) {
- return i;
+ if (!this.inventoryStacks.get(i).allowModification(player)) {
+ rejectedModification = true;
+ } else {
+ return i;
+ }
}
}
+ if (rejectedModification) {
+ throw new IllegalStateException("Unable to take item from inventory due to slot not allowing modification! Item requested: " + itemStack);
+ }
+
return -1;
}