aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/mc/FakeInventory.kt
blob: 26c04bc64ab1170be19b3ca3e6ecf489f888a659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
	}
}