aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-17 20:13:20 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-17 20:13:20 +0100
commit067c90d4362a57313a4e2d59f3639cba383433ed (patch)
treed4dc5b6eb86a93d2c13a22bbb56b56add58a0cce /src/main/kotlin/util
parent3954f51abcc2f3985be1550128c46f1ea26c3647 (diff)
downloadFirmament-067c90d4362a57313a4e2d59f3639cba383433ed.tar.gz
Firmament-067c90d4362a57313a4e2d59f3639cba383433ed.tar.bz2
Firmament-067c90d4362a57313a4e2d59f3639cba383433ed.zip
feat: Add item rarities into all storage overlay pages
Diffstat (limited to 'src/main/kotlin/util')
-rw-r--r--src/main/kotlin/util/mc/FakeInventory.kt41
-rw-r--r--src/main/kotlin/util/mc/FakeSlot.kt15
2 files changed, 56 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
+ }
+}
diff --git a/src/main/kotlin/util/mc/FakeSlot.kt b/src/main/kotlin/util/mc/FakeSlot.kt
new file mode 100644
index 0000000..a9be484
--- /dev/null
+++ b/src/main/kotlin/util/mc/FakeSlot.kt
@@ -0,0 +1,15 @@
+package moe.nea.firmament.util.mc
+
+import util.mc.FakeInventory
+import net.minecraft.item.ItemStack
+import net.minecraft.screen.slot.Slot
+
+class FakeSlot(
+ stack: ItemStack,
+ x: Int,
+ y: Int
+) : Slot(FakeInventory(stack), 0, x, y) {
+ init {
+ id = 0
+ }
+}