diff options
Diffstat (limited to 'src/main/kotlin/features')
23 files changed, 160 insertions, 117 deletions
diff --git a/src/main/kotlin/features/chat/ChatLinks.kt b/src/main/kotlin/features/chat/ChatLinks.kt index 1fb12e1..28c526f 100644 --- a/src/main/kotlin/features/chat/ChatLinks.kt +++ b/src/main/kotlin/features/chat/ChatLinks.kt @@ -8,6 +8,7 @@ import java.net.URL import java.util.Collections import java.util.concurrent.atomic.AtomicInteger import moe.nea.jarvis.api.Point +import org.joml.Vector2i import kotlinx.coroutines.Deferred import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async @@ -27,6 +28,7 @@ import moe.nea.firmament.events.ModifyChatEvent import moe.nea.firmament.events.ScreenRenderPostEvent import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.gui.config.ManagedConfig +import moe.nea.firmament.jarvis.JarvisIntegration import moe.nea.firmament.util.MC import moe.nea.firmament.util.render.drawTexture import moe.nea.firmament.util.transformEachRecursively @@ -42,7 +44,7 @@ object ChatLinks : FirmamentFeature { val allowAllHosts by toggle("allow-all-hosts") { false } val allowedHosts by string("allowed-hosts") { "cdn.discordapp.com,media.discordapp.com,media.discordapp.net,i.imgur.com" } val actualAllowedHosts get() = allowedHosts.split(",").map { it.trim() } - val position by position("position", 16 * 20, 9 * 20) { Point(0.0, 0.0) } + val position by position("position", 16 * 20, 9 * 20) { Vector2i(0, 0) } } private fun isHostAllowed(host: String) = @@ -110,11 +112,11 @@ object ChatLinks : FirmamentFeature { val imageFuture = imageCache[url] ?: return if (!imageFuture.isCompleted) return val image = imageFuture.getCompleted() ?: return - it.drawContext.matrices.push() + it.drawContext.matrices.pushMatrix() val pos = TConfig.position - pos.applyTransformations(it.drawContext.matrices) + pos.applyTransformations(JarvisIntegration.jarvis, it.drawContext.matrices) val scale = min(1F, min((9 * 20F) / image.height, (16 * 20F) / image.width)) - it.drawContext.matrices.scale(scale, scale, 1F) + it.drawContext.matrices.scale(scale, scale) it.drawContext.drawTexture( image.texture, 0, @@ -126,7 +128,7 @@ object ChatLinks : FirmamentFeature { image.width, image.height, ) - it.drawContext.matrices.pop() + it.drawContext.matrices.popMatrix() } @Subscribe diff --git a/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt b/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt index f0250dc..bdc1f9a 100644 --- a/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt +++ b/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt @@ -12,7 +12,7 @@ data class ExportedTestConstantMeta( ) { companion object { val current = ExportedTestConstantMeta( - SharedConstants.getGameVersion().saveVersion.id, + SharedConstants.getGameVersion().dataVersion().id, Optional.of("Firmament ${Firmament.version.friendlyString}") ) diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemData.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemData.kt index bc8c618..29a85d6 100644 --- a/src/main/kotlin/features/debug/itemeditor/LegacyItemData.kt +++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemData.kt @@ -1,15 +1,13 @@ package moe.nea.firmament.features.debug.itemeditor import kotlinx.serialization.Serializable -import kotlin.jvm.optionals.getOrNull -import net.minecraft.item.ItemStack import net.minecraft.nbt.NbtCompound import net.minecraft.util.Identifier import moe.nea.firmament.Firmament import moe.nea.firmament.repo.ExpensiveItemCacheApi import moe.nea.firmament.repo.ItemCache -import moe.nea.firmament.util.MC import moe.nea.firmament.util.StringUtil.camelWords +import moe.nea.firmament.util.mc.loadItemFromNbt /** * Load data based on [prismarine.js' 1.8 item data](https://github.com/PrismarineJS/minecraft-data/blob/master/data/pc/1.8/items.json) @@ -68,8 +66,7 @@ object LegacyItemData { putByte("Count", 1) putShort("Damage", legacyItemType.metadata) })!! - val stack = ItemStack.fromNbt(MC.defaultRegistries, nbt).getOrNull() - ?: error("Could not transform ${legacyItemType}") + val stack = loadItemFromNbt(nbt) ?: error("Could not transform $legacyItemType") stack.item to legacyItemType } }.toMap() diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt index ecf3d2c..f4f23b0 100644 --- a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt +++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt @@ -284,7 +284,7 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) { fun copyLegacySkullNbt() { val profile = itemStack.get(DataComponentTypes.PROFILE) ?: return legacyNbt.put("SkullOwner", NbtCompound().apply { - profile.id.ifPresent { + profile.uuid.ifPresent { putString("Id", it.toString()) } putBoolean("hypixelPopulated", true) diff --git a/src/main/kotlin/features/diana/AncestralSpadeSolver.kt b/src/main/kotlin/features/diana/AncestralSpadeSolver.kt index ff85c00..48004e8 100644 --- a/src/main/kotlin/features/diana/AncestralSpadeSolver.kt +++ b/src/main/kotlin/features/diana/AncestralSpadeSolver.kt @@ -106,13 +106,11 @@ object AncestralSpadeSolver : SubscriptionOwner { nextGuess?.let { tinyBlock(it, 1f, 0x80FFFFFF.toInt()) // TODO: replace this - color(1f, 1f, 0f, 1f) - tracer(it, lineWidth = 3f) + tracer(it, lineWidth = 3f, color = 0x80FFFFFF.toInt()) } if (particlePositions.size > 2 && lastDing.passedTime() < 10.seconds && nextGuess != null) { // TODO: replace this // TODO: add toggle - color(0f, 1f, 0f, 0.7f) - line(particlePositions) + line(particlePositions, color = 0x80FFFFFF.toInt()) } } } diff --git a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt index 0cfaeba..0f0316a 100644 --- a/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt +++ b/src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt @@ -4,6 +4,7 @@ package moe.nea.firmament.features.events.anniversity import io.github.notenoughupdates.moulconfig.observer.ObservableList import io.github.notenoughupdates.moulconfig.xml.Bind import moe.nea.jarvis.api.Point +import org.joml.Vector2i import kotlin.time.Duration.Companion.seconds import net.minecraft.entity.passive.PigEntity import net.minecraft.util.math.BlockPos @@ -31,7 +32,7 @@ object AnniversaryFeatures : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.EVENTS) { val enableShinyPigTracker by toggle("shiny-pigs") {true} - val trackPigCooldown by position("pig-hud", 200, 300) { Point(0.1, 0.2) } + val trackPigCooldown by position("pig-hud", 200, 300) { Vector2i(100, 200) } } override val config: ManagedConfig? diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt index d490cc4..8870285 100644 --- a/src/main/kotlin/features/fixes/Fixes.kt +++ b/src/main/kotlin/features/fixes/Fixes.kt @@ -1,6 +1,7 @@ package moe.nea.firmament.features.fixes import moe.nea.jarvis.api.Point +import org.joml.Vector2i import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable import net.minecraft.client.MinecraftClient import net.minecraft.client.option.KeyBinding @@ -22,7 +23,7 @@ object Fixes : FirmamentFeature { var autoSprint by toggle("auto-sprint") { false } val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding") val autoSprintUnderWater by toggle("auto-sprint-underwater") { true } - val autoSprintHud by position("auto-sprint-hud", 80, 10) { Point(0.0, 1.0) } + val autoSprintHud by position("auto-sprint-hud", 80, 10) { Vector2i() } val peekChat by keyBindingWithDefaultUnbound("peek-chat") val hidePotionEffects by toggle("hide-mob-effects") { false } val hidePotionEffectsHud by toggle("hide-potion-effects-hud") { false } @@ -49,7 +50,7 @@ object Fixes : FirmamentFeature { @Subscribe fun onRenderHud(it: HudRenderEvent) { if (!TConfig.autoSprintKeyBinding.isBound) return - it.context.matrices.push() + it.context.matrices.pushMatrix() TConfig.autoSprintHud.applyTransformations(it.context.matrices) it.context.drawText( MC.font, ( @@ -65,7 +66,7 @@ object Fixes : FirmamentFeature { } ), 0, 0, -1, true ) - it.context.matrices.pop() + it.context.matrices.popMatrix() } @Subscribe diff --git a/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt b/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt index fdc378a..9dae118 100644 --- a/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt +++ b/src/main/kotlin/features/inventory/ItemRarityCosmetics.kt @@ -1,6 +1,7 @@ package moe.nea.firmament.features.inventory import java.awt.Color +import net.minecraft.client.gl.RenderPipelines import net.minecraft.client.gui.DrawContext import net.minecraft.client.render.RenderLayer import net.minecraft.item.ItemStack @@ -38,7 +39,7 @@ object ItemRarityCosmetics : FirmamentFeature { val rarity = Rarity.fromItem(item) ?: return val rgb = rarityToColor[rarity] ?: 0xFF00FF80.toInt() drawContext.drawGuiTexture( - RenderLayer::getGuiTextured, + RenderPipelines.GUI_TEXTURED, Identifier.of("firmament:item_rarity_background"), x, y, 16, 16, diff --git a/src/main/kotlin/features/inventory/PetFeatures.kt b/src/main/kotlin/features/inventory/PetFeatures.kt index 9393b03..701d30c 100644 --- a/src/main/kotlin/features/inventory/PetFeatures.kt +++ b/src/main/kotlin/features/inventory/PetFeatures.kt @@ -1,6 +1,6 @@ package moe.nea.firmament.features.inventory -import moe.nea.jarvis.api.Point +import org.joml.Vector2i import net.minecraft.item.ItemStack import net.minecraft.text.Text import net.minecraft.util.Formatting @@ -10,6 +10,7 @@ import moe.nea.firmament.events.HudRenderEvent import moe.nea.firmament.events.SlotRenderEvents import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.gui.config.ManagedConfig +import moe.nea.firmament.jarvis.JarvisIntegration import moe.nea.firmament.util.FirmFormatters.formatPercent import moe.nea.firmament.util.FirmFormatters.shortFormat import moe.nea.firmament.util.MC @@ -31,7 +32,9 @@ object PetFeatures : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.INVENTORY) { val highlightEquippedPet by toggle("highlight-pet") { true } var petOverlay by toggle("pet-overlay") { false } - val petOverlayHud by position("pet-overlay-hud", 80, 10) { Point(0.5, 1.0) } + val petOverlayHud by position("pet-overlay-hud", 80, 10) { + Vector2i() + } } val petMenuTitle = "Pets(?: \\([0-9]+/[0-9]+\\))?".toPattern() @@ -43,12 +46,12 @@ object PetFeatures : FirmamentFeature { val stack = event.slot.stack if (stack.petData?.active == true) petMenuTitle.useMatch(MC.screenName ?: return) { - petItemStack = stack - event.context.drawGuiTexture( - Firmament.identifier("selected_pet_background"), - event.slot.x, event.slot.y, 16, 16, - ) - } + petItemStack = stack + event.context.drawGuiTexture( + Firmament.identifier("selected_pet_background"), + event.slot.x, event.slot.y, 16, 16, + ) + } } @Subscribe @@ -62,25 +65,48 @@ object PetFeatures : FirmamentFeature { val petType = titleCase(petData.type) val heldItem = petData.heldItem?.let { item -> "Held Item: ${titleCase(item)}" } - it.context.matrices.push() - TConfig.petOverlayHud.applyTransformations(it.context.matrices) + it.context.matrices.pushMatrix() + TConfig.petOverlayHud.applyTransformations(JarvisIntegration.jarvis, it.context.matrices) val lines = mutableListOf<Text>() - it.context.matrices.push() - it.context.matrices.translate(-0.5, -0.5, 0.0) - it.context.matrices.scale(2f, 2f, 1f) + it.context.matrices.pushMatrix() + it.context.matrices.translate(-0.5F, -0.5F) + it.context.matrices.scale(2f, 2f) it.context.drawItem(itemStack, 0, 0) - it.context.matrices.pop() + it.context.matrices.popMatrix() lines.add(Text.literal("[Lvl ${xp.currentLevel}] ").append(Text.literal(petType).withColor(rarityCode))) if (heldItem != null) lines.add(Text.literal(heldItem)) - if (xp.currentLevel != xp.maxLevel) lines.add(Text.literal("Required L${xp.currentLevel + 1}: ${shortFormat(xp.expInCurrentLevel.toDouble())}/${shortFormat(xp.expRequiredForNextLevel.toDouble())} (${formatPercent(xp.percentageToNextLevel.toDouble())})")) - lines.add(Text.literal("Required L100: ${shortFormat(xp.expTotal.toDouble())}/${shortFormat(xp.expRequiredForMaxLevel.toDouble())} (${formatPercent(xp.percentageToMaxLevel.toDouble())})")) + if (xp.currentLevel != xp.maxLevel) lines.add( + Text.literal( + "Required L${xp.currentLevel + 1}: ${shortFormat(xp.expInCurrentLevel.toDouble())}/${ + shortFormat( + xp.expRequiredForNextLevel.toDouble() + ) + } (${formatPercent(xp.percentageToNextLevel.toDouble())})" + ) + ) + lines.add( + Text.literal( + "Required L100: ${shortFormat(xp.expTotal.toDouble())}/${shortFormat(xp.expRequiredForMaxLevel.toDouble())} (${ + formatPercent( + xp.percentageToMaxLevel.toDouble() + ) + })" + ) + ) for ((index, line) in lines.withIndex()) { - it.context.drawText(MC.font, line.copy().withColor(Formatting.GRAY), 36, MC.font.fontHeight * index, -1, true) + it.context.drawText( + MC.font, + line.copy().withColor(Formatting.GRAY), + 36, + MC.font.fontHeight * index, + -1, + true + ) } - it.context.matrices.pop() + it.context.matrices.popMatrix() } } diff --git a/src/main/kotlin/features/inventory/REIDependencyWarner.kt b/src/main/kotlin/features/inventory/REIDependencyWarner.kt index 476759a..6bf2928 100644 --- a/src/main/kotlin/features/inventory/REIDependencyWarner.kt +++ b/src/main/kotlin/features/inventory/REIDependencyWarner.kt @@ -31,7 +31,7 @@ object REIDependencyWarner { var sentWarning = false fun modrinthLink(slug: String) = - "https://modrinth.com/mod/$slug/versions?g=${SharedConstants.getGameVersion().name}&l=fabric" + "https://modrinth.com/mod/$slug/versions?g=${SharedConstants.getGameVersion().name()}&l=fabric" fun downloadButton(modName: String, modId: String, slug: String): Text { val alreadyDownloaded = FabricLoader.getInstance().isModLoaded(modId) diff --git a/src/main/kotlin/features/inventory/SlotLocking.kt b/src/main/kotlin/features/inventory/SlotLocking.kt index 0a3f01b..f413ef5 100644 --- a/src/main/kotlin/features/inventory/SlotLocking.kt +++ b/src/main/kotlin/features/inventory/SlotLocking.kt @@ -2,6 +2,7 @@ package moe.nea.firmament.features.inventory +import com.mojang.blaze3d.pipeline.RenderPipeline import java.util.UUID import org.lwjgl.glfw.GLFW import kotlinx.serialization.KSerializer @@ -16,6 +17,7 @@ import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.int import kotlinx.serialization.serializer +import net.minecraft.client.gl.RenderPipelines import net.minecraft.client.gui.screen.ingame.HandledScreen import net.minecraft.client.render.RenderLayer import net.minecraft.entity.player.PlayerInventory @@ -484,7 +486,7 @@ object SlotLocking : FirmamentFeature { val isUUIDLocked = (it.slot.stack?.skyblockUUID) in (lockedUUIDs ?: setOf()) if (isSlotLocked || isUUIDLocked) { it.context.drawGuiTexture( - RenderLayer::getGuiTexturedOverlay, + RenderPipelines.GUI_TEXTURED, when { isSlotLocked -> (Identifier.of("firmament:slot_locked")) diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButtonEditor.kt b/src/main/kotlin/features/inventory/buttons/InventoryButtonEditor.kt index eecbd17..1e4f6a3 100644 --- a/src/main/kotlin/features/inventory/buttons/InventoryButtonEditor.kt +++ b/src/main/kotlin/features/inventory/buttons/InventoryButtonEditor.kt @@ -122,7 +122,9 @@ class InventoryButtonEditor( ButtonWidget.builder(Text.translatable("firmament.inventory-buttons.simple-preset")) { // Preset from NEU // Credit: https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/9b1fcfebc646e9fb69f99006327faa3e734e5f51/src/main/resources/assets/notenoughupdates/invbuttons/presets.json#L900-L1348 - val newButtons = InventoryButtonTemplates.loadTemplate("TkVVQlVUVE9OUy9bIntcblx0XCJ4XCI6IDE2MCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcImJvbmVcIixcblx0XCJjb21tYW5kXCI6IFwicGV0c1wiXG59Iiwie1xuXHRcInhcIjogMTQwLFxuXHRcInlcIjogLTIwLFxuXHRcImFuY2hvclJpZ2h0XCI6IGZhbHNlLFxuXHRcImFuY2hvckJvdHRvbVwiOiBmYWxzZSxcblx0XCJpY29uXCI6IFwiYXJtb3Jfc3RhbmRcIixcblx0XCJjb21tYW5kXCI6IFwid2FyZHJvYmVcIlxufSIsIntcblx0XCJ4XCI6IDEyMCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwi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RhbmRcIixcblx0XCJjb21tYW5kXCI6IFwid2FyZHJvYmVcIlxufSIsIntcblx0XCJ4XCI6IDEyMCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcImVuZGVyX2NoZXN0XCIsXG5cdFwiY29tbWFuZFwiOiBcInN0b3JhZ2VcIlxufSIsIntcblx0XCJ4XCI6IDEwMCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcInNrdWxsOmQ3Y2M2Njg3NDIzZDA1NzBkNTU2YWM1M2UwNjc2Y2I1NjNiYmRkOTcxN2NkODI2OWJkZWJlZDZmNmQ0ZTdiZjhcIixcblx0XCJjb21tYW5kXCI6IFwid2FycCBpc2xhbmRcIlxufSIsIntcblx0XCJ4XCI6IDgwLFxuXHRcInlcIjogLTIwLFxuXHRcImFuY2hvclJpZ2h0XCI6IGZhbHNlLFxuXHRcImFuY2hvckJvdHRvbVwiOiBmYWxzZSxcblx0XCJpY29uXCI6IFwic2t1bGw6MzVmNGI0MGNlZjllMDE3Y2Q0MTEyZDI2YjYyNTU3ZjhjMWQ1YjE4OWRhMmU5OTUzNDIyMmJjOGNlYzdkOTE5NlwiLFxuXHRcImNvbW1hbmRcIjogXCJ3YXJwIGh1YlwiXG59Il0=" + ) if (newButtons != null) buttons = moveButtons(newButtons.map { it.copy(command = it.command?.removePrefix("/")) }) } @@ -134,7 +136,9 @@ class InventoryButtonEditor( ButtonWidget.builder(Text.translatable("firmament.inventory-buttons.all-warps-preset")) { // Preset from NEU // Credit: https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/9b1fcfebc646e9fb69f99006327faa3e734e5f51/src/main/resources/assets/notenoughupdates/invbuttons/presets.json#L1817-L2276 - val newButtons = InventoryBut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NTMzM2I5ZDM1YTdmNTY4YjYzZDFlZjRhZGE0YjA2OGI1YTI1XCIsXG5cdFwiY29tbWFuZFwiOiBcIndhcnAgc3BpZGVyXCJcbn0iLCJ7XG5cdFwieFwiOiAxNTEsXG5cdFwieVwiOiAyLFxuXHRcImFuY2hvclJpZ2h0XCI6IGZhbHNlLFxuXHRcImFuY2hvckJvdHRvbVwiOiB0cnVlLFxuXHRcImljb25cIjogXCJza3VsbDpjMzY4N2UyNWM2MzJiY2U4YWE2MWUwZDY0YzI0ZTY5NGMzZWVhNjI5ZWE5NDRmNGNmMzBkY2ZiNGZiY2UwNzFcIixcblx0XCJjb21tYW5kXCI6IFwid2FycCBuZXRoZXJcIlxufSJd" + ) if (newButtons != null) buttons = moveButtons(newButtons.map { it.copy(command = it.command?.removePrefix("/")) }) } @@ -188,31 +192,24 @@ class InventoryButtonEditor( return newButtons } - override fun renderBackground(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { - context.matrices.push() - context.matrices.translate(0F, 0F, -15F) - super.renderBackground(context, mouseX, mouseY, delta) - context.matrices.pop() - } - override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) { super.render(context, mouseX, mouseY, delta) - context.matrices.push() - context.matrices.translate(0f, 0f, -10f) + context.matrices.pushMatrix() PanelComponent.DefaultBackgroundRenderer.VANILLA .render( ModernRenderContext(context), lastGuiRect.minX, lastGuiRect.minY, lastGuiRect.width, lastGuiRect.height, ) - context.matrices.pop() + context.matrices.popMatrix() for (button in buttons) { val buttonPosition = button.getBounds(lastGuiRect) - context.matrices.push() - context.matrices.translate(buttonPosition.minX.toFloat(), buttonPosition.minY.toFloat(), 0F) + context.matrices.pushMatrix() + context.matrices.translate(buttonPosition.minX.toFloat(), buttonPosition.minY.toFloat()) button.render(context) - context.matrices.pop() + context.matrices.popMatrix() } + renderPopup(context, mouseX, mouseY, delta) } override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean { @@ -228,8 +225,15 @@ class InventoryButtonEditor( if (super.mouseReleased(mouseX, mouseY, button)) return true val clickedButton = buttons.firstOrNull { it.getBounds(lastGuiRect).contains(Point(mouseX, mouseY)) } if (clickedButton != null && !justPerformedAClickAction) { - if (InputUtil.isKeyPressed(MC.window.handle, InputUtil.GLFW_KEY_LEFT_CONTROL)) Editor(clickedButton).delete() - else createPopup(MoulConfigUtils.loadGui("button_editor_fragment", Editor(clickedButton)), Point(mouseX, mouseY)) + if (InputUtil.isKeyPressed( + MC.window.handle, + InputUtil.GLFW_KEY_LEFT_CONTROL + ) + ) Editor(clickedButton).delete() + else createPopup( + MoulConfigUtils.loadGui("button_editor_fragment", Editor(clickedButton)), + Point(mouseX, mouseY) + ) return true } justPerformedAClickAction = false diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt index ab80d97..46e91b2 100644 --- a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt +++ b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt @@ -76,10 +76,10 @@ object InventoryButtons { var hoveredComponent: InventoryButton? = null for (button in getValidButtons(it.screen)) { val buttonBounds = button.getBounds(bounds) - it.context.matrices.push() - it.context.matrices.translate(buttonBounds.minX.toFloat(), buttonBounds.minY.toFloat(), 0F) + it.context.matrices.pushMatrix() + it.context.matrices.translate(buttonBounds.minX.toFloat(), buttonBounds.minY.toFloat()) button.render(it.context) - it.context.matrices.pop() + it.context.matrices.popMatrix() if (buttonBounds.contains(it.mouseX, it.mouseY) && TConfig.hoverText && hoveredComponent == null) { hoveredComponent = button diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverviewScreen.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverviewScreen.kt index 3462d3d..e383d29 100644 --- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverviewScreen.kt +++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverviewScreen.kt @@ -44,10 +44,10 @@ class StorageOverviewScreen() : Screen(Text.empty()) { super.render(context, mouseX, mouseY, delta) context.fill(0, 0, width, height, 0x90000000.toInt()) layoutedForEach { (key, value), offsetX, offsetY -> - context.matrices.push() - context.matrices.translate(offsetX.toFloat(), offsetY.toFloat(), 0F) + context.matrices.pushMatrix() + context.matrices.translate(offsetX.toFloat(), offsetY.toFloat()) renderStoragePage(context, value, mouseX - offsetX, mouseY - offsetY) - context.matrices.pop() + context.matrices.popMatrix() } } diff --git a/src/main/kotlin/features/items/BonemerangOverlay.kt b/src/main/kotlin/features/items/BonemerangOverlay.kt index ffdffe3..6483b7a 100644 --- a/src/main/kotlin/features/items/BonemerangOverlay.kt +++ b/src/main/kotlin/features/items/BonemerangOverlay.kt @@ -2,6 +2,7 @@ package moe.nea.firmament.features.items import me.shedaniel.math.Color import moe.nea.jarvis.api.Point +import org.joml.Vector2i import net.minecraft.entity.LivingEntity import net.minecraft.entity.decoration.ArmorStandEntity import net.minecraft.entity.player.PlayerEntity @@ -25,7 +26,7 @@ object BonemerangOverlay : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.ITEMS) { var bonemerangOverlay by toggle("bonemerang-overlay") { false } - val bonemerangOverlayHud by position("bonemerang-overlay-hud", 80, 10) { Point(0.1, 1.0) } + val bonemerangOverlayHud by position("bonemerang-overlay-hud", 80, 10) { Vector2i() } var highlightHitEntities by toggle("highlight-hit-entities") { false } } @@ -87,7 +88,7 @@ object BonemerangOverlay : FirmamentFeature { val entities = getEntities() - it.context.matrices.push() + it.context.matrices.pushMatrix() TConfig.bonemerangOverlayHud.applyTransformations(it.context.matrices) it.context.drawText( MC.font, String.format( @@ -96,6 +97,6 @@ object BonemerangOverlay : FirmamentFeature { ).string, entities.size ), 0, 0, -1, true ) - it.context.matrices.pop() + it.context.matrices.popMatrix() } } diff --git a/src/main/kotlin/features/macros/ComboProcessor.kt b/src/main/kotlin/features/macros/ComboProcessor.kt index 5c5ac0e..1f77ff6 100644 --- a/src/main/kotlin/features/macros/ComboProcessor.kt +++ b/src/main/kotlin/features/macros/ComboProcessor.kt @@ -56,12 +56,11 @@ object ComboProcessor { fun onRender(event: HudRenderEvent) { if (!isInputting) return if (!event.isRenderingHud) return - event.context.matrices.push() + event.context.matrices.pushMatrix() val width = 120 event.context.matrices.translate( (MC.window.scaledWidth - width) / 2F, - (MC.window.scaledHeight) / 2F + 8, - 0F + (MC.window.scaledHeight) / 2F + 8 ) val breadCrumbText = breadCrumbs.joinToString(" > ") event.context.drawText( @@ -72,7 +71,7 @@ object ComboProcessor { -1, true ) - event.context.matrices.translate(0F, MC.font.fontHeight + 2F, 0F) + event.context.matrices.translate(0F, MC.font.fontHeight + 2F) for ((key, value) in activeTrie.nodes) { event.context.drawText( MC.font, @@ -82,9 +81,9 @@ object ComboProcessor { -1, true ) - event.context.matrices.translate(0F, MC.font.fontHeight + 1F, 0F) + event.context.matrices.translate(0F, MC.font.fontHeight + 1F) } - event.context.matrices.pop() + event.context.matrices.popMatrix() } @Subscribe diff --git a/src/main/kotlin/features/macros/RadialMenu.kt b/src/main/kotlin/features/macros/RadialMenu.kt index 9e5222f..5134994 100644 --- a/src/main/kotlin/features/macros/RadialMenu.kt +++ b/src/main/kotlin/features/macros/RadialMenu.kt @@ -63,11 +63,10 @@ object RadialMenuViewer { fun onRender(event: HudRenderEvent) { val menu = activeMenu ?: return val mat = event.context.matrices - mat.push() + mat.pushMatrix() mat.translate( (MC.window.scaledWidth) / 2F, (MC.window.scaledHeight) / 2F, - 0F ) val sliceWidth = (τ / menu.options.size).toFloat() var selectedAngle = wrapAngle(atan2(delta.y, delta.x)) @@ -75,8 +74,8 @@ object RadialMenuViewer { selectedAngle = Float.NaN for ((idx, option) in menu.options.withIndex()) { val range = (sliceWidth * idx)..(sliceWidth * (idx + 1)) - mat.push() - mat.scale(64F, 64F, 1F) + mat.pushMatrix() + mat.scale(64F, 64F) val cutout = INNER_CIRCLE_RADIUS / 64F / 2 RenderCircleProgress.renderCircularSlice( event.context, @@ -86,16 +85,16 @@ object RadialMenuViewer { color = if (selectedAngle in range) 0x70A0A0A0 else 0x70FFFFFF, innerCutoutRadius = cutout ) - mat.pop() - mat.push() + mat.popMatrix() + mat.pushMatrix() val centreAngle = lerpAngle(range.start, range.endInclusive, 0.5F) val vec = Vector2f(cos(centreAngle), sin(centreAngle)).mul(40F) - mat.translate(vec.x, vec.y, 0F) + mat.translate(vec.x, vec.y) option.renderSlice(event.context) - mat.pop() + mat.popMatrix() } event.context.drawLine(1, 1, delta.x.toInt(), delta.y.toInt(), me.shedaniel.math.Color.ofOpaque(0x00FF00)) - mat.pop() + mat.popMatrix() } @Subscribe diff --git a/src/main/kotlin/features/mining/PickaxeAbility.kt b/src/main/kotlin/features/mining/PickaxeAbility.kt index 430bae0..0e8f62f 100644 --- a/src/main/kotlin/features/mining/PickaxeAbility.kt +++ b/src/main/kotlin/features/mining/PickaxeAbility.kt @@ -229,14 +229,14 @@ object PickaxeAbility : FirmamentFeature { if (ao != ability.name && ao != null) { ability = PickaxeAbilityData(ao, defaultAbilityDurations[ao] ?: 120.seconds) } - event.context.matrices.push() - event.context.matrices.translate(MC.window.scaledWidth / 2F, MC.window.scaledHeight / 2F, 0F) - event.context.matrices.scale(TConfig.cooldownScale.toFloat(), TConfig.cooldownScale.toFloat(), 1F) + event.context.matrices.pushMatrix() + event.context.matrices.translate(MC.window.scaledWidth / 2F, MC.window.scaledHeight / 2F) + event.context.matrices.scale(TConfig.cooldownScale.toFloat(), TConfig.cooldownScale.toFloat()) RenderCircleProgress.renderCircle( event.context, Identifier.of("firmament", "textures/gui/circle.png"), getCooldownPercentage(ability.name, ability.cooldown).toFloat(), 0f, 1f, 0f, 1f ) - event.context.matrices.pop() + event.context.matrices.popMatrix() } } diff --git a/src/main/kotlin/features/mining/PristineProfitTracker.kt b/src/main/kotlin/features/mining/PristineProfitTracker.kt index 377a470..eb3cba6 100644 --- a/src/main/kotlin/features/mining/PristineProfitTracker.kt +++ b/src/main/kotlin/features/mining/PristineProfitTracker.kt @@ -2,6 +2,7 @@ package moe.nea.firmament.features.mining import io.github.notenoughupdates.moulconfig.xml.Bind import moe.nea.jarvis.api.Point +import org.joml.Vector2i import kotlinx.serialization.Serializable import kotlinx.serialization.serializer import kotlin.time.Duration.Companion.seconds @@ -57,7 +58,7 @@ object PristineProfitTracker : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.MINING) { val timeout by duration("timeout", 0.seconds, 120.seconds) { 30.seconds } - val gui by position("position", 100, 30) { Point(0.05, 0.2) } + val gui by position("position", 100, 30) { Vector2i() } val useFineGemstones by toggle("fine-gemstones") { false } } diff --git a/src/main/kotlin/features/misc/CustomCapes.kt b/src/main/kotlin/features/misc/CustomCapes.kt index dc5187a..a3725e5 100644 --- a/src/main/kotlin/features/misc/CustomCapes.kt +++ b/src/main/kotlin/features/misc/CustomCapes.kt @@ -1,6 +1,8 @@ package moe.nea.firmament.features.misc +import com.mojang.blaze3d.buffers.GpuBuffer import com.mojang.blaze3d.systems.RenderSystem +import java.nio.ByteBuffer import java.util.OptionalDouble import java.util.OptionalInt import util.render.CustomRenderPipelines @@ -63,34 +65,44 @@ object CustomCapes : FirmamentFeature { vertexConsumerProvider: VertexConsumerProvider, model: (VertexConsumer) -> Unit ) { + // TODO: figure out how exactly the rotation abstraction works + val animationValue = (startTime.passedTime() / animationSpeed).mod(1F) + val commandEncoder = RenderSystem.getDevice().createCommandEncoder() + val animationBufSource = ByteBuffer.allocateDirect(8) + animationBufSource.putFloat(animationValue.toFloat()) + animationBufSource.flip() BufferAllocator(2048).use { allocator -> val bufferBuilder = BufferBuilder(allocator, renderLayer.drawMode, renderLayer.vertexFormat) model(bufferBuilder) bufferBuilder.end().use { buffer -> - val commandEncoder = RenderSystem.getDevice().createCommandEncoder() val vertexBuffer = renderLayer.vertexFormat.uploadImmediateVertexBuffer(buffer.buffer) val indexBufferConstructor = RenderSystem.getSequentialBuffer(renderLayer.drawMode) val indexBuffer = indexBufferConstructor.getIndexBuffer(buffer.drawParameters.indexCount) val templateTexture = MC.textureManager.getTexture(template) val backgroundTexture = MC.textureManager.getTexture(background) val foregroundTexture = MC.textureManager.getTexture(overlay) - commandEncoder.createRenderPass( - MC.instance.framebuffer.colorAttachment, - OptionalInt.empty(), - MC.instance.framebuffer.depthAttachment, - OptionalDouble.empty(), - ).use { renderPass -> - // TODO: account for lighting - renderPass.setPipeline(CustomRenderPipelines.PARALLAX_CAPE_SHADER) - renderPass.bindSampler("Sampler0", templateTexture.glTexture) - renderPass.bindSampler("Sampler1", backgroundTexture.glTexture) - renderPass.bindSampler("Sampler3", foregroundTexture.glTexture) - val animationValue = (startTime.passedTime() / animationSpeed).mod(1F) - renderPass.setUniform("Animation", animationValue.toFloat()) - renderPass.setIndexBuffer(indexBuffer, indexBufferConstructor.indexType) - renderPass.setVertexBuffer(0, vertexBuffer) - renderPass.drawIndexed(0, buffer.drawParameters.indexCount) - } + RenderSystem.getDevice() + .createBuffer({ "Firm Cape Animation" }, GpuBuffer.USAGE_UNIFORM, animationBufSource) + .use { animationUniformBuf -> + commandEncoder.createRenderPass( + { "FirmamentCustomCape" }, + MC.instance.framebuffer.colorAttachmentView, + OptionalInt.empty(), + MC.instance.framebuffer.depthAttachmentView, + OptionalDouble.empty(), + ).use { renderPass -> + // TODO: account for lighting + renderPass.setPipeline(CustomRenderPipelines.PARALLAX_CAPE_SHADER) + renderPass.bindSampler("Sampler0", templateTexture.glTextureView) + renderPass.bindSampler("Sampler1", backgroundTexture.glTextureView) + renderPass.bindSampler("Sampler3", foregroundTexture.glTextureView) + renderPass.setUniform("Animation", animationUniformBuf) + renderPass.setIndexBuffer(indexBuffer, indexBufferConstructor.indexType) + renderPass.setVertexBuffer(0, vertexBuffer) + renderPass.drawIndexed(0, 0, buffer.drawParameters.indexCount, 1) + } + + } } } } diff --git a/src/main/kotlin/features/misc/Hud.kt b/src/main/kotlin/features/misc/Hud.kt index 9661fc5..8c785ab 100644 --- a/src/main/kotlin/features/misc/Hud.kt +++ b/src/main/kotlin/features/misc/Hud.kt @@ -7,6 +7,7 @@ import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.util.MC import moe.nea.firmament.util.tr import moe.nea.jarvis.api.Point +import org.joml.Vector2i import net.minecraft.client.network.PlayerListEntry import net.minecraft.text.Text @@ -16,11 +17,11 @@ object Hud : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.MISC) { var dayCount by toggle("day-count") { false } - val dayCountHud by position("day-count-hud", 80, 10) { Point(0.5, 0.8) } + val dayCountHud by position("day-count-hud", 80, 10) { Vector2i() } var fpsCount by toggle("fps-count") { false } - val fpsCountHud by position("fps-count-hud", 80, 10) { Point(0.5, 0.9) } + val fpsCountHud by position("fps-count-hud", 80, 10) { Vector2i() } var pingCount by toggle("ping-count") { false } - val pingCountHud by position("ping-count-hud", 80, 10) { Point(0.5, 1.0) } + val pingCountHud by position("ping-count-hud", 80, 10) { Vector2i() } } override val config: ManagedConfig @@ -29,7 +30,7 @@ object Hud : FirmamentFeature { @Subscribe fun onRenderHud(it: HudRenderEvent) { if (TConfig.dayCount) { - it.context.matrices.push() + it.context.matrices.pushMatrix() TConfig.dayCountHud.applyTransformations(it.context.matrices) val day = (MC.world?.timeOfDay ?: 0L) / 24000 it.context.drawText( @@ -40,11 +41,11 @@ object Hud : FirmamentFeature { -1, true ) - it.context.matrices.pop() + it.context.matrices.popMatrix() } if (TConfig.fpsCount) { - it.context.matrices.push() + it.context.matrices.pushMatrix() TConfig.fpsCountHud.applyTransformations(it.context.matrices) it.context.drawText( MC.font, Text.literal( @@ -53,11 +54,11 @@ object Hud : FirmamentFeature { ) ), 36, MC.font.fontHeight, -1, true ) - it.context.matrices.pop() + it.context.matrices.popMatrix() } if (TConfig.pingCount) { - it.context.matrices.push() + it.context.matrices.pushMatrix() TConfig.pingCountHud.applyTransformations(it.context.matrices) val ping = MC.player?.let { val entry: PlayerListEntry? = MC.networkHandler?.getPlayerListEntry(it.uuid) @@ -71,7 +72,7 @@ object Hud : FirmamentFeature { ), 36, MC.font.fontHeight, -1, true ) - it.context.matrices.pop() + it.context.matrices.popMatrix() } } } diff --git a/src/main/kotlin/features/world/FairySouls.kt b/src/main/kotlin/features/world/FairySouls.kt index d4bf560..699aafc 100644 --- a/src/main/kotlin/features/world/FairySouls.kt +++ b/src/main/kotlin/features/world/FairySouls.kt @@ -103,7 +103,6 @@ object FairySouls : FirmamentFeature { currentMissingSouls.forEach { block(it.blockPos, Color.ofRGBA(176, 0, 255, 128).color) } - color(1f, 0f, 1f, 1f) currentLocationSouls.forEach { wireframeCube(it.blockPos) } diff --git a/src/main/kotlin/features/world/Waypoints.kt b/src/main/kotlin/features/world/Waypoints.kt index b4f91b0..205d5eb 100644 --- a/src/main/kotlin/features/world/Waypoints.kt +++ b/src/main/kotlin/features/world/Waypoints.kt @@ -53,8 +53,7 @@ object Waypoints : FirmamentFeature { } else { orderedIndex %= w.waypoints.size val firstColor = Color.ofRGBA(0, 200, 40, 180) - color(firstColor) - tracer(w.waypoints[orderedIndex].blockPos.toCenterPos(), lineWidth = 3f) + tracer(w.waypoints[orderedIndex].blockPos.toCenterPos(), color = firstColor.color, lineWidth = 3f) w.waypoints.withIndex().toList().wrappingWindow(orderedIndex, 3).zip(listOf( firstColor, Color.ofRGBA(180, 200, 40, 150), |
