aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-28 12:07:55 +0100
committerLinnea Gräf <nea@nea.moe>2024-10-28 12:07:55 +0100
commitc38dcee2c5f483ef5990ae9204355e1bc3c2bf74 (patch)
tree3b70359076001e14514c496e3c44980fdbd92d01 /src/main/kotlin/features
parent8ab44088546bf3360564e1a09f0831fea7659d2e (diff)
downloadFirmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.gz
Firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.bz2
Firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.zip
Make REI optional
Diffstat (limited to 'src/main/kotlin/features')
-rw-r--r--src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt8
-rw-r--r--src/main/kotlin/features/inventory/CraftingOverlay.kt20
2 files changed, 15 insertions, 13 deletions
diff --git a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
index 825cd6c..5151862 100644
--- a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
+++ b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt
@@ -15,8 +15,8 @@ import moe.nea.firmament.events.WorldReadyEvent
import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.gui.hud.MoulConfigHud
-import moe.nea.firmament.rei.SBItemEntryDefinition
import moe.nea.firmament.repo.ItemNameLookup
+import moe.nea.firmament.repo.SBItemStack
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.SHORT_NUMBER_FORMAT
import moe.nea.firmament.util.SkyblockId
@@ -197,9 +197,9 @@ object AnniversaryFeatures : FirmamentFeature {
}
val itemStack = if (backedBy is Reward.Items) {
- SBItemEntryDefinition.getEntry(backedBy.item, backedBy.amount)
+ SBItemStack(backedBy.item, backedBy.amount)
} else {
- SBItemEntryDefinition.getEntry(SkyblockId.NULL)
+ SBItemStack(SkyblockId.NULL)
}
@Bind
@@ -207,7 +207,7 @@ object AnniversaryFeatures : FirmamentFeature {
return when (backedBy) {
is Reward.Coins -> "Coins"
is Reward.EXP -> backedBy.skill
- is Reward.Items -> itemStack.value.asItemStack().name.string
+ is Reward.Items -> itemStack.asImmutableItemStack().name.string
is Reward.Unknown -> backedBy.text
}
}
diff --git a/src/main/kotlin/features/inventory/CraftingOverlay.kt b/src/main/kotlin/features/inventory/CraftingOverlay.kt
index 8e75478..a958e25 100644
--- a/src/main/kotlin/features/inventory/CraftingOverlay.kt
+++ b/src/main/kotlin/features/inventory/CraftingOverlay.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.features.inventory
+import io.github.moulberry.repo.data.NEUCraftingRecipe
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen
import net.minecraft.item.ItemStack
import net.minecraft.util.Formatting
@@ -7,15 +8,14 @@ import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.ScreenChangeEvent
import moe.nea.firmament.events.SlotRenderEvents
import moe.nea.firmament.features.FirmamentFeature
-import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry
-import moe.nea.firmament.rei.SBItemEntryDefinition
-import moe.nea.firmament.rei.recipes.SBCraftingRecipe
+import moe.nea.firmament.repo.SBItemStack
import moe.nea.firmament.util.MC
+import moe.nea.firmament.util.skyblockId
object CraftingOverlay : FirmamentFeature {
private var screen: GenericContainerScreen? = null
- private var recipe: SBCraftingRecipe? = null
+ private var recipe: NEUCraftingRecipe? = null
private var useNextScreen = false
private val craftingOverlayIndices = listOf(
10, 11, 12,
@@ -24,7 +24,7 @@ object CraftingOverlay : FirmamentFeature {
)
val CRAFTING_SCREEN_NAME = "Craft Item"
- fun setOverlay(screen: GenericContainerScreen?, recipe: SBCraftingRecipe) {
+ fun setOverlay(screen: GenericContainerScreen?, recipe: NEUCraftingRecipe) {
this.screen = screen
if (screen == null) {
useNextScreen = true
@@ -52,10 +52,12 @@ object CraftingOverlay : FirmamentFeature {
if (slot.inventory != screen?.screenHandler?.inventory) return
val recipeIndex = craftingOverlayIndices.indexOf(slot.index)
if (recipeIndex < 0) return
- val expectedItem = recipe.neuRecipe.inputs[recipeIndex]
+ val expectedItem = recipe.inputs[recipeIndex]
val actualStack = slot.stack ?: ItemStack.EMPTY!!
- val actualEntry = SBItemEntryDefinition.getEntry(actualStack).value
- if ((actualEntry.skyblockId.neuItem != expectedItem.itemId || actualEntry.getStackSize() < expectedItem.amount) && expectedItem.amount.toInt() != 0) {
+ val actualEntry = SBItemStack(actualStack)
+ if ((actualEntry.skyblockId != expectedItem.skyblockId || actualEntry.getStackSize() < expectedItem.amount)
+ && expectedItem.amount.toInt() != 0
+ ) {
event.context.fill(
event.slot.x,
event.slot.y,
@@ -65,7 +67,7 @@ object CraftingOverlay : FirmamentFeature {
)
}
if (!slot.hasStack()) {
- val itemStack = SBItemEntryDefinition.getEntry(expectedItem).asItemEntry().value
+ val itemStack = SBItemStack(expectedItem)?.asImmutableItemStack() ?: return
event.context.drawItem(itemStack, event.slot.x, event.slot.y)
event.context.drawItemInSlot(
MC.font,