aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-17 18:10:11 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-17 18:10:11 +0100
commit11eed13b8113a00c1e6bfa27cd6c7fdee3a74e14 (patch)
tree955dbc2636aeb0eeff9ccceb6df1ea58a9a0867e /src
parent74a043e53540c120ebe58b0199f57bfa36d30e47 (diff)
downloadFirmament-11eed13b8113a00c1e6bfa27cd6c7fdee3a74e14.tar.gz
Firmament-11eed13b8113a00c1e6bfa27cd6c7fdee3a74e14.tar.bz2
Firmament-11eed13b8113a00c1e6bfa27cd6c7fdee3a74e14.zip
feat: Keep old reforges in reforge recipes
Diffstat (limited to 'src')
-rw-r--r--src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt14
-rw-r--r--src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt3
-rw-r--r--src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBReforgeRecipe.kt41
3 files changed, 24 insertions, 34 deletions
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt
index 9638281..2b1700d 100644
--- a/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt
+++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt
@@ -15,12 +15,9 @@ import net.minecraft.registry.tag.TagKey
import net.minecraft.text.Text
import net.minecraft.util.Identifier
import moe.nea.firmament.compat.rei.FirmamentReiPlugin.Companion.asItemEntry
-import moe.nea.firmament.repo.PetData
import moe.nea.firmament.repo.RepoManager
import moe.nea.firmament.repo.SBItemStack
import moe.nea.firmament.util.SkyblockId
-import moe.nea.firmament.util.petData
-import moe.nea.firmament.util.skyBlockId
object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
override fun equals(o1: SBItemStack, o2: SBItemStack, context: ComparisonContext): Boolean {
@@ -55,7 +52,7 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
override fun wildcard(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack {
return value.copy(stackSize = 1, petData = RepoManager.getPotentialStubPetData(value.skyblockId),
- stars = 0, extraLore = listOf())
+ stars = 0, extraLore = listOf(), reforge = null)
}
override fun normalize(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack {
@@ -86,12 +83,5 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> {
fun getPassthrough(item: ItemConvertible) = getEntry(SBItemStack.passthrough(ItemStack(item.asItem())))
fun getEntry(stack: ItemStack): EntryStack<SBItemStack> =
- getEntry(
- SBItemStack(
- stack.skyBlockId ?: SkyblockId.NULL,
- RepoManager.getNEUItem(stack.skyBlockId ?: SkyblockId.NULL),
- stack.count,
- petData = stack.petData?.let { PetData.fromHypixel(it) }
- )
- )
+ getEntry(SBItemStack(stack))
}
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt
index cfb6f74..518f7b4 100644
--- a/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt
+++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt
@@ -17,8 +17,7 @@ object SkyblockItemIdFocusedStackProvider : FocusedStackProvider {
screen as AccessorHandledScreen
val focusedSlot = screen.focusedSlot_Firmament ?: return CompoundEventResult.pass()
val item = focusedSlot.stack ?: return CompoundEventResult.pass()
- val skyblockId = item.skyBlockId ?: return CompoundEventResult.pass()
- return CompoundEventResult.interruptTrue(SBItemEntryDefinition.getEntry(skyblockId))
+ return CompoundEventResult.interruptTrue(SBItemEntryDefinition.getEntry(item))
}
override fun getPriority(): Double = 1_000_000.0
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBReforgeRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBReforgeRecipe.kt
index 4d00a4f..b8313a6 100644
--- a/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBReforgeRecipe.kt
+++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBReforgeRecipe.kt
@@ -44,7 +44,7 @@ import moe.nea.firmament.util.tr
class SBReforgeRecipe(
val reforge: Reforge,
- val limitToItem: SkyblockId?,
+ val limitToItem: SBItemStack?,
) : Display {
companion object {
val catIdentifier = CategoryIdentifier.of<SBReforgeRecipe>(Firmament.MOD_ID, "reforge_recipe")
@@ -132,10 +132,10 @@ class SBReforgeRecipe(
fun getRecipesForSBItemStack(item: SBItemStack): Optional<List<SBReforgeRecipe>> {
val reforgeRecipes = mutableListOf<SBReforgeRecipe>()
for (reforge in ReforgeStore.findEligibleForInternalName(item.skyblockId)) {
- reforgeRecipes.add(SBReforgeRecipe(reforge, item.skyblockId))
+ reforgeRecipes.add(SBReforgeRecipe(reforge, item))
}
for (reforge in ReforgeStore.findEligibleForItem(item.itemType ?: ItemType.NIL)) {
- reforgeRecipes.add(SBReforgeRecipe(reforge, item.skyblockId))
+ reforgeRecipes.add(SBReforgeRecipe(reforge, item))
}
if (reforgeRecipes.isEmpty()) return Optional.empty()
return Optional.of(reforgeRecipes)
@@ -162,26 +162,27 @@ class SBReforgeRecipe(
}
}
- private val eligibleItems =
- if (limitToItem != null) listOfNotNull(RepoManager.getNEUItem(limitToItem))
- else reforge.eligibleItems.flatMap {
+ private val inputItems = run {
+ if (limitToItem != null) return@run listOf(SBItemEntryDefinition.getEntry(limitToItem))
+ val eligibleItems = reforge.eligibleItems.flatMap {
when (it) {
- is Reforge.ReforgeEligibilityFilter.AllowsInternalName ->
- listOfNotNull(RepoManager.getNEUItem(it.internalName))
-
- is Reforge.ReforgeEligibilityFilter.AllowsItemType ->
- ReforgeStore.resolveItemType(it.itemType)
- .flatMapTo(mutableSetOf()) {
- (RepoItemTypeCache.byItemType[it] ?: listOf()) +
- (RepoItemTypeCache.byItemType[it.dungeonVariant] ?: listOf())
- }.toList()
-
- is Reforge.ReforgeEligibilityFilter.AllowsVanillaItemType -> {
- listOf() // TODO: add filter support for this and potentially rework this to search for the declared item type in repo, instead of remapped item type
+ is Reforge.ReforgeEligibilityFilter.AllowsInternalName ->
+ listOfNotNull(RepoManager.getNEUItem(it.internalName))
+
+ is Reforge.ReforgeEligibilityFilter.AllowsItemType ->
+ ReforgeStore.resolveItemType(it.itemType)
+ .flatMapTo(mutableSetOf()) {
+ (RepoItemTypeCache.byItemType[it] ?: listOf()) +
+ (RepoItemTypeCache.byItemType[it.dungeonVariant] ?: listOf())
+ }.toList()
+
+ is Reforge.ReforgeEligibilityFilter.AllowsVanillaItemType -> {
+ listOf() // TODO: add filter support for this and potentially rework this to search for the declared item type in repo, instead of remapped item type
+ }
}
- }
}
- private val inputItems = eligibleItems.map { SBItemEntryDefinition.getEntry(it.skyblockId) }
+ eligibleItems.map { SBItemEntryDefinition.getEntry(it.skyblockId) }
+ }
private val outputItems =
inputItems.map { SBItemEntryDefinition.getEntry(it.value.copy(reforge = reforge.reforgeId)) }
private val reforgeStone = reforge.reforgeStone?.let(SBItemEntryDefinition::getEntry)