aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/inventory/buttons/InventoryButton.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
committerLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
commitc93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch)
tree5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/features/inventory/buttons/InventoryButton.kt
parentaf9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff)
downloadFirmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/features/inventory/buttons/InventoryButton.kt')
-rw-r--r--src/main/kotlin/features/inventory/buttons/InventoryButton.kt42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButton.kt b/src/main/kotlin/features/inventory/buttons/InventoryButton.kt
index e31f4a0..0cb51ca 100644
--- a/src/main/kotlin/features/inventory/buttons/InventoryButton.kt
+++ b/src/main/kotlin/features/inventory/buttons/InventoryButton.kt
@@ -5,14 +5,14 @@ import me.shedaniel.math.Dimension
import me.shedaniel.math.Point
import me.shedaniel.math.Rectangle
import kotlinx.serialization.Serializable
-import net.minecraft.client.gl.RenderPipelines
-import net.minecraft.client.gui.DrawContext
-import net.minecraft.command.CommandRegistryAccess
-import net.minecraft.command.argument.ItemStackArgumentType
-import net.minecraft.item.ItemStack
-import net.minecraft.item.Items
-import net.minecraft.resource.featuretoggle.FeatureFlags
-import net.minecraft.util.Identifier
+import net.minecraft.client.renderer.RenderPipelines
+import net.minecraft.client.gui.GuiGraphics
+import net.minecraft.commands.CommandBuildContext
+import net.minecraft.commands.arguments.item.ItemArgument
+import net.minecraft.world.item.ItemStack
+import net.minecraft.world.item.Items
+import net.minecraft.world.flag.FeatureFlags
+import net.minecraft.resources.ResourceLocation
import moe.nea.firmament.repo.ExpensiveItemCacheApi
import moe.nea.firmament.repo.ItemCache.asItemStack
import moe.nea.firmament.repo.ItemCache.isBroken
@@ -40,10 +40,10 @@ data class InventoryButton(
companion object {
val itemStackParser by lazy {
- ItemStackArgumentType.itemStack(
- CommandRegistryAccess.of(
+ ItemArgument.item(
+ CommandBuildContext.simple(
MC.defaultRegistries,
- FeatureFlags.VANILLA_FEATURES
+ FeatureFlags.VANILLA_SET
)
)
}
@@ -71,7 +71,7 @@ data class InventoryButton(
else icon
val componentItem =
runCatching {
- itemStackParser.parse(StringReader(giveSyntaxItem)).createStack(1, false)
+ itemStackParser.parse(StringReader(giveSyntaxItem)).createItemStack(1, false)
}.getOrNull()
if (componentItem != null)
itemStack = componentItem
@@ -84,23 +84,23 @@ data class InventoryButton(
}
}
- fun render(context: DrawContext) {
- context.drawGuiTexture(
+ fun render(context: GuiGraphics) {
+ context.blitSprite(
RenderPipelines.GUI_TEXTURED,
- Identifier.of("firmament:inventory_button_background"),
+ ResourceLocation.parse("firmament:inventory_button_background"),
0,
0,
myDimension.width,
myDimension.height,
)
if (isGigantic) {
- context.matrices.pushMatrix()
- context.matrices.translate(myDimension.width / 2F, myDimension.height / 2F)
- context.matrices.scale(2F)
- context.drawItem(getItem(), -8, -8)
- context.matrices.popMatrix()
+ context.pose().pushMatrix()
+ context.pose().translate(myDimension.width / 2F, myDimension.height / 2F)
+ context.pose().scale(2F)
+ context.renderItem(getItem(), -8, -8)
+ context.pose().popMatrix()
} else {
- context.drawItem(getItem(), 1, 1)
+ context.renderItem(getItem(), 1, 1)
}
}