aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2024-07-20 18:39:18 +0900
committershedaniel <daniel@shedaniel.me>2024-07-20 18:40:38 +0900
commit2d7389aa03f9a6bad7b5e7b81456acb5f9d358e9 (patch)
tree436e12342250e26296166479c33902cd8e1ff713 /src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java
parentdeb29135ec13b735f18695deb6ffccc49a74c9db (diff)
downloadRoughlyEnoughItems-4.x.tar.gz
RoughlyEnoughItems-4.x.tar.bz2
RoughlyEnoughItems-4.x.zip
Check slots before modification4.x
Diffstat (limited to 'src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java')
-rw-r--r--src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java b/src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java
index 46b4d7b8b..f0d0e361e 100644
--- a/src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java
+++ b/src/main/java/me/shedaniel/rei/server/SlotStackAccessor.java
@@ -23,6 +23,7 @@
package me.shedaniel.rei.server;
+import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
@@ -47,4 +48,14 @@ public class SlotStackAccessor implements StackAccessor {
public ItemStack takeStack(int amount) {
return slot.takeStack(amount);
}
+
+ @Override
+ public boolean allowModification(PlayerEntity player) {
+ return slot.canTakeItems(player);
+ }
+
+ @Override
+ public boolean canPlace(ItemStack stack) {
+ return slot.canInsert(stack);
+ }
}