diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-28 12:07:55 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-28 12:07:55 +0100 |
commit | c38dcee2c5f483ef5990ae9204355e1bc3c2bf74 (patch) | |
tree | 3b70359076001e14514c496e3c44980fdbd92d01 /src/main/kotlin/features/inventory/CraftingOverlay.kt | |
parent | 8ab44088546bf3360564e1a09f0831fea7659d2e (diff) | |
download | firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.gz firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.bz2 firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.zip |
Make REI optional
Diffstat (limited to 'src/main/kotlin/features/inventory/CraftingOverlay.kt')
-rw-r--r-- | src/main/kotlin/features/inventory/CraftingOverlay.kt | 20 |
1 files changed, 11 insertions, 9 deletions
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, |