diff --git a/gradle.properties b/gradle.properties index fdb86f88..071d2a75 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.19 + minecraft_version=1.18.2 loader_version=0.14.6 # Mod Properties @@ -13,8 +13,8 @@ org.gradle.jvmargs=-Xmx1G maven_group = net.sorenon # Dependencies - fabric_version=0.55.1+1.19 + fabric_version=0.58.0+1.18.2 pehkui_version=3.3.2 joml_version=1.10.4 night_config_version=3.6.5 - quilt_mappings=1 + quilt_mappings=22 diff --git a/mcxr-core/src/main/java/net/sorenon/mcxr/core/mixin/hands/client/MultiPlayerGameModeMixin.java b/mcxr-core/src/main/java/net/sorenon/mcxr/core/mixin/hands/client/MultiPlayerGameModeMixin.java index 8a2cdf46..16d4b6e4 100644 --- a/mcxr-core/src/main/java/net/sorenon/mcxr/core/mixin/hands/client/MultiPlayerGameModeMixin.java +++ b/mcxr-core/src/main/java/net/sorenon/mcxr/core/mixin/hands/client/MultiPlayerGameModeMixin.java @@ -1,5 +1,6 @@ package net.sorenon.mcxr.core.mixin.hands.client; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.MultiPlayerGameMode; import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.InteractionHand; @@ -15,17 +16,17 @@ @Mixin(MultiPlayerGameMode.class) public class MultiPlayerGameModeMixin { - @Inject(method = "performUseItemOn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;")) - void preUse(LocalPlayer localPlayer, InteractionHand interactionHand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { - PlayerExt playerExt = ((PlayerExt) localPlayer); + @Inject(method = "useItemOn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;")) + void preUse(LocalPlayer player, ClientLevel world, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { + PlayerExt playerExt = ((PlayerExt) player); if (playerExt.isXR() && MCXRCore.getCoreConfig().handBasedItemUsage()) { - playerExt.getOverrideTransform().set(MCXRCore.handToArm(localPlayer, interactionHand)); + playerExt.getOverrideTransform().set(MCXRCore.handToArm(player, hand)); } } - @Inject(method = "performUseItemOn", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/item/ItemStack;useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;")) - void postUse(LocalPlayer localPlayer, InteractionHand interactionHand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { - PlayerExt playerExt = ((PlayerExt) localPlayer); + @Inject(method = "useItemOn", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/item/ItemStack;useOn(Lnet/minecraft/world/item/context/UseOnContext;)Lnet/minecraft/world/InteractionResult;")) + void postUse(LocalPlayer player, ClientLevel world, InteractionHand hand, BlockHitResult hitResult, CallbackInfoReturnable cir) { + PlayerExt playerExt = ((PlayerExt) player); if (playerExt.isXR()) { playerExt.getOverrideTransform().set(null); } diff --git a/mcxr-core/src/main/resources/fabric.mod.json b/mcxr-core/src/main/resources/fabric.mod.json index 987a3602..bcd8e51a 100644 --- a/mcxr-core/src/main/resources/fabric.mod.json +++ b/mcxr-core/src/main/resources/fabric.mod.json @@ -41,7 +41,7 @@ "depends": { "fabricloader": ">=0.14.6", "fabric": "*", - "minecraft": "1.19.x", + "minecraft": "1.18.x", "java": ">=17" }, "suggests": { diff --git a/mcxr-desktop/build.gradle.kts b/mcxr-desktop/build.gradle.kts index 76c8e323..e5160024 100644 --- a/mcxr-desktop/build.gradle.kts +++ b/mcxr-desktop/build.gradle.kts @@ -40,7 +40,6 @@ dependencies { modImplementation("net.fabricmc.fabric-api:fabric-api:${properties["fabric_version"].toString()}") - include(implementation("org.lwjgl:lwjgl-openxr:3.3.1")!!) implementation("org.joml:joml:${properties["joml_version"].toString()}") implementation("com.electronwill.night-config:core:${properties["night_config_version"].toString()}") implementation("com.electronwill.night-config:toml:${properties["night_config_version"].toString()}") diff --git a/mcxr-desktop/src/main/java/net/sorenon/mcxr/desktop/MCXRDesktop.java b/mcxr-desktop/src/main/java/net/sorenon/mcxr/desktop/MCXRDesktop.java index 13ab8d5d..12082035 100644 --- a/mcxr-desktop/src/main/java/net/sorenon/mcxr/desktop/MCXRDesktop.java +++ b/mcxr-desktop/src/main/java/net/sorenon/mcxr/desktop/MCXRDesktop.java @@ -13,10 +13,7 @@ import org.lwjgl.glfw.GLFWNativeX11; import org.lwjgl.opengl.GL30; import org.lwjgl.openxr.*; -import org.lwjgl.system.Configuration; -import org.lwjgl.system.MemoryStack; -import org.lwjgl.system.Platform; -import org.lwjgl.system.Struct; +import org.lwjgl.system.*; import org.lwjgl.system.linux.X11; import org.lwjgl.system.windows.User32; @@ -36,11 +33,17 @@ public class MCXRDesktop implements ClientModInitializer, MCXRPlatform { @Override public void onInitializeClient() { - Configuration.OPENXR_EXPLICIT_INIT.set(true); + PLATFORM = this; PLATFORM.loadNatives(); } + @Override + public SharedLibrary getOpenXRLib() { + return Library.loadNative(XR.class, "openxr_loader", false); + + } + @Override public void loadNatives() { XR.create("openxr_loader"); @@ -53,7 +56,7 @@ public Struct createGraphicsBinding(MemoryStack stack) { long windowHandle = window.getWindow(); if (Platform.get() == Platform.WINDOWS) { return XrGraphicsBindingOpenGLWin32KHR.calloc(stack).set( - KHROpenGLEnable.XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR, + KHROpenglEnable.XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR, NULL, User32.GetDC(GLFWNativeWin32.glfwGetWin32Window(windowHandle)), GLFWNativeWGL.glfwGetWGLContext(windowHandle) @@ -73,7 +76,7 @@ public Struct createGraphicsBinding(MemoryStack stack) { long fbConfig = fbConfigBuf.get(); return XrGraphicsBindingOpenGLXlibKHR.calloc(stack).set( - KHROpenGLEnable.XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR, + KHROpenglEnable.XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR, NULL, xDisplay, (int) Objects.requireNonNull(glXGetVisualFromFBConfig(xDisplay, fbConfig)).visualid(), @@ -91,8 +94,8 @@ public List tryEnableExtensions(XrExtensionProperties.Buffer availableEx while (availableExtensions.hasRemaining()) { XrExtensionProperties prop = availableExtensions.get(); String extensionName = prop.extensionNameString(); - if (extensionName.equals(KHROpenGLEnable.XR_KHR_OPENGL_ENABLE_EXTENSION_NAME)) { - return List.of(KHROpenGLEnable.XR_KHR_OPENGL_ENABLE_EXTENSION_NAME); + if (extensionName.equals(KHROpenglEnable.XR_KHR_OPENGL_ENABLE_EXTENSION_NAME)) { + return List.of(KHROpenglEnable.XR_KHR_OPENGL_ENABLE_EXTENSION_NAME); } } @@ -119,7 +122,7 @@ public int[] enumerateSwapchainImages(OpenXRInstance instance, XrSwapchain handl int imageCount = intBuf.get(0); XrSwapchainImageOpenGLKHR.Buffer swapchainImageBuffer = XrSwapchainImageOpenGLKHR.calloc(imageCount, stack); for (XrSwapchainImageOpenGLKHR image : swapchainImageBuffer) { - image.type(KHROpenGLEnable.XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR); + image.type(KHROpenglEnable.XR_TYPE_SWAPCHAIN_IMAGE_OPENGL_KHR); } instance.checkPanic(XR10.xrEnumerateSwapchainImages(handle, intBuf, XrSwapchainImageBaseHeader.create(swapchainImageBuffer.address(), swapchainImageBuffer.capacity())), "xrEnumerateSwapchainImages"); @@ -140,8 +143,8 @@ public void framebufferTextureLayer(int color, int index) { @Override public void checkGraphicsRequirements(OpenXRInstance instance, long system) { try (var stack = stackPush()) { - XrGraphicsRequirementsOpenGLKHR graphicsRequirements = XrGraphicsRequirementsOpenGLKHR.calloc(stack).type(KHROpenGLEnable.XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR); - instance.checkPanic(KHROpenGLEnable.xrGetOpenGLGraphicsRequirementsKHR(instance.handle, system, graphicsRequirements), "xrGetOpenGLGraphicsRequirementsKHR"); + XrGraphicsRequirementsOpenGLKHR graphicsRequirements = XrGraphicsRequirementsOpenGLKHR.calloc(stack).type(KHROpenglEnable.XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR); + instance.checkPanic(KHROpenglEnable.xrGetOpenGLGraphicsRequirementsKHR(instance.handle, system, graphicsRequirements), "xrGetOpenGLGraphicsRequirementsKHR"); } } } diff --git a/mcxr-desktop/src/main/resources/fabric.mod.json b/mcxr-desktop/src/main/resources/fabric.mod.json index fd7bca3f..aff9253d 100644 --- a/mcxr-desktop/src/main/resources/fabric.mod.json +++ b/mcxr-desktop/src/main/resources/fabric.mod.json @@ -29,7 +29,7 @@ "depends": { "fabricloader": ">=0.14.6", "fabric": "*", - "minecraft": "1.19.x", + "minecraft": "1.18.x", "java": ">=17" }, "icon": "assets/mcxr-play/icon.png" diff --git a/mcxr-play/build.gradle.kts b/mcxr-play/build.gradle.kts index 63e5794f..944dfe3e 100644 --- a/mcxr-play/build.gradle.kts +++ b/mcxr-play/build.gradle.kts @@ -45,8 +45,6 @@ dependencies { exclude(group = "net.fabricmc.fabric-api") } - compileOnly("org.lwjgl:lwjgl-openxr:3.3.1") - implementation("org.joml:joml:${properties["joml_version"].toString()}") implementation("com.electronwill.night-config:core:${properties["night_config_version"].toString()}") implementation("com.electronwill.night-config:toml:${properties["night_config_version"].toString()}") diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRNativeLoad.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRNativeLoad.java new file mode 100644 index 00000000..70ac9f4e --- /dev/null +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRNativeLoad.java @@ -0,0 +1,12 @@ + +package net.sorenon.mcxr.play; + +public class MCXRNativeLoad { + static { + System.loadLibrary("mcxr_loader"); + } + + public static native long getJVMPtr(); + public static native long getApplicationActivityPtr(); + public static native void renderImage(int colorAttachment, int index); +} \ No newline at end of file diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXROptionsScreen.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXROptionsScreen.java index f7f2e0b2..5e075b6b 100644 --- a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXROptionsScreen.java +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXROptionsScreen.java @@ -1,18 +1,16 @@ package net.sorenon.mcxr.play; import com.mojang.blaze3d.vertex.PoseStack; -import net.fabricmc.fabric.mixin.resource.loader.client.GameOptionsMixin; import net.minecraft.client.Minecraft; -import net.minecraft.client.Options; +import net.minecraft.client.Option; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiComponent; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.main.GameConfig; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import net.sorenon.mcxr.play.input.XrInput; +import net.minecraft.network.chat.TranslatableComponent; import net.sorenon.mcxr.play.openxr.OpenXRInstance; import net.sorenon.mcxr.play.openxr.OpenXRState; import net.sorenon.mcxr.play.openxr.OpenXRSystem; @@ -30,7 +28,7 @@ public class MCXROptionsScreen extends Screen { private Button reloadButton; public MCXROptionsScreen(@Nullable Screen previous) { - super(Component.translatable("mcxr.options.title")); + super(new TranslatableComponent("mcxr.options.title")); this.previous = previous; } @@ -43,7 +41,7 @@ protected void init() { this.height / 6 - 12 - 4 + 24, 150, 20, - Component.translatable("mcxr.menu.reload"), + new TranslatableComponent("mcxr.menu.reload"), button -> MCXRPlayClient.OPEN_XR_STATE.tryInitialize())); if (PlayOptions.xrUninitialized) { reloadButton.active = false; @@ -54,7 +52,7 @@ protected void init() { this.height / 6 - 12 - 4 + 24, 150, 20, - PlayOptions.xrUninitialized ? Component.translatable("mcxr.options.initialize") : Component.translatable("mcxr.options.uninitialize"), + PlayOptions.xrUninitialized ? new TranslatableComponent("mcxr.options.initialize") : new TranslatableComponent("mcxr.options.uninitialize"), button -> { PlayOptions.xrUninitialized = !PlayOptions.xrUninitialized; PlayOptions.save(); @@ -62,7 +60,7 @@ protected void init() { if (!PlayOptions.xrUninitialized) { MCXRPlayClient.OPEN_XR_STATE.tryInitialize(); } - button.setMessage(PlayOptions.xrUninitialized ? Component.translatable("mcxr.options.initialize") : Component.translatable("mcxr.options.uninitialize")); + button.setMessage(PlayOptions.xrUninitialized ? new TranslatableComponent("mcxr.options.initialize") : new TranslatableComponent("mcxr.options.uninitialize")); })); this.addRenderableWidget(new Button( @@ -70,11 +68,11 @@ protected void init() { this.height / 6 - 12 - 4, 200, 20, - PlayOptions.xrPaused ? Component.translatable("mcxr.options.unpause") : Component.translatable("mcxr.options.pause"), + PlayOptions.xrPaused ? new TranslatableComponent("mcxr.options.unpause") : new TranslatableComponent("mcxr.options.pause"), button -> { PlayOptions.xrPaused = !PlayOptions.xrPaused; PlayOptions.save(); - button.setMessage(PlayOptions.xrPaused ? Component.translatable("mcxr.options.unpause") : Component.translatable("mcxr.options.pause")); + button.setMessage(PlayOptions.xrPaused ?new TranslatableComponent("mcxr.options.unpause") : new TranslatableComponent("mcxr.options.pause")); })); //TODO merge end @@ -83,22 +81,22 @@ protected void init() { this.height / 6 + 54 + 12, 150, 20, - Component.translatable("mcxr.options.walk_direction", PlayOptions.walkDirection.toComponent()), + new TranslatableComponent("mcxr.options.walk_direction"), button -> { PlayOptions.walkDirection = PlayOptions.walkDirection.iterate(); PlayOptions.save(); - button.setMessage(Component.translatable("mcxr.options.walk_direction", PlayOptions.walkDirection.toComponent())); + button.setMessage(new TranslatableComponent("mcxr.options.walk_direction")); })); this.addRenderableWidget(new Button( this.width / 2 - 155, this.height / 6 + 54 + 24 + 12, 150, 20, - Component.translatable("mcxr.options.swim_direction", PlayOptions.swimDirection.toComponent()), + new TranslatableComponent("mcxr.options.swim_direction"), button -> { PlayOptions.swimDirection = PlayOptions.swimDirection.iterate(); PlayOptions.save(); - button.setMessage(Component.translatable("mcxr.options.swim_direction", PlayOptions.swimDirection.toComponent())); + button.setMessage(new TranslatableComponent("mcxr.options.swim_direction")); })); this.addRenderableWidget(new Button( @@ -106,11 +104,11 @@ protected void init() { this.height / 6 + 54 + 24 * 2 + 12, 150, 20, - Component.translatable("mcxr.options.fly_direction", PlayOptions.flyDirection.toComponent()), + new TranslatableComponent("mcxr.options.fly_direction"), button -> { PlayOptions.flyDirection = PlayOptions.flyDirection.iterate(); PlayOptions.save(); - button.setMessage(Component.translatable("mcxr.options.fly_direction", PlayOptions.flyDirection.toComponent())); + button.setMessage(new TranslatableComponent("mcxr.options.fly_direction")); })); this.addRenderableWidget(new Button( @@ -118,25 +116,25 @@ protected void init() { this.height / 6 + 54 + 24 * 3 + 12, 150, 20, - MCXRPlayClient.heightAdjustStand ? Component.translatable("mcxr.options.unlock_playerheight") : Component.translatable("mcxr.options.lock_playerheight"), + MCXRPlayClient.heightAdjustStand ? new TranslatableComponent("mcxr.options.unlock_playerheight") : new TranslatableComponent("mcxr.options.lock_playerheight"), button -> { MCXRPlayClient.heightAdjustStand = !MCXRPlayClient.heightAdjustStand; - button.setMessage(MCXRPlayClient.heightAdjustStand ? Component.translatable("mcxr.options.unlock_playerheight") : Component.translatable("mcxr.options.lock_playerheight")); + button.setMessage(MCXRPlayClient.heightAdjustStand ? new TranslatableComponent("mcxr.options.unlock_playerheight") : new TranslatableComponent("mcxr.options.lock_playerheight")); })); assert this.minecraft != null; - this.addRenderableWidget(Minecraft.getInstance().options.mainHand().createButton(this.minecraft.options, this.width / 2 - 155 + 160, this.height / 6 + 54 + 12, 150)); + this.addRenderableWidget(Option.MAIN_HAND.createButton(this.minecraft.options, this.width / 2 - 155 + 160, this.height / 6 + 54 + 12, 150)); this.addRenderableWidget(new Button( this.width / 2 - 155 + 160, this.height / 6 + 54 + 24 + 12, 150, 20, - PlayOptions.smoothTurning ? Component.translatable("mcxr.options.enable_snap_turning") : Component.translatable("mcxr.options.enable_smooth_turning"), + PlayOptions.smoothTurning ? new TranslatableComponent("mcxr.options.enable_snap_turning") : new TranslatableComponent("mcxr.options.enable_smooth_turning"), button -> { PlayOptions.smoothTurning = !PlayOptions.smoothTurning; PlayOptions.save(); - button.setMessage(PlayOptions.smoothTurning ? Component.translatable("mcxr.options.enable_snap_turning") : Component.translatable("mcxr.options.enable_smooth_turning")); + button.setMessage(PlayOptions.smoothTurning ? new TranslatableComponent("mcxr.options.enable_snap_turning") : new TranslatableComponent("mcxr.options.enable_smooth_turning")); })); this.addRenderableWidget(new Button( @@ -144,11 +142,11 @@ protected void init() { this.height / 6 + 54 + 24 * 2 + 12, 150, 20, - PlayOptions.immersiveControls ? Component.translatable("mcxr.options_disable_immersive_controls") : Component.translatable("mcxr.options_enable_immersive_controls"), + PlayOptions.immersiveControls ? new TranslatableComponent("mcxr.options_disable_immersive_controls") : new TranslatableComponent("mcxr.options_enable_immersive_controls"), button -> { PlayOptions.immersiveControls = !PlayOptions.immersiveControls; PlayOptions.save(); - button.setMessage(PlayOptions.immersiveControls ? Component.translatable("mcxr.options_disable_immersive_controls") : Component.translatable("mcxr.options_enable_immersive_controls")); + button.setMessage(PlayOptions.immersiveControls ? new TranslatableComponent("mcxr.options_disable_immersive_controls") : new TranslatableComponent("mcxr.options_enable_immersive_controls")); })); //TODO MCXR if (true || @@ -236,6 +234,6 @@ private static List wordWrap(String string, int wrapLength) { } private static List wordWrapText(String string, int wrapLength) { - return WordUtils.wrap(string, wrapLength, null, true).lines().map(s -> (Component) (Component.literal(s))).toList(); + return WordUtils.wrap(string, wrapLength, null, true).lines().map(s -> (Component) (new TranslatableComponent(s))).toList(); } } diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRPlatform.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRPlatform.java index a004a2a2..1e01567c 100644 --- a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRPlatform.java +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MCXRPlatform.java @@ -5,12 +5,15 @@ import org.lwjgl.openxr.XrExtensionProperties; import org.lwjgl.openxr.XrSwapchain; import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.SharedLibrary; import org.lwjgl.system.Struct; import java.util.List; public interface MCXRPlatform { + SharedLibrary getOpenXRLib(); + void loadNatives(); Struct createGraphicsBinding(MemoryStack stack); diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MoveDirectionPose.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MoveDirectionPose.java index 1d786120..56095754 100644 --- a/mcxr-play/src/main/java/net/sorenon/mcxr/play/MoveDirectionPose.java +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/MoveDirectionPose.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.phys.Vec3; import net.sorenon.mcxr.core.JOMLUtil; import net.sorenon.mcxr.core.Pose; @@ -24,13 +25,13 @@ public enum MoveDirectionPose { public Component toComponent() { switch (this) { case Head -> { - return Component.translatable("mcxr.move_direction.head"); + return new TranslatableComponent("mcxr.move_direction.head"); } case RightHand -> { - return Component.translatable("mcxr.move_direction.right_hand"); + return new TranslatableComponent("mcxr.move_direction.right_hand"); } case LeftHand -> { - return Component.translatable("mcxr.move_direction.left_hand"); + return new TranslatableComponent("mcxr.move_direction.left_hand"); } default -> throw new IllegalStateException("Unexpected value: " + this); } diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/PlayOptions.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/PlayOptions.java index d8a4bd54..358e4726 100644 --- a/mcxr-play/src/main/java/net/sorenon/mcxr/play/PlayOptions.java +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/PlayOptions.java @@ -5,6 +5,7 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import org.lwjgl.glfw.GLFW; public class PlayOptions { @@ -95,13 +96,13 @@ public enum IndexTouchpad { public Component toComponent() { switch (this) { case Off -> { - return Component.translatable("mcxr.index_touchpad.off"); + return new TranslatableComponent("mcxr.index_touchpad.off"); } case RightForward -> { - return Component.translatable("mcxr.index_touchpad.right_hand"); + return new TranslatableComponent("mcxr.index_touchpad.right_hand"); } case LeftForward -> { - return Component.translatable("mcxr.index_touchpad.left_hand"); + return new TranslatableComponent("mcxr.index_touchpad.left_hand"); } default -> throw new IllegalStateException("Unexpected value: " + this); } diff --git a/mcxr-play/src/main/java/net/sorenon/mcxr/play/compat/svc/SimpleVoiceChatCompat.java b/mcxr-play/src/main/java/net/sorenon/mcxr/play/compat/svc/SimpleVoiceChatCompat.java index 68fc81c0..12de818c 100644 --- a/mcxr-play/src/main/java/net/sorenon/mcxr/play/compat/svc/SimpleVoiceChatCompat.java +++ b/mcxr-play/src/main/java/net/sorenon/mcxr/play/compat/svc/SimpleVoiceChatCompat.java @@ -4,12 +4,13 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import java.util.ArrayList; public class SimpleVoiceChatCompat { public static void createButton(ArrayList