aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts6
-rw-r--r--gradle/libs.versions.toml45
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt35
-rw-r--r--src/compat/jade/java/moe/nea/firmament/mixins/compat/jade/ElementAccessor.java12
-rw-r--r--src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt8
-rw-r--r--src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt174
-rw-r--r--src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java13
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java2
-rw-r--r--src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java2
-rw-r--r--src/main/kotlin/features/chat/ChatLinks.kt12
-rw-r--r--src/main/kotlin/features/debug/ExportedTestConstantMeta.kt2
-rw-r--r--src/main/kotlin/features/debug/itemeditor/LegacyItemData.kt7
-rw-r--r--src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt2
-rw-r--r--src/main/kotlin/features/diana/AncestralSpadeSolver.kt6
-rw-r--r--src/main/kotlin/features/events/anniversity/AnniversaryFeatures.kt3
-rw-r--r--src/main/kotlin/features/fixes/Fixes.kt7
-rw-r--r--src/main/kotlin/features/inventory/ItemRarityCosmetics.kt3
-rw-r--r--src/main/kotlin/features/inventory/PetFeatures.kt62
-rw-r--r--src/main/kotlin/features/inventory/REIDependencyWarner.kt2
-rw-r--r--src/main/kotlin/features/inventory/SlotLocking.kt4
-rw-r--r--src/main/kotlin/features/inventory/buttons/InventoryButtonEditor.kt38
-rw-r--r--src/main/kotlin/features/inventory/buttons/InventoryButtons.kt6
-rw-r--r--src/main/kotlin/features/inventory/storageoverlay/StorageOverviewScreen.kt6
-rw-r--r--src/main/kotlin/features/items/BonemerangOverlay.kt7
-rw-r--r--src/main/kotlin/features/macros/ComboProcessor.kt11
-rw-r--r--src/main/kotlin/features/macros/RadialMenu.kt17
-rw-r--r--src/main/kotlin/features/mining/PickaxeAbility.kt8
-rw-r--r--src/main/kotlin/features/mining/PristineProfitTracker.kt3
-rw-r--r--src/main/kotlin/features/misc/CustomCapes.kt48
-rw-r--r--src/main/kotlin/features/misc/Hud.kt19
-rw-r--r--src/main/kotlin/features/world/FairySouls.kt1
-rw-r--r--src/main/kotlin/features/world/Waypoints.kt3
-rw-r--r--src/main/kotlin/gui/BarComponent.kt4
-rw-r--r--src/main/kotlin/gui/CheckboxComponent.kt3
-rw-r--r--src/main/kotlin/gui/config/HudMetaHandler.kt14
-rw-r--r--src/main/kotlin/gui/config/JAnyHud.kt71
-rw-r--r--src/main/kotlin/gui/config/ManagedConfig.kt7
-rw-r--r--src/main/kotlin/gui/entity/EntityRenderer.kt7
-rw-r--r--src/main/kotlin/gui/hud/MoulConfigHud.kt10
-rw-r--r--src/main/kotlin/repo/ItemCache.kt5
-rw-r--r--src/main/kotlin/repo/MiningRepoData.kt3
-rw-r--r--src/main/kotlin/util/FragmentGuiScreen.kt10
-rw-r--r--src/main/kotlin/util/MC.kt5
-rw-r--r--src/main/kotlin/util/MoulConfigFragment.kt6
-rw-r--r--src/main/kotlin/util/MoulConfigUtils.kt6
-rw-r--r--src/main/kotlin/util/mc/ItemUtil.kt30
-rw-r--r--src/main/kotlin/util/render/CustomRenderLayers.kt10
-rw-r--r--src/main/kotlin/util/render/DrawContextExt.kt85
-rw-r--r--src/main/kotlin/util/render/FacingThePlayerContext.kt5
-rw-r--r--src/main/kotlin/util/render/RenderCircleProgress.kt14
-rw-r--r--src/main/kotlin/util/render/RenderInWorldContext.kt25
-rw-r--r--src/main/kotlin/util/render/TranslatedScissors.kt28
-rw-r--r--src/main/resources/firmament.accesswidener3
-rw-r--r--src/test/kotlin/testutil/ItemResources.kt2
-rw-r--r--src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomGlobalArmorOverrides.kt4
-rw-r--r--src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomScreenLayouts.kt3
-rw-r--r--src/texturePacks/java/moe/nea/firmament/features/texturepack/StringMatcher.kt265
-rw-r--r--src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/SkullPredicate.kt2
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/CustomSkullTexturePatch.java4
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java6
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java6
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java5
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java11
-rw-r--r--src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java17
67 files changed, 698 insertions, 566 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index c8bdfdb..9b28c22 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,10 +27,8 @@ plugins {
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.kotlin.plugin.powerassert)
alias(libs.plugins.kotlin.plugin.ksp)
- // alias(libs.plugins.loom)
+ alias(libs.plugins.loom)
alias(libs.plugins.shadow) apply false
- // TODO: use arch loom once they update to 1.8
- id("fabric-loom") version "1.10.1"
id("firmament.common")
id("firmament.license-management")
alias(libs.plugins.mcAutoTranslations)
@@ -197,7 +195,7 @@ val explosiveEnhancementSourceSet =
val wildfireGenderSourceSet = createIsolatedSourceSet("wildfireGender")
val jadeSourceSet = createIsolatedSourceSet("jade")
val modmenuSourceSet = createIsolatedSourceSet("modmenu")
-val reiSourceSet = createIsolatedSourceSet("rei")
+val reiSourceSet = createIsolatedSourceSet("rei", isEnabled = false)
val moulconfigSourceSet = createIsolatedSourceSet("moulconfig")
val customTexturesSourceSet = createIsolatedSourceSet("texturePacks", "texturePacks")
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index d4ff2c4..46dc698 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -3,42 +3,41 @@
# SPDX-License-Identifier: CC0-1.0
[versions]
-minecraft = "1.21.5"
+minecraft = "1.21.7"
+# Update from https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/
+fabric_kotlin = "1.13.2+kotlin.2.1.20"
# Update from https://kotlinlang.org/
kotlin = "2.1.20"
# Update from https://github.com/google/ksp/releases
kotlin_ksp = "2.1.20-2.0.0"
-# Update from https://linkie.shedaniel.me/dependencies?loader=fabric
-fabric_loader = "0.16.13"
-fabric_api = "0.119.9+1.21.5"
-yarn = "1.21.5+build.1"
-modmenu = "14.0.0-rc.2"
-architectury = "16.0.3"
+# Update from https://linkie.shedaniel.dev/dependencies?loader=fabric
+yarn = "1.21.7+build.8"
+fabric_loader = "0.16.14"
+fabric_api = "0.129.0+1.21.7"
+architectury = "17.0.6"
+modmenu = "15.0.0-beta.3"
# Update from https://maven.architectury.dev/me/shedaniel/RoughlyEnoughItems-fabric/ (but is typically late)
rei = "19.0.805"
-# Update from https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/
-fabric_kotlin = "1.13.2+kotlin.2.1.20"
-
# Update from https://maven.architectury.dev/dev/architectury/loom/dev.architectury.loom.gradle.plugin/
-loom = "1.7.414" # TODO: port back to architectury (and) 1.9.424
+loom = "1.10.433" # TODO: port back to architectury (and) 1.9.424
# Update from https://modrinth.com/mod/qolify/versions?l=fabric
qolify = "1.6.0-1.21.1"
# Update from https://modrinth.com/mod/sodium/versions?l=fabric
-sodium = "mc1.21.5-0.6.13-fabric"
+sodium = "mc1.21.6-0.6.13-fabric"
# Update from https://modrinth.com/mod/freecam/versions?l=fabric
-freecammod = "1.3.3+mc1.21.5"
+freecammod = "1.3.4+mc1.21.6"
# Update from https://modrinth.com/mod/no-chat-reports/versions?l=fabric
-ncr = "Fabric-1.21.5-v2.12.0"
+ncr = "Fabric-1.21.7-v2.14.0"
# Update from https://modrinth.com/mod/female-gender/versions?l=fabric
-femalegender = "4.3.4+1.21.5"
+femalegender = "4.3.4+1.21.7"
shadow = "8.3.8"
@@ -46,18 +45,18 @@ shadow = "8.3.8"
explosiveenhancement = "1.2.3-1.21.0"
# Update from https://modrinth.com/mod/not-enough-animations/versions?l=fabric
-notenoughanimations = "prj4BdjU"
+notenoughanimations = "JTLkasT1"
-# Update from https://modrinth.com/mod/cit-resewn/versions?l=fabric
+# Update from https://modrinth.com/mod/cit-resewn/versions?l=fabric lmao yeah sure
citresewn = "1.2.0+1.21"
# Update from https://modrinth.com/mod/jade/versions?l=fabric
-jade = "18.1.0+fabric"
+jade = "19.0.4+fabric"
devauth = "1.2.1"
# Update from https://ktor.io/docs/
-ktor = "3.1.2"
+ktor = "3.2.2"
# Update from https://repo.nea.moe/#/releases/moe/nea/neurepoparser
neurepoparser = "1.8.0"
@@ -69,7 +68,9 @@ hotswap_agent = "1.4.2-SNAPSHOT"
# Update from https://github.com/LlamaLad7/MixinExtras/tags
mixinextras = "0.4.1"
-jarvis = "1.1.4"
+# Update from https://repo.nea.moe/#/releases/moe/nea/jarvis/
+jarvis = "2.0.0"
+
nealisp = "1.1.0"
# Update from https://github.com/NotEnoughUpdates/MoulConfig/tags
@@ -90,7 +91,7 @@ manninghamMills = "2.4.1"
# Update from https://docs.isxander.dev/yet-another-config-lib/installing-yacl
# Nvm, they just don't update docs: https://modrinth.com/mod/yacl/versions?l=fabric
-yacl = "3.6.6+1.21.5-fabric"
+yacl = "3.7.1+1.21.6-fabric"
# Update from https://maven.shedaniel.me/me/shedaniel/cloth/basic-math/
basicMath = "0.6.1"
@@ -109,7 +110,7 @@ fabric_api_deprecated = { module = "net.fabricmc.fabric-api:fabric-api-deprecate
fabric_kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric_kotlin" }
architectury = { module = "dev.architectury:architectury", version.ref = "architectury" }
rei_api = { module = "me.shedaniel:RoughlyEnoughItems-api", version.ref = "rei" }
-moulconfig = { module = "org.notenoughupdates.moulconfig:modern-1.21.5", version.ref = "moulconfig" }
+moulconfig = { module = "org.notenoughupdates.moulconfig:modern-1.21.7", version.ref = "moulconfig" }
repoparser = { module = "moe.nea:neurepoparser", version.ref = "neurepoparser" }
mixinextras = { module = "io.github.llamalad7:mixinextras-fabric", version.ref = "mixinextras" }
jarvis_api = { module = "moe.nea.jarvis:jarvis-api", version.ref = "jarvis" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 4cdd0fb..8b8fb18 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -4,6 +4,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt
index 10bff1b..addfc42 100644
--- a/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt
+++ b/src/compat/jade/java/moe/nea/firmament/compat/jade/DrillToolProvider.kt
@@ -1,6 +1,5 @@
package moe.nea.firmament.compat.jade
-import java.util.Optional
import java.util.function.UnaryOperator
import snownee.jade.api.BlockAccessor
import snownee.jade.api.IBlockComponentProvider
@@ -8,14 +7,13 @@ import snownee.jade.api.ITooltip
import snownee.jade.api.JadeIds
import snownee.jade.api.config.IPluginConfig
import snownee.jade.api.theme.IThemeHelper
-import snownee.jade.api.ui.IElement
-import snownee.jade.api.ui.IElementHelper
+import snownee.jade.api.ui.Element
+import snownee.jade.api.ui.JadeUI
+import snownee.jade.gui.JadeLinearLayout
import snownee.jade.impl.ui.ItemStackElement
-import snownee.jade.impl.ui.TextElement
-import kotlin.jvm.optionals.getOrDefault
+import snownee.jade.impl.ui.TextElementImpl
import net.minecraft.text.Text
import net.minecraft.util.Identifier
-import net.minecraft.util.math.Vec2f
import moe.nea.firmament.Firmament
import moe.nea.firmament.repo.ExpensiveItemCacheApi
import moe.nea.firmament.repo.RepoManager
@@ -38,34 +36,31 @@ class DrillToolProvider : IBlockComponentProvider {
if (lastItemIndex < 0) return@map inner
val innerMut = inner.toMutableList()
val harvestIndicator = innerMut.indexOfLast {
- it is TextElement && it.cachedSize == Vec2f.ZERO && it.text.visit {
- if (it.isEmpty()) Optional.empty() else Optional.of(true)
- }.getOrDefault(false)
+ it is TextElementImpl && it.width == 0 && it.string.isNotEmpty()
}
val canHarvest = SBItemStack(MC.stackInHand).breakingPower >= customBlock.breakingPower
val lastItem = innerMut[lastItemIndex] as ItemStackElement
if (harvestIndicator < 0) {
- innerMut.add(lastItemIndex + 1, canHarvestIndicator(canHarvest, lastItem.alignment))
+ innerMut.add(lastItemIndex + 1, canHarvestIndicator(canHarvest))
} else {
- innerMut.set(harvestIndicator, canHarvestIndicator(canHarvest, lastItem.alignment))
+ innerMut.set(harvestIndicator, canHarvestIndicator(canHarvest))
}
- innerMut.set(lastItemIndex, IElementHelper.get()
- .item(tool, 0.75f)
- .translate(lastItem.translation)
- .size(lastItem.size)
- .message(null)
- .align(lastItem.alignment))
+ innerMut.set(
+ lastItemIndex, JadeUI
+ .item(tool, 0.75f)
+ )
innerMut.subList(0, lastItemIndex - 1).removeIf { it is ItemStackElement }
innerMut
}
})
}
- fun canHarvestIndicator(canHarvest: Boolean, align: IElement.Align): IElement {
+ fun canHarvestIndicator(canHarvest: Boolean): Element {
val t = IThemeHelper.get()
val text = if (canHarvest) t.success(CHECK) else t.danger(X)
- return IElementHelper.get().text(text)
- .scale(0.75F).zOffset(800).size(Vec2f.ZERO).translate(Vec2f(-3F, 3.25F)).align(align)
+ return JadeUI.text(text)
+ .scale(0.75F)
+ .alignSelfCenter()
}
private val CHECK: Text = Text.literal("✔")
diff --git a/src/compat/jade/java/moe/nea/firmament/mixins/compat/jade/ElementAccessor.java b/src/compat/jade/java/moe/nea/firmament/mixins/compat/jade/ElementAccessor.java
deleted file mode 100644
index 1b58e3c..0000000
--- a/src/compat/jade/java/moe/nea/firmament/mixins/compat/jade/ElementAccessor.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package moe.nea.firmament.mixins.compat.jade;
-
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.gen.Accessor;
-import snownee.jade.api.ui.Element;
-import snownee.jade.api.ui.IElement;
-
-@Mixin(Element.class)
-public interface ElementAccessor {
- @Accessor("align")
- IElement.Align getAlign_firmament();
-}
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt
index 5e4eee3..f881f77 100644
--- a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt
+++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt
@@ -52,9 +52,9 @@ object NEUItemEntryRenderer : EntryRenderer<SBItemStack> {
entry.value.asImmutableItemStack()
}
- context.matrices.push()
- context.matrices.translate(bounds.centerX.toFloat(), bounds.centerY.toFloat(), 0F)
- context.matrices.scale(bounds.width.toFloat() / 16F, bounds.height.toFloat() / 16F, 1f)
+ context.matrices.pushMatrix()
+ context.matrices.translate(bounds.centerX.toFloat(), bounds.centerY.toFloat(), )
+ context.matrices.scale(bounds.width.toFloat() / 16F, bounds.height.toFloat() / 16F, )
context.drawItemWithoutEntity(itemToRender, -8, -8)
context.drawStackOverlay(
minecraft.textRenderer, itemToRender, -8, -8,
@@ -64,7 +64,7 @@ object NEUItemEntryRenderer : EntryRenderer<SBItemStack> {
)
else null
)
- context.matrices.pop()
+ context.matrices.popMatrix()
}
val minecraft = MinecraftClient.getInstance()
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt
index cce1465..f77e9f5 100644
--- a/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt
+++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/recipes/SBKatRecipe.kt
@@ -17,7 +17,6 @@ import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds
import me.shedaniel.rei.api.client.gui.widgets.Widgets
import me.shedaniel.rei.api.client.registry.display.DisplayCategory
import me.shedaniel.rei.api.common.category.CategoryIdentifier
-import me.shedaniel.rei.api.common.util.EntryStacks
import kotlin.time.Duration.Companion.seconds
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.gui.Element
@@ -55,11 +54,13 @@ class SBKatRecipe(override val neuRecipe: NEUKatUpgradeRecipe) : SBRecipe() {
val inputLevelLabelCenter = Point(bounds.minX + 30 - 18 + 5 + 8, bounds.minY + 25)
val inputLevelLabel = Widgets.createLabel(
inputLevelLabelCenter,
- Text.literal("")).centered()
+ Text.literal("")
+ ).centered()
val outputLevelLabelCenter = Point(bounds.maxX - 30 + 8, bounds.minY + 25)
val outputLevelLabel = Widgets.createLabel(
outputLevelLabelCenter,
- Text.literal("")).centered()
+ Text.literal("")
+ ).centered()
val coinStack = SBItemStack(SkyblockId.COINS, recipe.coins.toInt())
levelValue.whenChanged { oldValue, newValue ->
if (oldValue.toInt() == newValue.toInt()) return@whenChanged
@@ -72,40 +73,60 @@ class SBKatRecipe(override val neuRecipe: NEUKatUpgradeRecipe) : SBRecipe() {
inputLevelLabel.message = Text.literal(newInput.levelData.currentLevel.toString())
inputLevelLabel.bounds.location = Point(
inputLevelLabelCenter.x - MC.font.getWidth(inputLevelLabel.message) / 2,
- inputLevelLabelCenter.y)
+ inputLevelLabelCenter.y
+ )
outputLevelLabel.message = Text.literal(newOutput.levelData.currentLevel.toString())
outputLevelLabel.bounds.location = Point(
outputLevelLabelCenter.x - MC.font.getWidth(outputLevelLabel.message) / 2,
- outputLevelLabelCenter.y)
+ outputLevelLabelCenter.y
+ )
coinStack.setStackSize((recipe.coins * (1 - 0.3 * newValue / 100)).toInt())
}
levelValue.set(1F)
add(Widgets.createRecipeBase(bounds))
- add(wrapWidget(Rectangle(bounds.centerX - slider.width / 2,
- bounds.maxY - 30,
- slider.width,
- slider.height),
- slider))
- add(Widgets.withTooltip(
- Widgets.createArrow(Point(bounds.centerX - arrowWidth / 2, bounds.minY + 40)),
- Text.literal("Upgrade time: " + FirmFormatters.formatTimespan(recipe.seconds.seconds))))
+ add(
+ wrapWidget(
+ Rectangle(
+ bounds.centerX - slider.width / 2,
+ bounds.maxY - 30,
+ slider.width,
+ slider.height
+ ),
+ slider
+ )
+ )
+ add(
+ Widgets.withTooltip(
+ Widgets.createArrow(Point(bounds.centerX - arrowWidth / 2, bounds.minY + 40)),
+ Text.literal("Upgrade time: " + FirmFormatters.formatTimespan(recipe.seconds.seconds))
+ )
+ )
add(Widgets.createResultSlotBackground(Point(bounds.maxX - 30, bounds.minY + 40)))
add(inputLevelLabel)
add(outputLevelLabel)
- add(Widgets.createSlot(Point(bounds.maxX - 30, bounds.minY + 40)).markOutput().disableBackground()
- .entry(SBItemEntryDefinition.getEntry(outputStack)))
- add(Widgets.createSlot(Point(bounds.minX + 30 - 18 + 5, bounds.minY + 40)).markInput()
- .entry(SBItemEntryDefinition.getEntry(inputStack)))
+ add(
+ Widgets.createSlot(Point(bounds.maxX - 30, bounds.minY + 40)).markOutput().disableBackground()
+ .entry(SBItemEntryDefinition.getEntry(outputStack))
+ )
+ add(
+ Widgets.createSlot(Point(bounds.minX + 30 - 18 + 5, bounds.minY + 40)).markInput()
+ .entry(SBItemEntryDefinition.getEntry(inputStack))
+ )
val allInputs = recipe.items.map { SBItemEntryDefinition.getEntry(it) } +
listOf(SBItemEntryDefinition.getEntry(coinStack))
for ((index, item) in allInputs.withIndex()) {
- add(Widgets.createSlot(
- Point(bounds.centerX + index * 20 - allInputs.size * 18 / 2 - (allInputs.size - 1) * 2 / 2,
- bounds.minY + 20))
- .markInput()
- .entry(item))
+ add(
+ Widgets.createSlot(
+ Point(
+ bounds.centerX + index * 20 - allInputs.size * 18 / 2 - (allInputs.size - 1) * 2 / 2,
+ bounds.minY + 20
+ )
+ )
+ .markInput()
+ .entry(item)
+ )
}
}
}
@@ -123,8 +144,8 @@ fun wrapWidget(bounds: Rectangle, component: GuiComponent): Widget {
}
override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) {
- context.matrices.push()
- context.matrices.translate(bounds.minX.toFloat(), bounds.minY.toFloat(), 0F)
+ context.matrices.pushMatrix()
+ context.matrices.translate(bounds.minX.toFloat(), bounds.minY.toFloat())
component.render(
GuiImmediateContext(
ModernRenderContext(context),
@@ -133,50 +154,57 @@ fun wrapWidget(bounds: Rectangle, component: GuiComponent): Widget {
mouseX - bounds.minX, mouseY - bounds.minY,
mouseX, mouseY,
mouseX.toFloat(), mouseY.toFloat()
- ))
- context.matrices.pop()
+ )
+ )
+ context.matrices.popMatrix()
}
override fun mouseMoved(mouseX: Double, mouseY: Double) {
val mouseXInt = mouseX.toInt()
val mouseYInt = mouseY.toInt()
- component.mouseEvent(MouseEvent.Move(0F, 0F),
- GuiImmediateContext(
- IMinecraft.instance.provideTopLevelRenderContext(),
- bounds.minX, bounds.minY,
- bounds.width, bounds.height,
- mouseXInt - bounds.minX, mouseYInt - bounds.minY,
- mouseXInt, mouseYInt,
- mouseX.toFloat(), mouseY.toFloat()
- ))
+ component.mouseEvent(
+ MouseEvent.Move(0F, 0F),
+ GuiImmediateContext(
+ IMinecraft.instance.provideTopLevelRenderContext(),
+ bounds.minX, bounds.minY,
+ bounds.width, bounds.height,
+ mouseXInt - bounds.minX, mouseYInt - bounds.minY,
+ mouseXInt, mouseYInt,
+ mouseX.toFloat(), mouseY.toFloat()
+ )
+ )
}
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
val mouseXInt = mouseX.toInt()
val mouseYInt = mouseY.toInt()
- return component.mouseEvent(MouseEvent.Click(button, true),
- GuiImmediateContext(
- IMinecraft.instance.provideTopLevelRenderContext(),
- bounds.minX, bounds.minY,
- bounds.width, bounds.height,
- mouseXInt - bounds.minX, mouseYInt - bounds.minY,
- mouseXInt, mouseYInt,
- mouseX.toFloat(), mouseY.toFloat()
- ))
+ return component.mouseEvent(
+ MouseEvent.Click(button, true),
+ GuiImmediateContext(
+ IMinecraft.instance.provideTopLevelRenderContext(),
+ bounds.minX, bounds.minY,
+ bounds.width, bounds.height,
+ mouseXInt - bounds.minX, mouseYInt - bounds.minY,
+ mouseXInt, mouseYInt,
+ mouseX.toFloat(), mouseY.toFloat()
+ )
+ )
}
override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean {
val mouseXInt = mouseX.toInt()
val mouseYInt = mouseY.toInt()
- return component.mouseEvent(MouseEvent.Click(button, false),
- GuiImmediateContext(
- IMinecraft.instance.provideTopLevelRenderContext(),
- bounds.minX, bounds.minY,
- bounds.width, bounds.height,
- mouseXInt - bounds.minX, mouseYInt - bounds.minY,
- mouseXInt, mouseYInt,
- mouseX.toFloat(), mouseY.toFloat()
- ))
+ return component.mouseEvent(
+ MouseEvent.Click(button, false),
+ GuiImmediateContext(
+ IMinecraft.instance.provideTopLevelRenderContext(),
+ bounds.minX, bounds.minY,
+ bounds.width, bounds.height,
+ mouseXInt - bounds.minX, mouseYInt - bounds.minY,
+ mouseXInt, mouseYInt,
+ mouseX.toFloat(), mouseY.toFloat()
+ )
+ )
}
override fun mouseDragged(
@@ -188,15 +216,17 @@ fun wrapWidget(bounds: Rectangle, component: GuiComponent): Widget {
): Boolean {
val mouseXInt = mouseX.toInt()
val mouseYInt = mouseY.toInt()
- return component.mouseEvent(MouseEvent.Move(deltaX.toFloat(), deltaY.toFloat()),
- GuiImmediateContext(
- IMinecraft.instance.provideTopLevelRenderContext(),
- bounds.minX, bounds.minY,
- bounds.width, bounds.height,
- mouseXInt - bounds.minX, mouseYInt - bounds.minY,
- mouseXInt, mouseYInt,
- mouseX.toFloat(), mouseY.toFloat()
- ))
+ return component.mouseEvent(
+ MouseEvent.Move(deltaX.toFloat(), deltaY.toFloat()),
+ GuiImmediateContext(
+ IMinecraft.instance.provideTopLevelRenderContext(),
+ bounds.minX, bounds.minY,
+ bounds.width, bounds.height,
+ mouseXInt - bounds.minX, mouseYInt - bounds.minY,
+ mouseXInt, mouseYInt,
+ mouseX.toFloat(), mouseY.toFloat()
+ )
+ )
}
@@ -208,15 +238,17 @@ fun wrapWidget(bounds: Rectangle, component: GuiComponent): Widget {
): Boolean {
val mouseXInt = mouseX.toInt()
val mouseYInt = mouseY.toInt()
- return component.mouseEvent(MouseEvent.Scroll(verticalAmount.toFloat()),
- GuiImmediateContext(
- IMinecraft.instance.provideTopLevelRenderContext(),
- bounds.minX, bounds.minY,
- bounds.width, bounds.height,
- mouseXInt - bounds.minX, mouseYInt - bounds.minY,
- mouseXInt, mouseYInt,
- mouseX.toFloat(), mouseY.toFloat()
- ))
+ return component.mouseEvent(
+ MouseEvent.Scroll(verticalAmount.toFloat()),
+ GuiImmediateContext(
+ IMinecraft.instance.provideTopLevelRenderContext(),
+ bounds.minX, bounds.minY,
+ bounds.width, bounds.height,
+ mouseXInt - bounds.minX, mouseYInt - bounds.minY,
+ mouseXInt, mouseYInt,
+ mouseX.toFloat(), mouseY.toFloat()
+ )
+ )
}
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
index c5af8b6..2a58921 100644
--- a/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
@@ -1,17 +1,16 @@
package moe.nea.firmament.mixins;
-import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import moe.nea.firmament.features.fixes.Fixes;
import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.gui.screen.ingame.StatusEffectsDisplay;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(InventoryScreen.class)
+@Mixin(StatusEffectsDisplay.class)
public abstract class HideStatusEffectsPatch {
@Shadow
public abstract boolean shouldHideStatusEffectHud();
@@ -21,9 +20,11 @@ public abstract class HideStatusEffectsPatch {
cir.setReturnValue(!Fixes.TConfig.INSTANCE.getHidePotionEffects());
}
- @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/StatusEffectsDisplay;drawStatusEffects(Lnet/minecraft/client/gui/DrawContext;IIF)V"))
- private boolean conditionalRenderStatuses(StatusEffectsDisplay instance, DrawContext context, int mouseX, int mouseY, float tickDelta) {
- return shouldHideStatusEffectHud() || !Fixes.TConfig.INSTANCE.getHidePotionEffects();
+ @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true)
+ private void conditionalRenderStatuses(DrawContext context, int mouseX, int mouseY, CallbackInfo ci) {
+ if (shouldHideStatusEffectHud() || !Fixes.TConfig.INSTANCE.getHidePotionEffects()) {
+ ci.cancel();
+ }
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
index 43aec40..a5fec35 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
@@ -62,12 +62,12 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
}
}
- @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawForeground(Lnet/minecraft/client/gui/DrawContext;II)V", shift = At.Shift.AFTER))
+ @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;renderMain(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER))
public void onAfterRenderForeground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- context.getMatrices().push();
- context.getMatrices().translate(-x, -y, 0);
+ context.getMatrices().pushMatrix();
+ context.getMatrices().translate(-x, -y);
HandledScreenForegroundEvent.Companion.publish(new HandledScreenForegroundEvent((HandledScreen<?>) (Object) this, context, mouseX, mouseY, delta));
- context.getMatrices().pop();
+ context.getMatrices().popMatrix();
}
@Inject(method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V", at = @At("HEAD"), cancellable = true)
diff --git a/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java b/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
index f07604e..86f6806 100644
--- a/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientPlayerEntity.class)
public abstract class PlayerDropEventPatch extends PlayerEntity {
public PlayerDropEventPatch() {
- super(null, null, 0, null);
+ super(null, null);
}
@Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true)
diff --git a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
index 3ed8c1b..e268819 100644
--- a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
@@ -2,8 +2,10 @@
package moe.nea.firmament.mixins;
+import com.mojang.blaze3d.buffers.GpuBufferSlice;
import moe.nea.firmament.events.WorldRenderLastEvent;
import net.minecraft.client.render.*;
+import net.minecraft.client.render.fog.FogRenderer;
import net.minecraft.client.util.Handle;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.profiler.Profiler;
@@ -29,7 +31,7 @@ public abstract class WorldRenderLastEventPatch {
protected abstract void checkEmpty(MatrixStack matrices);
@Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V", shift = At.Shift.AFTER))
- public void onWorldRenderLast(Fog fog, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Matrix4f matrix4f2, Handle handle, Handle handle2, boolean bl, Frustum frustum, Handle handle3, Handle handle4, CallbackInfo ci) {
+ public void onWorldRenderLast(GpuBufferSlice gpuBufferSlice, RenderTickCounter renderTickCounter, Camera camera, Profiler profiler, Matrix4f matrix4f, Handle handle, Handle handle2, boolean bl, Frustum frustum, Handle handle3, Handle handle4, CallbackInfo ci) {
var imm = this.bufferBuilders.getEntityVertexConsumers();
var stack = new MatrixStack();
// TODO: pre-cancel this event if F1 is active
diff --git a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
index 5a92f89..e1bdd7e 100644
--- a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
@@ -29,7 +29,7 @@ public abstract class CustomCapeFeatureRenderer extends FeatureRenderer<PlayerEn
method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BipedEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V")
)
- private void onRender(BipedEntityModel instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, Operation<Void> original, @Local PlayerEntityRenderState playerEntityRenderState, @Local SkinTextures skinTextures, @Local VertexConsumerProvider vertexConsumerProvider) {
+ private void onRender(BipedEntityModel<PlayerEntityRenderState> instance, MatrixStack matrixStack, VertexConsumer vertexConsumer, int light, int overlay, Operation<Void> original, @Local(argsOnly = true) PlayerEntityRenderState playerEntityRenderState, @Local SkinTextures skinTextures, @Local VertexConsumerProvider vertexConsumerProvider) {
CustomCapes.render(
playerEntityRenderState,
vertexConsumer,
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("TkVVQlVUVE9OUy9bIntcblx0XCJ4XCI6IDE2MCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcImJvbmVcIixcblx0XCJjb21tYW5kXCI6IFwicGV0c1wiXG59Iiwie1xuXHRcInhcIjogMTQwLFxuXHRcInlcIjogLTIwLFxuXHRcImFuY2hvclJpZ2h0XCI6IGZhbHNlLFxuXHRcImFuY2hvckJvdHRvbVwiOiBmYWxzZSxcblx0XCJpY29uXCI6IFwiYXJtb3Jfc3RhbmRcIixcblx0XCJjb21tYW5kXCI6IFwid2FyZHJvYmVcIlxufSIsIntcblx0XCJ4XCI6IDEyMCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcImVuZGVyX2NoZXN0XCIsXG5cdFwiY29tbWFuZFwiOiBcInN0b3JhZ2VcIlxufSIsIntcblx0XCJ4XCI6IDEwMCxcblx0XCJ5XCI6IC0yMCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcInNrdWxsOmQ3Y2M2Njg3NDIzZDA1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MCxcblx0XCJhbmNob3JSaWdodFwiOiBmYWxzZSxcblx0XCJhbmNob3JCb3R0b21cIjogZmFsc2UsXG5cdFwiaWNvblwiOiBcInNrdWxsOmQ3Y2M2Njg3NDIzZDA1NzBkNTU2YWM1M2UwNjc2Y2I1NjNiYmRkOTcxN2NkODI2OWJkZWJlZDZmNmQ0ZTdiZjhcIixcblx0XCJjb21tYW5kXCI6IFwid2FycCBpc2xhbmRcIlxufSIsIntcblx0XCJ4XCI6IDgwLFxuXHRcInlcIjogLTIwLFxuXHRcImFuY2hvclJpZ2h0XCI6IGZhbHNlLFxuXHRcImFuY2hvckJvdHRvbVwiOiBmYWxzZSxcblx0XCJpY29uXCI6IFwic2t1bGw6MzVmNGI0MGNlZjllMDE3Y2Q0MTEyZDI2YjYyNTU3ZjhjMWQ1YjE4OWRhMmU5OTUzNDIyMmJjOGNlYzdkOTE5NlwiLFxuXHRcImNvbW1hbmRcIjogXCJ3YXJwIGh1YlwiXG59Il0="
+ )
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 = InventoryButtonTemplates.loadTemplate("TkVVQlVUVE9OUy9bIntcblx0XCJ4XCI6IDIsXG5cdFwieVwiOiAtODQsXG5cdFwiYW5jaG9yUmlnaHRcIjogdHJ1ZSxcblx0XCJhbmNob3JCb3R0b21cIjogdHJ1ZSxcblx0XCJpY29uXCI6IFwic2t1bGw6YzljODg4MWU0MjkxNWE5ZDI5YmI2MWExNmZiMjZkMDU5OTEzMjA0ZDI2NWRmNWI0MzliM2Q3OTJhY2Q1NlwiLFxuXHRcImNvbW1hbmRcIjogX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YzI0ZTY5NGMzZWVhNjI5ZWE5NDRmNGNmMzBkY2ZiNGZiY2UwNzFcIixcblx0XCJjb21tYW5kXCI6IFwid2FycCBuZXRoZXJcIlxufSJd"
+ )
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),
diff --git a/src/main/kotlin/gui/BarComponent.kt b/src/main/kotlin/gui/BarComponent.kt
index da781da..563e159 100644
--- a/src/main/kotlin/gui/BarComponent.kt
+++ b/src/main/kotlin/gui/BarComponent.kt
@@ -8,6 +8,7 @@ import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext
import io.github.notenoughupdates.moulconfig.observer.GetSetter
import io.github.notenoughupdates.moulconfig.platform.ModernRenderContext
import me.shedaniel.math.Color
+import net.minecraft.client.gl.RenderPipelines
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.render.RenderLayer
import net.minecraft.util.Identifier
@@ -33,7 +34,7 @@ class BarComponent(
) {
fun draw(context: DrawContext, x: Int, y: Int, width: Int, height: Int, color: Color) {
context.drawTexturedQuad(
- RenderLayer::getGuiTextured,
+ RenderPipelines.GUI_TEXTURED,
identifier,
x, y, x + width, x + height,
u1, u2, v1, v2,
@@ -104,7 +105,6 @@ class BarComponent(
(context.width - 4) * total.get() / context.width,
total.get()
)
- RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
}
diff --git a/src/main/kotlin/gui/CheckboxComponent.kt b/src/main/kotlin/gui/CheckboxComponent.kt
index fc48661..9baf720 100644
--- a/src/main/kotlin/gui/CheckboxComponent.kt
+++ b/src/main/kotlin/gui/CheckboxComponent.kt
@@ -5,6 +5,7 @@ import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext
import io.github.notenoughupdates.moulconfig.gui.MouseEvent
import io.github.notenoughupdates.moulconfig.observer.GetSetter
import io.github.notenoughupdates.moulconfig.platform.ModernRenderContext
+import net.minecraft.client.gl.RenderPipelines
import net.minecraft.client.render.RenderLayer
import moe.nea.firmament.Firmament
@@ -27,7 +28,7 @@ class CheckboxComponent<T>(
override fun render(context: GuiImmediateContext) {
val ctx = (context.renderContext as ModernRenderContext).drawContext
ctx.drawGuiTexture(
- RenderLayer::getGuiTextured,
+ RenderPipelines.GUI_TEXTURED,
if (isEnabled()) Firmament.identifier("widget/checkbox_checked")
else Firmament.identifier("widget/checkbox_unchecked"),
0, 0,
diff --git a/src/main/kotlin/gui/config/HudMetaHandler.kt b/src/main/kotlin/gui/config/HudMetaHandler.kt
index a9659ee..0637351 100644
--- a/src/main/kotlin/gui/config/HudMetaHandler.kt
+++ b/src/main/kotlin/gui/config/HudMetaHandler.kt
@@ -8,18 +8,25 @@ import kotlinx.serialization.json.encodeToJsonElement
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.MutableText
import net.minecraft.text.Text
+import moe.nea.firmament.Firmament
import moe.nea.firmament.gui.FirmButtonComponent
import moe.nea.firmament.jarvis.JarvisIntegration
import moe.nea.firmament.util.MC
-class HudMetaHandler(val config: ManagedConfig, val label: MutableText, val width: Int, val height: Int) :
+class HudMetaHandler(
+ val config: ManagedConfig,
+ val propertyName: String,
+ val label: MutableText,
+ val width: Int,
+ val height: Int
+) :
ManagedConfig.OptionHandler<HudMeta> {
override fun toJson(element: HudMeta): JsonElement? {
return Json.encodeToJsonElement(element.position)
}
override fun fromJson(element: JsonElement): HudMeta {
- return HudMeta(Json.decodeFromJsonElement(element), label, width, height)
+ return HudMeta(Json.decodeFromJsonElement(element), Firmament.identifier(propertyName), label, width, height)
}
fun openEditor(option: ManagedOption<HudMeta>, oldScreen: Screen) {
@@ -34,7 +41,8 @@ class HudMetaHandler(val config: ManagedConfig, val label: MutableText, val widt
opt.labelText,
FirmButtonComponent(
TextComponent(
- Text.stringifiedTranslatable("firmament.hud.edit", label).string),
+ Text.stringifiedTranslatable("firmament.hud.edit", label).string
+ ),
) {
openEditor(opt, guiAppender.screenAccessor())
})
diff --git a/src/main/kotlin/gui/config/JAnyHud.kt b/src/main/kotlin/gui/config/JAnyHud.kt
index 35c4eb2..1cde4f9 100644
--- a/src/main/kotlin/gui/config/JAnyHud.kt
+++ b/src/main/kotlin/gui/config/JAnyHud.kt
@@ -1,48 +1,67 @@
-
-
package moe.nea.firmament.gui.config
import moe.nea.jarvis.api.JarvisHud
-import moe.nea.jarvis.api.JarvisScalable
+import org.joml.Matrix3x2f
+import org.joml.Vector2i
+import org.joml.Vector2ic
import kotlinx.serialization.Serializable
import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+import moe.nea.firmament.jarvis.JarvisIntegration
@Serializable
data class HudPosition(
- var x: Double,
- var y: Double,
- var scale: Float,
+ var x: Int,
+ var y: Int,
+ var scale: Float,
)
data class HudMeta(
- val position: HudPosition,
- private val label: Text,
- private val width: Int,
- private val height: Int,
-) : JarvisScalable, JarvisHud {
- override fun getX(): Double = position.x
+ val position: HudPosition,
+ private val id: Identifier,
+ private val label: Text,
+ private val width: Int,
+ private val height: Int,
+) : JarvisHud, JarvisHud.Scalable {
+ override fun getLabel(): Text = label
+ override fun getUnscaledWidth(): Int {
+ return width
+ }
+
+ override fun getUnscaledHeight(): Int {
+ return height
+ }
- override fun setX(newX: Double) {
- position.x = newX
- }
+ override fun getHudId(): Identifier {
+ return id
+ }
- override fun getY(): Double = position.y
+ override fun getPosition(): Vector2ic {
+ return Vector2i(position.x, position.y)
+ }
- override fun setY(newY: Double) {
- position.y = newY
- }
+ override fun setPosition(p0: Vector2ic) {
+ position.x = p0.x()
+ position.y = p0.y()
+ }
- override fun getLabel(): Text = label
+ override fun isEnabled(): Boolean {
+ return true // TODO: this should be actually truthful, if possible
+ }
- override fun getWidth(): Int = width
+ override fun isVisible(): Boolean {
+ return true // TODO: this should be actually truthful, if possible
+ }
- override fun getHeight(): Int = height
+ override fun getScale(): Float = position.scale
- override fun getScale(): Float = position.scale
+ override fun setScale(newScale: Float) {
+ position.scale = newScale
+ }
- override fun setScale(newScale: Float) {
- position.scale = newScale
- }
+ fun applyTransformations(matrix4f: Matrix3x2f) {
+ applyTransformations(JarvisIntegration.jarvis, matrix4f)
+ }
}
diff --git a/src/main/kotlin/gui/config/ManagedConfig.kt b/src/main/kotlin/gui/config/ManagedConfig.kt
index 12b82d6..71d8c66 100644
--- a/src/main/kotlin/gui/config/ManagedConfig.kt
+++ b/src/main/kotlin/gui/config/ManagedConfig.kt
@@ -12,6 +12,7 @@ import io.github.notenoughupdates.moulconfig.gui.component.RowComponent
import io.github.notenoughupdates.moulconfig.gui.component.ScrollPanelComponent
import io.github.notenoughupdates.moulconfig.gui.component.TextComponent
import moe.nea.jarvis.api.Point
+import org.joml.Vector2i
import org.lwjgl.glfw.GLFW
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.JsonElement
@@ -172,13 +173,13 @@ abstract class ManagedConfig(
propertyName: String,
width: Int,
height: Int,
- default: () -> Point,
+ default: () -> Vector2i,
): ManagedOption<HudMeta> {
val label = Text.translatable("firmament.config.${name}.${propertyName}")
return option(propertyName, {
val p = default()
- HudMeta(HudPosition(p.x, p.y, 1F), label, width, height)
- }, HudMetaHandler(this, label, width, height))
+ HudMeta(HudPosition(p.x(), p.y(), 1F), Firmament.identifier(propertyName), label, width, height)
+ }, HudMetaHandler(this, propertyName, label, width, height))
}
protected fun keyBinding(
diff --git a/src/main/kotlin/gui/entity/EntityRenderer.kt b/src/main/kotlin/gui/entity/EntityRenderer.kt
index a1b2577..c17169b 100644
--- a/src/main/kotlin/gui/entity/EntityRenderer.kt
+++ b/src/main/kotlin/gui/entity/EntityRenderer.kt
@@ -121,7 +121,8 @@ object EntityRenderer {
for (modifierJson in modifiers) {
val modifier = ErrorUtil.notNullOr(
modifierJson["type"]?.asString?.let(entityModifiers::get),
- "Could not create entity with id $entityId. Failed to apply modifier $modifierJson") { return null }
+ "Could not create entity with id $entityId. Failed to apply modifier $modifierJson"
+ ) { return null }
entity = modifier.apply(entity, modifierJson)
}
return entity
@@ -217,8 +218,8 @@ object EntityRenderer {
val vector3f = Vector3f(0.0f, (entity.height / 2.0f + bottomOffset).toFloat(), 0.0f)
InventoryScreen.drawEntity(
context,
- centerX,
- centerY,
+ x1, y1,
+ x2, y2,
size.toFloat(),
vector3f,
rotateToFaceTheFront,
diff --git a/src/main/kotlin/gui/hud/MoulConfigHud.kt b/src/main/kotlin/gui/hud/MoulConfigHud.kt
index e99b069..14b7232 100644
--- a/src/main/kotlin/gui/hud/MoulConfigHud.kt
+++ b/src/main/kotlin/gui/hud/MoulConfigHud.kt
@@ -9,6 +9,7 @@ import net.minecraft.resource.SynchronousResourceReloader
import moe.nea.firmament.events.FinalizeResourceManagerEvent
import moe.nea.firmament.events.HudRenderEvent
import moe.nea.firmament.gui.config.HudMeta
+import moe.nea.firmament.jarvis.JarvisIntegration
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.MoulConfigUtils
@@ -42,13 +43,14 @@ abstract class MoulConfigHud(
val renderContext = componentWrapper.createContext(it.context)
if (fragment == null)
loadFragment()
- it.context.matrices.push()
+ it.context.matrices.pushMatrix()
hudMeta.applyTransformations(it.context.matrices)
- val renderContextTranslated =
- renderContext.translated(hudMeta.absoluteX, hudMeta.absoluteY, hudMeta.width, hudMeta.height)
+ val pos = hudMeta.getEffectivePosition(JarvisIntegration.jarvis)
+ val renderContextTranslated =
+ renderContext.translated(pos.x(), pos.y(), hudMeta.effectiveWidth, hudMeta.effectiveHeight)
.scaled(hudMeta.scale)
fragment!!.root.render(renderContextTranslated)
- it.context.matrices.pop()
+ it.context.matrices.popMatrix()
}
FinalizeResourceManagerEvent.subscribe("MoulConfigHud:finalizeResourceManager") {
MC.resourceManager.registerReloader(object : SynchronousResourceReloader {
diff --git a/src/main/kotlin/repo/ItemCache.kt b/src/main/kotlin/repo/ItemCache.kt
index 14decd8..72549e9 100644
--- a/src/main/kotlin/repo/ItemCache.kt
+++ b/src/main/kotlin/repo/ItemCache.kt
@@ -47,6 +47,7 @@ import moe.nea.firmament.util.directLiteralStringContent
import moe.nea.firmament.util.mc.FirmamentDataComponentTypes
import moe.nea.firmament.util.mc.appendLore
import moe.nea.firmament.util.mc.displayNameAccordingToNbt
+import moe.nea.firmament.util.mc.loadItemFromNbt
import moe.nea.firmament.util.mc.loreAccordingToNbt
import moe.nea.firmament.util.mc.modifyLore
import moe.nea.firmament.util.mc.setCustomName
@@ -70,7 +71,7 @@ object ItemCache : IReloadable {
@ExpensiveItemCacheApi
private fun NbtCompound.transformFrom10809ToModern() = convert189ToModern(this@transformFrom10809ToModern)
- val currentSaveVersion = SharedConstants.getGameVersion().saveVersion.id
+ val currentSaveVersion = SharedConstants.getGameVersion().dataVersion().id
@ExpensiveItemCacheApi
fun convert189ToModern(nbtComponent: NbtCompound): NbtCompound? =
@@ -171,7 +172,7 @@ object ItemCache : IReloadable {
?: return brokenItemStack(this)
}
val itemInstance =
- ItemStack.fromNbt(MC.defaultRegistries, modernItemTag).getOrNull() ?: return brokenItemStack(this)
+ loadItemFromNbt( modernItemTag) ?: return brokenItemStack(this)
if (usedOldNbt) {
val tag = oldItemTag.getCompound("tag")
val extraAttributes = tag.flatMap { it.getCompound("ExtraAttributes") }
diff --git a/src/main/kotlin/repo/MiningRepoData.kt b/src/main/kotlin/repo/MiningRepoData.kt
index e96a241..055253f 100644
--- a/src/main/kotlin/repo/MiningRepoData.kt
+++ b/src/main/kotlin/repo/MiningRepoData.kt
@@ -23,6 +23,7 @@ import moe.nea.firmament.util.SkyBlockIsland
import moe.nea.firmament.util.SkyblockId
import moe.nea.firmament.util.mc.FirmamentDataComponentTypes
import moe.nea.firmament.util.mc.displayNameAccordingToNbt
+import moe.nea.firmament.util.mc.loadItemFromNbt
import moe.nea.firmament.util.skyblockId
class MiningRepoData : IReloadable {
@@ -118,7 +119,7 @@ class MiningRepoData : IReloadable {
putString("id", itemId)
putShort("Damage", damage)
}) ?: return null
- val itemStack = ItemStack.fromNbt(MC.defaultRegistries, newCompound).getOrNull() ?: return null
+ val itemStack = loadItemFromNbt(newCompound) ?: return null
val blockItem = itemStack.item as? BlockItem ?: return null
return blockItem.block
}
diff --git a/src/main/kotlin/util/FragmentGuiScreen.kt b/src/main/kotlin/util/FragmentGuiScreen.kt
index 5e13d51..c4d9ac0 100644
--- a/src/main/kotlin/util/FragmentGuiScreen.kt
+++ b/src/main/kotlin/util/FragmentGuiScreen.kt
@@ -19,13 +19,9 @@ abstract class FragmentGuiScreen(
popup = MoulConfigFragment(context, position) { popup = null }
}
- 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, 1000f)
- popup?.render(context, mouseX, mouseY, delta)
- context.matrices.pop()
- }
+ fun renderPopup(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float) {
+ popup?.render(context, mouseX, mouseY, delta)
+ }
private inline fun ifPopup(ifYes: (MoulConfigFragment) -> Unit): Boolean {
val p = popup ?: return false
diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt
index e85b119..d597beb 100644
--- a/src/main/kotlin/util/MC.kt
+++ b/src/main/kotlin/util/MC.kt
@@ -16,11 +16,13 @@ import net.minecraft.client.world.ClientWorld
import net.minecraft.entity.Entity
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
+import net.minecraft.nbt.NbtOps
import net.minecraft.network.packet.c2s.play.CommandExecutionC2SPacket
import net.minecraft.registry.BuiltinRegistries
import net.minecraft.registry.Registry
import net.minecraft.registry.RegistryKey
import net.minecraft.registry.RegistryKeys
+import net.minecraft.registry.RegistryOps
import net.minecraft.registry.RegistryWrapper
import net.minecraft.resource.ReloadableResourceManagerImpl
import net.minecraft.text.Text
@@ -74,7 +76,7 @@ object MC {
fun sendCommand(command: String) {
// TODO: add a queue to this and sendServerChat
ErrorUtil.softCheck("Server commands have an implied /", !command.startsWith("/"))
- player?.networkHandler?.sendCommand(command)
+ player?.networkHandler?.sendChatCommand(command)
}
fun onMainThread(block: () -> Unit) {
@@ -117,6 +119,7 @@ object MC {
inline val window get() = instance.window
inline val currentRegistries: RegistryWrapper.WrapperLookup? get() = world?.registryManager
val defaultRegistries: RegistryWrapper.WrapperLookup by lazy { BuiltinRegistries.createWrapperLookup() }
+ val defaultRegistryNbtOps by lazy { RegistryOps.of(NbtOps.INSTANCE, defaultRegistries) }
inline val currentOrDefaultRegistries get() = currentRegistries ?: defaultRegistries
val defaultItems: RegistryWrapper.Impl<Item> by lazy { defaultRegistries.getOrThrow(RegistryKeys.ITEM) }
var currentTick = 0
diff --git a/src/main/kotlin/util/MoulConfigFragment.kt b/src/main/kotlin/util/MoulConfigFragment.kt
index 28ccfd0..1aaea0a 100644
--- a/src/main/kotlin/util/MoulConfigFragment.kt
+++ b/src/main/kotlin/util/MoulConfigFragment.kt
@@ -31,10 +31,10 @@ class MoulConfigFragment(
override fun render(drawContext: DrawContext?, i: Int, j: Int, f: Float) {
val ctx = createContext(drawContext)
val m = drawContext!!.matrices
- m.push()
- m.translate(position.x.toFloat(), position.y.toFloat(), 0F)
+ m.pushMatrix()
+ m.translate(position.x.toFloat(), position.y.toFloat())
context.root.render(ctx)
- m.pop()
+ m.popMatrix()
ctx.renderContext.renderExtraLayers()
}
diff --git a/src/main/kotlin/util/MoulConfigUtils.kt b/src/main/kotlin/util/MoulConfigUtils.kt
index 51ff340..048ec0a 100644
--- a/src/main/kotlin/util/MoulConfigUtils.kt
+++ b/src/main/kotlin/util/MoulConfigUtils.kt
@@ -316,10 +316,10 @@ object MoulConfigUtils {
mouseY: Int
) {
val immContext = createInPlaceFullContext(this, mouseX, mouseY)
- matrices.push()
- matrices.translate(x.toFloat(), y.toFloat(), 0F)
+ matrices.pushMatrix()
+ matrices.translate(x.toFloat(), y.toFloat())
component.render(immContext.translated(x, y, w, h))
- matrices.pop()
+ matrices.popMatrix()
}
diff --git a/src/main/kotlin/util/mc/ItemUtil.kt b/src/main/kotlin/util/mc/ItemUtil.kt
index 13519cf..3cabb8e 100644
--- a/src/main/kotlin/util/mc/ItemUtil.kt
+++ b/src/main/kotlin/util/mc/ItemUtil.kt
@@ -1,20 +1,30 @@
package moe.nea.firmament.util.mc
+import kotlin.jvm.optionals.getOrNull
import net.minecraft.item.ItemStack
+import net.minecraft.nbt.NbtCompound
+import net.minecraft.nbt.NbtOps
+import net.minecraft.registry.RegistryOps
+import net.minecraft.registry.RegistryWrapper
import net.minecraft.text.Text
+import moe.nea.firmament.util.MC
fun ItemStack.appendLore(args: List<Text>) {
- if (args.isEmpty()) return
- modifyLore {
- val loreList = loreAccordingToNbt.toMutableList()
- for (arg in args) {
- loreList.add(arg)
- }
- loreList
- }
+ if (args.isEmpty()) return
+ modifyLore {
+ val loreList = loreAccordingToNbt.toMutableList()
+ for (arg in args) {
+ loreList.add(arg)
+ }
+ loreList
+ }
}
fun ItemStack.modifyLore(update: (List<Text>) -> List<Text>) {
- val loreList = loreAccordingToNbt
- loreAccordingToNbt = update(loreList)
+ val loreList = loreAccordingToNbt
+ loreAccordingToNbt = update(loreList)
+}
+
+fun loadItemFromNbt(nbt: NbtCompound, registries: RegistryWrapper.WrapperLookup = MC.defaultRegistries): ItemStack? {
+ return ItemStack.CODEC.decode(RegistryOps.of(NbtOps.INSTANCE, registries), nbt).result().getOrNull()?.first
}
diff --git a/src/main/kotlin/util/render/CustomRenderLayers.kt b/src/main/kotlin/util/render/CustomRenderLayers.kt
index f713a81..6c14bf6 100644
--- a/src/main/kotlin/util/render/CustomRenderLayers.kt
+++ b/src/main/kotlin/util/render/CustomRenderLayers.kt
@@ -31,7 +31,7 @@ object CustomRenderPipelines {
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
.build()
val COLORED_OMNIPRESENT_QUADS =
- RenderPipeline.builder(RenderPipelines.MATRICES_COLOR_SNIPPET)// TODO: split this up to support better transparent ordering.
+ RenderPipeline.builder(RenderPipelines.TRANSFORMS_AND_PROJECTION_SNIPPET)// TODO: split this up to support better transparent ordering.
.withLocation(Firmament.identifier("colored_omnipresent_quads"))
.withVertexShader("core/position_color")
.withFragmentShader("core/position_color")
@@ -46,7 +46,7 @@ object CustomRenderPipelines {
RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET)
.withVertexFormat(VertexFormats.POSITION_TEXTURE_COLOR, DrawMode.TRIANGLES)
.withLocation(Firmament.identifier("gui_textured_overlay_tris_circle"))
- .withUniform("InnerCutoutRadius", UniformType.FLOAT)
+ .withUniform("InnerCutoutRadius", UniformType.UNIFORM_BUFFER)
.withFragmentShader(Firmament.identifier("circle_discard_color"))
.withBlend(BlendFunction.TRANSLUCENT)
.build()
@@ -57,12 +57,12 @@ object CustomRenderPipelines {
.withSampler("Sampler0")
.withSampler("Sampler1")
.withSampler("Sampler3")
- .withUniform("Animation", UniformType.FLOAT)
+ .withUniform("Animation", UniformType.UNIFORM_BUFFER)
.build()
}
object CustomRenderLayers {
- inline fun memoizeTextured(crossinline func: (Identifier) -> RenderLayer) = memoize(func)
+ inline fun memoizeTextured(crossinline func: (Identifier) -> RenderLayer.MultiPhase) = memoize(func)
inline fun <T, R> memoize(crossinline func: (T) -> R): Function<T, R> {
return Util.memoize { it: T -> func(it) }
}
@@ -73,7 +73,7 @@ object CustomRenderLayers {
RenderLayer.DEFAULT_BUFFER_SIZE,
CustomRenderPipelines.GUI_TEXTURED_NO_DEPTH_TRIS,
RenderLayer.MultiPhaseParameters.builder().texture(
- RenderPhase.Texture(texture, TriState.DEFAULT, false)
+ RenderPhase.Texture(texture, false)
)
.build(false)
)
diff --git a/src/main/kotlin/util/render/DrawContextExt.kt b/src/main/kotlin/util/render/DrawContextExt.kt
index a833c86..d11ba6a 100644
--- a/src/main/kotlin/util/render/DrawContextExt.kt
+++ b/src/main/kotlin/util/render/DrawContextExt.kt
@@ -2,26 +2,27 @@ package moe.nea.firmament.util.render
import com.mojang.blaze3d.systems.RenderSystem
import me.shedaniel.math.Color
-import org.joml.Matrix4f
import util.render.CustomRenderLayers
+import net.minecraft.client.gl.RenderPipelines
import net.minecraft.client.gui.DrawContext
-import net.minecraft.client.render.RenderLayer
+import net.minecraft.client.gui.ScreenRect
+import net.minecraft.client.gui.render.state.special.SpecialGuiElementRenderState
import net.minecraft.util.Identifier
import moe.nea.firmament.util.MC
fun DrawContext.isUntranslatedGuiDrawContext(): Boolean {
- return (matrices.peek().positionMatrix.properties() and Matrix4f.PROPERTY_IDENTITY.toInt()) != 0
+ return matrices.m00 == 1F && matrices.m11 == 1f && matrices.m01 == 0F && matrices.m10 == 0F && matrices.m20 == 1f && matrices.m21 == 1F
}
@Deprecated("Use the other drawGuiTexture")
fun DrawContext.drawGuiTexture(
x: Int, y: Int, z: Int, width: Int, height: Int, sprite: Identifier
-) = this.drawGuiTexture(RenderLayer::getGuiTextured, sprite, x, y, width, height)
+) = this.drawGuiTexture(RenderPipelines.GUI_TEXTURED, sprite, x, y, width, height)
fun DrawContext.drawGuiTexture(
sprite: Identifier,
x: Int, y: Int, width: Int, height: Int
-) = this.drawGuiTexture(RenderLayer::getGuiTextured, sprite, x, y, width, height)
+) = this.drawGuiTexture(RenderPipelines.GUI_TEXTURED, sprite, x, y, width, height)
fun DrawContext.drawTexture(
sprite: Identifier,
@@ -34,18 +35,20 @@ fun DrawContext.drawTexture(
textureWidth: Int,
textureHeight: Int
) {
- this.drawTexture(RenderLayer::getGuiTextured,
- sprite,
- x,
- y,
- u,
- v,
- width,
- height,
- width,
- height,
- textureWidth,
- textureHeight)
+ this.drawTexture(
+ RenderPipelines.GUI_TEXTURED,
+ sprite,
+ x,
+ y,
+ u,
+ v,
+ width,
+ height,
+ width,
+ height,
+ textureWidth,
+ textureHeight
+ )
}
fun DrawContext.drawLine(fromX: Int, fromY: Int, toX: Int, toY: Int, color: Color) {
@@ -55,14 +58,46 @@ fun DrawContext.drawLine(fromX: Int, fromY: Int, toX: Int, toY: Int, color: Colo
drawLine(toX, toY, fromX, fromY, color)
return
}
+ val rect = ScreenRect(fromX, fromY, toX - fromX, toY - fromY).transform(matrices)
RenderSystem.lineWidth(MC.window.scaleFactor.toFloat())
- draw { vertexConsumers ->
- val buf = vertexConsumers.getBuffer(CustomRenderLayers.LINES)
- val matrix = this.matrices.peek()
- buf.vertex(matrix, fromX.toFloat(), fromY.toFloat(), 0F).color(color.color)
- .normal(toX - fromX.toFloat(), toY - fromY.toFloat(), 0F)
- buf.vertex(matrix, toX.toFloat(), toY.toFloat(), 0F).color(color.color)
- .normal(toX - fromX.toFloat(), toY - fromY.toFloat(), 0F)
- }
+ // TODO: this also requires adding a List<SpecialGuiElementRenderer<?>> entry in guirenderer
+ // TODO: state.addSpecialElement(object : SpecialGuiElementRenderState {
+ // override fun x1(): Int {
+ // return fromX
+ // }
+ //
+ // override fun x2(): Int {
+ // return toY
+ // }
+ //
+ // override fun y1(): Int {
+ // return fromY
+ // }
+ //
+ // override fun y2(): Int {
+ // return toY
+ // }
+ //
+ // override fun scale(): Float {
+ // return 1f
+ // }
+ //
+ // override fun scissorArea(): ScreenRect? {
+ // return rect
+ // }
+ //
+ // override fun bounds(): ScreenRect? {
+ // return rect
+ // }
+ //
+ // })
+// draw { vertexConsumers ->
+// val buf = vertexConsumers.getBuffer(CustomRenderLayers.LINES)
+// val matrix = this.matrices.peek()
+// buf.vertex(matrix, fromX.toFloat(), fromY.toFloat(), 0F).color(color.color)
+// .normal(toX - fromX.toFloat(), toY - fromY.toFloat(), 0F)
+// buf.vertex(matrix, toX.toFloat(), toY.toFloat(), 0F).color(color.color)
+// .normal(toX - fromX.toFloat(), toY - fromY.toFloat(), 0F)
+// }
}
diff --git a/src/main/kotlin/util/render/FacingThePlayerContext.kt b/src/main/kotlin/util/render/FacingThePlayerContext.kt
index 670beb6..0e5788a 100644
--- a/src/main/kotlin/util/render/FacingThePlayerContext.kt
+++ b/src/main/kotlin/util/render/FacingThePlayerContext.kt
@@ -3,9 +3,12 @@ package moe.nea.firmament.util.render
import io.github.notenoughupdates.moulconfig.platform.next
import org.joml.Matrix4f
+import util.render.CustomRenderLayers
import net.minecraft.client.font.TextRenderer
import net.minecraft.client.render.LightmapTextureManager
import net.minecraft.client.render.RenderLayer
+import net.minecraft.client.render.RenderLayers
+import net.minecraft.client.render.TexturedRenderLayers
import net.minecraft.client.render.VertexConsumer
import net.minecraft.text.Text
import net.minecraft.util.Identifier
@@ -70,7 +73,7 @@ class FacingThePlayerContext(val worldContext: RenderInWorldContext) {
u1: Float, v1: Float,
u2: Float, v2: Float,
) {
- val buf = worldContext.vertexConsumers.getBuffer(RenderLayer.getGuiTexturedOverlay(texture))
+ val buf = worldContext.vertexConsumers.getBuffer(CustomRenderLayers.GUI_TEXTURED_NO_DEPTH_TRIS.apply(texture)) // TODO: this is strictly an incorrect render layer
val hw = width / 2F
val hh = height / 2F
val matrix4f: Matrix4f = worldContext.matrixStack.peek().positionMatrix
diff --git a/src/main/kotlin/util/render/RenderCircleProgress.kt b/src/main/kotlin/util/render/RenderCircleProgress.kt
index 81dde6f..2c875f8 100644
--- a/src/main/kotlin/util/render/RenderCircleProgress.kt
+++ b/src/main/kotlin/util/render/RenderCircleProgress.kt
@@ -4,7 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
import com.mojang.blaze3d.vertex.VertexFormat
import io.github.notenoughupdates.moulconfig.platform.next
import java.util.OptionalInt
-import org.joml.Matrix4f
+import org.joml.Matrix3x2f
import util.render.CustomRenderLayers
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.render.BufferBuilder
@@ -19,7 +19,7 @@ object RenderCircleProgress {
fun renderCircularSlice(
drawContext: DrawContext,
- layer: RenderLayer,
+ layer: RenderLayer.MultiPhase,
u1: Float,
u2: Float,
v1: Float,
@@ -28,13 +28,12 @@ object RenderCircleProgress {
color: Int = -1,
innerCutoutRadius: Float = 0F
) {
- drawContext.draw()
val sections = angleRadians.nonNegligibleSubSectionsAlignedWith((τ / 8f).toFloat())
.zipWithNext().toList()
BufferAllocator(layer.vertexFormat.vertexSize * sections.size * 3).use { allocator ->
val bufferBuilder = BufferBuilder(allocator, VertexFormat.DrawMode.TRIANGLES, layer.vertexFormat)
- val matrix: Matrix4f = drawContext.matrices.peek().positionMatrix
+ val matrix: Matrix3x2f = drawContext.matrices
for ((sectionStart, sectionEnd) in sections) {
val firstPoint = Projections.Two.projectAngleOntoUnitBox(sectionStart.toDouble())
@@ -69,14 +68,15 @@ object RenderCircleProgress {
val indexBufferConstructor = RenderSystem.getSequentialBuffer(VertexFormat.DrawMode.TRIANGLES)
val indexBuffer = indexBufferConstructor.getIndexBuffer(buffer.drawParameters.indexCount)
RenderSystem.getDevice().createCommandEncoder().createRenderPass(
- MC.instance.framebuffer.colorAttachment,
+ { "Firmament Circle Renderer" },
+ MC.instance.framebuffer.colorAttachmentView,
OptionalInt.empty(),
).use { renderPass ->
renderPass.setPipeline(layer.pipeline)
- renderPass.setUniform("InnerCutoutRadius", innerCutoutRadius)
+// renderPass.setUniform("InnerCutoutRadius", innerCutoutRadius)
renderPass.setIndexBuffer(indexBuffer, indexBufferConstructor.indexType)
renderPass.setVertexBuffer(0, vertexBuffer)
- renderPass.drawIndexed(0, buffer.drawParameters.indexCount)
+ renderPass.drawIndexed(0, 0, buffer.drawParameters.indexCount, 1)
}
}
}
diff --git a/src/main/kotlin/util/render/RenderInWorldContext.kt b/src/main/kotlin/util/render/RenderInWorldContext.kt
index 4963920..2f665f2 100644
--- a/src/main/kotlin/util/render/RenderInWorldContext.kt
+++ b/src/main/kotlin/util/render/RenderInWorldContext.kt
@@ -11,7 +11,6 @@ import net.minecraft.client.render.RenderLayer
import net.minecraft.client.render.RenderTickCounter
import net.minecraft.client.render.VertexConsumer
import net.minecraft.client.render.VertexConsumerProvider
-import net.minecraft.client.render.VertexFormats
import net.minecraft.client.texture.Sprite
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.text.Text
@@ -30,18 +29,6 @@ class RenderInWorldContext private constructor(
private val tickCounter: RenderTickCounter,
val vertexConsumers: VertexConsumerProvider.Immediate,
) {
-
-
- @Deprecated("stateful color management is no longer a thing")
- fun color(color: me.shedaniel.math.Color) {
- color(color.red / 255F, color.green / 255f, color.blue / 255f, color.alpha / 255f)
- }
-
- @Deprecated("stateful color management is no longer a thing")
- fun color(red: Float, green: Float, blue: Float, alpha: Float) {
- RenderSystem.setShaderColor(red, green, blue, alpha)
- }
-
fun block(blockPos: BlockPos, color: Int) {
matrixStack.push()
matrixStack.translate(blockPos.x.toFloat(), blockPos.y.toFloat(), blockPos.z.toFloat())
@@ -126,6 +113,7 @@ class RenderInWorldContext private constructor(
fun wireframeCube(blockPos: BlockPos, lineWidth: Float = 10F) {
val buf = vertexConsumers.getBuffer(RenderLayer.LINES)
matrixStack.push()
+ // TODO: add color arg to this
// TODO: this does not render through blocks (or water layers) anymore
RenderSystem.lineWidth(lineWidth / pow(camera.pos.squaredDistanceTo(blockPos.toCenterPos()), 0.25).toFloat())
matrixStack.translate(blockPos.x.toFloat(), blockPos.y.toFloat(), blockPos.z.toFloat())
@@ -134,16 +122,16 @@ class RenderInWorldContext private constructor(
vertexConsumers.draw()
}
- fun line(vararg points: Vec3d, lineWidth: Float = 10F) {
- line(points.toList(), lineWidth)
+ fun line(vararg points: Vec3d, color: Int, lineWidth: Float = 10F) {
+ line(points.toList(), color, lineWidth)
}
- fun tracer(toWhere: Vec3d, lineWidth: Float = 3f) {
+ fun tracer(toWhere: Vec3d, color: Int, lineWidth: Float = 3f) {
val cameraForward = Vector3f(0f, 0f, -1f).rotate(camera.rotation)
- line(camera.pos.add(Vec3d(cameraForward)), toWhere, lineWidth = lineWidth)
+ line(camera.pos.add(Vec3d(cameraForward)), toWhere, color = color, lineWidth = lineWidth)
}
- fun line(points: List<Vec3d>, lineWidth: Float = 10F) {
+ fun line(points: List<Vec3d>, color: Int, lineWidth: Float = 10F) {
RenderSystem.lineWidth(lineWidth)
val buffer = vertexConsumers.getBuffer(CustomRenderLayers.LINES)
@@ -263,7 +251,6 @@ class RenderInWorldContext private constructor(
event.matrices.pop()
event.vertexConsumers.draw()
- RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
}
}
}
diff --git a/src/main/kotlin/util/render/TranslatedScissors.kt b/src/main/kotlin/util/render/TranslatedScissors.kt
index 8f8bdcf..70565ed 100644
--- a/src/main/kotlin/util/render/TranslatedScissors.kt
+++ b/src/main/kotlin/util/render/TranslatedScissors.kt
@@ -1,26 +1,26 @@
-
package moe.nea.firmament.util.render
-import org.joml.Matrix4f
+import org.joml.Vector3f
import org.joml.Vector4f
import net.minecraft.client.gui.DrawContext
fun DrawContext.enableScissorWithTranslation(x1: Float, y1: Float, x2: Float, y2: Float) {
- enableScissor(x1.toInt(), y1.toInt(), x2.toInt(), y2.toInt())
+ enableScissor(x1.toInt(), y1.toInt(), x2.toInt(), y2.toInt())
}
+
fun DrawContext.enableScissorWithoutTranslation(x1: Float, y1: Float, x2: Float, y2: Float) {
- val pMat = matrices.peek().positionMatrix.invert(Matrix4f())
- val target = Vector4f()
+ val pMat = matrices.invert()
+ var target = Vector3f()
- target.set(x1, y1, 0f, 1f)
- target.mul(pMat)
- val scissorX1 = target.x
- val scissorY1 = target.y
+ target.set(x1, y1, 0f)
+ target.mul(pMat)
+ val scissorX1 = target.x
+ val scissorY1 = target.y
- target.set(x2, y2, 0f, 1f)
- target.mul(pMat)
- val scissorX2 = target.x
- val scissorY2 = target.y
+ target.set(x2, y2, 0f)
+ target.mul(pMat)
+ val scissorX2 = target.x
+ val scissorY2 = target.y
- enableScissor(scissorX1.toInt(), scissorY1.toInt(), scissorX2.toInt(), scissorY2.toInt())
+ enableScissor(scissorX1.toInt(), scissorY1.toInt(), scissorX2.toInt(), scissorY2.toInt())
}
diff --git a/src/main/resources/firmament.accesswidener b/src/main/resources/firmament.accesswidener
index 0b7b830..e600936 100644
--- a/src/main/resources/firmament.accesswidener
+++ b/src/main/resources/firmament.accesswidener
@@ -14,7 +14,7 @@ accessible method net/minecraft/client/render/model/ModelBaker$BakerImpl <init>
accessible field net/minecraft/entity/mob/CreeperEntity CHARGED Lnet/minecraft/entity/data/TrackedData;
accessible method net/minecraft/entity/decoration/ArmorStandEntity setSmall (Z)V
accessible method net/minecraft/resource/NamespaceResourceManager loadMetadata (Lnet/minecraft/resource/InputSupplier;)Lnet/minecraft/resource/metadata/ResourceMetadata;
-accessible method net/minecraft/client/gui/DrawContext drawTexturedQuad (Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIIIFFFFI)V
+accessible method net/minecraft/client/gui/DrawContext drawTexturedQuad (Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIIIFFFFI)V
accessible class net/minecraft/client/render/model/BlockStatesLoader$LoadedBlockStateDefinition
accessible field net/minecraft/client/render/model/BlockStatesLoader FINDER Lnet/minecraft/resource/ResourceFinder;
@@ -32,5 +32,6 @@ accessible method net/minecraft/client/render/RenderPhase$Texture getId ()Ljava/
accessible field net/minecraft/client/render/RenderLayer$MultiPhase phases Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;
accessible field net/minecraft/client/render/RenderLayer$MultiPhaseParameters texture Lnet/minecraft/client/render/RenderPhase$TextureBase;
accessible field net/minecraft/client/network/ClientPlayerInteractionManager currentBreakingPos Lnet/minecraft/util/math/BlockPos;
+accessible field net/minecraft/client/render/RenderLayer$MultiPhase pipeline Lcom/mojang/blaze3d/pipeline/RenderPipeline;
mutable field net/minecraft/client/render/entity/state/LivingEntityRenderState headItemRenderState Lnet/minecraft/client/render/item/ItemRenderState;
diff --git a/src/test/kotlin/testutil/ItemResources.kt b/src/test/kotlin/testutil/ItemResources.kt
index e996fc2..60925c7 100644
--- a/src/test/kotlin/testutil/ItemResources.kt
+++ b/src/test/kotlin/testutil/ItemResources.kt
@@ -60,7 +60,7 @@ object ItemResources {
typ,
Dynamic(NbtOps.INSTANCE, wrappedNbtSource),
source.get().dataVersion,
- SharedConstants.getGameVersion().saveVersion.id
+ SharedConstants.getGameVersion().dataVersion().id
).value
} else {
wrappedNbtSource
diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomGlobalArmorOverrides.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomGlobalArmorOverrides.kt
index 8a2bde5..f731982 100644
--- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomGlobalArmorOverrides.kt
+++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomGlobalArmorOverrides.kt
@@ -85,7 +85,9 @@ object CustomGlobalArmorOverrides {
false,
false,
false,
- false
+ false,
+ false,
+ null
)
}
diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomScreenLayouts.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomScreenLayouts.kt
index 4785e90..69a1c7e 100644
--- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomScreenLayouts.kt
+++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomScreenLayouts.kt
@@ -4,6 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import net.minecraft.client.font.TextRenderer
+import net.minecraft.client.gl.RenderPipelines
import net.minecraft.client.gui.DrawContext
import net.minecraft.client.gui.screen.Screen
import net.minecraft.client.gui.screen.ingame.HandledScreen
@@ -82,7 +83,7 @@ object CustomScreenLayouts : SinglePreparationResourceReloader<List<CustomScreen
val textureWidth = this.width
val textureHeight = this.height
context.drawTexture(
- RenderLayer::getGuiTextured,
+ RenderPipelines.GUI_TEXTURED,
this.texture,
modifiedX,
modifiedY,
diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/StringMatcher.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/StringMatcher.kt
index dd28d9f..7de84d2 100644
--- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/StringMatcher.kt
+++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/StringMatcher.kt
@@ -1,4 +1,3 @@
-
package moe.nea.firmament.features.texturepack
import com.google.gson.JsonArray
@@ -13,148 +12,148 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
-import kotlin.jvm.optionals.getOrNull
import net.minecraft.nbt.NbtString
import net.minecraft.text.Text
-import moe.nea.firmament.util.MC
import moe.nea.firmament.util.removeColorCodes
@Serializable(with = StringMatcher.Serializer::class)
interface StringMatcher {
- fun matches(string: String): Boolean
- fun matches(text: Text): Boolean {
- return matches(text.string)
- }
-
- fun matches(nbt: NbtString): Boolean {
- val string = nbt.value
- val jsonStart = string.indexOf('{')
- val stringStart = string.indexOf('"')
- val isString = stringStart >= 0 && string.subSequence(0, stringStart).isBlank()
- val isJson = jsonStart >= 0 && string.subSequence(0, jsonStart).isBlank()
- if (isString || isJson)
- return matches(Text.Serialization.fromJson(string, MC.defaultRegistries) ?: return false)
- return matches(string)
- }
-
- class Equals(input: String, val stripColorCodes: Boolean) : StringMatcher {
- private val expected = if (stripColorCodes) input.removeColorCodes() else input
- override fun matches(string: String): Boolean {
- return expected == (if (stripColorCodes) string.removeColorCodes() else string)
- }
-
- override fun toString(): String {
- return "Equals($expected, stripColorCodes = $stripColorCodes)"
- }
- }
-
- class Pattern(val patternWithColorCodes: String, val stripColorCodes: Boolean) : StringMatcher {
- private val regex: Predicate<String> = patternWithColorCodes.toPattern().asMatchPredicate()
- override fun matches(string: String): Boolean {
- return regex.test(if (stripColorCodes) string.removeColorCodes() else string)
- }
-
- override fun toString(): String {
- return "Pattern($patternWithColorCodes, stripColorCodes = $stripColorCodes)"
- }
- }
-
- object Serializer : KSerializer<StringMatcher> {
- val delegateSerializer = kotlinx.serialization.json.JsonElement.serializer()
- override val descriptor: SerialDescriptor
- get() = SerialDescriptor("StringMatcher", delegateSerializer.descriptor)
-
- override fun deserialize(decoder: Decoder): StringMatcher {
- val delegate = decoder.decodeSerializableValue(delegateSerializer)
- val gsonDelegate = delegate.intoGson()
- return parse(gsonDelegate)
- }
-
- override fun serialize(encoder: Encoder, value: StringMatcher) {
- encoder.encodeSerializableValue(delegateSerializer, serialize(value).intoKotlinJson())
- }
-
- }
-
- companion object {
- fun serialize(stringMatcher: StringMatcher): JsonElement {
- TODO("Cannot serialize string matchers rn")
- }
-
- fun parse(jsonElement: JsonElement): StringMatcher {
- if (jsonElement is JsonPrimitive) {
- return Equals(jsonElement.asString, true)
- }
- if (jsonElement is JsonObject) {
- val regex = jsonElement["regex"] as JsonPrimitive?
- val text = jsonElement["equals"] as JsonPrimitive?
- val shouldStripColor = when (val color = (jsonElement["color"] as JsonPrimitive?)?.asString) {
- "preserve" -> false
- "strip", null -> true
- else -> error("Unknown color preservation mode: $color")
- }
- if ((regex == null) == (text == null)) error("Could not parse $jsonElement as string matcher")
- if (regex != null)
- return Pattern(regex.asString, shouldStripColor)
- if (text != null)
- return Equals(text.asString, shouldStripColor)
- }
- error("Could not parse $jsonElement as a string matcher")
- }
- }
+ fun matches(string: String): Boolean
+ fun matches(text: Text): Boolean {
+ return matches(text.string)
+ }
+
+ fun matches(nbt: NbtString): Boolean {
+ val string = nbt.value
+ val jsonStart = string.indexOf('{')
+ val stringStart = string.indexOf('"')
+ val isString = stringStart >= 0 && string.subSequence(0, stringStart).isBlank()
+ val isJson = jsonStart >= 0 && string.subSequence(0, jsonStart).isBlank()
+ if (isString || isJson) {
+ // TODO: return matches(TextCodecs.CODEC.parse(MC.defaultRegistryNbtOps, string) ?: return false)
+ }
+ return matches(string)
+ }
+
+ class Equals(input: String, val stripColorCodes: Boolean) : StringMatcher {
+ private val expected = if (stripColorCodes) input.removeColorCodes() else input
+ override fun matches(string: String): Boolean {
+ return expected == (if (stripColorCodes) string.removeColorCodes() else string)
+ }
+
+ override fun toString(): String {
+ return "Equals($expected, stripColorCodes = $stripColorCodes)"
+ }
+ }
+
+ class Pattern(val patternWithColorCodes: String, val stripColorCodes: Boolean) : StringMatcher {
+ private val regex: Predicate<String> = patternWithColorCodes.toPattern().asMatchPredicate()
+ override fun matches(string: String): Boolean {
+ return regex.test(if (stripColorCodes) string.removeColorCodes() else string)
+ }
+
+ override fun toString(): String {
+ return "Pattern($patternWithColorCodes, stripColorCodes = $stripColorCodes)"
+ }
+ }
+
+ object Serializer : KSerializer<StringMatcher> {
+ val delegateSerializer = kotlinx.serialization.json.JsonElement.serializer()
+ override val descriptor: SerialDescriptor
+ get() = SerialDescriptor("StringMatcher", delegateSerializer.descriptor)
+
+ override fun deserialize(decoder: Decoder): StringMatcher {
+ val delegate = decoder.decodeSerializableValue(delegateSerializer)
+ val gsonDelegate = delegate.intoGson()
+ return parse(gsonDelegate)
+ }
+
+ override fun serialize(encoder: Encoder, value: StringMatcher) {
+ encoder.encodeSerializableValue(delegateSerializer, serialize(value).intoKotlinJson())
+ }
+
+ }
+
+ companion object {
+ fun serialize(stringMatcher: StringMatcher): JsonElement {
+ TODO("Cannot serialize string matchers rn")
+ }
+
+ fun parse(jsonElement: JsonElement): StringMatcher {
+ if (jsonElement is JsonPrimitive) {
+ return Equals(jsonElement.asString, true)
+ }
+ if (jsonElement is JsonObject) {
+ val regex = jsonElement["regex"] as JsonPrimitive?
+ val text = jsonElement["equals"] as JsonPrimitive?
+ val shouldStripColor = when (val color = (jsonElement["color"] as JsonPrimitive?)?.asString) {
+ "preserve" -> false
+ "strip", null -> true
+ else -> error("Unknown color preservation mode: $color")
+ }
+ if ((regex == null) == (text == null)) error("Could not parse $jsonElement as string matcher")
+ if (regex != null)
+ return Pattern(regex.asString, shouldStripColor)
+ if (text != null)
+ return Equals(text.asString, shouldStripColor)
+ }
+ error("Could not parse $jsonElement as a string matcher")
+ }
+ }
}
fun JsonElement.intoKotlinJson(): kotlinx.serialization.json.JsonElement {
- when (this) {
- is JsonNull -> return kotlinx.serialization.json.JsonNull
- is JsonObject -> {
- return kotlinx.serialization.json.JsonObject(this.entrySet()
- .associate { it.key to it.value.intoKotlinJson() })
- }
-
- is JsonArray -> {
- return kotlinx.serialization.json.JsonArray(this.map { it.intoKotlinJson() })
- }
-
- is JsonPrimitive -> {
- if (this.isString)
- return kotlinx.serialization.json.JsonPrimitive(this.asString)
- if (this.isBoolean)
- return kotlinx.serialization.json.JsonPrimitive(this.asBoolean)
- return kotlinx.serialization.json.JsonPrimitive(this.asNumber)
- }
-
- else -> error("Unknown json variant $this")
- }
+ when (this) {
+ is JsonNull -> return kotlinx.serialization.json.JsonNull
+ is JsonObject -> {
+ return kotlinx.serialization.json.JsonObject(
+ this.entrySet()
+ .associate { it.key to it.value.intoKotlinJson() })
+ }
+
+ is JsonArray -> {
+ return kotlinx.serialization.json.JsonArray(this.map { it.intoKotlinJson() })
+ }
+
+ is JsonPrimitive -> {
+ if (this.isString)
+ return kotlinx.serialization.json.JsonPrimitive(this.asString)
+ if (this.isBoolean)
+ return kotlinx.serialization.json.JsonPrimitive(this.asBoolean)
+ return kotlinx.serialization.json.JsonPrimitive(this.asNumber)
+ }
+
+ else -> error("Unknown json variant $this")
+ }
}
fun kotlinx.serialization.json.JsonElement.intoGson(): JsonElement {
- when (this) {
- is kotlinx.serialization.json.JsonNull -> return JsonNull.INSTANCE
- is kotlinx.serialization.json.JsonPrimitive -> {
- if (this.isString)
- return JsonPrimitive(this.content)
- if (this.content == "true")
- return JsonPrimitive(true)
- if (this.content == "false")
- return JsonPrimitive(false)
- return JsonPrimitive(LazilyParsedNumber(this.content))
- }
-
- is kotlinx.serialization.json.JsonObject -> {
- val obj = JsonObject()
- for ((k, v) in this) {
- obj.add(k, v.intoGson())
- }
- return obj
- }
-
- is kotlinx.serialization.json.JsonArray -> {
- val arr = JsonArray()
- for (v in this) {
- arr.add(v.intoGson())
- }
- return arr
- }
- }
+ when (this) {
+ is kotlinx.serialization.json.JsonNull -> return JsonNull.INSTANCE
+ is kotlinx.serialization.json.JsonPrimitive -> {
+ if (this.isString)
+ return JsonPrimitive(this.content)
+ if (this.content == "true")
+ return JsonPrimitive(true)
+ if (this.content == "false")
+ return JsonPrimitive(false)
+ return JsonPrimitive(LazilyParsedNumber(this.content))
+ }
+
+ is kotlinx.serialization.json.JsonObject -> {
+ val obj = JsonObject()
+ for ((k, v) in this) {
+ obj.add(k, v.intoGson())
+ }
+ return obj
+ }
+
+ is kotlinx.serialization.json.JsonArray -> {
+ val arr = JsonArray()
+ for (v in this) {
+ arr.add(v.intoGson())
+ }
+ return arr
+ }
+ }
}
diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/SkullPredicate.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/SkullPredicate.kt
index 416e86c..f17582d 100644
--- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/SkullPredicate.kt
+++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/predicates/SkullPredicate.kt
@@ -42,7 +42,7 @@ class SkullPredicate(
}
when {
profileId != null
- && profileId != profile.id.getOrNull() ->
+ && profileId != profile.uuid.getOrNull() ->
return false
textureValue != null
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/CustomSkullTexturePatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/CustomSkullTexturePatch.java
index fede766..cc59d99 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/CustomSkullTexturePatch.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/CustomSkullTexturePatch.java
@@ -16,11 +16,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SkullBlockEntityRenderer.class)
public class CustomSkullTexturePatch {
@Inject(
- method = "getRenderLayer(Lnet/minecraft/block/SkullBlock$SkullType;Lnet/minecraft/component/type/ProfileComponent;Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;",
+ method = "getRenderLayer",
at = @At("HEAD"),
cancellable = true
)
- private static void onGetRenderLayer(SkullBlock.SkullType type, ProfileComponent profile, Identifier texture, CallbackInfoReturnable<RenderLayer> cir) {
+ private static void onGetRenderLayer(SkullBlock.SkullType type, ProfileComponent profile, CallbackInfoReturnable<RenderLayer> cir) {
CustomSkyBlockTextures.INSTANCE.modifySkullTexture(type, profile, cir);
}
}
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java
index 75cedf8..8687088 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/SupplyFakeModelPatch.java
@@ -17,6 +17,7 @@ import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourcePack;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import java.io.InputStreamReader;
@@ -44,6 +45,7 @@ public class SupplyFakeModelPatch {
return original.thenCompose(oldModels -> CompletableFuture.supplyAsync(() -> supplyExtraModels(resourceManager, oldModels), executor));
}
+ @Unique
private static ItemAssetsLoader.Result supplyExtraModels(ResourceManager resourceManager, ItemAssetsLoader.Result oldModels) {
if (!CustomSkyBlockTextures.TConfig.INSTANCE.getEnableLegacyMinecraftCompat()) return oldModels;
Map<Identifier, ItemAsset> newModels = new HashMap<>(oldModels.contents());
@@ -72,13 +74,14 @@ public class SupplyFakeModelPatch {
.orElse(true)) {
newModels.put(itemModelId, new ItemAsset(
unbakedModel,
- new ItemAsset.Properties(true)
+ new ItemAsset.Properties(true, true)
));
}
}
return new ItemAssetsLoader.Result(newModels);
}
+ @Unique
private static boolean isResourcePackNewer(
ResourceManager manager,
ResourcePack null_, ResourcePack proposal) {
@@ -88,6 +91,7 @@ public class SupplyFakeModelPatch {
return pack.orElse(null_) != null_;
}
+ @Unique
private static <T> Collector<T, ?, Optional<T>> findLast() {
return Collectors.reducing(Optional.empty(), Optional::of,
(left, right) -> right.isPresent() ? right : left);
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java
index 7c5dc45..5dbdc8e 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceAnvilScreen.java
@@ -42,11 +42,11 @@ public abstract class ReplaceAnvilScreen extends ForgingScreen<AnvilScreenHandle
}
@WrapOperation(method = "drawForeground",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)I"),
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)V"),
allow = 1)
- private int onDrawRepairCost(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, Operation<Integer> original) {
+ private void onDrawRepairCost(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, Operation<Void> original) {
var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getRepairCostTitle);
- return original.call(instance, textRenderer,
+ original.call(instance, textRenderer,
textOverride.replaceText(text),
textOverride.replaceX(textRenderer, text, x),
textOverride.replaceY(y),
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java
index 6b076db..4c84143 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceFurnaceBackgrounds.java
@@ -1,6 +1,7 @@
package moe.nea.firmament.mixins.custommodels.screenlayouts;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
+import com.mojang.blaze3d.pipeline.RenderPipeline;
import moe.nea.firmament.features.texturepack.CustomScreenLayouts;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.AbstractFurnaceScreen;
@@ -21,8 +22,8 @@ public abstract class ReplaceFurnaceBackgrounds<T extends AbstractFurnaceScreenH
super(handler, recipeBook, inventory, title);
}
- @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIFFIIII)V"), allow = 1)
- private boolean onDrawBackground(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) {
+ @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIII)V"), allow = 1)
+ private boolean onDrawBackground(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) {
final var override = CustomScreenLayouts.getActiveScreenOverride();
if (override == null || override.getBackground() == null) return true;
override.getBackground().renderGeneric(instance, this);
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java
index e02a821..9ae2e2f 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplacePlayerBackgrounds.java
@@ -3,6 +3,7 @@ package moe.nea.firmament.mixins.custommodels.screenlayouts;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
+import com.mojang.blaze3d.pipeline.RenderPipeline;
import moe.nea.firmament.features.texturepack.CustomScreenLayouts;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
@@ -28,10 +29,10 @@ public abstract class ReplacePlayerBackgrounds extends RecipeBookScreen<PlayerSc
@WrapOperation(method = "drawForeground",
allow = 1,
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)I"))
- private int onDrawForegroundText(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Integer> original) {
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V"))
+ private void onDrawForegroundText(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) {
var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getContainerTitle);
- return original.call(instance, textRenderer,
+ original.call(instance, textRenderer,
textOverride.replaceText(text),
textOverride.replaceX(textRenderer, text, x),
textOverride.replaceY(y),
@@ -39,8 +40,8 @@ public abstract class ReplacePlayerBackgrounds extends RecipeBookScreen<PlayerSc
shadow);
}
- @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Ljava/util/function/Function;Lnet/minecraft/util/Identifier;IIFFIIII)V"))
- private boolean onDrawBackground(DrawContext instance, Function<Identifier, RenderLayer> renderLayers, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) {
+ @WrapWithCondition(method = "drawBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIII)V"))
+ private boolean onDrawBackground(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) {
final var override = CustomScreenLayouts.getActiveScreenOverride();
if (override == null || override.getBackground() == null) return true;
override.getBackground().renderGeneric(instance, this);
diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java
index 4f0905a..392d532 100644
--- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java
+++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/screenlayouts/ReplaceTextColorInHandledScreen.java
@@ -5,12 +5,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import moe.nea.firmament.features.texturepack.CustomScreenLayouts;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.screen.ingame.AnvilScreen;
-import net.minecraft.client.gui.screen.ingame.BeaconScreen;
-import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
-import net.minecraft.client.gui.screen.ingame.InventoryScreen;
-import net.minecraft.client.gui.screen.ingame.MerchantScreen;
import net.minecraft.text.Text;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
@@ -25,16 +20,16 @@ public class ReplaceTextColorInHandledScreen {
method = "drawForeground",
at = @At(
value = "INVOKE",
- target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)I"),
+ target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V"),
slice = @Slice(
from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;title:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD),
to = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;playerInventoryTitle:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD)
),
allow = 1,
require = 1)
- private int replaceContainerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Integer> original) {
+ private void replaceContainerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) {
var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getContainerTitle);
- return original.call(instance, textRenderer,
+ original.call(instance, textRenderer,
textOverride.replaceText(text),
textOverride.replaceX(textRenderer, text, x),
textOverride.replaceY(y),
@@ -46,16 +41,16 @@ public class ReplaceTextColorInHandledScreen {
method = "drawForeground",
at = @At(
value = "INVOKE",
- target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)I"),
+ target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;IIIZ)V"),
slice = @Slice(
from = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;playerInventoryTitle:Lnet/minecraft/text/Text;", opcode = Opcodes.GETFIELD),
to = @At(value = "TAIL")
),
allow = 1,
require = 1)
- private int replacePlayerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Integer> original) {
+ private void replacePlayerTitle(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color, boolean shadow, Operation<Void> original) {
var textOverride = CustomScreenLayouts.getTextMover(CustomScreenLayouts.CustomScreenLayout::getPlayerTitle);
- return original.call(instance, textRenderer,
+ original.call(instance, textRenderer,
textOverride.replaceText(text),
textOverride.replaceX(textRenderer, text, x),
textOverride.replaceY(y),