diff options
28 files changed, 451 insertions, 374 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 244b01d..4bcffe8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -185,6 +185,7 @@ val yaclSourceSet = createIsolatedSourceSet("yacl") val explosiveEnhancementSourceSet = createIsolatedSourceSet("explosiveEnhancement") val wildfireGenderSourceSet = createIsolatedSourceSet("wildfireGender") val modmenuSourceSet = createIsolatedSourceSet("modmenu") +val reiSourceSet = createIsolatedSourceSet("rei") dependencies { // Minecraft dependencies @@ -199,6 +200,8 @@ dependencies { modImplementation(libs.fabric.kotlin) modImplementation(libs.moulconfig) modImplementation(libs.manninghamMills) + modImplementation(libs.basicMath) + include(libs.basicMath) (modmenuSourceSet.modImplementationConfigurationName)(libs.modmenu) (explosiveEnhancementSourceSet.modImplementationConfigurationName)(libs.explosiveenhancement) modImplementation(libs.hypixelmodapi) @@ -234,13 +237,14 @@ dependencies { (yaclSourceSet.modImplementationConfigurationName)(libs.yacl) // Actual dependencies - modCompileOnly(libs.rei.api) { + (reiSourceSet.modImplementationConfigurationName)(libs.rei.api) { exclude(module = "architectury") exclude(module = "architectury-fabric") } nonModImplentation(libs.repoparser) shadowMe(libs.repoparser) fun ktor(mod: String) = "io.ktor:ktor-$mod-jvm:${libs.versions.ktor.get()}" + // TODO: get rid of ktor. lowkey ballooning file size and like not neccessary at all for what i am doing.0 transInclude(nonModImplentation(ktor("client-core"))!!) transInclude(nonModImplentation(ktor("client-java"))!!) transInclude(nonModImplentation(ktor("serialization-kotlinx-json"))!!) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index efb7c94..62a7a13 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -79,6 +79,9 @@ manninghamMills = "2.4.1" # Update from https://docs.isxander.dev/yet-another-config-lib/installing-yacl yacl = "3.5.0+1.21-fabric" +# Update from https://maven.shedaniel.me/me/shedaniel/cloth/basic-math/0.6.1/ +basicMath = "0.6.1" + [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } @@ -113,6 +116,7 @@ freecammod = { module = "maven.modrinth:freecam", version.ref = "freecammod" } citresewn = { module = "maven.modrinth:cit-resewn", version.ref = "citresewn" } femalegender = { module = "maven.modrinth:female-gender", version.ref = "femalegender" } yacl = { module = "dev.isxander:yet-another-config-lib", version.ref = "yacl" } +basicMath = { module = "me.shedaniel.cloth:basic-math", version.ref = "basicMath" } [bundles] runtime_required = [ diff --git a/src/main/kotlin/gui/entity/EntityWidget.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/EntityWidget.kt index 2e49072..9b7b190 100644 --- a/src/main/kotlin/gui/entity/EntityWidget.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/EntityWidget.kt @@ -1,10 +1,10 @@ - -package moe.nea.firmament.gui.entity +package moe.nea.firmament.compat.rei import me.shedaniel.math.Dimension import me.shedaniel.math.Point import me.shedaniel.math.Rectangle import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds +import moe.nea.firmament.gui.entity.EntityRenderer import net.minecraft.client.gui.DrawContext import net.minecraft.client.gui.Element import net.minecraft.entity.LivingEntity @@ -19,7 +19,7 @@ class EntityWidget(val entity: LivingEntity, val point: Point) : WidgetWithBound override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { try { if (!hasErrored) - EntityRenderer.renderEntity(entity, context, point.x, point.y, mouseX.toFloat(), mouseY.toFloat()) + EntityRenderer.renderEntity(entity, context, point.x, point.y, mouseX.toFloat(), mouseY.toFloat()) } catch (ex: Exception) { EntityRenderer.logger.error("Failed to render constructed entity: $entity", ex) hasErrored = true diff --git a/src/main/kotlin/rei/FirmamentReiPlugin.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt index f234f3e..d95d2d1 100644 --- a/src/main/kotlin/rei/FirmamentReiPlugin.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt @@ -1,4 +1,4 @@ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import me.shedaniel.rei.api.client.plugins.REIClientPlugin import me.shedaniel.rei.api.client.registry.category.CategoryRegistry @@ -23,12 +23,13 @@ import net.minecraft.util.Identifier import moe.nea.firmament.events.HandledScreenPushREIEvent import moe.nea.firmament.features.inventory.CraftingOverlay import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlayScreen -import moe.nea.firmament.rei.recipes.SBCraftingRecipe -import moe.nea.firmament.rei.recipes.SBEssenceUpgradeRecipe -import moe.nea.firmament.rei.recipes.SBForgeRecipe -import moe.nea.firmament.rei.recipes.SBKatRecipe -import moe.nea.firmament.rei.recipes.SBMobDropRecipe +import moe.nea.firmament.compat.rei.recipes.SBCraftingRecipe +import moe.nea.firmament.compat.rei.recipes.SBEssenceUpgradeRecipe +import moe.nea.firmament.compat.rei.recipes.SBForgeRecipe +import moe.nea.firmament.compat.rei.recipes.SBKatRecipe +import moe.nea.firmament.compat.rei.recipes.SBMobDropRecipe import moe.nea.firmament.repo.RepoManager +import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.MC import moe.nea.firmament.util.ScreenUtil import moe.nea.firmament.util.SkyblockId @@ -63,7 +64,7 @@ class FirmamentReiPlugin : REIClientPlugin { MC.sendCommand("craft") shouldReturn = false } - CraftingOverlay.setOverlay(screen as? GenericContainerScreen, display) + CraftingOverlay.setOverlay(screen as? GenericContainerScreen, display.neuRecipe) } if (context.isActuallyCrafting && useSuperCraft) { shouldReturn = false diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/HoveredItemStackProvider.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/HoveredItemStackProvider.kt new file mode 100644 index 0000000..3d21b66 --- /dev/null +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/HoveredItemStackProvider.kt @@ -0,0 +1,37 @@ +package moe.nea.firmament.compat.rei + +import com.google.auto.service.AutoService +import me.shedaniel.math.impl.PointHelper +import me.shedaniel.rei.api.client.REIRuntime +import me.shedaniel.rei.api.client.gui.widgets.Slot +import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry +import net.minecraft.client.gui.Element +import net.minecraft.client.gui.ParentElement +import net.minecraft.client.gui.screen.ingame.HandledScreen +import net.minecraft.item.ItemStack +import moe.nea.firmament.util.HoveredItemStackProvider +import moe.nea.firmament.util.compatloader.CompatLoader + +@AutoService(HoveredItemStackProvider::class) +@CompatLoader.RequireMod("roughlyenoughitems") +class ScreenRegistryHoveredItemStackProvider : HoveredItemStackProvider { + override fun provideHoveredItemStack(screen: HandledScreen<*>): ItemStack? { + val entryStack = ScreenRegistry.getInstance().getFocusedStack(screen, PointHelper.ofMouse()) + ?: return null + return entryStack.value as? ItemStack ?: entryStack.cheatsAs().value + } +} +@AutoService(HoveredItemStackProvider::class) +@CompatLoader.RequireMod("roughlyenoughitems") +class OverlayHoveredItemStackProvider : HoveredItemStackProvider { + override fun provideHoveredItemStack(screen: HandledScreen<*>): ItemStack? { + var baseElement: Element? = REIRuntime.getInstance().overlay.orElse(null) + val mx = PointHelper.getMouseFloatingX() + val my = PointHelper.getMouseFloatingY() + while (true) { + if (baseElement is Slot) return baseElement.currentEntry.cheatsAs().value + if (baseElement !is ParentElement) return null + baseElement = baseElement.hoveredElement(mx, my).orElse(null) + } + } +} diff --git a/src/main/kotlin/rei/NEUItemEntryRenderer.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt index ba99b30..a02742b 100644 --- a/src/main/kotlin/rei/NEUItemEntryRenderer.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt @@ -7,7 +7,7 @@ * SPDX-License-Identifier: MIT */ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import com.mojang.blaze3d.platform.GlStateManager.DstFactor import com.mojang.blaze3d.platform.GlStateManager.SrcFactor @@ -30,7 +30,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture import net.minecraft.item.Item import net.minecraft.item.ItemStack import net.minecraft.item.tooltip.TooltipType -import moe.nea.firmament.rei.FirmamentReiPlugin.Companion.asItemEntry +import moe.nea.firmament.compat.rei.FirmamentReiPlugin.Companion.asItemEntry +import moe.nea.firmament.repo.SBItemStack object NEUItemEntryRenderer : EntryRenderer<SBItemStack>, BatchedEntryRenderer<SBItemStack, BakedModel> { override fun render( diff --git a/src/main/kotlin/rei/NEUItemEntrySerializer.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntrySerializer.kt index a35d75f..6a03a48 100644 --- a/src/main/kotlin/rei/NEUItemEntrySerializer.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntrySerializer.kt @@ -1,10 +1,11 @@ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import me.shedaniel.rei.api.common.entry.EntrySerializer import me.shedaniel.rei.api.common.entry.EntryStack import net.minecraft.nbt.NbtCompound +import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.SkyblockId object NEUItemEntrySerializer : EntrySerializer<SBItemStack> { 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 new file mode 100644 index 0000000..a242c1b --- /dev/null +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt @@ -0,0 +1,94 @@ +package moe.nea.firmament.compat.rei + +import io.github.moulberry.repo.data.NEUIngredient +import java.util.stream.Stream +import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer +import me.shedaniel.rei.api.common.entry.EntrySerializer +import me.shedaniel.rei.api.common.entry.EntryStack +import me.shedaniel.rei.api.common.entry.comparison.ComparisonContext +import me.shedaniel.rei.api.common.entry.type.EntryDefinition +import me.shedaniel.rei.api.common.entry.type.EntryType +import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes +import net.minecraft.item.ItemStack +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 { + return o1.skyblockId == o2.skyblockId && o1.getStackSize() == o2.getStackSize() + } + + override fun cheatsAs(entry: EntryStack<SBItemStack>?, value: SBItemStack): ItemStack { + return value.asCopiedItemStack() + } + + override fun getValueType(): Class<SBItemStack> = SBItemStack::class.java + override fun getType(): EntryType<SBItemStack> = EntryType.deferred(FirmamentReiPlugin.SKYBLOCK_ITEM_TYPE_ID) + + override fun getRenderer(): EntryRenderer<SBItemStack> = NEUItemEntryRenderer + + override fun getSerializer(): EntrySerializer<SBItemStack> { + return NEUItemEntrySerializer + } + + override fun getTagsFor(entry: EntryStack<SBItemStack>?, value: SBItemStack?): Stream<out TagKey<*>>? { + return Stream.empty() + } + + override fun asFormattedText(entry: EntryStack<SBItemStack>, value: SBItemStack): Text { + return VanillaEntryTypes.ITEM.definition.asFormattedText(entry.asItemEntry(), value.asImmutableItemStack()) + } + + override fun hash(entry: EntryStack<SBItemStack>, value: SBItemStack, context: ComparisonContext): Long { + // Repo items are immutable, and get replaced entirely when loaded from disk + return value.skyblockId.hashCode() * 31L + } + + override fun wildcard(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack { + return value.copy(stackSize = 1, petData = RepoManager.getPotentialStubPetData(value.skyblockId), + stars = 0, extraLore = listOf()) + } + + override fun normalize(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack { + return wildcard(entry, value) + } + + override fun copy(entry: EntryStack<SBItemStack>?, value: SBItemStack): SBItemStack { + return value + } + + override fun isEmpty(entry: EntryStack<SBItemStack>?, value: SBItemStack): Boolean { + return value.getStackSize() == 0 + } + + override fun getIdentifier(entry: EntryStack<SBItemStack>?, value: SBItemStack): Identifier { + return value.skyblockId.identifier + } + + fun getEntry(sbItemStack: SBItemStack): EntryStack<SBItemStack> = + EntryStack.of(this, sbItemStack) + + fun getEntry(skyblockId: SkyblockId, count: Int = 1): EntryStack<SBItemStack> = + getEntry(SBItemStack(skyblockId, count)) + + fun getEntry(ingredient: NEUIngredient): EntryStack<SBItemStack> = + getEntry(SkyblockId(ingredient.itemId), count = ingredient.amount.toInt()) + + 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) } + ) + ) +} diff --git a/src/main/kotlin/rei/SkyblockCraftingRecipeDynamicGenerator.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockCraftingRecipeDynamicGenerator.kt index 5136902..f52f418 100644 --- a/src/main/kotlin/rei/SkyblockCraftingRecipeDynamicGenerator.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockCraftingRecipeDynamicGenerator.kt @@ -1,6 +1,6 @@ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import io.github.moulberry.repo.data.NEUCraftingRecipe import io.github.moulberry.repo.data.NEUForgeRecipe @@ -12,13 +12,14 @@ import me.shedaniel.rei.api.client.registry.display.DynamicDisplayGenerator import me.shedaniel.rei.api.client.view.ViewSearchBuilder import me.shedaniel.rei.api.common.display.Display import me.shedaniel.rei.api.common.entry.EntryStack -import moe.nea.firmament.rei.recipes.SBCraftingRecipe -import moe.nea.firmament.rei.recipes.SBEssenceUpgradeRecipe -import moe.nea.firmament.rei.recipes.SBForgeRecipe -import moe.nea.firmament.rei.recipes.SBKatRecipe -import moe.nea.firmament.rei.recipes.SBMobDropRecipe +import moe.nea.firmament.compat.rei.recipes.SBCraftingRecipe +import moe.nea.firmament.compat.rei.recipes.SBEssenceUpgradeRecipe +import moe.nea.firmament.compat.rei.recipes.SBForgeRecipe +import moe.nea.firmament.compat.rei.recipes.SBKatRecipe +import moe.nea.firmament.compat.rei.recipes.SBMobDropRecipe import moe.nea.firmament.repo.EssenceRecipeProvider import moe.nea.firmament.repo.RepoManager +import moe.nea.firmament.repo.SBItemStack val SkyblockCraftingRecipeDynamicGenerator = diff --git a/src/main/kotlin/rei/SkyblockItemIdFocusedStackProvider.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt index bb0a5a5..cfb6f74 100644 --- a/src/main/kotlin/rei/SkyblockItemIdFocusedStackProvider.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SkyblockItemIdFocusedStackProvider.kt @@ -1,6 +1,6 @@ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import dev.architectury.event.CompoundEventResult import me.shedaniel.math.Point diff --git a/src/main/kotlin/rei/math.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/math.kt index 1318beb..7db36f2 100644 --- a/src/main/kotlin/rei/math.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/math.kt @@ -1,6 +1,6 @@ -package moe.nea.firmament.rei +package moe.nea.firmament.compat.rei import me.shedaniel.math.Point diff --git a/src/main/kotlin/rei/recipes/SBCraftingRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBCraftingRecipe.kt index d6bbf0c..ed18c6e 100644 --- a/src/main/kotlin/rei/recipes/SBCraftingRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBCraftingRecipe.kt @@ -1,6 +1,6 @@ -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import io.github.moulberry.repo.data.NEUCraftingRecipe import io.github.moulberry.repo.data.NEUIngredient @@ -15,7 +15,7 @@ import me.shedaniel.rei.api.common.util.EntryStacks import net.minecraft.block.Blocks import net.minecraft.text.Text import moe.nea.firmament.Firmament -import moe.nea.firmament.rei.SBItemEntryDefinition +import moe.nea.firmament.compat.rei.SBItemEntryDefinition class SBCraftingRecipe(override val neuRecipe: NEUCraftingRecipe) : SBRecipe() { override fun getCategoryIdentifier(): CategoryIdentifier<*> = Category.catIdentifier diff --git a/src/main/kotlin/rei/recipes/SBEssenceUpgradeRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBEssenceUpgradeRecipe.kt index 80bc2b7..f81d529 100644 --- a/src/main/kotlin/rei/recipes/SBEssenceUpgradeRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBEssenceUpgradeRecipe.kt @@ -1,5 +1,5 @@ -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import me.shedaniel.math.Point import me.shedaniel.math.Rectangle @@ -10,9 +10,9 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory import me.shedaniel.rei.api.common.category.CategoryIdentifier import net.minecraft.text.Text import moe.nea.firmament.Firmament -import moe.nea.firmament.rei.SBItemEntryDefinition -import moe.nea.firmament.rei.SBItemStack +import moe.nea.firmament.compat.rei.SBItemEntryDefinition import moe.nea.firmament.repo.EssenceRecipeProvider +import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.SkyblockId class SBEssenceUpgradeRecipe(override val neuRecipe: EssenceRecipeProvider.EssenceUpgradeRecipe) : SBRecipe() { diff --git a/src/main/kotlin/rei/recipes/SBForgeRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBForgeRecipe.kt index 569f4a0..bb51021 100644 --- a/src/main/kotlin/rei/recipes/SBForgeRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBForgeRecipe.kt @@ -1,6 +1,6 @@ -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import io.github.moulberry.repo.data.NEUForgeRecipe import me.shedaniel.math.Point @@ -17,8 +17,8 @@ import kotlin.time.Duration.Companion.seconds import net.minecraft.block.Blocks import net.minecraft.text.Text import moe.nea.firmament.Firmament -import moe.nea.firmament.rei.SBItemEntryDefinition -import moe.nea.firmament.rei.plus +import moe.nea.firmament.compat.rei.SBItemEntryDefinition +import moe.nea.firmament.compat.rei.plus class SBForgeRecipe(override val neuRecipe: NEUForgeRecipe) : SBRecipe() { override fun getCategoryIdentifier(): CategoryIdentifier<*> = Category.categoryIdentifier diff --git a/src/main/kotlin/rei/recipes/SBKatRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt index f906a43..fc77fa6 100644 --- a/src/main/kotlin/rei/recipes/SBKatRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt @@ -1,5 +1,5 @@ -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import io.github.moulberry.repo.data.NEUKatUpgradeRecipe import io.github.notenoughupdates.moulconfig.common.IMinecraft @@ -26,9 +26,9 @@ import net.minecraft.client.gui.Element import net.minecraft.item.Items import net.minecraft.text.Text import moe.nea.firmament.Firmament -import moe.nea.firmament.rei.PetData -import moe.nea.firmament.rei.SBItemEntryDefinition -import moe.nea.firmament.rei.SBItemStack +import moe.nea.firmament.compat.rei.SBItemEntryDefinition +import moe.nea.firmament.repo.PetData +import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.FirmFormatters import moe.nea.firmament.util.MC import moe.nea.firmament.util.SkyblockId diff --git a/src/main/kotlin/rei/recipes/SBMobDropRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBMobDropRecipe.kt index a02220f..cb240fc 100644 --- a/src/main/kotlin/rei/recipes/SBMobDropRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBMobDropRecipe.kt @@ -1,5 +1,5 @@ -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import io.github.moulberry.repo.data.NEUMobDropRecipe import me.shedaniel.math.Point @@ -15,8 +15,8 @@ import net.minecraft.text.Text import net.minecraft.util.Identifier import moe.nea.firmament.Firmament import moe.nea.firmament.gui.entity.EntityRenderer -import moe.nea.firmament.gui.entity.EntityWidget -import moe.nea.firmament.rei.SBItemEntryDefinition +import moe.nea.firmament.compat.rei.EntityWidget +import moe.nea.firmament.compat.rei.SBItemEntryDefinition class SBMobDropRecipe(override val neuRecipe: NEUMobDropRecipe) : SBRecipe() { override fun getCategoryIdentifier(): CategoryIdentifier<*> = Category.categoryIdentifier @@ -73,8 +73,8 @@ class SBMobDropRecipe(override val neuRecipe: NEUMobDropRecipe) : SBRecipe() { tt.removeAt(1) add( Widgets.withTooltip( - EntityWidget(entity, Point(bounds.minX + 5, bounds.minY + 15)), - tt + EntityWidget(entity, Point(bounds.minX + 5, bounds.minY + 15)), + tt ) ) } diff --git a/src/main/kotlin/rei/recipes/SBRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBRecipe.kt index 7872d83..a66a529 100644 --- a/src/main/kotlin/rei/recipes/SBRecipe.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBRecipe.kt @@ -1,12 +1,10 @@ - - -package moe.nea.firmament.rei.recipes +package moe.nea.firmament.compat.rei.recipes import io.github.moulberry.repo.data.NEUIngredient import io.github.moulberry.repo.data.NEURecipe import me.shedaniel.rei.api.common.display.Display import me.shedaniel.rei.api.common.entry.EntryIngredient -import moe.nea.firmament.rei.SBItemEntryDefinition +import moe.nea.firmament.compat.rei.SBItemEntryDefinition import moe.nea.firmament.util.SkyblockId abstract class SBRecipe : Display { 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, diff --git a/src/main/kotlin/gui/entity/ModifyEquipment.kt b/src/main/kotlin/gui/entity/ModifyEquipment.kt index 11dfb52..a558936 100644 --- a/src/main/kotlin/gui/entity/ModifyEquipment.kt +++ b/src/main/kotlin/gui/entity/ModifyEquipment.kt @@ -1,4 +1,3 @@ - package moe.nea.firmament.gui.entity import com.google.gson.JsonObject @@ -6,50 +5,49 @@ import net.minecraft.component.DataComponentTypes import net.minecraft.component.type.DyedColorComponent import net.minecraft.entity.EquipmentSlot import net.minecraft.entity |
