aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/rei
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-30 22:47:56 +0200
committernea <nea@nea.moe>2023-05-30 22:47:56 +0200
commit88cb9468b4432f68d1197f512f68c951fdbdf3dd (patch)
treefb9da150d4173cbe33d68b80c6d86240fe03c4e2 /src/main/kotlin/moe/nea/firmament/rei
parent3139306088f8d3cad1b4906c3bbd1b412b9bda6f (diff)
downloadFirmament-88cb9468b4432f68d1197f512f68c951fdbdf3dd.tar.gz
Firmament-88cb9468b4432f68d1197f512f68c951fdbdf3dd.tar.bz2
Firmament-88cb9468b4432f68d1197f512f68c951fdbdf3dd.zip
Forge recipes and coin items
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/rei')
-rw-r--r--src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt15
-rw-r--r--src/main/kotlin/moe/nea/firmament/rei/math.kt8
2 files changed, 17 insertions, 6 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
index 1e5ae4c..ee6b673 100644
--- a/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
+++ b/src/main/kotlin/moe/nea/firmament/rei/SBItemEntryDefinition.kt
@@ -33,6 +33,7 @@ import net.minecraft.registry.tag.TagKey
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry
+import moe.nea.firmament.repo.ItemCache
import moe.nea.firmament.repo.ItemCache.asItemStack
import moe.nea.firmament.repo.RepoManager
import moe.nea.firmament.util.SkyblockId
@@ -43,15 +44,17 @@ data class SBItemStack(
val skyblockId: SkyblockId,
val neuItem: NEUItem?,
val stackSize: Int,
-)
+) {
+ fun asItemStack(): ItemStack? {
+ if (skyblockId == SkyblockId.COINS)
+ return ItemCache.coinItem(stackSize)
+ return neuItem.asItemStack(idHint = skyblockId).copyWithCount(stackSize)
+ }
+}
object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
override fun equals(o1: SBItemStack, o2: SBItemStack, context: ComparisonContext): Boolean {
- if (!context.isFuzzy) {
- if (o1.stackSize != o2.stackSize)
- return false
- }
- return o1.skyblockId == o2.skyblockId
+ return o1.skyblockId == o2.skyblockId && o1.stackSize == o2.stackSize
}
override fun cheatsAs(entry: EntryStack<SBItemStack>?, value: SBItemStack): ItemStack {
diff --git a/src/main/kotlin/moe/nea/firmament/rei/math.kt b/src/main/kotlin/moe/nea/firmament/rei/math.kt
new file mode 100644
index 0000000..e3504a1
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/rei/math.kt
@@ -0,0 +1,8 @@
+package moe.nea.firmament.rei
+
+import me.shedaniel.math.Point
+
+operator fun Point.plus(other: Point): Point = Point(
+ this.x + other.x,
+ this.y + other.y,
+)