aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/mc/FakeInventory.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/mc/FakeInventory.kt')
-rw-r--r--src/main/kotlin/util/mc/FakeInventory.kt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/kotlin/util/mc/FakeInventory.kt b/src/main/kotlin/util/mc/FakeInventory.kt
new file mode 100644
index 0000000..26c04bc
--- /dev/null
+++ b/src/main/kotlin/util/mc/FakeInventory.kt
@@ -0,0 +1,41 @@
+package util.mc
+
+import net.minecraft.entity.player.PlayerEntity
+import net.minecraft.inventory.Inventory
+import net.minecraft.item.ItemStack
+
+class FakeInventory(val stack: ItemStack) : Inventory {
+ override fun clear() {
+ }
+
+ override fun size(): Int {
+ return 1
+ }
+
+ override fun isEmpty(): Boolean {
+ return stack.isEmpty
+ }
+
+ override fun getStack(slot: Int): ItemStack {
+ require(slot == 0)
+ return stack
+ }
+
+ override fun removeStack(slot: Int, amount: Int): ItemStack {
+ return ItemStack.EMPTY
+ }
+
+ override fun removeStack(slot: Int): ItemStack {
+ return ItemStack.EMPTY
+ }
+
+ override fun setStack(slot: Int, stack: ItemStack?) {
+ }
+
+ override fun markDirty() {
+ }
+
+ override fun canPlayerUse(player: PlayerEntity?): Boolean {
+ return true
+ }
+}