From 1e68eb6ed6cc9fe7a2ef821b200b12784291aebb Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Sat, 23 Sep 2023 17:48:40 -0700 Subject: [PATCH 01/12] removing all custom math classes there can be only one --- .gitignore | 11 +- .idea/codeStyles/Project.xml | 108 + .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/compiler.xml | 32 + .idea/gradle.xml | 20 + .../VivecraftMod_Default.xml | 96 + .../inspectionProfiles/profiles_settings.xml | 6 + .idea/jarRepositories.xml | 170 ++ .idea/misc.xml | 13 + .idea/modules.xml | 14 + .idea/scopes/java_awt.xml | 3 + .idea/scopes/jetbrains_annotations.xml | 3 + .idea/scopes/scope_settings.xml | 6 + .idea/scopes/vivecraft.xml | 3 + .idea/scopes/vivecraft_common_main_mixin.xml | 3 + build.gradle | 24 +- common/build.gradle | 3 + .../main/java/org/vivecraft/MixinConfig.java | 20 +- .../org/vivecraft/api_beta/VivecraftAPI.java | 4 +- .../api_beta/client/VivecraftClientAPI.java | 3 +- .../org/vivecraft/client/ClientAPIImpl.java | 8 +- .../org/vivecraft/client/VRPlayersClient.java | 155 +- .../org/vivecraft/client/VivecraftVRMod.java | 246 +-- .../java/org/vivecraft/client/Xevents.java | 14 +- .../main/java/org/vivecraft/client/Xplat.java | 7 +- .../extensions/RenderTargetExtension.java | 43 +- .../client/gui/framework/GuiVROption.java | 9 +- .../gui/framework/GuiVROptionButton.java | 57 +- .../gui/framework/GuiVROptionSlider.java | 63 +- .../gui/framework/GuiVROptionsBase.java | 438 ++-- .../client/gui/framework/TwoHandedScreen.java | 50 +- .../client/gui/framework/VROptionEntry.java | 61 - .../client/gui/framework/VROptionLayout.java | 162 -- .../gui/framework/VROptionPosition.java | 8 + .../client/gui/screens/ErrorScreen.java | 44 +- .../client/gui/screens/UpdateScreen.java | 48 +- .../gui/settings/GuiFreeMoveSettings.java | 61 +- .../client/gui/settings/GuiHUDSettings.java | 96 +- .../gui/settings/GuiMainVRSettings.java | 171 +- .../gui/settings/GuiMenuWorldSettings.java | 72 +- .../gui/settings/GuiOtherHUDSettings.java | 83 +- .../gui/settings/GuiQuickCommandEditor.java | 16 +- .../gui/settings/GuiQuickCommandsInGame.java | 49 +- .../gui/settings/GuiQuickCommandsList.java | 102 +- .../gui/settings/GuiRadialConfiguration.java | 109 +- .../gui/settings/GuiRadialItemsList.java | 31 +- .../gui/settings/GuiRenderOpticsSettings.java | 213 +- .../gui/settings/GuiRoomscaleSettings.java | 33 +- .../client/gui/settings/GuiSeatedOptions.java | 50 +- .../gui/settings/GuiStandingSettings.java | 46 +- .../gui/settings/GuiTeleportSettings.java | 40 +- .../gui/settings/GuiTouchHotbarSettings.java | 56 + .../client/gui/settings/GuiVRControls.java | 60 +- .../gui/settings/GuiVRFingerDisplays.java | 54 + .../gui/settings/GuiVRSkeletalInput.java | 56 + .../client/gui/widgets/TextScrollWidget.java | 65 +- .../client/network/ClientNetworking.java | 171 +- .../client/network/PatreonReceiver.java | 18 +- .../org/vivecraft/client/render/HMDLayer.java | 42 +- .../client/render/OpenGLdebugging.java | 107 +- .../client/render/VRPlayerModel.java | 89 +- .../client/render/VRPlayerModel_WithArms.java | 464 +++-- .../client/render/VRPlayerRenderer.java | 62 +- .../org/vivecraft/client/utils/Debug.java | 91 +- .../vivecraft/client/utils/UpdateChecker.java | 25 +- .../org/vivecraft/client/utils/Utils.java | 502 +---- .../client/utils/math/BezierCurve.java | 127 -- .../client_vr/ClientDataHolderVR.java | 70 +- .../org/vivecraft/client_vr/ItemTags.java | 32 +- .../org/vivecraft/client_vr/MethodHolder.java | 35 - .../org/vivecraft/client_vr/ScreenUtils.java | 23 +- .../java/org/vivecraft/client_vr/VRData.java | 196 +- .../java/org/vivecraft/client_vr/VRState.java | 126 +- .../vivecraft/client_vr/VRTextureTarget.java | 27 +- .../org/vivecraft/client_vr/Vec3History.java | 138 +- .../EntityRenderDispatcherVRExtension.java | 3 +- .../extensions/FrustumExtension.java | 4 +- .../extensions/GameRendererExtension.java | 13 +- .../ItemInHandRendererExtension.java | 3 +- .../extensions/LevelRendererExtension.java | 1 + .../client_vr/extensions/PlayerExtension.java | 6 +- .../client_vr/gameplay/VRMovementStyle.java | 235 +-- .../client_vr/gameplay/VRPlayer.java | 589 +++--- .../gameplay/screenhandlers/GuiHandler.java | 376 ++-- .../screenhandlers/KeyboardHandler.java | 108 +- .../screenhandlers/RadialHandler.java | 84 +- .../gameplay/trackers/BackpackTracker.java | 68 +- .../gameplay/trackers/BowTracker.java | 145 +- .../gameplay/trackers/CameraTracker.java | 66 +- .../gameplay/trackers/ClimbTracker.java | 245 ++- .../gameplay/trackers/CrawlTracker.java | 53 +- .../gameplay/trackers/EatingTracker.java | 67 +- .../gameplay/trackers/HorseTracker.java | 73 +- .../gameplay/trackers/InteractTracker.java | 130 +- .../gameplay/trackers/JumpTracker.java | 120 +- .../gameplay/trackers/RowTracker.java | 107 +- .../gameplay/trackers/RunTracker.java | 49 +- .../gameplay/trackers/SneakTracker.java | 46 +- .../gameplay/trackers/SwimTracker.java | 48 +- .../gameplay/trackers/SwingTracker.java | 176 +- .../gameplay/trackers/TeleportTracker.java | 146 +- .../gameplay/trackers/TelescopeTracker.java | 39 +- .../client_vr/gameplay/trackers/Tracker.java | 27 +- .../gameplay/trackers/VehicleTracker.java | 104 +- .../vivecraft/client_vr/gui/GuiKeyboard.java | 198 +- .../vivecraft/client_vr/gui/GuiRadial.java | 121 +- .../client_vr/gui/PhysicalKeyboard.java | 405 ++-- .../client_vr/menuworlds/FakeBlockAccess.java | 63 +- .../menuworlds/MenuWorldDownloader.java | 53 +- .../menuworlds/MenuWorldExporter.java | 246 ++- .../menuworlds/MenuWorldRenderer.java | 606 +++--- .../client_vr/provider/ControllerType.java | 2 +- .../client_vr/provider/HandedKeyBinding.java | 7 +- .../client_vr/provider/HardwareType.java | 7 +- .../client_vr/provider/InputSimulator.java | 19 +- .../vivecraft/client_vr/provider/MCVR.java | 1122 +++++----- .../client_vr/provider/VRRenderer.java | 308 +-- .../client_vr/provider/nullvr/NullVR.java | 91 +- .../provider/nullvr/NullVRStereoRenderer.java | 75 +- .../provider/openvr_lwjgl/MCOpenVR.java | 873 ++++---- .../openvr_lwjgl/OpenVRHapticScheduler.java | 22 +- .../openvr_lwjgl/OpenVRStereoRenderer.java | 181 +- .../provider/openvr_lwjgl/OpenVRUtil.java | 44 - .../provider/openvr_lwjgl/VRInputAction.java | 216 +- .../control/HapticMusicPlayer.java | 26 +- .../control/TrackpadSwipeSampler.java | 20 +- .../control/VRInputActionSet.java | 29 +- .../control/VivecraftMovementInput.java | 12 +- .../client_vr/provider/ovr_lwjgl/MC_OVR.java | 2 +- .../ovr_lwjgl/OVR_StereoRenderer.java | 4 +- .../client_vr/render/RenderPass.java | 3 +- .../client_vr/render/ShaderHelper.java | 68 +- .../client_vr/render/VRArmRenderer.java | 15 +- .../render/VRFirstPersonArmSwing.java | 2 +- .../vivecraft/client_vr/render/VRShaders.java | 18 +- .../client_vr/render/VRWidgetHelper.java | 94 +- .../render/VivecraftItemRendering.java | 435 ++-- .../vivecraft/client_vr/render/XRCamera.java | 41 +- .../client_vr/settings/AutoCalibration.java | 38 +- .../client_vr/settings/OptionEnum.java | 23 +- .../client_vr/settings/SettingField.java | 6 +- .../client_vr/settings/VRHotkeys.java | 341 +-- .../client_vr/settings/VRSettings.java | 847 +++++--- .../settings/profile/ProfileManager.java | 97 +- .../settings/profile/ProfileReader.java | 10 +- .../settings/profile/ProfileWriter.java | 5 +- .../client_vr/utils/LoaderUtils.java | 38 +- .../vivecraft/client_vr/utils/RGBAColor.java | 88 - .../client_vr/utils/external/jinfinadeck.java | 16 +- .../client_vr/utils/external/jkatvr.java | 12 +- .../render_pass/RenderPassManager.java | 16 +- .../render_pass/WorldRenderPass.java | 23 +- .../java/org/vivecraft/common/APIImpl.java | 5 +- .../org/vivecraft/common/VRServerPerms.java | 14 +- .../common/network/CommonNetworkHelper.java | 11 +- .../org/vivecraft/common/network/Pose.java | 5 +- .../common/network/VRPlayerState.java | 51 + .../common/network/VrPlayerState.java | 60 - .../org/vivecraft/common/utils/Utils.java | 268 ++- .../vivecraft/common/utils/color/Color.java | 1099 ++++++++++ .../vivecraft/common/utils/lwjgl/Matrix.java | 27 - .../common/utils/lwjgl/Matrix2f.java | 259 --- .../common/utils/lwjgl/Matrix3f.java | 346 ---- .../common/utils/lwjgl/Matrix4f.java | 648 ------ .../vivecraft/common/utils/lwjgl/Vector.java | 41 - .../common/utils/lwjgl/Vector2f.java | 192 -- .../common/utils/lwjgl/Vector3f.java | 229 -- .../common/utils/lwjgl/Vector4f.java | 235 --- .../vivecraft/common/utils/math/Angle.java | 206 -- .../org/vivecraft/common/utils/math/Axis.java | 21 - .../vivecraft/common/utils/math/Convert.java | 173 -- .../vivecraft/common/utils/math/Matrix4f.java | 237 --- .../common/utils/math/Quaternion.java | 403 ---- .../vivecraft/common/utils/math/Vector2.java | 177 -- .../vivecraft/common/utils/math/Vector3.java | 320 --- .../client/blaze3d/RenderSystemAccessor.java | 4 +- .../client/blaze3d/RenderTargetMixin.java | 158 +- .../events/ContainerEventHandlerVRMixin.java | 4 +- .../mixin/client/gui/screens/ScreenMixin.java | 16 +- .../client/gui/screens/TitleScreenMixin.java | 65 +- .../mixin/client/main/MainMixin.java | 38 +- .../player/AbstractClientPlayerMixin.java | 5 +- .../block/LiquidBlockRendererMixin.java | 9 +- .../renderer/culling/FrustumVRMixin.java | 7 +- .../entity/EntityRenderDispatcherMixin.java | 53 +- .../renderer/entity/ItemRendererVRMixin.java | 55 +- .../renderer/entity/PlayerRendererMixin.java | 76 +- .../entity/layers/RenderLayerMixin.java | 4 +- .../ClientBrandRetrieverVRMixin.java | 6 +- .../client_vr/KeyboardHandlerVRMixin.java | 62 +- .../mixin/client_vr/KeyboardInputVRMixin.java | 93 +- .../mixin/client_vr/MinecraftVRMixin.java | 1140 +++++----- .../mixin/client_vr/MouseHandlerVRMixin.java | 49 +- .../mixin/client_vr/OptionsVRMixin.java | 59 +- .../blaze3d/audio/LibraryVRMixin.java | 15 +- .../platform/GlStateManagerVRMixin.java | 17 +- .../platform/InputConstantsVRMixin.java | 14 +- .../blaze3d/platform/WindowVRMixin.java | 45 +- .../blaze3d/systems/RenderSystemVRMixin.java | 13 +- .../mixin/client_vr/gui/EditBoxVRMixin.java | 24 +- .../client_vr/gui/GuiComponentVRMixin.java | 21 +- .../mixin/client_vr/gui/GuiVRMixin.java | 94 +- .../client_vr/gui/TutorialToastVRMixin.java | 24 +- .../gui/screens/OptionsScreenVRMixin.java | 28 +- .../gui/screens/PauseScreenVRMixin.java | 127 +- .../client_vr/gui/screens/ScreenVRMixin.java | 19 +- .../screens/SoundOptionsScreenVRMixin.java | 46 +- .../gui/screens/WinScreenVRMixin.java | 9 +- .../AbstractContainerScreenVRMixin.java | 1 + .../AbstractSignEditScreenVRMixin.java | 13 +- .../inventory/BookEditScreenVRMixin.java | 12 +- .../CreativeModeInventoryScreenVRMixin.java | 21 +- .../ClientPacketListenerVRMixin.java | 103 +- .../MultiPlayerGameModeVRMixin.java | 23 +- .../particle/ItemPickupParticleVRMixin.java | 51 +- .../client_vr/player/LocalPlayerVRMixin.java | 309 ++- .../renderer/GameRendererVRMixin.java | 1845 +++++++++-------- .../renderer/ItemInHandRendererVRMixin.java | 193 +- .../renderer/ItemPropertiesVRMixin.java | 13 +- .../renderer/LevelRendererVRMixin.java | 177 +- .../NoSodiumLevelRendererVRMixin.java | 21 +- .../client_vr/renderer/PostChainVRMixin.java | 16 +- .../TheEndGatewayRendererVRMixin.java | 54 +- .../TheEndPortalRendererVRMixin.java | 51 +- .../entity/EntityRenderDispatcherVRMixin.java | 85 +- .../entity/EntityRendererVRMixin.java | 8 +- .../entity/FishingHookRendererVRMixin.java | 52 +- .../entity/GuardianRendererVRMixin.java | 15 +- .../renderer/entity/MobRendererVRMixin.java | 20 +- .../MovementTutorialStepInstanceVRMixin.java | 88 +- .../OpenInventoryTutorialStepVRMixin.java | 16 +- .../PunchTreeTutorialStepInstanceVRMixin.java | 10 +- .../mixin/client_vr/world/BoatMixin.java | 273 +-- .../client_vr/world/FishingHookVRMixin.java | 49 +- .../mixin/client_vr/world/ItemVRMixin.java | 9 +- .../client_vr/world/PotionItemVRMixin.java | 15 +- .../world/entity/player/PlayerVRMixin.java | 1 + .../FireworkRocketEntityVRMixin.java | 30 +- .../world/level/block/DoorBlockVRMixin.java | 13 +- .../level/block/FenceGateBlockVRMixin.java | 17 +- .../level/block/TrapDoorBlockVRMixin.java | 13 +- .../mixin/server/ChunkMapAccessor.java | 2 + .../mixin/server/MinecraftServerMixin.java | 8 +- .../ServerGamePacketListenerImplMixin.java | 38 +- .../ServerLoginPacketListenerImplMixin.java | 4 +- .../mixin/server/ServerPlayerMixin.java | 82 +- .../mixin/server/TrackedEntityAccessor.java | 5 +- .../world/entity/ai/goal/SwellGoalMixin.java | 14 +- .../EndermanFreezeWhenLookedAtMixin.java | 14 +- .../world/entity/monster/EndermanMixin.java | 6 +- .../entity/projectile/AbstractArrowMixin.java | 51 +- .../AbstractHurtingProjectileMixin.java | 13 +- .../entity/projectile/FishingHookMixin.java | 51 +- .../entity/projectile/ProjectileMixin.java | 12 +- .../projectile/ThrowableProjectileMixin.java | 13 +- .../entity/projectile/ThrownTridentMixin.java | 15 +- .../mixin/world/item/CrossbowItemMixin.java | 19 +- .../item/crafting/ShapedRecipeMixin.java | 8 +- .../mixin/DynamicFPSModVRMixin.java | 5 +- .../mixin/DynamicFPSScreenVRMixin.java | 6 +- .../mod_compat_vr/iris/IrisHelper.java | 3 +- .../extensions/PipelineManagerExtension.java | 3 +- .../iris/mixin/IrisBeginFrameHack.java | 8 +- .../mixin/IrisChunkProgramOverridesMixin.java | 37 +- ...unkProgramOverridesMixinSodium_0_4_11.java | 8 +- ...hunkProgramOverridesMixinSodium_0_4_9.java | 8 +- .../iris/mixin/IrisHandRendererVRMixin.java | 8 +- .../IrisNewWorldRenderingPipelineVRMixin.java | 10 +- .../mixin/IrisPipelineManagerVRMixin.java | 53 +- .../iris/mixin/IrisProgramUniformsMixin.java | 15 +- .../iris/mixin/IrisRenderSystemVRMixin.java | 4 +- .../iris/mixin/IrisShadowMatricesMixin.java | 23 +- .../iris/mixin/IrisShadowRendererMixin.java | 41 +- .../optifine/OptifineHelper.java | 33 +- .../optifine/mixin/ShadersRenderVRMixin.java | 33 +- .../optifine/mixin/ShadersVRMixin.java | 28 +- .../mod_compat_vr/pehkui/PehkuiHelper.java | 3 +- .../physicsmod/mixin/OptionsScreenMixin.java | 1 + .../rei/mixin/reiTextFieldWidgetMixin.java | 10 +- .../ResolutionControlHelper.java | 3 +- .../mixin/ResolutionControlModMixin.java | 19 +- .../mod_compat_vr/sodium/SodiumHelper.java | 6 +- .../FabricSodiumGameOptionPagesVRMixin.java | 11 +- .../ForgeSodiumGameOptionPagesVRMixin.java | 11 +- .../mixin/RenderSectionManagerVRMixin.java | 1 + .../mixin/SodiumWorldRendererVRMixin.java | 4 +- .../org/vivecraft/server/AimFixHandler.java | 18 +- .../vivecraft/server/ServerNetworking.java | 237 ++- .../java/org/vivecraft/server/ServerUtil.java | 10 +- .../org/vivecraft/server/ServerVRPlayers.java | 5 +- .../vivecraft/server/ServerVivePlayer.java | 52 +- .../server/config/ConfigBuilder.java | 3 +- .../vivecraft/server/config/ServerConfig.java | 116 +- .../vivecraft/input/cosmos_defaults.json | 2 +- .../input/cosmos_defaults_reversed.json | 2 +- .../vivecraft/input/knuckles_defaults.json | 12 +- .../input/knuckles_defaults_reversed.json | 12 +- .../vivecraft/input/oculus_defaults.json | 2 +- .../input/oculus_defaults_reversed.json | 2 +- .../vivecraft/input/tracker_defaults.json | 2 +- .../assets/vivecraft/input/vive_defaults.json | 2 +- .../input/vive_defaults_reversed.json | 2 +- .../assets/vivecraft/input/wmr_defaults.json | 2 +- .../input/wmr_defaults_reversed.json | 2 +- .../assets/vivecraft/lang/en_us.json | 74 +- .../assets/vivecraft/vivecraft.vrmanifest | 2 +- fabric/build.gradle | 3 + .../vivecraft/client/fabric/XeventsImpl.java | 1 + .../vivecraft/client/fabric/XplatImpl.java | 17 +- .../org/vivecraft/fabric/VivecraftMod.java | 5 +- .../mixin/FabricGameRendererVRMixin.java | 15 +- .../model/FabricModelBakeryMixin.java | 17 +- .../client/FabricClientNetworkingVRMixin.java | 5 +- .../world/level/biome/BiomeAccessor.java | 4 +- fabric/src/main/resources/fabric.mod.json | 1 + forge/build.gradle | 3 + .../vivecraft/client/forge/XeventsImpl.java | 10 +- .../org/vivecraft/client/forge/XplatImpl.java | 17 +- .../java/org/vivecraft/forge/Vivecraft.java | 3 +- .../vivecraft/forge/event/ClientEvents.java | 21 +- .../vivecraft/forge/event/CommonEvents.java | 8 +- .../forge/mixin/ForgeGameRendererVRMixin.java | 21 +- .../forge/mixin/ForgeIngameGuiVRMixin.java | 11 +- .../network/ForgeOpenContainerVRMixin.java | 16 +- forge/src/main/resources/META-INF/mods.toml | 2 +- gradlew | 0 326 files changed, 13378 insertions(+), 15041 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/inspectionProfiles/VivecraftMod_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/java_awt.xml create mode 100644 .idea/scopes/jetbrains_annotations.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/scopes/vivecraft.xml create mode 100644 .idea/scopes/vivecraft_common_main_mixin.xml delete mode 100644 common/src/main/java/org/vivecraft/client/gui/framework/VROptionEntry.java delete mode 100644 common/src/main/java/org/vivecraft/client/gui/framework/VROptionLayout.java create mode 100644 common/src/main/java/org/vivecraft/client/gui/framework/VROptionPosition.java create mode 100644 common/src/main/java/org/vivecraft/client/gui/settings/GuiTouchHotbarSettings.java create mode 100644 common/src/main/java/org/vivecraft/client/gui/settings/GuiVRFingerDisplays.java create mode 100644 common/src/main/java/org/vivecraft/client/gui/settings/GuiVRSkeletalInput.java delete mode 100644 common/src/main/java/org/vivecraft/client/utils/math/BezierCurve.java delete mode 100644 common/src/main/java/org/vivecraft/client_vr/MethodHolder.java delete mode 100644 common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRUtil.java delete mode 100644 common/src/main/java/org/vivecraft/client_vr/utils/RGBAColor.java create mode 100644 common/src/main/java/org/vivecraft/common/network/VRPlayerState.java delete mode 100644 common/src/main/java/org/vivecraft/common/network/VrPlayerState.java create mode 100644 common/src/main/java/org/vivecraft/common/utils/color/Color.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix2f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix3f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix4f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector2f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector3f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector4f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Angle.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Axis.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Convert.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Matrix4f.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Quaternion.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Vector2.java delete mode 100644 common/src/main/java/org/vivecraft/common/utils/math/Vector3.java mode change 100644 => 100755 gradlew diff --git a/.gitignore b/.gitignore index aa9842795..5396c1d34 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,16 @@ libs/ .classpath .project -.idea/ +.idea/* +!.idea/compiler.xml +!.idea/gradle.xml +!.idea/jarRepositories.xml +!.idea/misc.xml +!.idea/modules.xml +!.idea/codeStyles/ +!.idea/inspectionProfiles/ +!.idea/modules/ +!.idea/scopes/ classes/ .metadata .vscode diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000..b189217f7 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,108 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000..79ee123c2 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 000000000..939d937d8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 000000000..08d38a44a --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/VivecraftMod_Default.xml b/.idea/inspectionProfiles/VivecraftMod_Default.xml new file mode 100644 index 000000000..97e77ca9a --- /dev/null +++ b/.idea/inspectionProfiles/VivecraftMod_Default.xml @@ -0,0 +1,96 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..9c0c90608 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 000000000..56cfd71ef --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..f62f5df63 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..636763cd9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/java_awt.xml b/.idea/scopes/java_awt.xml new file mode 100644 index 000000000..a90bc0e02 --- /dev/null +++ b/.idea/scopes/java_awt.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/jetbrains_annotations.xml b/.idea/scopes/jetbrains_annotations.xml new file mode 100644 index 000000000..bdef76ddb --- /dev/null +++ b/.idea/scopes/jetbrains_annotations.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000..ec495b09e --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/scopes/vivecraft.xml b/.idea/scopes/vivecraft.xml new file mode 100644 index 000000000..33a68dd3a --- /dev/null +++ b/.idea/scopes/vivecraft.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/scopes/vivecraft_common_main_mixin.xml b/.idea/scopes/vivecraft_common_main_mixin.xml new file mode 100644 index 000000000..c440f5df2 --- /dev/null +++ b/.idea/scopes/vivecraft_common_main_mixin.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7cb380fff..ff0e273d8 100644 --- a/build.gradle +++ b/build.gradle @@ -23,10 +23,10 @@ subprojects { dependencies { minecraft "com.mojang:minecraft:${rootProject.minecraft_version}" - // The following line declares the mojmap mappings, you may use other mappings as well - mappings loom.officialMojangMappings() - // The following line declares the yarn mappings you may select this one as well. - // mappings "net.fabricmc:yarn:1.18.2+build.4:v2" + mappings loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-1.20.1:2023.08.20@zip") + } implementation("org.lwjgl:lwjgl-openvr:3.3.1") implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-linux") implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-macos") @@ -80,6 +80,11 @@ allprojects { } } + maven { + name = 'ParchmentMC' + url = 'https://maven.parchmentmc.org' + } + exclusiveContent { forRepository { maven { @@ -120,7 +125,16 @@ allprojects { maven { url = "https://maven.terraformersmc.com/" } maven { url = "https://maven.cafeteria.dev/releases/" } maven { url = "https://maven.gegy.dev" } - maven { url = "https://modmaven.dev" } + maven { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + url = "https://modmaven.dev" + } + maven { + // location of the maven that hosts JEI files since January 2023 + name = "Jared's maven" + url = "https://maven.blamejared.com/" + } exclusiveContent { forRepository { maven { diff --git a/common/build.gradle b/common/build.gradle index 12fe263e3..2e1654caf 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -53,6 +53,9 @@ dependencies { //LaunchPopup implementation 'com.github.fayer3:LaunchPopup:master-SNAPSHOT' + // MixinExtras + implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0-rc.4")) + } // extract the LaunchPopup classes jar { diff --git a/common/src/main/java/org/vivecraft/MixinConfig.java b/common/src/main/java/org/vivecraft/MixinConfig.java index 9657306e8..51f78ddc7 100644 --- a/common/src/main/java/org/vivecraft/MixinConfig.java +++ b/common/src/main/java/org/vivecraft/MixinConfig.java @@ -1,13 +1,6 @@ package org.vivecraft; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.objectweb.asm.tree.ClassNode; -import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; -import org.spongepowered.asm.mixin.extensibility.IMixinInfo; -import org.spongepowered.asm.service.MixinService; import org.vivecraft.client.Xplat; - import org.vivecraft.mod_compat_vr.iris.mixin.IrisChunkProgramOverridesMixinSodium_0_4_11; import org.vivecraft.mod_compat_vr.iris.mixin.IrisChunkProgramOverridesMixinSodium_0_4_9; import org.vivecraft.mod_compat_vr.sodium.mixin.RenderSectionManagerVRMixin; @@ -16,6 +9,13 @@ import java.util.List; import java.util.Set; +import static org.vivecraft.common.utils.Utils.logger; + +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; +import org.spongepowered.asm.service.MixinService; + public class MixinConfig implements IMixinConfigPlugin { @Override @@ -51,7 +51,7 @@ public void onLoad(String mixinPackage) { @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { if (!Xplat.isModLoadedSuccess()) { - LogManager.getLogger().log(Level.WARN, "not loading '" + mixinClassName + "' because mod failed to load completely"); + logger.warn("not loading '{}' because mod failed to load completely", mixinClassName); return false; } @@ -68,7 +68,7 @@ else if (mixinClassName.equals(RenderSectionManagerVRMixin.class.getName())) { try { MixinService.getService().getBytecodeProvider().getClassNode(neededClass); ClassNode node = MixinService.getService().getBytecodeProvider().getClassNode(targetClassName); - return node.fields.stream().anyMatch(field -> field.name.equals("chunkRenderList")); + return node.fields.stream().anyMatch(field -> "chunkRenderList".equals(field.name)); } catch (ClassNotFoundException | IOException e) { return false; } @@ -79,7 +79,7 @@ else if (mixinClassName.equals(RenderSectionManagerVRMixin.class.getName())) { MixinService.getService().getBytecodeProvider().getClassNode(neededClass); return true; } catch (ClassNotFoundException | IOException e) { - LogManager.getLogger().log(Level.INFO, "Vivecraft: skipping mixin '" + mixinClassName + "'"); + logger.info("skipping mixin '{}'", mixinClassName); return false; } } diff --git a/common/src/main/java/org/vivecraft/api_beta/VivecraftAPI.java b/common/src/main/java/org/vivecraft/api_beta/VivecraftAPI.java index a95a3b0b8..873e3769a 100644 --- a/common/src/main/java/org/vivecraft/api_beta/VivecraftAPI.java +++ b/common/src/main/java/org/vivecraft/api_beta/VivecraftAPI.java @@ -1,8 +1,10 @@ package org.vivecraft.api_beta; +import org.vivecraft.common.APIImpl; + import com.google.common.annotations.Beta; + import net.minecraft.world.entity.player.Player; -import org.vivecraft.common.APIImpl; @Beta public interface VivecraftAPI { diff --git a/common/src/main/java/org/vivecraft/api_beta/client/VivecraftClientAPI.java b/common/src/main/java/org/vivecraft/api_beta/client/VivecraftClientAPI.java index ff629beb4..06bdfc4ca 100644 --- a/common/src/main/java/org/vivecraft/api_beta/client/VivecraftClientAPI.java +++ b/common/src/main/java/org/vivecraft/api_beta/client/VivecraftClientAPI.java @@ -1,8 +1,9 @@ package org.vivecraft.api_beta.client; -import com.google.common.annotations.Beta; import org.vivecraft.client.ClientAPIImpl; +import com.google.common.annotations.Beta; + public interface VivecraftClientAPI { static VivecraftClientAPI getInstance() { diff --git a/common/src/main/java/org/vivecraft/client/ClientAPIImpl.java b/common/src/main/java/org/vivecraft/client/ClientAPIImpl.java index 215c6625d..c6505233b 100644 --- a/common/src/main/java/org/vivecraft/client/ClientAPIImpl.java +++ b/common/src/main/java/org/vivecraft/client/ClientAPIImpl.java @@ -1,9 +1,11 @@ package org.vivecraft.client; import org.vivecraft.api_beta.client.VivecraftClientAPI; -import org.vivecraft.client_vr.VRState; import org.vivecraft.client_xr.render_pass.RenderPassType; +import static org.vivecraft.client_vr.VRState.vrInitialized; +import static org.vivecraft.client_vr.VRState.vrRunning; + public final class ClientAPIImpl implements VivecraftClientAPI { public static final ClientAPIImpl INSTANCE = new ClientAPIImpl(); @@ -13,12 +15,12 @@ private ClientAPIImpl() { @Override public boolean isVrInitialized() { - return VRState.vrInitialized; + return vrInitialized; } @Override public boolean isVrActive() { - return VRState.vrRunning; + return vrRunning; } @Override diff --git a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java index 0f452f3e2..34bd12af8 100644 --- a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java +++ b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java @@ -1,23 +1,27 @@ package org.vivecraft.client; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.utils.Utils; +import org.vivecraft.client_vr.VRData; +import org.vivecraft.common.network.VRPlayerState; + +import org.joml.Quaternionf; +import org.joml.Vector3d; +import org.joml.Vector3f; + import net.minecraft.client.particle.Particle; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.common.network.VrPlayerState; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; import java.util.*; -import java.util.Map.Entry; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; + +import static org.joml.Math.*; public class VRPlayersClient { - private final Minecraft mc; private final Map vivePlayers = new HashMap<>(); private final Map vivePlayersLast = new HashMap<>(); private final Map vivePlayersReceived = Collections.synchronizedMap(new HashMap<>()); @@ -38,12 +42,8 @@ public static void clear() { instance = null; } - private VRPlayersClient() { - this.mc = Minecraft.getInstance(); - } - public boolean isVRPlayer(Player player) { - return vivePlayers.containsKey(player.getUUID()); + return this.vivePlayers.containsKey(player.getUUID()); } public void disableVR(UUID player) { @@ -52,23 +52,19 @@ public void disableVR(UUID player) { this.vivePlayersReceived.remove(player); } - public void Update(UUID uuid, VrPlayerState vrPlayerState, float worldScale, float heightScale, boolean localPlayer) { - if (localPlayer || !this.mc.player.getUUID().equals(uuid)) { - Vector3 forward = new Vector3(0.0F, 0.0F, -1.0F); - Vector3 hmdDir = vrPlayerState.hmd().orientation().multiply(forward); - Vector3 controller0Dir = vrPlayerState.controller0().orientation().multiply(forward); - Vector3 controller1Dir = vrPlayerState.controller1().orientation().multiply(forward); + public void Update(UUID uuid, VRPlayerState vrPlayerState, float worldScale, float heightScale, boolean localPlayer) { + if (localPlayer || !mc.player.getUUID().equals(uuid)) { var rotInfo = new RotInfo(); - rotInfo.reverse = vrPlayerState.reverseHands(); - rotInfo.seated = vrPlayerState.seated(); if (this.donors.containsKey(uuid)) { rotInfo.hmd = this.donors.get(uuid); } - rotInfo.leftArmRot = new Vec3(controller1Dir.getX(), controller1Dir.getY(), controller1Dir.getZ()); - rotInfo.rightArmRot = new Vec3(controller0Dir.getX(), controller0Dir.getY(), controller0Dir.getZ()); - rotInfo.headRot = new Vec3(hmdDir.getX(), hmdDir.getY(), hmdDir.getZ()); + rotInfo.reverse = vrPlayerState.reverseHands(); + rotInfo.seated = vrPlayerState.seated(); + rotInfo.leftArmRot = convertToVec3(vrPlayerState.controller1().orientation().transformUnit(0.0F, 0.0F, -1.0F, new Vector3f())); + rotInfo.rightArmRot = convertToVec3(vrPlayerState.controller0().orientation().transformUnit(0.0F, 0.0F, -1.0F, new Vector3f())); + rotInfo.headRot = convertToVec3(vrPlayerState.hmd().orientation().transformUnit(0.0F, 0.0F, -1.0F, new Vector3f())); rotInfo.Headpos = vrPlayerState.hmd().position(); rotInfo.leftArmPos = vrPlayerState.controller1().position(); rotInfo.rightArmPos = vrPlayerState.controller0().position(); @@ -95,42 +91,36 @@ public void Update(UUID uuid, VrPlayerState vrPlayerState, float worldScale, flo } } - public void Update(UUID uuid, VrPlayerState vrPlayerState, float worldscale, float heightscale) { + public void Update(UUID uuid, VRPlayerState vrPlayerState, float worldscale, float heightscale) { this.Update(uuid, vrPlayerState, worldscale, heightscale, false); } public void tick() { - for (Entry entry : this.vivePlayers.entrySet()) { - this.vivePlayersLast.put(entry.getKey(), entry.getValue()); - } - - for (Entry entry1 : this.vivePlayersReceived.entrySet()) { - this.vivePlayers.put(entry1.getKey(), entry1.getValue()); - } + this.vivePlayersLast.putAll(this.vivePlayers); - Level level = Minecraft.getInstance().level; + this.vivePlayers.putAll(this.vivePlayersReceived); - if (level != null) { + if (mc.level != null) { Iterator iterator = this.vivePlayers.keySet().iterator(); while (iterator.hasNext()) { UUID uuid = iterator.next(); - if (level.getPlayerByUUID(uuid) == null) { + if (mc.level.getPlayerByUUID(uuid) == null) { iterator.remove(); this.vivePlayersLast.remove(uuid); this.vivePlayersReceived.remove(uuid); } } - if (!this.mc.isPaused()) { - for (Player player : level.players()) { + if (!mc.isPaused()) { + for (Player player : mc.level.players()) { if (this.donors.getOrDefault(player.getUUID(), 0) > 3 && this.rand.nextInt(10) < 4) { RotInfo playermodelcontroller$rotinfo = this.vivePlayers.get(player.getUUID()); Vec3 vec3 = player.getLookAngle(); if (playermodelcontroller$rotinfo != null) { - vec3 = playermodelcontroller$rotinfo.leftArmPos.subtract(playermodelcontroller$rotinfo.rightArmPos).yRot((-(float) Math.PI / 2F)); + vec3 = playermodelcontroller$rotinfo.leftArmPos.subtract(playermodelcontroller$rotinfo.rightArmPos).yRot((-(float) PI / 2F)); if (playermodelcontroller$rotinfo.reverse) { vec3 = vec3.scale(-1.0D); @@ -144,11 +134,15 @@ public void tick() { } vec3 = vec3.scale(0.1F); - Vec3 vec31 = playermodelcontroller$rotinfo != null && player == this.mc.player ? playermodelcontroller$rotinfo.Headpos.add(player.position()) : player.getEyePosition(1.0F); - Particle particle = this.mc.particleEngine.createParticle(ParticleTypes.FIREWORK, vec31.x + (player.isShiftKeyDown() ? -vec3.x * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.y - (double) (player.isShiftKeyDown() ? 1.0F : 0.8F) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.z + (player.isShiftKeyDown() ? -vec3.z * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, -vec3.x + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F, ((double) this.rand.nextFloat() - (double) 0.05F) * (double) 0.05F, -vec3.z + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F); + Vec3 vec31 = playermodelcontroller$rotinfo != null && player == mc.player ? playermodelcontroller$rotinfo.Headpos.add(player.position()) : player.getEyePosition(1.0F); + Particle particle = mc.particleEngine.createParticle(ParticleTypes.FIREWORK, vec31.x + (player.isShiftKeyDown() ? -vec3.x * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.y - (double) (player.isShiftKeyDown() ? 1.0F : 0.8F) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.z + (player.isShiftKeyDown() ? -vec3.z * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, -vec3.x + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F, ((double) this.rand.nextFloat() - (double) 0.05F) * (double) 0.05F, -vec3.z + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F); if (particle != null) { - particle.setColor(0.5F + this.rand.nextFloat() / 2.0F, 0.5F + this.rand.nextFloat() / 2.0F, 0.5F + this.rand.nextFloat() / 2.0F); + particle.setColor( + 0.5F + this.rand.nextFloat() / 2.0F, + 0.5F + this.rand.nextFloat() / 2.0F, + 0.5F + this.rand.nextFloat() / 2.0F + ); } } } @@ -166,7 +160,7 @@ public boolean HMDCHecked(UUID uuid) { public RotInfo getRotationsForPlayer(UUID uuid) { if (this.debug) { - uuid = this.mc.player.getUUID(); + uuid = mc.player.getUUID(); } RotInfo playermodelcontroller$rotinfo = this.vivePlayers.get(uuid); @@ -174,7 +168,7 @@ public RotInfo getRotationsForPlayer(UUID uuid) { if (playermodelcontroller$rotinfo != null && this.vivePlayersLast.containsKey(uuid)) { RotInfo playermodelcontroller$rotinfo1 = this.vivePlayersLast.get(uuid); RotInfo playermodelcontroller$rotinfo2 = new RotInfo(); - float f = Minecraft.getInstance().getFrameTime(); + float f = mc.getFrameTime(); playermodelcontroller$rotinfo2.reverse = playermodelcontroller$rotinfo.reverse; playermodelcontroller$rotinfo2.seated = playermodelcontroller$rotinfo.seated; playermodelcontroller$rotinfo2.hmd = playermodelcontroller$rotinfo.hmd; @@ -184,10 +178,22 @@ public RotInfo getRotationsForPlayer(UUID uuid) { playermodelcontroller$rotinfo2.leftArmQuat = playermodelcontroller$rotinfo.leftArmQuat; playermodelcontroller$rotinfo2.rightArmQuat = playermodelcontroller$rotinfo.rightArmQuat; playermodelcontroller$rotinfo2.headQuat = playermodelcontroller$rotinfo.headQuat; - Vector3 vector3 = new Vector3(0.0F, 0.0F, -1.0F); - playermodelcontroller$rotinfo2.leftArmRot = Utils.vecLerp(playermodelcontroller$rotinfo1.leftArmRot, Utils.convertToVector3d(playermodelcontroller$rotinfo2.leftArmQuat.multiply(vector3)), f); - playermodelcontroller$rotinfo2.rightArmRot = Utils.vecLerp(playermodelcontroller$rotinfo1.rightArmRot, Utils.convertToVector3d(playermodelcontroller$rotinfo2.rightArmQuat.multiply(vector3)), f); - playermodelcontroller$rotinfo2.headRot = Utils.vecLerp(playermodelcontroller$rotinfo1.headRot, Utils.convertToVector3d(playermodelcontroller$rotinfo2.headQuat.multiply(vector3)), f); + playermodelcontroller$rotinfo2.leftArmRot = Utils.vecLerp( + playermodelcontroller$rotinfo1.leftArmRot, + convertToVec3( + playermodelcontroller$rotinfo2.leftArmQuat.transformUnit(new Vector3f(forward)) + ), f + ); + playermodelcontroller$rotinfo2.rightArmRot = Utils.vecLerp( + playermodelcontroller$rotinfo1.rightArmRot, + convertToVec3(playermodelcontroller$rotinfo2.rightArmQuat.transformUnit(new Vector3f(forward))), + f + ); + playermodelcontroller$rotinfo2.headRot = Utils.vecLerp( + playermodelcontroller$rotinfo1.headRot, + convertToVec3(playermodelcontroller$rotinfo2.headQuat.transformUnit(new Vector3f(forward))), + f + ); playermodelcontroller$rotinfo2.heightScale = playermodelcontroller$rotinfo.heightScale; playermodelcontroller$rotinfo2.worldScale = playermodelcontroller$rotinfo.worldScale; return playermodelcontroller$rotinfo2; @@ -198,13 +204,13 @@ public RotInfo getRotationsForPlayer(UUID uuid) { public static RotInfo getMainPlayerRotInfo(VRData data) { RotInfo playermodelcontroller$rotinfo = new RotInfo(); - Quaternion quaternion = new Quaternion(data.getController(1).getMatrix()); - Quaternion quaternion1 = new Quaternion(data.getController(0).getMatrix()); - Quaternion quaternion2 = new Quaternion(data.hmd.getMatrix()); + Quaternionf quaternion = new Quaternionf().setFromNormalized(data.getController(1).getMatrix()); + Quaternionf quaternion1 = new Quaternionf().setFromNormalized(data.getController(0).getMatrix()); + Quaternionf quaternion2 = new Quaternionf().setFromNormalized(data.hmd.getMatrix()); playermodelcontroller$rotinfo.headQuat = quaternion2; playermodelcontroller$rotinfo.leftArmQuat = quaternion; playermodelcontroller$rotinfo.rightArmQuat = quaternion1; - playermodelcontroller$rotinfo.seated = ClientDataHolderVR.getInstance().vrSettings.seated; + playermodelcontroller$rotinfo.seated = dh.vrSettings.seated; playermodelcontroller$rotinfo.leftArmPos = data.getController(1).getPosition(); playermodelcontroller$rotinfo.rightArmPos = data.getController(0).getPosition(); playermodelcontroller$rotinfo.Headpos = data.hmd.getPosition(); @@ -213,26 +219,30 @@ public static RotInfo getMainPlayerRotInfo(VRData data) { public boolean isTracked(UUID uuid) { this.debug = false; - return this.debug ? true : this.vivePlayers.containsKey(uuid); + return this.debug || this.vivePlayers.containsKey(uuid); } public static float getFacingYaw(RotInfo rotInfo) { Vec3 vec3 = getOrientVec(rotInfo.headQuat); - return (float) Math.toDegrees(Math.atan2(vec3.x, vec3.z)); + return (float) toDegrees(atan2(vec3.x, vec3.z)); } - public static Vec3 getOrientVec(Quaternion quat) { - Vec3 vec3 = quat.multiply(new Vec3(0.0D, 0.0D, -1.0D)).cross(quat.multiply(new Vec3(0.0D, 1.0D, 0.0D))).normalize(); - return (new Vec3(0.0D, 1.0D, 0.0D)).cross(vec3).normalize(); + public static Vec3 getOrientVec(Quaternionf quat) { + return convertToVec3( + new Vector3f(up).cross( + quat.transformUnit(new Vector3f(forward)).cross( + quat.transformUnit(new Vector3f(up))).normalize() + ).normalize() + ); } public static class RotInfo { public boolean seated; public boolean reverse; public int hmd = 0; - public Quaternion leftArmQuat; - public Quaternion rightArmQuat; - public Quaternion headQuat; + public Quaternionf leftArmQuat; + public Quaternionf rightArmQuat; + public Quaternionf headQuat; public Vec3 leftArmRot; public Vec3 rightArmRot; public Vec3 headRot; @@ -243,18 +253,25 @@ public static class RotInfo { public float heightScale; public double getBodyYawRadians() { - Vec3 vec3 = this.leftArmPos.subtract(this.rightArmPos).yRot((-(float) Math.PI / 2F)); - - if (this.reverse) { - vec3 = vec3.scale(-1.0D); - } + Vector3d vec3; if (this.seated) { - vec3 = this.rightArmRot; + vec3 = convertToVector3d(this.rightArmRot, new Vector3d()); + } + else + { + vec3 = convertToVector3d(this.leftArmPos, new Vector3d()) + .sub(this.rightArmPos.x(), this.rightArmPos.y(), this.rightArmPos.z()) + .rotateY((-(float)PI / 2.0F)); + + if (this.reverse) + { + vec3.negate(); + } } - Vec3 vec31 = Utils.vecLerp(vec3, this.headRot, 0.5D); - return Math.atan2(-vec31.x, vec31.z); + vec3.lerp(convertToVector3d(this.headRot, new Vector3d()), 0.5D); + return atan2(-vec3.x, vec3.z); } } } diff --git a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java index 9fcdcc08a..75c7a715d 100644 --- a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java +++ b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java @@ -1,162 +1,118 @@ package org.vivecraft.client; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; -import org.apache.commons.lang3.ArrayUtils; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.provider.HandedKeyBinding; -import java.util.*; - -public class VivecraftVRMod { - - public static final boolean compiledWithForge = true; - - private static final Minecraft mc = Minecraft.getInstance(); - - public static VivecraftVRMod INSTANCE = new VivecraftVRMod(); - - Set allKeyBindingSet; - - // key binds that are settable by the user - Set userKeyBindingSet; - - // key binds that are needed internally, but are not required to be set by the user - Set hiddenKeyBindingSet; - - protected Set vanillaBindingSet; - - public final HandedKeyBinding keyClimbeyGrab = new HandedKeyBinding("vivecraft.key.climbeyGrab", -1, "vivecraft.key.category.climbey"); - public final HandedKeyBinding keyClimbeyJump = new HandedKeyBinding("vivecraft.key.climbeyJump", -1, "vivecraft.key.category.climbey"); - public final KeyMapping keyExportWorld = new KeyMapping("vivecraft.key.exportWorld", -1, "key.categories.misc"); - public final KeyMapping keyFreeMoveRotate = new KeyMapping("vivecraft.key.freeMoveRotate", -1, "key.categories.movement"); - public final KeyMapping keyFreeMoveStrafe = new KeyMapping("vivecraft.key.freeMoveStrafe", -1, "key.categories.movement"); - public final KeyMapping keyHotbarNext = new KeyMapping("vivecraft.key.hotbarNext", -1, "key.categories.inventory"); - public final KeyMapping keyHotbarPrev = new KeyMapping("vivecraft.key.hotbarPrev", -1, "key.categories.inventory"); - public final KeyMapping keyHotbarScroll = new KeyMapping("vivecraft.key.hotbarScroll", -1, "key.categories.inventory"); - public final KeyMapping keyHotbarSwipeX = new KeyMapping("vivecraft.key.hotbarSwipeX", -1, "key.categories.inventory"); - public final KeyMapping keyHotbarSwipeY = new KeyMapping("vivecraft.key.hotbarSwipeY", -1, "key.categories.inventory"); - public final KeyMapping keyMenuButton = new KeyMapping("vivecraft.key.ingameMenuButton", -1, "key.categories.ui"); - public final KeyMapping keyMoveThirdPersonCam = new KeyMapping("vivecraft.key.moveThirdPersonCam", -1, "key.categories.misc"); - public final KeyMapping keyQuickHandheldCam = new KeyMapping("vivecraft.key.quickHandheldCam", -1, "key.categories.misc"); - public final KeyMapping keyQuickTorch = new KeyMapping("vivecraft.key.quickTorch", -1, "key.categories.gameplay"); - public final KeyMapping keyRadialMenu = new KeyMapping("vivecraft.key.radialMenu", -1, "key.categories.ui"); - public final KeyMapping keyRotateAxis = new KeyMapping("vivecraft.key.rotateAxis", -1, "key.categories.movement"); - public final KeyMapping keyRotateFree = new KeyMapping("vivecraft.key.rotateFree", -1, "key.categories.movement"); - public final KeyMapping keyRotateLeft = new KeyMapping("vivecraft.key.rotateLeft", -1, "key.categories.movement"); - public final KeyMapping keyRotateRight = new KeyMapping("vivecraft.key.rotateRight", -1, "key.categories.movement"); - public final KeyMapping keySwapMirrorView = new KeyMapping("vivecraft.key.swapMirrorView", -1, "key.categories.misc"); - public final KeyMapping keyTeleport = new KeyMapping("vivecraft.key.teleport", -1, "key.categories.movement"); - public final KeyMapping keyTeleportFallback = new KeyMapping("vivecraft.key.teleportFallback", -1, "key.categories.movement"); - public final KeyMapping keyToggleHandheldCam = new KeyMapping("vivecraft.key.toggleHandheldCam", -1, "key.categories.misc"); - public final KeyMapping keyToggleKeyboard = new KeyMapping("vivecraft.key.toggleKeyboard", -1, "key.categories.ui"); - public final KeyMapping keyToggleMovement = new KeyMapping("vivecraft.key.toggleMovement", -1, "key.categories.movement"); - public final KeyMapping keyTogglePlayerList = new KeyMapping("vivecraft.key.togglePlayerList", -1, "key.categories.multiplayer"); - public final HandedKeyBinding keyTrackpadTouch = new HandedKeyBinding("vivecraft.key.trackpadTouch", -1, "key.categories.misc"); - public final HandedKeyBinding keyVRInteract = new HandedKeyBinding("vivecraft.key.vrInteract", -1, "key.categories.gameplay"); - public final KeyMapping keyWalkabout = new KeyMapping("vivecraft.key.walkabout", -1, "key.categories.movement"); - - private void setupKeybindingSets() { - if (this.userKeyBindingSet == null || hiddenKeyBindingSet == null) - { - this.userKeyBindingSet = new LinkedHashSet<>(); - this.hiddenKeyBindingSet = new LinkedHashSet<>(); - this.allKeyBindingSet = new LinkedHashSet<>(); - - this.userKeyBindingSet.add(this.keyRotateLeft); - this.userKeyBindingSet.add(this.keyRotateRight); - this.userKeyBindingSet.add(this.keyTeleport); - this.userKeyBindingSet.add(this.keyTeleportFallback); - this.userKeyBindingSet.add(this.keyToggleMovement); - this.userKeyBindingSet.add(this.keyQuickTorch); - this.userKeyBindingSet.add(this.keySwapMirrorView); - this.userKeyBindingSet.add(this.keyExportWorld); - this.userKeyBindingSet.add(this.keyMoveThirdPersonCam); - this.userKeyBindingSet.add(this.keyTogglePlayerList); - this.userKeyBindingSet.add(this.keyToggleHandheldCam); - this.userKeyBindingSet.add(this.keyQuickHandheldCam); - - this.hiddenKeyBindingSet.add(GuiHandler.keyLeftClick); - this.hiddenKeyBindingSet.add(GuiHandler.keyRightClick); - this.hiddenKeyBindingSet.add(GuiHandler.keyMiddleClick); - this.hiddenKeyBindingSet.add(GuiHandler.keyShift); - this.hiddenKeyBindingSet.add(GuiHandler.keyCtrl); - this.hiddenKeyBindingSet.add(GuiHandler.keyAlt); - this.hiddenKeyBindingSet.add(GuiHandler.keyScrollUp); - this.hiddenKeyBindingSet.add(GuiHandler.keyScrollDown); - this.hiddenKeyBindingSet.add(GuiHandler.keyScrollAxis); - this.hiddenKeyBindingSet.add(GuiHandler.keyKeyboardClick); - this.hiddenKeyBindingSet.add(GuiHandler.keyKeyboardShift); - this.hiddenKeyBindingSet.add(this.keyClimbeyGrab); - this.hiddenKeyBindingSet.add(this.keyClimbeyJump); - this.hiddenKeyBindingSet.add(this.keyMenuButton); - this.hiddenKeyBindingSet.add(this.keyRadialMenu); - this.hiddenKeyBindingSet.add(this.keyToggleKeyboard); - this.hiddenKeyBindingSet.add(this.keyHotbarSwipeX); - this.hiddenKeyBindingSet.add(this.keyHotbarSwipeY); - this.hiddenKeyBindingSet.add(this.keyTrackpadTouch); - - this.hiddenKeyBindingSet.add(this.keyRotateAxis); - this.hiddenKeyBindingSet.add(this.keyRotateFree); - this.hiddenKeyBindingSet.add(this.keyFreeMoveRotate); - this.hiddenKeyBindingSet.add(this.keyFreeMoveStrafe); - this.hiddenKeyBindingSet.add(this.keyHotbarNext); - this.hiddenKeyBindingSet.add(this.keyHotbarPrev); - this.hiddenKeyBindingSet.add(this.keyHotbarScroll); - this.hiddenKeyBindingSet.add(this.keyVRInteract); - this.hiddenKeyBindingSet.add(this.keyWalkabout); - - allKeyBindingSet.addAll(userKeyBindingSet); - allKeyBindingSet.addAll(hiddenKeyBindingSet); - } - } - - public Set getUserKeyBindings() - { - setupKeybindingSets(); - return this.userKeyBindingSet; - } - - public Set getHiddenKeyBindings() { - setupKeybindingSets(); - return hiddenKeyBindingSet; - } +import net.minecraft.client.KeyMapping; - public Set getAllKeyBindings() { - setupKeybindingSets(); - return allKeyBindingSet; - } +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; - public KeyMapping[] initializeBindings(KeyMapping[] keyBindings) - { - for (KeyMapping keymapping : this.getUserKeyBindings()) - { - keyBindings = ArrayUtils.add(keyBindings, keymapping); - } +import static org.vivecraft.client_vr.VRState.mc; - this.setVanillaBindings(keyBindings); - Map map = KeyMapping.CATEGORY_SORT_ORDER; - map.put("vivecraft.key.category.gui", 8); - map.put("vivecraft.key.category.climbey", 9); - map.put("vivecraft.key.category.keyboard", 10); - return keyBindings; - } +import static org.lwjgl.glfw.GLFW.*; - public void setVanillaBindings(KeyMapping[] bindings) - { - this.vanillaBindingSet = new HashSet<>(Arrays.asList(bindings)); - // add hidden keys, since those are not in there - vanillaBindingSet.addAll(hiddenKeyBindingSet); - } +public class VivecraftVRMod { - public boolean isSafeBinding(KeyMapping kb) + public static final HandedKeyBinding keyClimbeyGrab = new HandedKeyBinding("vivecraft.key.climbeyGrab", GLFW_KEY_UNKNOWN, "vivecraft.key.category.climbey"); + public static final HandedKeyBinding keyClimbeyJump = new HandedKeyBinding("vivecraft.key.climbeyJump", GLFW_KEY_UNKNOWN, "vivecraft.key.category.climbey"); + public static final KeyMapping keyExportWorld = new KeyMapping("vivecraft.key.exportWorld", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final KeyMapping keyFreeMoveRotate = new KeyMapping("vivecraft.key.freeMoveRotate", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyFreeMoveStrafe = new KeyMapping("vivecraft.key.freeMoveStrafe", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyHotbarNext = new KeyMapping("vivecraft.key.hotbarNext", GLFW_KEY_UNKNOWN, "key.categories.inventory"); + public static final KeyMapping keyHotbarPrev = new KeyMapping("vivecraft.key.hotbarPrev", GLFW_KEY_UNKNOWN, "key.categories.inventory"); + public static final KeyMapping keyHotbarScroll = new KeyMapping("vivecraft.key.hotbarScroll", GLFW_KEY_UNKNOWN, "key.categories.inventory"); + public static final KeyMapping keyHotbarSwipeX = new KeyMapping("vivecraft.key.hotbarSwipeX", GLFW_KEY_UNKNOWN, "key.categories.inventory"); + public static final KeyMapping keyHotbarSwipeY = new KeyMapping("vivecraft.key.hotbarSwipeY", GLFW_KEY_UNKNOWN, "key.categories.inventory"); + public static final KeyMapping keyMenuButton = new KeyMapping("vivecraft.key.ingameMenuButton", GLFW_KEY_UNKNOWN, "key.categories.ui"); + public static final KeyMapping keyMoveThirdPersonCam = new KeyMapping("vivecraft.key.moveThirdPersonCam", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final KeyMapping keyQuickHandheldCam = new KeyMapping("vivecraft.key.quickHandheldCam", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final KeyMapping keyQuickTorch = new KeyMapping("vivecraft.key.quickTorch", GLFW_KEY_UNKNOWN, "key.categories.gameplay"); + public static final KeyMapping keyRadialMenu = new KeyMapping("vivecraft.key.radialMenu", GLFW_KEY_UNKNOWN, "key.categories.ui"); + public static final KeyMapping keyRotateAxis = new KeyMapping("vivecraft.key.rotateAxis", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyRotateFree = new KeyMapping("vivecraft.key.rotateFree", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyRotateLeft = new KeyMapping("vivecraft.key.rotateLeft", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyRotateRight = new KeyMapping("vivecraft.key.rotateRight", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keySwapMirrorView = new KeyMapping("vivecraft.key.swapMirrorView", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final KeyMapping keyTeleport = new KeyMapping("vivecraft.key.teleport", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyTeleportFallback = new KeyMapping("vivecraft.key.teleportFallback", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyToggleHandheldCam = new KeyMapping("vivecraft.key.toggleHandheldCam", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final KeyMapping keyToggleKeyboard = new KeyMapping("vivecraft.key.toggleKeyboard", GLFW_KEY_UNKNOWN, "key.categories.ui"); + public static final KeyMapping keyToggleMovement = new KeyMapping("vivecraft.key.toggleMovement", GLFW_KEY_UNKNOWN, "key.categories.movement"); + public static final KeyMapping keyTogglePlayerList = new KeyMapping("vivecraft.key.togglePlayerList", GLFW_KEY_UNKNOWN, "key.categories.multiplayer"); + public static final HandedKeyBinding keyTrackpadTouch = new HandedKeyBinding("vivecraft.key.trackpadTouch", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final HandedKeyBinding keyVRInteract = new HandedKeyBinding("vivecraft.key.vrInteract", GLFW_KEY_UNKNOWN, "key.categories.gameplay"); + public static final KeyMapping keyWalkabout = new KeyMapping("vivecraft.key.walkabout", GLFW_KEY_UNKNOWN, "key.categories.movement"); + + /** Key binds provided by vivecraft, which the player may bind. */ + public static final Set userKeyBindingSet = new LinkedHashSet<>(Arrays.asList( + keyRotateLeft, + keyRotateRight, + keyTeleport, + keyTeleportFallback, + keyToggleMovement, + keyQuickTorch, + keySwapMirrorView, + keyExportWorld, + keyMoveThirdPersonCam, + keyTogglePlayerList, + keyToggleHandheldCam, + keyQuickHandheldCam + )); + + /** Key binds internal to vivecraft, which the player may not bind. */ + public static final Set hiddenKeyBindingSet = new LinkedHashSet<>(Arrays.asList( + GuiHandler.keyLeftClick, + GuiHandler.keyRightClick, + GuiHandler.keyMiddleClick, + GuiHandler.keyShift, + GuiHandler.keyCtrl, + GuiHandler.keyAlt, + GuiHandler.keyScrollUp, + GuiHandler.keyScrollDown, + GuiHandler.keyScrollAxis, + GuiHandler.keyKeyboardClick, + GuiHandler.keyKeyboardShift, + keyClimbeyGrab, + keyClimbeyJump, + keyMenuButton, + keyRadialMenu, + keyToggleKeyboard, + keyHotbarSwipeX, + keyHotbarSwipeY, + keyTrackpadTouch, + keyRotateAxis, + keyRotateFree, + keyFreeMoveRotate, + keyFreeMoveStrafe, + keyHotbarNext, + keyHotbarPrev, + keyHotbarScroll, + keyVRInteract, + keyWalkabout + )); + + /** Key binds provided by vanilla. */ + public static final Set vanillaBindingSet = new LinkedHashSet<>(); + + /** Key binds provided to the player. */ + public static final Set allKeyBindingSet = Stream.concat( + userKeyBindingSet.stream(), + hiddenKeyBindingSet.stream() + ).collect(Collectors.toSet()); + + public static boolean isSafeBinding(KeyMapping kb) { - return this.getAllKeyBindings().contains(kb) || kb == mc.options.keyChat || kb == mc.options.keyInventory; + return allKeyBindingSet.contains(kb) || kb == mc.options.keyChat || kb == mc.options.keyInventory; } - public boolean isModBinding(KeyMapping kb) + /** checks if a key bind is provided by vanilla or internal to vivecraft */ + public static boolean isModBinding(final KeyMapping kb) { - return !this.vanillaBindingSet.contains(kb); + return !hiddenKeyBindingSet.contains(kb) && !vanillaBindingSet.contains(kb); } } diff --git a/common/src/main/java/org/vivecraft/client/Xevents.java b/common/src/main/java/org/vivecraft/client/Xevents.java index c1fd3640d..0ccdca162 100644 --- a/common/src/main/java/org/vivecraft/client/Xevents.java +++ b/common/src/main/java/org/vivecraft/client/Xevents.java @@ -1,7 +1,9 @@ package org.vivecraft.client; -import com.mojang.blaze3d.vertex.PoseStack; import dev.architectury.injectables.annotations.ExpectPlatform; + +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.state.BlockState; @@ -9,27 +11,27 @@ public interface Xevents { @ExpectPlatform - public static boolean renderBlockOverlay(Player player, PoseStack mat, BlockState state, BlockPos pos) { + static boolean renderBlockOverlay(Player player, PoseStack mat, BlockState state, BlockPos pos) { return false; } @ExpectPlatform - public static boolean renderWaterOverlay(Player player, PoseStack mat) { + static boolean renderWaterOverlay(Player player, PoseStack mat) { return false; } @ExpectPlatform - public static boolean renderFireOverlay(Player player, PoseStack mat) { + static boolean renderFireOverlay(Player player, PoseStack mat) { return false; } @ExpectPlatform - public static void onRenderTickStart(float f) { + static void onRenderTickStart(float f) { } @ExpectPlatform - public static void onRenderTickEnd(float f) { + static void onRenderTickEnd(float f) { } diff --git a/common/src/main/java/org/vivecraft/client/Xplat.java b/common/src/main/java/org/vivecraft/client/Xplat.java index 7d56b8189..67743c1e1 100644 --- a/common/src/main/java/org/vivecraft/client/Xplat.java +++ b/common/src/main/java/org/vivecraft/client/Xplat.java @@ -1,11 +1,14 @@ package org.vivecraft.client; -import com.mojang.blaze3d.pipeline.RenderTarget; import dev.architectury.injectables.annotations.ExpectPlatform; + +import com.mojang.blaze3d.pipeline.RenderTarget; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.ClimateSettings; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.material.FluidState; @@ -76,7 +79,7 @@ static TextureAtlasSprite[] getFluidTextures(BlockAndTintGetter level, BlockPos } @ExpectPlatform - static Biome.ClimateSettings getBiomeClimateSettings(Biome biome){ + static ClimateSettings getBiomeClimateSettings(Biome biome){ return null; } diff --git a/common/src/main/java/org/vivecraft/client/extensions/RenderTargetExtension.java b/common/src/main/java/org/vivecraft/client/extensions/RenderTargetExtension.java index 0aa61315d..b894844e7 100644 --- a/common/src/main/java/org/vivecraft/client/extensions/RenderTargetExtension.java +++ b/common/src/main/java/org/vivecraft/client/extensions/RenderTargetExtension.java @@ -1,32 +1,43 @@ package org.vivecraft.client.extensions; +import org.lwjgl.opengl.GL11C; +import org.lwjgl.opengl.GL30C; + import net.minecraft.client.renderer.ShaderInstance; -import org.lwjgl.opengl.GL30; -public interface RenderTargetExtension { +public interface RenderTargetExtension +{ - String getName(); + String getName(); - void clearWithColor(float r, float g, float b, float a, boolean isMac); + void clearWithColor(float r, float g, float b, float a, boolean isMac); - default void blitToScreen(int i, int viewWidth, int viewHeight, int j, boolean b, float f, float g, boolean c) { - blitToScreen(null, i, viewWidth, viewHeight, j, b, f, g, c); - } + default void blitToScreen( + int left, int width, int height, int top, boolean disableBlend, float xCropFactor, + float yCropFactor, boolean keepAspect + ) + { + blitToScreen(null, left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect); + } - void blitToScreen(ShaderInstance instance, int i, int viewWidth, int viewHeight, int j, boolean b, float f, float g, boolean c); + void blitToScreen( + ShaderInstance instance, int left, int width, int height, int top, boolean disableBlend, float xCropFactor, + float yCropFactor, boolean keepAspect + ); - default void genMipMaps() { - GL30.glGenerateMipmap(3553); - } + default void genMipMaps() + { + GL30C.glGenerateMipmap(GL11C.GL_TEXTURE_2D); + } - void setTextid(int texid); + void setTextid(int texid); - void setUseStencil(boolean useStencil); + void setUseStencil(boolean useStencil); - boolean getUseStencil(); + boolean getUseStencil(); - void isLinearFilter(boolean linearFilter); + void isLinearFilter(boolean linearFilter); - void blitFovReduction(ShaderInstance instance, int width, int height); + void blitFovReduction(ShaderInstance instance, int width, int height); } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROption.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROption.java index f2e24fd45..ed1dd9199 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROption.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROption.java @@ -1,10 +1,13 @@ package org.vivecraft.client.gui.framework; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import net.minecraft.client.gui.layouts.LayoutElement; -import org.vivecraft.client_vr.settings.VRSettings; + +import javax.annotation.Nonnull; public interface GuiVROption extends LayoutElement { - int getId(); - VRSettings.VrOptions getOption(); + @Nonnull + VrOptions getOption(); } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionButton.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionButton.java index 52c901d73..719c7362b 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionButton.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionButton.java @@ -1,50 +1,55 @@ package org.vivecraft.client.gui.framework; -import javax.annotation.Nullable; - -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import static org.vivecraft.client_vr.VRState.dh; + public class GuiVROptionButton extends Button implements GuiVROption { - @Nullable - private final VRSettings.VrOptions enumOptions; - private int id = -1; + @Nonnull + private final VrOptions enumOptions; - public GuiVROptionButton(int id, int x, int y, String text, OnPress action) + public GuiVROptionButton(int x, int y, String text, OnPress action) { - this(id, x, y, (VRSettings.VrOptions)null, text, action); + this(x, y, null, text, action); } - public GuiVROptionButton(int id, int x, int y, @Nullable VRSettings.VrOptions option, String text, OnPress action) + public GuiVROptionButton(int x, int y, @Nullable VrOptions option, String text, OnPress action) { - this(id, x, y, 150, 20, option, text, action); + this(x, y, 150, 20, option, text, action); } - public GuiVROptionButton(int id, int x, int y, int width, int height, @Nullable VRSettings.VrOptions option, String text, OnPress action) + public GuiVROptionButton(int x, int y, int width, int height, @Nullable VrOptions option, String text, OnPress action) { - super(x, y, width, height, Component.translatable(text), action, Button.DEFAULT_NARRATION); - this.id = id; - this.enumOptions = option; - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - - if (option != null && dataholder.vrSettings.overrides.hasSetting(option) && dataholder.vrSettings.overrides.getSetting(option).isValueOverridden()) + super( + x, + y, + width, + height, + I18n.exists(text + ".button") ? + Component.translatable(text + ".button") : + Component.translatable(text), + action, + Button.DEFAULT_NARRATION + ); + this.enumOptions = option == null ? VrOptions.DUMMY : option; + + if (option != null && dh.vrSettings.overrides.hasSetting(option) && + dh.vrSettings.overrides.getSetting(option).isValueOverridden() + ) { this.active = false; } } - @Override - public int getId() { - return id; - } - - @Override - @Nullable - public VRSettings.VrOptions getOption() + public @Override @Nonnull VrOptions getOption() { return this.enumOptions; } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java index dbb6ec986..3e51f608d 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionSlider.java @@ -1,61 +1,62 @@ package org.vivecraft.client.gui.framework; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import net.minecraft.client.InputType; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.AbstractSliderButton; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; - import net.minecraft.network.chat.Component; +import javax.annotation.Nonnull; import javax.annotation.Nullable; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class GuiVROptionSlider extends AbstractSliderButton implements GuiVROption { - @Nullable - private final VRSettings.VrOptions enumOptions; - private int id = -1; + @Nonnull + private final VrOptions enumOptions; - public GuiVROptionSlider(int id, int x, int y, int width, int height, VRSettings.VrOptions option) + public GuiVROptionSlider(int x, int y, int width, int height, @Nonnull VrOptions option) { - super(x, y, width, height, - Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(option)), - option.normalizeValue(ClientDataHolderVR.getInstance().vrSettings.getOptionFloatValue(option))); + super( + x, + y, + width, + height, + Component.literal(dh.vrSettings.getButtonDisplayString(option)), + option.normalizeValue(dh.vrSettings.getOptionFloatValue(option)) + ); - this.id = id; this.enumOptions = option; } - public GuiVROptionSlider(int id, int x, int y, VRSettings.VrOptions option) + public GuiVROptionSlider(int x, int y, @Nullable VrOptions option) { - this(id, x, y, 150, 20, option); + this(x, y, 150, 20, option == null ? VrOptions.DUMMY : option); } @Override - protected void updateMessage() { - this.setMessage(Component.literal(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this.enumOptions))); + protected void updateMessage() + { + this.setMessage(Component.literal(dh.vrSettings.getButtonDisplayString(this.enumOptions))); } @Override - protected void applyValue() { - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - double d0 = this.enumOptions.denormalizeValue((float)this.value); - dataholder.vrSettings.setOptionFloatValue(this.enumOptions, (float)d0); + protected void applyValue() + { + double d0 = this.enumOptions.denormalizeValue((float) this.value); + dh.vrSettings.setOptionFloatValue(this.enumOptions, (float) d0); // with that keyboard changes don't work, if there are fewer options than pixels - InputType inputType = Minecraft.getInstance().getLastInputType(); - if (inputType == InputType.MOUSE) { - this.value = this.enumOptions.normalizeValue((float)d0); + InputType inputType = mc.getLastInputType(); + if (inputType == InputType.MOUSE) + { + this.value = this.enumOptions.normalizeValue((float) d0); } } - @Override - public int getId() { - return id; - } - - @Override - @Nullable - public VRSettings.VrOptions getOption() { + public @Override @Nonnull VrOptions getOption() + { return this.enumOptions; } } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java index 437e8b1ff..bf0522cee 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java @@ -1,8 +1,14 @@ package org.vivecraft.client.gui.framework; +import org.vivecraft.client_vr.ScreenUtils; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import org.joml.RoundingMode; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; @@ -11,26 +17,30 @@ import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; import net.minecraft.world.phys.Vec2; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.ScreenUtils; -import org.vivecraft.client_vr.settings.VRSettings; -import java.util.ArrayList; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; +import java.util.function.BiFunction; + +import static org.vivecraft.client.gui.framework.VROptionPosition.*; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; public abstract class GuiVROptionsBase extends Screen { - protected ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); public static final int DONE_BUTTON = 200; public static final int DEFAULTS_BUTTON = 201; protected final Screen lastScreen; - protected final VRSettings settings; //private VRTooltipManager tooltipManager = new VRTooltipManager(this, new TooltipProviderVROptions()); protected boolean reinit; protected boolean drawDefaultButtons = true; - protected ObjectSelectionList visibleList = null; + protected ObjectSelectionList visibleList; private int nextButtonIndex = 0; - public String vrTitle = "Title"; + public static String vrTitle = "Title"; private Button btnDone; private Button btnDefaults; @@ -38,26 +48,25 @@ public GuiVROptionsBase(Screen lastScreen) { super(Component.literal("")); this.lastScreen = lastScreen; - this.settings = ClientDataHolderVR.getInstance().vrSettings; } protected void addDefaultButtons() { - this.addRenderableWidget(this.btnDone = new Button.Builder(Component.translatable("gui.back"), (p) -> + this.addRenderableWidget(this.btnDone = new Builder(Component.translatable("gui.back"), (p) -> { if (!this.onDoneClicked()) { - this.dataholder.vrSettings.saveOptions(); - this.minecraft.setScreen(this.lastScreen); + dh.vrSettings.saveOptions(); + mc.setScreen(this.lastScreen); } }) .pos(this.width / 2 + 5, this.height - 30) .size(150, 20) .build()); - this.addRenderableWidget(this.btnDefaults = new Button.Builder(Component.translatable("vivecraft.gui.loaddefaults"), (p) -> + this.addRenderableWidget(this.btnDefaults = new Builder(Component.translatable("vivecraft.gui.loaddefaults"), (p) -> { this.loadDefaults(); - this.dataholder.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); this.reinit = true; }) .pos(this.width / 2 - 155, this.height - 30) @@ -65,157 +74,257 @@ protected void addDefaultButtons() .build()); } + @Override + protected void clearWidgets(){ + super.clearWidgets(); + this.nextButtonIndex = 0; + } + protected boolean onDoneClicked() { return false; } - protected void init(VROptionLayout[] settings, boolean clear) + protected void init( + @Nullable Class subScreen, + @Nullable VrOptions option, + @Nullable BiFunction customHandler, + @Nonnull VROptionPosition pos, + float row, + @Nonnull String buttonText + ) { - if (clear) + if (this.nextButtonIndex < this.children().size()) { - this.clearWidgets(); + this.nextButtonIndex = this.children().size(); } - int i = 0; - - for (final VROptionLayout vroptionlayout : settings) + int x = switch (pos) { - if (vroptionlayout.getOption() != null && vroptionlayout.getOption().getEnumFloat()) + case POS_LEFT -> { - this.addRenderableWidget(new GuiVROptionSlider(vroptionlayout.getOrdinal(), vroptionlayout.getX(this.width), vroptionlayout.getY(this.height), vroptionlayout.getOption()) - { - public void onClick(double pMouseX, double p_93635_) - { - if (vroptionlayout.getCustomHandler() == null || !vroptionlayout.getCustomHandler().apply(this, new Vec2((float)pMouseX, (float)p_93635_))) - { - super.onClick(pMouseX, p_93635_); - } - } - }); + yield this.width / 2 - 155; } - else if (vroptionlayout.getOption() != null) + case POS_RIGHT -> { - this.addRenderableWidget(new GuiVROptionButton(vroptionlayout.getOrdinal(), vroptionlayout.getX(this.width), vroptionlayout.getY(this.height), vroptionlayout.getOption(), vroptionlayout.getButtonText(), (p) -> - { - if (vroptionlayout.getCustomHandler() == null || !vroptionlayout.getCustomHandler().apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F))) - { - this.settings.setOptionValue(((GuiVROptionButton)p).getOption()); - p.setMessage(Component.literal(vroptionlayout.getButtonText())); - } - })); + yield this.width / 2 - 155 + 160; } - else if (vroptionlayout.getScreen() != null) + default -> { - this.addRenderableWidget(new GuiVROptionButton(vroptionlayout.getOrdinal(), vroptionlayout.getX(this.width), vroptionlayout.getY(this.height), vroptionlayout.getButtonText(), (p) -> - { - try { - if (vroptionlayout.getCustomHandler() != null && vroptionlayout.getCustomHandler().apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F))) - { - return; - } + yield this.width / 2 - 155 + 80; + } + }; - this.settings.saveOptions(); - this.minecraft.setScreen(vroptionlayout.getScreen().getConstructor(Screen.class).newInstance(this)); - } - catch (ReflectiveOperationException reflectiveoperationexception) + int y = roundUsing((float) (this.height / 6) + 21.0F * row - 10.0F, RoundingMode.CEILING); + + if (option != null && option.getEnumFloat()) + { + this.addRenderableWidget(new GuiVROptionSlider(x, y, option) + { + @Override public void onClick(double mouseX, double mouseY) + { + if (customHandler == null || !customHandler.apply(this, new Vec2((float)mouseX, (float)mouseY))) { - reflectiveoperationexception.printStackTrace(); + super.onClick(mouseX, mouseY); } - })); - } - else if (vroptionlayout.getCustomHandler() != null) + } + }); + } + else if (option != null) + { + this.addRenderableWidget(new GuiVROptionButton(x, y, option, dh.vrSettings.getButtonDisplayString(option), (p) -> { - this.addRenderableWidget(new GuiVROptionButton(vroptionlayout.getOrdinal(), vroptionlayout.getX(this.width), vroptionlayout.getY(this.height), vroptionlayout.getButtonText(), (p) -> + if (customHandler == null || !customHandler.apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F))) { - vroptionlayout.getCustomHandler().apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F)); - })); - } - else + dh.vrSettings.setOptionValue(((GuiVROptionButton)p).getOption()); + p.setMessage(Component.literal(dh.vrSettings.getButtonDisplayString(option))); + } + })); + } + else if (subScreen != null) + { + this.addRenderableWidget(new GuiVROptionButton(x, y, buttonText, (p) -> { - this.addRenderableWidget(new GuiVROptionButton(vroptionlayout.getOrdinal(), vroptionlayout.getX(this.width), vroptionlayout.getY(this.height), vroptionlayout.getButtonText(), (p) -> + try { + if (customHandler != null && customHandler.apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F))) + { + return; + } + + dh.vrSettings.saveOptions(); + mc.setScreen(subScreen.getConstructor(Screen.class).newInstance(this)); + } + catch (ReflectiveOperationException reflectiveoperationexception) { - })); - } + reflectiveoperationexception.printStackTrace(); + } + })); + } + else if (customHandler != null) + { + this.addRenderableWidget(new GuiVROptionButton(x, y, buttonText, (p) -> + { + customHandler.apply((GuiVROptionButton)p, new Vec2(0.0F, 0.0F)); + })); + } + else + { + this.addRenderableWidget(new GuiVROptionButton(x, y, buttonText, (p) -> {})); } - - ++i; } protected void loadDefaults() { for (GuiEventListener child : this.children()) { - if (!(child instanceof GuiVROption)) - continue; + if (child instanceof GuiVROption optionButton) { + dh.vrSettings.loadDefault(optionButton.getOption()); + } + } + } - GuiVROption optionButton = (GuiVROption)child; - this.settings.loadDefault(optionButton.getOption()); + protected final void init( + @Nonnull BiFunction customHandler, + @Nonnull VROptionPosition pos, + float row, + @Nonnull String buttonText + ) + { + this.init(null, null, customHandler, pos, row, buttonText); + } + + @SafeVarargs + protected final void init(@Nonnull Class ...subScreens) + { + for (Class subScreen : subScreens) + { + this.init(subScreen); } } - protected void init(VROptionEntry[] settings, boolean clear) + protected void init(@Nonnull Class subScreen) + { + this.init(subScreen, null, null); + } + + protected void init(@Nonnull Class subScreen, @Nullable String buttonText) + { + this.init(subScreen, buttonText, null); + } + + protected void init(@Nonnull Class subScreen, @Nullable VROptionPosition pos) + { + this.init(subScreen, null, pos); + } + + protected void init(@Nonnull Class subScreen, @Nullable String buttonText, @Nullable VROptionPosition pos) + { + this.init(subScreen, buttonText, null, null, pos); + } + + protected void init(@Nonnull final VrOptions ...options) { - if (clear) + for (final VrOptions setting : options) { - this.clearWidgets(); - this.nextButtonIndex = 0; + this.init(setting); } + } + + protected void init(@Nonnull final VrOptions option) + { + this.init(option, (VROptionPosition)null); + } - ArrayList arraylist = new ArrayList<>(); + protected void init(@Nonnull final VrOptions option, @Nullable final VROptionPosition pos) + { + this.init(option, null, pos); + } + protected void init(@Nonnull final VrOptions option, @Nullable final BiFunction customHandler) + { + this.init(option, customHandler, null); + } + + protected void init(@Nonnull final VrOptions option, @Nullable final BiFunction customHandler, @Nullable final VROptionPosition pos) + { + this.init(null, option, customHandler, pos); + } + + protected void init(@Nullable final String buttonText) + { + this.init(buttonText, null); + } + + protected void init(@Nullable final String buttonText, @Nullable final BiFunction customHandler) + { + this.init(buttonText, customHandler, null); + } + + protected void init(@Nullable final String buttonText, @Nullable final BiFunction customHandler, @Nullable final VROptionPosition pos) + { + this.init(buttonText, null, customHandler, pos); + } + + protected void init(@Nullable final String buttonText, @Nullable final VrOptions option, @Nullable final BiFunction customHandler, @Nullable VROptionPosition pos) + { + this.init(null, buttonText, option, customHandler, pos); + } + + protected void init(@Nullable Class subScreen, @Nullable String buttonText, @Nullable final VrOptions option, @Nullable final BiFunction customHandler, @Nullable VROptionPosition pos) + { if (this.nextButtonIndex < this.children().size()) { this.nextButtonIndex = this.children().size(); } - int i = this.nextButtonIndex; - - for (int j = 0; j < settings.length; ++j) + if (pos == null) { - VROptionLayout.Position vroptionlayout$position = settings[j].center ? VROptionLayout.Position.POS_CENTER : (i % 2 == 0 ? VROptionLayout.Position.POS_LEFT : VROptionLayout.Position.POS_RIGHT); - - if (settings[j].center && i % 2 != 0) + pos = (this.nextButtonIndex % 2) == 0 ? POS_LEFT : POS_RIGHT; + } + else + { + if (pos == POS_CENTER || (this.nextButtonIndex % 2) == (pos == POS_LEFT ? 1 : 0)) { - ++i; + ++this.nextButtonIndex; } + } - if (settings[j].option != null) + if (buttonText == null || buttonText.isEmpty()){ + try { - if (settings[j].option != VRSettings.VrOptions.DUMMY) - { - arraylist.add(new VROptionLayout(settings[j].option, settings[j].customHandler, vroptionlayout$position, (float)Math.floor((double)((float)i / 2.0F)), true, settings[j].title)); - } - } - else if (settings[j].customHandler != null) + buttonText = (String) subScreen.getDeclaredField("vrTitle").get(null); + } catch (Exception ignored) { - arraylist.add(new VROptionLayout(settings[j].customHandler, vroptionlayout$position, (float)Math.floor((double)((float)i / 2.0F)), true, settings[j].title)); + buttonText = ""; } + } - if (settings[j].center) + if (subScreen != null){ + this.init( + subScreen, + option, + customHandler, + pos, + floor(this.nextButtonIndex / 2.0F), + buttonText + ); + } + else if (option != null) + { + if (option != VrOptions.DUMMY) { - ++i; + this.init(subScreen, option, customHandler, pos, floor(this.nextButtonIndex / 2.0F), buttonText); } - - ++i; } - - this.nextButtonIndex = i; - this.init(arraylist.toArray(new VROptionLayout[0]), false); - } - - protected void init(VRSettings.VrOptions[] settings, boolean clear) - { - VROptionEntry[] avroptionentry = new VROptionEntry[settings.length]; - - for (int i = 0; i < settings.length; ++i) + else if (customHandler != null) { - avroptionentry[i] = new VROptionEntry(settings[i]); + this.init(subScreen, option, customHandler, pos, floor(this.nextButtonIndex / 2.0F), buttonText); } - this.init(avroptionentry, clear); + ++this.nextButtonIndex; } - public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) + @Override + public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.reinit) { @@ -227,10 +336,14 @@ public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPar if (this.visibleList != null) { - this.visibleList.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); + this.visibleList.render(guiGraphics, mouseX, mouseY, partialTick); } - guiGraphics.drawCenteredString(this.font, Component.translatable(this.vrTitle), this.width / 2, 15, 16777215); + try { + guiGraphics.drawCenteredString(this.font, Component.translatable((String) this.getClass().getDeclaredField("vrTitle").get(null)), this.width / 2, 15, 16777215); + } catch (Exception ignored){ + guiGraphics.drawCenteredString(this.font, Component.translatable(vrTitle), this.width / 2, 15, 16777215); + } if (this.btnDefaults != null) { @@ -242,8 +355,8 @@ public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPar this.btnDone.visible = this.drawDefaultButtons; } - super.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); - renderTooltip(guiGraphics, pMouseX, pMouseY); + super.render(guiGraphics, mouseX, mouseY, partialTick); + this.renderTooltip(guiGraphics, mouseX, mouseY); } protected void actionPerformed(AbstractWidget button) @@ -254,101 +367,116 @@ protected void actionPerformedRightClick(AbstractWidget button) { } - public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY) + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { - boolean flag = super.mouseClicked(pMouseX, p_94738_, pMouseY); - AbstractWidget abstractwidget = ScreenUtils.getSelectedButton((int)pMouseX, (int)p_94738_, ScreenUtils.getButtonList(this)); + boolean flag = super.mouseClicked(mouseX, mouseY, button); + AbstractWidget abstractwidget = ScreenUtils.getSelectedButton((int)mouseX, (int)mouseY, ScreenUtils.getButtonList(this)); if (abstractwidget != null) { - if (pMouseY == 0) + if (button == GLFW_MOUSE_BUTTON_1) { this.actionPerformed(abstractwidget); } - else if (pMouseY == 1) + else if (button == GLFW_MOUSE_BUTTON_2) { this.actionPerformedRightClick(abstractwidget); } } else if (this.visibleList != null) { - return this.visibleList.mouseClicked(pMouseX, p_94738_, pMouseY); + return this.visibleList.mouseClicked(mouseX, mouseY, button); } return flag; } - public boolean mouseReleased(double pMouseX, double p_94754_, int pMouseY) + @Override + public boolean mouseReleased(double mouseX, double mouseY, int button) { - return this.visibleList != null ? this.visibleList.mouseReleased(pMouseX, p_94754_, pMouseY) : super.mouseReleased(pMouseX, p_94754_, pMouseY); + return this.visibleList != null ? this.visibleList.mouseReleased(mouseX, mouseY, button) : super.mouseReleased(mouseX, mouseY, button); } - public boolean mouseDragged(double pMouseX, double p_94741_, int pMouseY, double p_94743_, double pButton) + @Override + public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) { - return this.visibleList != null ? this.visibleList.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton) : super.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton); + return this.visibleList != null ? this.visibleList.mouseDragged(mouseX, mouseY, button, dragX, dragY) : super.mouseDragged(mouseX, mouseY, button, dragX, dragY); } - public boolean mouseScrolled(double pMouseX, double p_94735_, double pMouseY) + @Override + public boolean mouseScrolled(double mouseX, double mouseY, double delta) { if (this.visibleList != null) { - this.visibleList.mouseScrolled(pMouseX, p_94735_, pMouseY); + this.visibleList.mouseScrolled(mouseX, mouseY, delta); } - return super.mouseScrolled(pMouseX, p_94735_, pMouseY); + return super.mouseScrolled(mouseX, mouseY, delta); } - public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) + @Override + public boolean keyPressed(int keyCode, int scanCode, int modifiers) { - if (pKeyCode == 256) + if (keyCode == GLFW_KEY_ESCAPE) { if (!this.onDoneClicked()) { - this.dataholder.vrSettings.saveOptions(); - this.minecraft.setScreen(this.lastScreen); + dh.vrSettings.saveOptions(); + mc.setScreen(this.lastScreen); } return true; } else { - return this.visibleList != null && this.visibleList.keyPressed(pKeyCode, pScanCode, pModifiers) ? true : super.keyPressed(pKeyCode, pScanCode, pModifiers); + return this.visibleList != null && this.visibleList.keyPressed(keyCode, scanCode, modifiers) || super.keyPressed(keyCode, scanCode, modifiers); } } - public boolean charTyped(char pCodePoint, int pModifiers) + @Override + public boolean charTyped(char codePoint, int modifiers) { - return this.visibleList != null && this.visibleList.charTyped(pCodePoint, pModifiers) ? true : super.charTyped(pCodePoint, pModifiers); + return this.visibleList != null && this.visibleList.charTyped(codePoint, modifiers) || super.charTyped(codePoint, modifiers); } - private void renderTooltip(GuiGraphics guiGraphics, int pMouseX, int pMouseY) { + private void renderTooltip(GuiGraphics guiGraphics, int mouseX, int mouseY) + { AbstractWidget hover = null; // find active button - for (GuiEventListener child: children()) { - if (child instanceof AbstractWidget && child.isMouseOver(pMouseX, pMouseY)) { - hover = (AbstractWidget) child; + for (GuiEventListener child: this.children()) + { + if (child instanceof AbstractWidget renderable && renderable.isMouseOver(mouseX, mouseY)) + { + hover = renderable; } } - if (hover != null ) { - if (hover instanceof GuiVROption guiHover) { - if (guiHover.getOption() != null) { - String tooltipString = "vivecraft.options." + guiHover.getOption().name() + ".tooltip"; - // check if it has a tooltip - if (I18n.exists(tooltipString)) { - String tooltip = I18n.get(tooltipString, (Object) null); - // add format reset at line ends - tooltip = tooltip.replace("\n", "§r\n"); - - // make last line the roughly 308 wide - List formattedText = font.getSplitter().splitLines(tooltip, 308, Style.EMPTY); - tooltip += " ".repeat((308 - (formattedText.size() == 0 ? 0 : font.width(formattedText.get(formattedText.size() - 1)))) / font.width(" ")); - - // if tooltip is not too low, draw below button, else above - if (guiHover.getY() + guiHover.getHeight() + formattedText.size() * (font.lineHeight + 1) + 14 < this.height) { - guiGraphics.renderTooltip(this.font, font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() + guiHover.getHeight() + 14); - } else { - guiGraphics.renderTooltip(this.font, font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() - formattedText.size() * (font.lineHeight + 1) + 9); - } + if (hover != null) + { + if (hover instanceof GuiVROption guiHover) + { + VrOptions option = guiHover.getOption(); + String tooltipString = "vivecraft.options." + guiHover.getOption().name() + ".tooltip"; + // check if it has a tooltip + String tooltip = option.getTooltipString(tooltipString); + if (tooltip == null && I18n.exists(tooltipString)) + { + tooltip = I18n.get(tooltipString, (Object) null); + } + if (tooltip != null) + { + // add format reset at line ends + tooltip = tooltip.replace("\n", "§r\n"); + + // make last line the roughly 308 wide + List formattedText = this.font.getSplitter().splitLines(tooltip, 308, Style.EMPTY); + tooltip += " ".repeat((308 - (formattedText.size() == 0 ? 0 : this.font.width(formattedText.get(formattedText.size() - 1)))) / this.font.width(" ")); + + // if tooltip is not too low, draw below button, else above + if (guiHover.getY() + guiHover.getHeight() + formattedText.size() * (font.lineHeight + 1) + 14 < this.height) { + guiGraphics.renderTooltip(this.font, this.font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() + guiHover.getHeight() + 14); + } else { + guiGraphics.renderTooltip(this.font, this.font.split(Component.literal(tooltip), 308), this.width / 2 - 166, guiHover.getY() - formattedText.size() * (this.font.lineHeight + 1) + 9); } } } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/TwoHandedScreen.java b/common/src/main/java/org/vivecraft/client/gui/framework/TwoHandedScreen.java index 759ece6e1..b365d1c07 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/TwoHandedScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/TwoHandedScreen.java @@ -1,19 +1,22 @@ package org.vivecraft.client.gui.framework; -import net.minecraft.client.gui.GuiGraphics; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.extensions.GuiExtension; import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.provider.MCVR; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public abstract class TwoHandedScreen extends Screen { - protected ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); public float cursorX1; public float cursorY1; public float cursorX2; @@ -27,11 +30,13 @@ protected TwoHandedScreen() super(Component.literal("")); } + @Override public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY) { if (super.mouseClicked(pMouseX, p_94738_, pMouseY)) { - double d0 = (double)Math.min(Math.max((int)this.cursorX2, 0), this.minecraft.getWindow().getScreenWidth()) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); + double d0 = (double) min(max((int) this.cursorX2, 0), mc.getWindow().getScreenWidth()) * + (double) mc.getWindow().getGuiScaledWidth() / (double) mc.getWindow().getScreenWidth(); return true; } else @@ -40,6 +45,7 @@ public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY) } } + @Override public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) { if (this.reinit) @@ -48,26 +54,32 @@ public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPar this.reinit = false; } - double d0 = (double)(this.cursorX1 * (float)this.width / (float)this.minecraft.getWindow().getGuiScaledWidth()) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); - double d1 = (double)(this.cursorY1 * (float)this.height / (float)this.minecraft.getWindow().getGuiScaledHeight()) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); - double d2 = (double)(this.cursorX2 * (float)this.width / (float)this.minecraft.getWindow().getGuiScaledWidth()) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); - double d3 = (double)(this.cursorY2 * (float)this.height / (float)this.minecraft.getWindow().getGuiScaledHeight()) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth(); + int i0 = ((int) this.cursorX1 * this.width / mc.getWindow().getGuiScaledWidth()) + * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth(); + int i1 = ((int) this.cursorY1 * this.height / mc.getWindow().getGuiScaledHeight()) + * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth(); + int i2 = ((int) this.cursorX2 * this.width / mc.getWindow().getGuiScaledWidth()) + * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth(); + int i3 = ((int) this.cursorY2 * this.height / mc.getWindow().getGuiScaledHeight()) + * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth(); AbstractWidget abstractwidget = null; AbstractWidget abstractwidget1 = null; - for (int i = 0; i < this.children().size(); ++i) + for (GuiEventListener child : this.children()) { - AbstractWidget abstractwidget2 = (AbstractWidget) this.children().get(i); - boolean flag = d0 >= (double)abstractwidget2.getX() && d1 >= (double)abstractwidget2.getY() && d0 < (double)(abstractwidget2.getX() + abstractwidget2.getWidth()) && d1 < (double)(abstractwidget2.getY() + 20); - boolean flag1 = d2 >= (double)abstractwidget2.getX() && d3 >= (double)abstractwidget2.getY() && d2 < (double)(abstractwidget2.getX() + abstractwidget2.getWidth()) && d3 < (double)(abstractwidget2.getY() + 20); + AbstractWidget abstractwidget2 = (AbstractWidget) child; + boolean flag = i0 >= abstractwidget2.getX() && i1 >= abstractwidget2.getY() && + i0 < (abstractwidget2.getX() + abstractwidget2.getWidth()) && i1 < (abstractwidget2.getY() + 20); + boolean flag1 = i2 >= abstractwidget2.getX() && i3 >= abstractwidget2.getY() && + i2 < (abstractwidget2.getX() + abstractwidget2.getWidth()) && i3 < (abstractwidget2.getY() + 20); if (flag) { - abstractwidget2.render(guiGraphics, (int)d0, (int)d1, pPartialTicks); + abstractwidget2.render(guiGraphics, i0, i1, pPartialTicks); } else { - abstractwidget2.render(guiGraphics, (int)d2, (int)d3, pPartialTicks); + abstractwidget2.render(guiGraphics, i2, i3, pPartialTicks); } if (flag) @@ -87,7 +99,7 @@ public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPar } else if (abstractwidget instanceof Button && this.lastHoveredButtonId1 != abstractwidget) { - MCVR.get().triggerHapticPulse(ControllerType.LEFT, 300); + dh.vr.triggerHapticPulse(ControllerType.LEFT, 300); this.lastHoveredButtonId1 = abstractwidget; } @@ -97,11 +109,11 @@ else if (abstractwidget instanceof Button && this.lastHoveredButtonId1 != abstra } else if (abstractwidget1 instanceof Button && this.lastHoveredButtonId2 != abstractwidget1) { - MCVR.get().triggerHapticPulse(ControllerType.RIGHT, 300); + dh.vr.triggerHapticPulse(ControllerType.RIGHT, 300); this.lastHoveredButtonId2 = abstractwidget1; } - ((GuiExtension) this.minecraft.gui).drawMouseMenuQuad((int)d0, (int)d1); - ((GuiExtension) this.minecraft.gui).drawMouseMenuQuad((int)d2, (int)d3); + ((GuiExtension) mc.gui).drawMouseMenuQuad(i0, i1); + ((GuiExtension) mc.gui).drawMouseMenuQuad(i2, i3); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/VROptionEntry.java b/common/src/main/java/org/vivecraft/client/gui/framework/VROptionEntry.java deleted file mode 100644 index 32257b26f..000000000 --- a/common/src/main/java/org/vivecraft/client/gui/framework/VROptionEntry.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.vivecraft.client.gui.framework; - -import java.util.function.BiFunction; -import net.minecraft.world.phys.Vec2; -import org.vivecraft.client_vr.settings.VRSettings; - -public class VROptionEntry -{ - public final VRSettings.VrOptions option; - public final String title; - public final BiFunction customHandler; - public final boolean center; - - public VROptionEntry(String label, BiFunction customHandler, boolean center) - { - this.option = null; - this.title = label; - this.customHandler = customHandler; - this.center = center; - } - - public VROptionEntry(String label, BiFunction customHandler) - { - this.option = null; - this.title = label; - this.customHandler = customHandler; - this.center = false; - } - - public VROptionEntry(VRSettings.VrOptions option, BiFunction customHandler, boolean center) - { - this.option = option; - this.title = null; - this.customHandler = customHandler; - this.center = center; - } - - public VROptionEntry(VRSettings.VrOptions option, BiFunction customHandler) - { - this.option = option; - this.title = null; - this.customHandler = customHandler; - this.center = false; - } - - public VROptionEntry(VRSettings.VrOptions option, boolean center) - { - this.option = option; - this.title = null; - this.customHandler = null; - this.center = center; - } - - public VROptionEntry(VRSettings.VrOptions option) - { - this.option = option; - this.title = null; - this.customHandler = null; - this.center = false; - } -} diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/VROptionLayout.java b/common/src/main/java/org/vivecraft/client/gui/framework/VROptionLayout.java deleted file mode 100644 index b643c36d3..000000000 --- a/common/src/main/java/org/vivecraft/client/gui/framework/VROptionLayout.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.vivecraft.client.gui.framework; - -import java.util.function.BiFunction; - -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; - -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.world.phys.Vec2; - -public class VROptionLayout -{ - public static final boolean ENABLED = true; - public static final boolean DISABLED = false; - private VRSettings.VrOptions _e; - Position _pos; - float _row; - public boolean _enabled; - String _title = ""; - int _ordinal; - boolean _defaultb; - float _defaultf; - float _maxf; - float _minf; - float _incrementf; - int _defaulti; - int _maxi; - int _mini; - int _incrementi; - Class screen; - BiFunction customHandler; - - public VROptionLayout(VRSettings.VrOptions e, BiFunction handler, Position pos, float row, boolean enabled, String title) - { - this._e = e; - this._pos = pos; - this._row = row; - - if (title != null) - { - this._title = title; - } - - this._enabled = enabled; - this.customHandler = handler; - } - - public VROptionLayout(VRSettings.VrOptions e, Position pos, float row, boolean enabled, String title) - { - this._e = e; - this._pos = pos; - this._row = row; - - if (title != null) - { - this._title = title; - } - - this._enabled = enabled; - } - - public VROptionLayout(Class screen, BiFunction handler, Position pos, float row, boolean enabled, String title) - { - this._pos = pos; - this._row = row; - - if (title != null) - { - this._title = title; - } - - this._enabled = enabled; - this.screen = screen; - this.customHandler = handler; - } - - public VROptionLayout(Class screen, Position pos, float row, boolean enabled, String title) - { - this._pos = pos; - this._row = row; - - if (title != null) - { - this._title = title; - } - - this._enabled = enabled; - this.screen = screen; - } - - public VROptionLayout(BiFunction handler, Position pos, float row, boolean enabled, String title) - { - this._pos = pos; - this._row = row; - - if (title != null) - { - this._title = title; - } - - this._enabled = enabled; - this.customHandler = handler; - } - - public VROptionLayout(int ordinal, Position pos, float row, boolean enabled, String title) - { - this._ordinal = ordinal; - this._pos = pos; - this._row = row; - this._title = title; - this._enabled = enabled; - } - - public int getX(int screenWidth) - { - if (this._pos == Position.POS_LEFT) - { - return screenWidth / 2 - 155 + 0; - } - else - { - return this._pos == Position.POS_RIGHT ? screenWidth / 2 - 155 + 160 : screenWidth / 2 - 155 + 80; - } - } - - public int getY(int screenHeight) - { - return (int)Math.ceil((double)((float)(screenHeight / 6) + 21.0F * this._row - 10.0F)); - } - - public String getButtonText() - { - return this._title.isEmpty() && this._e != null ? ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(this._e) : this._title; - } - - public VRSettings.VrOptions getOption() - { - return this._e; - } - - public Class getScreen() - { - return this.screen; - } - - public BiFunction getCustomHandler() - { - return this.customHandler; - } - - public int getOrdinal() - { - return this._e == null ? this._ordinal : this._e.returnEnumOrdinal(); - } - - public static enum Position - { - POS_LEFT, - POS_CENTER, - POS_RIGHT; - } -} diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/VROptionPosition.java b/common/src/main/java/org/vivecraft/client/gui/framework/VROptionPosition.java new file mode 100644 index 000000000..a5e756846 --- /dev/null +++ b/common/src/main/java/org/vivecraft/client/gui/framework/VROptionPosition.java @@ -0,0 +1,8 @@ +package org.vivecraft.client.gui.framework; + +public enum VROptionPosition +{ + POS_LEFT, + POS_CENTER, + POS_RIGHT +} diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java index 958347782..6ae0577f8 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java @@ -1,43 +1,49 @@ package org.vivecraft.client.gui.screens; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.gui.widgets.TextScrollWidget; + import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import org.jetbrains.annotations.NotNull; -import org.vivecraft.client.gui.widgets.TextScrollWidget; +import javax.annotation.Nonnull; -public class ErrorScreen extends Screen { +import static org.vivecraft.client_vr.VRState.mc; + + +public class ErrorScreen extends Screen +{ private final Screen lastScreen; private final Component error; - public ErrorScreen(String title, Component error) { + public ErrorScreen(String title, Component error) + { super(Component.literal(title)); - lastScreen = Minecraft.getInstance().screen; + lastScreen = mc.screen; this.error = error; } - protected void init() { + @Override + protected void init() + { this.addRenderableWidget(new TextScrollWidget(this.width / 2 - 155, 30, 310, this.height - 30 - 36, error)); - this.addRenderableWidget(new Button.Builder(Component.translatable("gui.back"), (p) -> - Minecraft.getInstance().setScreen(this.lastScreen)) - .pos(this.width / 2 + 5, this.height - 32) - .size(150, 20) - .build()); - this.addRenderableWidget(new Button.Builder(Component.translatable("chat.copy"), (p) -> - Minecraft.getInstance().keyboardHandler.setClipboard(error.getString())) - .pos(this.width / 2 - 155, this.height - 32) - .size(150, 20) - .build()); + this.addRenderableWidget(new Builder(Component.translatable("gui.back"), (p) -> + mc.setScreen(this.lastScreen)).pos(this.width / 2 + 5, this.height - 32).size(150, 20).build() + ); + this.addRenderableWidget(new Builder(Component.translatable("chat.copy"), (p) -> + mc.keyboardHandler.setClipboard(error.getString())).pos(this.width / 2 - 155, this.height - 32) + .size(150, 20) + .build() + ); } @Override - public void render(@NotNull GuiGraphics guiGraphics, int i, int j, float f) { + public void render(@Nonnull GuiGraphics guiGraphics, int i, int j, float f) + { this.renderBackground(guiGraphics); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java index 4e6f536c3..b4e04fe82 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java @@ -1,33 +1,45 @@ package org.vivecraft.client.gui.screens; +import org.vivecraft.client.gui.widgets.TextScrollWidget; +import org.vivecraft.client.utils.UpdateChecker; + import net.minecraft.Util; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import org.jetbrains.annotations.NotNull; -import org.vivecraft.client.gui.widgets.TextScrollWidget; -import org.vivecraft.client.utils.UpdateChecker; +import javax.annotation.Nonnull; import java.net.URI; import java.net.URISyntaxException; +import static org.vivecraft.client_vr.VRState.mc; + -public class UpdateScreen extends Screen { +public class UpdateScreen extends Screen +{ private final Screen lastScreen; - public UpdateScreen() { + public UpdateScreen() + { super(Component.literal("New Update Available")); - lastScreen = Minecraft.getInstance().screen; + lastScreen = mc.screen; } - protected void init() { + @Override + protected void init() + { - this.addRenderableWidget(new TextScrollWidget(this.width / 2 - 155, 30, 310, this.height - 30 - 60, UpdateChecker.changelog)); + this.addRenderableWidget(new TextScrollWidget( + this.width / 2 - 155, + 30, + 310, + this.height - 30 - 60, + UpdateChecker.changelog + )); - this.addRenderableWidget(new Button.Builder(Component.literal("Download from Modrinth"), (p) -> { + this.addRenderableWidget(new Builder(Component.literal("Download from Modrinth"), (p) -> { try { Util.getPlatform().openUri(new URI("https://modrinth.com/mod/vivecraft")); } catch (URISyntaxException ignored) { @@ -37,7 +49,7 @@ protected void init() { .size(150, 20) .build()); - this.addRenderableWidget(new Button.Builder(Component.literal("Download from Curseforge"), (p) -> { + this.addRenderableWidget(new Builder(Component.literal("Download from Curseforge"), (p) -> { try { Util.getPlatform().openUri(new URI("https://www.curseforge.com/minecraft/mc-mods/vivecraft")); } catch (URISyntaxException ignored) { @@ -47,22 +59,24 @@ protected void init() { .size(150, 20) .build()); - this.addRenderableWidget(new Button.Builder(Component.translatable("gui.back"), (p) -> - Minecraft.getInstance().setScreen(this.lastScreen)) + this.addRenderableWidget(new Builder(Component.translatable("gui.back"), (p) -> + mc.setScreen(this.lastScreen)) .pos(this.width / 2 - 75, this.height - 32) .size(150, 20) .build()); } @Override - public void render(@NotNull GuiGraphics guiGraphics, int i, int j, float f) { + public void render(@Nonnull GuiGraphics guiGraphics, int i, int j, float f) + { this.renderBackground(guiGraphics); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); super.render(guiGraphics, i, j, f); } @Override - public void onClose() { - this.minecraft.setScreen(lastScreen); + public void onClose() + { + mc.setScreen(lastScreen); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiFreeMoveSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiFreeMoveSettings.java index 86458d09c..833edf94f 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiFreeMoveSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiFreeMoveSettings.java @@ -1,64 +1,67 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.screens.Screen; import org.vivecraft.client.gui.framework.GuiVROption; import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.dh; public class GuiFreeMoveSettings extends GuiVROptionsBase { - private static VRSettings.VrOptions[] standingSettings = new VRSettings.VrOptions[] { - VRSettings.VrOptions.FREEMOVE_MODE, - VRSettings.VrOptions.FREEMOVE_FLY_MODE, - VRSettings.VrOptions.FOV_REDUCTION, - VRSettings.VrOptions.INERTIA_FACTOR, - VRSettings.VrOptions.MOVEMENT_MULTIPLIER, - VRSettings.VrOptions.AUTO_SPRINT, - VRSettings.VrOptions.AUTO_SPRINT_THRESHOLD, - VRSettings.VrOptions.ANALOG_MOVEMENT - }; - private static VRSettings.VrOptions[] seatedSettings = new VRSettings.VrOptions[] { - VRSettings.VrOptions.SEATED_HMD, - VRSettings.VrOptions.FOV_REDUCTION, - VRSettings.VrOptions.INERTIA_FACTOR - }; - private static VRSettings.VrOptions[] fovRed = new VRSettings.VrOptions[] { - VRSettings.VrOptions.FOV_REDUCTION_MIN, - VRSettings.VrOptions.FOV_REDUCTION_OFFSET - }; + public static String vrTitle = "vivecraft.options.screen.freemove"; public GuiFreeMoveSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.freemove"; + super.clearWidgets(); - if (this.dataholder.vrSettings.seated) + if (dh.vrSettings.seated) { - super.init(seatedSettings, true); + super.init( + VrOptions.SEATED_HMD, + VrOptions.FOV_REDUCTION, + VrOptions.INERTIA_FACTOR + ); } else { - super.init(standingSettings, true); + super.init( + VrOptions.FREEMOVE_MODE, + VrOptions.FREEMOVE_FLY_MODE, + VrOptions.FOV_REDUCTION, + VrOptions.INERTIA_FACTOR, + VrOptions.MOVEMENT_MULTIPLIER, + VrOptions.AUTO_SPRINT, + VrOptions.AUTO_SPRINT_THRESHOLD, + VrOptions.ANALOG_MOVEMENT + ); } - if (this.dataholder.vrSettings.useFOVReduction) + if (dh.vrSettings.useFOVReduction) { - super.init(fovRed, false); + super.init( + VrOptions.FOV_REDUCTION_MIN, + VrOptions.FOV_REDUCTION_OFFSET + ); } super.addDefaultButtons(); } + @Override protected void actionPerformed(AbstractWidget widget) { if (widget instanceof GuiVROption guivroption) { - if (guivroption.getId() == VRSettings.VrOptions.FOV_REDUCTION.ordinal()) + if (guivroption.getOption() == VrOptions.FOV_REDUCTION) { this.reinit = true; } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiHUDSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiHUDSettings.java index 31fe0decb..b752598df 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiHUDSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiHUDSettings.java @@ -1,67 +1,79 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client.gui.framework.VROptionEntry; +import org.vivecraft.client.gui.framework.GuiVROption; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client.gui.framework.GuiVROption; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; -public class GuiHUDSettings extends GuiVROptionsBase +public class GuiHUDSettings extends org.vivecraft.client.gui.framework.GuiVROptionsBase { - private VROptionEntry[] hudOptions = new VROptionEntry[] { - new VROptionEntry(VRSettings.VrOptions.HUD_HIDE), - new VROptionEntry(VRSettings.VrOptions.HUD_LOCK_TO), - new VROptionEntry(VRSettings.VrOptions.HUD_SCALE), - new VROptionEntry(VRSettings.VrOptions.HUD_DISTANCE), - new VROptionEntry(VRSettings.VrOptions.HUD_OCCLUSION), - new VROptionEntry(VRSettings.VrOptions.HUD_OPACITY), - new VROptionEntry(VRSettings.VrOptions.RENDER_MENU_BACKGROUND), - new VROptionEntry(VRSettings.VrOptions.TOUCH_HOTBAR), - new VROptionEntry(VRSettings.VrOptions.AUTO_OPEN_KEYBOARD), - new VROptionEntry(VRSettings.VrOptions.MENU_ALWAYS_FOLLOW_FACE), - new VROptionEntry(VRSettings.VrOptions.PHYSICAL_KEYBOARD, (button, mousePos) -> { - KeyboardHandler.setOverlayShowing(false); - return false; - }), - new VROptionEntry(VRSettings.VrOptions.GUI_APPEAR_OVER_BLOCK), - new VROptionEntry(VRSettings.VrOptions.PHYSICAL_KEYBOARD_SCALE), - new VROptionEntry("vivecraft.options.screen.menuworld.button", (button, mousePos) -> { - Minecraft.getInstance().setScreen(new GuiMenuWorldSettings(this)); - return true; - }), - new VROptionEntry(VRSettings.VrOptions.PHYSICAL_KEYBOARD_THEME), - new VROptionEntry(VRSettings.VrOptions.SHADER_GUI_RENDER) - }; + public static String vrTitle = "vivecraft.options.screen.gui"; public GuiHUDSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.gui"; - super.init(this.hudOptions, true); + super.clearWidgets(); + super.init( + VrOptions.HUD_HIDE, + VrOptions.HUD_LOCK_TO, + VrOptions.HUD_SCALE, + VrOptions.HUD_DISTANCE, + VrOptions.HUD_OCCLUSION, + VrOptions.HUD_OPACITY, + VrOptions.RENDER_MENU_BACKGROUND); + super.init(GuiTouchHotbarSettings.class); + super.init( + VrOptions.DUMMY, + VrOptions.MENU_ALWAYS_FOLLOW_FACE, + VrOptions.PLAYER_STATUS, + VrOptions.GUI_APPEAR_OVER_BLOCK, + switch (dh.vrSettings.playerStatus){ + case BOTH, ENTITY -> { yield true; } + default -> { yield false; } + } ? VrOptions.ENTITY_STATUS : VrOptions.DUMMY + ); + super.init(GuiMenuWorldSettings.class); + super.init( + VrOptions.DUMMY, + VrOptions.SHADER_GUI_RENDER + ); super.addDefaultButtons(); } + @Override protected void loadDefaults() { super.loadDefaults(); - this.minecraft.options.hideGui = false; + mc.options.hideGui = false; } - protected void actionPerformed(AbstractWidget widget) { - if (widget instanceof GuiVROption button) { - if (button.getId() == VRSettings.VrOptions.PHYSICAL_KEYBOARD_THEME.ordinal()) { - KeyboardHandler.physicalKeyboard.init(); - } - if (button.getId() == VRSettings.VrOptions.MENU_ALWAYS_FOLLOW_FACE.ordinal()) { - GuiHandler.onScreenChanged(Minecraft.getInstance().screen, Minecraft.getInstance().screen, false); + @Override + protected void actionPerformed(AbstractWidget widget) + { + if (widget instanceof GuiVROption guivroption) + { + switch(guivroption.getOption()){ + case PLAYER_STATUS -> { this.reinit = true; } + case PHYSICAL_KEYBOARD_THEME -> { KeyboardHandler.physicalKeyboard.init(); } + case MENU_ALWAYS_FOLLOW_FACE -> + { + GuiHandler.onScreenChanged( + mc.screen, + mc.screen, + false + ); + } } } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiMainVRSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiMainVRSettings.java index 4dad5599f..3b77d3183 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiMainVRSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiMainVRSettings.java @@ -1,117 +1,134 @@ package org.vivecraft.client.gui.settings; +import org.vivecraft.client.gui.framework.GuiVROption; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client.gui.framework.VROptionLayout; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.MCVR; -import org.vivecraft.client_vr.settings.VRSettings; -public class GuiMainVRSettings extends GuiVROptionsBase -{ - private VROptionLayout[] vrAlwaysOptions = new VROptionLayout[] { - new VROptionLayout(GuiHUDSettings.class, VROptionLayout.Position.POS_LEFT, 2.0F, true, "vivecraft.options.screen.gui.button"), - new VROptionLayout(GuiRenderOpticsSettings.class, VROptionLayout.Position.POS_LEFT, 1.0F, true, "vivecraft.options.screen.stereorendering.button"), - new VROptionLayout(GuiQuickCommandEditor.class, VROptionLayout.Position.POS_RIGHT, 1.0F, true, "vivecraft.options.screen.quickcommands.button"), - new VROptionLayout(GuiOtherHUDSettings.class, VROptionLayout.Position.POS_RIGHT, 2.0F, true, "vivecraft.options.screen.guiother.button"), - new VROptionLayout(VRSettings.VrOptions.WORLD_SCALE, VROptionLayout.Position.POS_LEFT, 6.0F, true, (String)null), - new VROptionLayout(VRSettings.VrOptions.WORLD_ROTATION, VROptionLayout.Position.POS_RIGHT, 6.0F, true, (String)null), - new VROptionLayout(VRSettings.VrOptions.PLAY_MODE_SEATED, (button, mousePos) -> { - this.reinit = true; +import static org.vivecraft.client.gui.framework.VROptionPosition.*; +import static org.vivecraft.client_vr.VRState.*; - if (!this.dataholder.vrSettings.seated) - { - this.isConfirm = true; - return true; - } - else { - return false; - } - }, VROptionLayout.Position.POS_LEFT, 0.0F, true, (String)null), - new VROptionLayout(VRSettings.VrOptions.VR_HOTSWITCH, VROptionLayout.Position.POS_RIGHT, 0.0F, true, (String)null), - new VROptionLayout(VRSettings.VrOptions.LOW_HEALTH_INDICATOR, VROptionLayout.Position.POS_RIGHT, 7.0F, true, (String)null) - }; - private VROptionLayout[] vrStandingOptions = new VROptionLayout[] { - new VROptionLayout(GuiStandingSettings.class, VROptionLayout.Position.POS_LEFT, 4.0F, true, "vivecraft.options.screen.standing.button"), - new VROptionLayout(GuiRoomscaleSettings.class, VROptionLayout.Position.POS_RIGHT, 4.0F, true, "vivecraft.options.screen.roomscale.button"), - new VROptionLayout(GuiVRControls.class, VROptionLayout.Position.POS_LEFT, 5.0F, true, "vivecraft.options.screen.controls.button"), - new VROptionLayout(GuiRadialConfiguration.class, VROptionLayout.Position.POS_RIGHT, 5.0F, true, "vivecraft.options.screen.radialmenu.button") - }; - private VROptionLayout[] vrSeatedOptions = new VROptionLayout[] { - new VROptionLayout(GuiSeatedOptions.class, VROptionLayout.Position.POS_LEFT, 4.0F, true, "vivecraft.options.screen.seated.button"), - new VROptionLayout(VRSettings.VrOptions.RESET_ORIGIN, (button, mousePos) -> { - this.resetOrigin(); - return true; - }, VROptionLayout.Position.POS_RIGHT, 4.0F, true, (String)null) - }; - private VROptionLayout[] vrConfirm = new VROptionLayout[] { - new VROptionLayout((button, mousePos) -> { - this.reinit = true; - this.isConfirm = false; - return false; - }, VROptionLayout.Position.POS_RIGHT, 2.0F, true, "gui.cancel"), - new VROptionLayout((button, mousePos) -> { - this.dataholder.vrSettings.seated = true; - this.settings.saveOptions(); - this.reinit = true; - this.isConfirm = false; - return false; - }, VROptionLayout.Position.POS_LEFT, 2.0F, true, "vivecraft.gui.ok") - }; +public class GuiMainVRSettings extends org.vivecraft.client.gui.framework.GuiVROptionsBase +{ private boolean isConfirm = false; + public static String vrTitle = "vivecraft.options.screen.main"; public GuiMainVRSettings(Screen lastScreen) { super(lastScreen); } + @Override protected void init() { + super.clearWidgets(); if (!this.isConfirm) { - this.vrTitle = "vivecraft.options.screen.main"; + vrTitle = "vivecraft.options.screen.main"; + super.init( + VrOptions.PLAY_MODE_SEATED, + (button, mousePos) -> { + if (dh.vrSettings.seated) + { + return false; + } + else + { + return this.isConfirm = true; + } + } + ); + super.init(VrOptions.VR_HOTSWITCH); + super.init( + GuiRenderOpticsSettings.class, + GuiQuickCommandEditor.class, + GuiHUDSettings.class, + GuiOtherHUDSettings.class + ); + + super.init(VrOptions.DUMMY, POS_CENTER); - if (this.dataholder.vrSettings.seated) + if (dh.vrSettings.seated) { - super.init(this.vrSeatedOptions, true); + super.init(GuiSeatedOptions.class); + super.init(VrOptions.RESET_ORIGIN); + super.init(VrOptions.DUMMY, POS_CENTER); } else { - super.init(this.vrStandingOptions, true); - - if (this.dataholder.vrSettings.allowStandingOriginOffset) - { - super.init(new VROptionLayout[] {new VROptionLayout(VRSettings.VrOptions.RESET_ORIGIN, (button, mousePos) -> { - this.resetOrigin(); - return true; - }, VROptionLayout.Position.POS_LEFT, 7.0F, true, (String)null) - }, false); - } + super.init( + GuiStandingSettings.class, + GuiRoomscaleSettings.class, + GuiVRControls.class, + GuiRadialConfiguration.class + ); } - super.init(this.vrAlwaysOptions, false); + super.init( + VrOptions.WORLD_SCALE, + VrOptions.WORLD_ROTATION, + !dh.vrSettings.seated && dh.vrSettings.allowStandingOriginOffset ? VrOptions.RESET_ORIGIN : VrOptions.DUMMY, + VrOptions.LOW_HEALTH_INDICATOR + ); super.addDefaultButtons(); } else { - this.vrTitle = "vivecraft.messages.seatedmode"; - super.init(this.vrConfirm, true); + vrTitle = "vivecraft.messages.seatedmode"; + super.init( + (button, mousePos) -> { + dh.vrSettings.seated = true; + dh.vrSettings.saveOptions(); + this.reinit = true; + this.isConfirm = false; + return false; + }, + POS_LEFT, + 2.0F, + "gui.ok" + ); + super.init( + (button, mousePos) -> { + this.reinit = true; + this.isConfirm = false; + return false; + }, + POS_RIGHT, + 2.0F, + "gui.cancel" + ); } } + @Override protected void loadDefaults() { super.loadDefaults(); - if (VRState.vrInitialized) { - MCVR.get().seatedRot = 0.0F; - MCVR.get().clearOffset(); + if (vrInitialized) { + dh.vr.seatedRot = 0.0F; + dh.vr.clearOffset(); } } protected void resetOrigin() { - MCVR.get().resetPosition(); - this.settings.saveOptions(); - this.minecraft.setScreen((Screen)null); + if (dh.vr != null) { + dh.vr.resetPosition(); + } + dh.vrSettings.saveOptions(); + mc.setScreen(null); + } + + @Override + protected void actionPerformed(AbstractWidget widget) + { + if (widget instanceof GuiVROption guivroption) + { + switch(guivroption.getOption()){ + case PLAY_MODE_SEATED -> { this.reinit = true; } + case RESET_ORIGIN -> { this.resetOrigin(); } + } + } } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiMenuWorldSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiMenuWorldSettings.java index 0abb1a373..7022a0831 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiMenuWorldSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiMenuWorldSettings.java @@ -1,57 +1,69 @@ package org.vivecraft.client.gui.settings; -import org.vivecraft.client.gui.framework.VROptionEntry; import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; import net.minecraft.client.gui.screens.Screen; +import static org.vivecraft.client_vr.VRState.dh; + public class GuiMenuWorldSettings extends GuiVROptionsBase { - private VROptionEntry[] miscSettings = new VROptionEntry[] { - new VROptionEntry(VRSettings.VrOptions.MENU_WORLD_SELECTION), - new VROptionEntry("vivecraft.gui.menuworld.refresh", (button, mousePos) -> { - if (this.dataholder.menuWorldRenderer != null && this.dataholder.menuWorldRenderer.getLevel() != null) + public static String vrTitle = "vivecraft.options.screen.menuworld"; + + public GuiMenuWorldSettings(Screen guiScreen) + { + super(guiScreen); + } + + @Override + public void init() + { + super.clearWidgets(); + super.init(VrOptions.MENU_WORLD_SELECTION); + super.init( + "vivecraft.gui.menuworld.refresh", + (button, mousePos) -> + { + if (dh.menuWorldRenderer != null && dh.menuWorldRenderer.getLevel() != null) { try { - this.dataholder.menuWorldRenderer.destroy(); - this.dataholder.menuWorldRenderer.prepare(); - } - catch (Exception exception) + dh.menuWorldRenderer.destroy(); + dh.menuWorldRenderer.prepare(); + } catch (Exception exception) { exception.printStackTrace(); } } return true; - }), - new VROptionEntry(VRSettings.VrOptions.DUMMY), new VROptionEntry("vivecraft.gui.menuworld.loadnew", (button, mousePos) -> { - if (this.dataholder.menuWorldRenderer != null) { - try { - if (this.dataholder.menuWorldRenderer.isReady()) { - this.dataholder.menuWorldRenderer.destroy(); + } + ); + super.init(VrOptions.DUMMY); + super.init( + "vivecraft.gui.menuworld.loadnew", + (button, mousePos) -> + { + if (dh.menuWorldRenderer != null) + { + try + { + if (dh.menuWorldRenderer.isReady()) + { + dh.menuWorldRenderer.destroy(); } - this.dataholder.menuWorldRenderer.init(); - } catch (Exception exception) { + dh.menuWorldRenderer.init(); + } catch (Exception exception) + { exception.printStackTrace(); } } return true; - }) - }; - - public GuiMenuWorldSettings(Screen guiScreen) - { - super(guiScreen); - } - - public void init() - { - this.vrTitle = "vivecraft.options.screen.menuworld"; - super.init(this.miscSettings, true); + } + ); super.addDefaultButtons(); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiOtherHUDSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiOtherHUDSettings.java index a92919e77..d03fd5ce8 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiOtherHUDSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiOtherHUDSettings.java @@ -1,60 +1,71 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; import org.vivecraft.client.gui.framework.GuiVROption; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.settings.VRSettings.ChatNotifications; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; -public class GuiOtherHUDSettings extends GuiVROptionsBase -{ - static VRSettings.VrOptions[] hudOptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.CROSSHAIR_SCALE, - VRSettings.VrOptions.RENDER_CROSSHAIR_MODE, - VRSettings.VrOptions.RENDER_BLOCK_OUTLINE_MODE, - VRSettings.VrOptions.MENU_CROSSHAIR_SCALE, - VRSettings.VrOptions.CROSSHAIR_OCCLUSION, - VRSettings.VrOptions.CROSSHAIR_SCALES_WITH_DISTANCE, - VRSettings.VrOptions.CHAT_NOTIFICATIONS - }; - static VRSettings.VrOptions[] chat = new VRSettings.VrOptions[] { - VRSettings.VrOptions.CHAT_NOTIFICATION_SOUND - }; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.screens.Screen; - static VRSettings.VrOptions[] messages = new VRSettings.VrOptions[] { - VRSettings.VrOptions.SHOW_UPDATES, - VRSettings.VrOptions.SHOW_PLUGIN, - VRSettings.VrOptions.SHOW_PLUGIN_MISSING - }; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +public class GuiOtherHUDSettings extends org.vivecraft.client.gui.framework.GuiVROptionsBase +{ + public static String vrTitle = "vivecraft.options.screen.guiother"; public GuiOtherHUDSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.guiother"; - super.init(hudOptions, true); - - if (this.dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.SOUND || this.dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.BOTH) - { - super.init(chat, false); - } else { - super.init(new VRSettings.VrOptions[]{VRSettings.VrOptions.DUMMY}, false); - } - super.init(messages, false); + super.clearWidgets(); + super.init( + VrOptions.CROSSHAIR_SCALE, + VrOptions.RENDER_CROSSHAIR_MODE, + VrOptions.RENDER_BLOCK_OUTLINE_MODE, + VrOptions.MENU_CROSSHAIR_SCALE, + VrOptions.CROSSHAIR_OCCLUSION, + VrOptions.CROSSHAIR_SCALES_WITH_DISTANCE, + VrOptions.CHAT_NOTIFICATIONS, + dh.vrSettings.chatNotifications == ChatNotifications.SOUND || dh.vrSettings.chatNotifications == ChatNotifications.BOTH ? VrOptions.CHAT_NOTIFICATION_SOUND : VrOptions.DUMMY, + VrOptions.SHOW_UPDATES, + VrOptions.SHOW_PLUGIN, + VrOptions.SHOW_PLUGIN_MISSING, + VrOptions.AUTO_OPEN_KEYBOARD + ); + super.init(VrOptions.PHYSICAL_KEYBOARD, (button, mousePos) -> { + KeyboardHandler.setOverlayShowing(false); + return false; + }); + super.init( + VrOptions.PHYSICAL_KEYBOARD_SCALE, + VrOptions.PHYSICAL_KEYBOARD_THEME + ); super.addDefaultButtons(); } + @Override protected void actionPerformed(AbstractWidget widget) { if (widget instanceof GuiVROption guivroption) { - if (guivroption.getId() == VRSettings.VrOptions.CHAT_NOTIFICATIONS.ordinal()) - { - this.reinit = true; + switch(guivroption.getOption()){ + case CHAT_NOTIFICATIONS -> { this.reinit = true; } + case PHYSICAL_KEYBOARD_THEME -> { KeyboardHandler.physicalKeyboard.init(); } + case MENU_ALWAYS_FOLLOW_FACE -> + { + GuiHandler.onScreenChanged( + mc.screen, + mc.screen, + false + ); + } } } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandEditor.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandEditor.java index 03ebd68a8..e8930ef18 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandEditor.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandEditor.java @@ -1,10 +1,14 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.screens.Screen; import org.vivecraft.client.gui.framework.GuiVROptionsBase; +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.dh; + public class GuiQuickCommandEditor extends GuiVROptionsBase { + public static String vrTitle = "vivecraft.options.screen.quickcommands"; private GuiQuickCommandsList guiList; public GuiQuickCommandEditor(Screen par1Screen) @@ -12,27 +16,29 @@ public GuiQuickCommandEditor(Screen par1Screen) super(par1Screen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.quickcommands"; - this.guiList = new GuiQuickCommandsList(this, this.minecraft); + this.guiList = new GuiQuickCommandsList(this); super.init(); super.addDefaultButtons(); this.visibleList = this.guiList; } + @Override protected void loadDefaults() { super.loadDefaults(); - this.dataholder.vrSettings.vrQuickCommands = this.dataholder.vrSettings.getQuickCommandsDefaults(); + dh.vrSettings.vrQuickCommands = dh.vrSettings.getQuickCommandsDefaults(); } + @Override protected boolean onDoneClicked() { for (int i = 0; i < 12; ++i) { String s = (this.guiList.children().get(i)).txt.getValue(); - this.dataholder.vrSettings.vrQuickCommands[i] = s; + dh.vrSettings.vrQuickCommands[i] = s; } return super.onDoneClicked(); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java index a06e2d7dc..4025132cb 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java @@ -1,19 +1,16 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.GuiGraphics; -import org.vivecraft.client_vr.ClientDataHolderVR; - import net.minecraft.client.KeyMapping; -import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class GuiQuickCommandsInGame extends Screen { - protected ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - private int field_146445_a; - private int field_146444_f; - private static final String __OBFID = "CL_00000703"; protected final Screen parentScreen; public GuiQuickCommandsInGame(Screen parent) @@ -22,43 +19,41 @@ public GuiQuickCommandsInGame(Screen parent) this.parentScreen = parent; } + @Override public void init() { KeyMapping.releaseAll(); - this.field_146445_a = 0; this.clearWidgets(); - byte b0 = -16; - boolean flag = true; - String[] astring = this.dataholder.vrSettings.vrQuickCommands; - int i = 0; + String[] astring = dh.vrSettings.vrQuickCommands; + int i; for (int j = 0; j < astring.length; ++j) { i = j > 5 ? 1 : 0; String s = astring[j]; - this.addRenderableWidget(new Button.Builder( Component.translatable(s.toString()), (p) -> + this.addRenderableWidget(new Builder(Component.translatable(s), (p) -> { - this.minecraft.setScreen((Screen)null); + mc.setScreen(null); if (p.getMessage().getString().startsWith("/")) { - this.minecraft.player.connection.sendCommand(p.getMessage().getString().substring(1)); + mc.player.connection.sendCommand(p.getMessage().getString().substring(1)); } else { - this.minecraft.player.connection.sendChat(p.getMessage().getString()); + mc.player.connection.sendChat(p.getMessage().getString()); } }) - .size( 125, 20) - .pos(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24) - .build()); + .size(125, 20) + .pos(this.width / 2 - 125 + 127 * i, 36 + (j - 6 * i) * 24) + .build() + ); } - this.addRenderableWidget(new Button.Builder( Component.translatable("Cancel"), (p) -> - { - this.minecraft.setScreen(this.parentScreen); - }) - .size( 100, 20) - .pos(this.width / 2 - 50, this.height - 30 + b0) - .build()); + this.addRenderableWidget(new Builder(Component.translatable("gui.cancel"), (p) -> mc.setScreen(this.parentScreen)) + .size(100, 20) + .pos(this.width / 2 - 50, this.height - 46) + .build() + ); } + @Override public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) { this.renderBackground(guiGraphics); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java index ea7e4e673..f5211e375 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java @@ -1,31 +1,27 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.*; -import org.vivecraft.client_vr.ClientDataHolderVR; +import org.vivecraft.client.gui.settings.GuiQuickCommandsList.CommandEntry; -import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; +import net.minecraft.client.gui.components.EditBox; +import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.network.chat.Component; -public class GuiQuickCommandsList extends ObjectSelectionList -{ - protected ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - private final GuiQuickCommandEditor parent; - private final Minecraft mc; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; - public GuiQuickCommandsList(GuiQuickCommandEditor parent, Minecraft mc) +public class GuiQuickCommandsList extends ObjectSelectionList +{ + public GuiQuickCommandsList(GuiQuickCommandEditor parent) { super(mc, parent.width, parent.height, 32, parent.height - 32, 20); - this.parent = parent; - this.mc = mc; - String[] astring = this.dataholder.vrSettings.vrQuickCommands; - String s = null; - int i = 0; - for (String s1 : astring) + for (String command : dh.vrSettings.vrQuickCommands) { - this.minecraft.font.width(s1); - this.addEntry(new CommandEntry(s1, this)); + mc.font.width(command); + this.addEntry(new CommandEntry(command, this)); } } @@ -33,16 +29,16 @@ public GuiQuickCommandsList(GuiQuickCommandEditor parent, Minecraft mc) protected void renderSelection(GuiGraphics guiGraphics, int i, int j, int k, int l, int m) { } - public class CommandEntry extends Entry + public static class CommandEntry extends Entry { private final Button btnDelete; public final EditBox txt; private CommandEntry(String command, GuiQuickCommandsList parent) { - this.txt = new EditBox(GuiQuickCommandsList.this.minecraft.font, parent.width / 2 - 100, 60, 200, 20, Component.literal("")); + this.txt = new EditBox(mc.font, parent.width / 2 - 100, 60, 200, 20, Component.literal("")); this.txt.setValue(command); - this.btnDelete = new Button.Builder( Component.literal("X"), (p) -> + this.btnDelete = new Builder(Component.literal("X"), (p) -> { this.txt.setValue(""); this.txt.setFocused(true); @@ -57,64 +53,60 @@ public void setFocused(boolean bl) { txt.setFocused(bl); } + @Override public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY) { - if (this.btnDelete.mouseClicked(pMouseX, p_94738_, pMouseY)) - { - return true; - } - else - { - return this.txt.mouseClicked(pMouseX, p_94738_, pMouseY) ? true : super.mouseClicked(pMouseX, p_94738_, pMouseY); - } + return (this.btnDelete.mouseClicked(pMouseX, p_94738_, pMouseY) || + this.txt.mouseClicked(pMouseX, p_94738_, pMouseY) || + super.mouseClicked(pMouseX, p_94738_, pMouseY) + ); } + @Override public boolean mouseDragged(double pMouseX, double p_94741_, int pMouseY, double p_94743_, double pButton) { - if (this.btnDelete.isMouseOver(pMouseX, p_94741_) && this.btnDelete.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton)) - { - return true; - } - else - { - return (this.txt.isMouseOver(pMouseX, p_94741_) && this.txt.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton)) || super.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton); - } + return (this.btnDelete.isMouseOver(pMouseX, p_94741_) && this.btnDelete.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton)) || (this.txt.isMouseOver(pMouseX, p_94741_) && this.txt.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton)) || super.mouseDragged(pMouseX, p_94741_, pMouseY, p_94743_, pButton); } + @Override public boolean mouseReleased(double pMouseX, double p_94754_, int pMouseY) { - if (this.btnDelete.mouseReleased(pMouseX, p_94754_, pMouseY)) - { - return true; - } - else - { - return this.txt.mouseReleased(pMouseX, p_94754_, pMouseY) ? true : super.mouseReleased(pMouseX, p_94754_, pMouseY); - } + return ( + this.btnDelete.mouseReleased(pMouseX, p_94754_, pMouseY) || + this.txt.mouseReleased(pMouseX, p_94754_, pMouseY) || + super.mouseReleased(pMouseX, p_94754_, pMouseY) + ); } + @Override public boolean mouseScrolled(double pMouseX, double p_94735_, double pMouseY) { - if (this.btnDelete.mouseScrolled(pMouseX, p_94735_, pMouseY)) - { - return true; - } - else - { - return this.txt.mouseScrolled(pMouseX, p_94735_, pMouseY) ? true : super.mouseScrolled(pMouseX, p_94735_, pMouseY); - } + return ( + this.btnDelete.mouseScrolled(pMouseX, p_94735_, pMouseY) || + this.txt.mouseScrolled(pMouseX, p_94735_, pMouseY) || + super.mouseScrolled(pMouseX, p_94735_, pMouseY) + ); } + @Override public boolean charTyped(char pCodePoint, int pModifiers) { - return this.txt.isFocused() ? this.txt.charTyped(pCodePoint, pModifiers) : super.charTyped(pCodePoint, pModifiers); + return ( + this.txt.isFocused() ? this.txt.charTyped(pCodePoint, pModifiers) : super.charTyped(pCodePoint, pModifiers) + ); } + @Override public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) { - return this.txt.isFocused() ? this.txt.keyPressed(pKeyCode, pScanCode, pModifiers) : super.keyPressed(pKeyCode, pScanCode, pModifiers); + return ( + this.txt.isFocused() ? + this.txt.keyPressed(pKeyCode, pScanCode, pModifiers) : + super.keyPressed(pKeyCode, pScanCode, pModifiers) + ); } + @Override public void render(GuiGraphics guiGraphics, int pIndex, int pTop, int pLeft, int pWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTicks) { this.txt.setX(pLeft); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java index 00760cf28..ef4ab85a8 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java @@ -1,22 +1,26 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.GuiGraphics; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import org.apache.commons.lang3.ArrayUtils; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client.gui.framework.VROptionLayout; -import org.vivecraft.client_vr.settings.VRSettings; import net.minecraft.client.KeyMapping; -import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; -public class GuiRadialConfiguration extends GuiVROptionsBase +import javax.annotation.Nonnull; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + +public class GuiRadialConfiguration extends org.vivecraft.client.gui.framework.GuiVROptionsBase { - static VROptionLayout[] options = new VROptionLayout[] { - new VROptionLayout(VRSettings.VrOptions.RADIAL_MODE_HOLD, VROptionLayout.Position.POS_LEFT, 0.0F, true, "") - }; + public static String vrTitle = "vivecraft.options.screen.radialmenu"; private String[] arr; private boolean isShift = false; private int selectedIndex = -1; @@ -46,75 +50,79 @@ public void setKey(KeyMapping key) if (!this.isShift) { - this.dataholder.vrSettings.vrRadialItems = ArrayUtils.clone(this.arr); + dh.vrSettings.vrRadialItems = ArrayUtils.clone(this.arr); } else { - this.dataholder.vrSettings.vrRadialItemsAlt = ArrayUtils.clone(this.arr); + dh.vrSettings.vrRadialItemsAlt = ArrayUtils.clone(this.arr); } - this.dataholder.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.radialmenu"; - this.list = new GuiRadialItemsList(this, this.minecraft); + this.list = new GuiRadialItemsList(this); this.clearWidgets(); if (this.isselectmode) { - this.addRenderableWidget(new Button.Builder( Component.translatable("gui.cancel"), (p) -> + this.addRenderableWidget(new Builder(Component.translatable("gui.cancel"), (p) -> { this.isselectmode = false; this.reinit = true; this.visibleList = null; }) - .size( 150, 20) - .pos(this.width / 2 - 155, this.height - 25) - .build()); - this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.clear"), (p) -> + .size(150, 20) + .pos(this.width / 2 - 155, this.height - 25) + .build() + ); + this.addRenderableWidget(new Builder(Component.translatable("vivecraft.gui.clear"), (p) -> { - this.setKey((KeyMapping)null); + this.setKey(null); }) - .size( 150, 20) - .pos(this.width / 2 - 155, 25) - .build()); + .size(150, 20) + .pos(this.width / 2 - 155, 25) + .build() + ); } else { + super.init(VrOptions.RADIAL_MODE_HOLD); if (this.isShift) { - this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.radialmenu.mainset"), (p) -> + this.addRenderableWidget(new Builder(Component.translatable("vivecraft.gui.radialmenu.mainset"), (p) -> { this.isShift = !this.isShift; this.reinit = true; }) - .size( 150, 20) - .pos(this.width / 2 + 2, 30) - .build()); + .size(150, 20) + .pos(this.width / 2 + 2, 30) + .build() + ); } else { - this.addRenderableWidget(new Button.Builder( Component.translatable("vivecraft.gui.radialmenu.alternateset"), (p) -> + this.addRenderableWidget(new Builder(Component.translatable("vivecraft.gui.radialmenu.alternateset"), (p) -> { this.isShift = !this.isShift; this.reinit = true; }) - .size( 150, 20) - .pos(this.width / 2 + 2, 30) - .build()); + .size(150, 20) + .pos(this.width / 2 + 2, 30) + .build() + ); } - super.init(options, false); int i = 8; int j = 120; int k = 360 / i; int l = 48; int i1 = this.width / 2; int j1 = this.height / 2; - this.arr = ArrayUtils.clone(this.dataholder.vrSettings.vrRadialItems); - String[] astring = ArrayUtils.clone(this.dataholder.vrSettings.vrRadialItemsAlt); + this.arr = ArrayUtils.clone(dh.vrSettings.vrRadialItems); + String[] astring = ArrayUtils.clone(dh.vrSettings.vrRadialItemsAlt); if (this.isShift) { @@ -125,7 +133,7 @@ public void init() { KeyMapping keymapping = null; - for (KeyMapping keymapping1 : this.minecraft.options.keyMappings) + for (KeyMapping keymapping1 : mc.options.keyMappings) { if (keymapping1.getName().equalsIgnoreCase(this.arr[k1])) { @@ -140,7 +148,7 @@ public void init() s = I18n.get(keymapping.getName()); } - int i2 = Math.max(j, this.font.width(s)); + int i2 = max(j, this.font.width(s)); int j2 = 0; int k2 = 0; @@ -186,36 +194,38 @@ else if (k1 == 7) } int l1 = k1; - this.addRenderableWidget(new Button.Builder( Component.translatable(s), (p) -> + this.addRenderableWidget(new Builder(Component.translatable(s), (p) -> { this.selectedIndex = l1; this.isselectmode = true; this.reinit = true; this.visibleList = this.list; }) - .size( i2, 20) - .pos(i1 + j2 - i2 / 2, j1 + k2) - .build()); - super.addDefaultButtons(); + .size(i2, 20) + .pos(i1 + j2 - i2 / 2, j1 + k2) + .build() + ); } + super.addDefaultButtons(); } } + @Override protected void loadDefaults() { super.loadDefaults(); - this.settings.vrRadialItems = this.settings.getRadialItemsDefault(); - this.settings.vrRadialItemsAlt = this.settings.getRadialItemsAltDefault(); + dh.vrSettings.vrRadialItems = dh.vrSettings.getRadialItemsDefault(); + dh.vrSettings.vrRadialItemsAlt = dh.vrSettings.getRadialItemsAltDefault(); } + @Override protected boolean onDoneClicked() { if (this.isselectmode) { this.isselectmode = false; - this.reinit = true; this.visibleList = null; - return true; + return this.reinit = true; } else { @@ -223,18 +233,19 @@ protected boolean onDoneClicked() } } - public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) + @Override + public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTick); if (this.visibleList == null) { - guiGraphics.drawCenteredString(this.minecraft.font, Component.translatable("vivecraft.messages.radialmenubind.1"), this.width / 2, this.height - 50, 5635925); + guiGraphics.drawCenteredString(mc.font, Component.translatable("vivecraft.messages.radialmenubind.1"), this.width / 2, this.height - 50, 5635925); } if (this.isShift) { - guiGraphics.drawCenteredString(this.minecraft.font, Component.translatable("vivecraft.messages.radialmenubind.2"), this.width / 2, this.height - 36, 13777015); + guiGraphics.drawCenteredString(mc.font, Component.translatable("vivecraft.messages.radialmenubind.2"), this.width / 2, this.height - 36, 13777015); } } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialItemsList.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialItemsList.java index 33e32f915..f2a33e247 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialItemsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialItemsList.java @@ -1,37 +1,33 @@ package org.vivecraft.client.gui.settings; -import java.util.Arrays; - -import net.minecraft.client.gui.GuiGraphics; import org.apache.commons.lang3.ArrayUtils; import net.minecraft.ChatFormatting; import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.components.ObjectSelectionList; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; -public class GuiRadialItemsList extends ObjectSelectionList +import java.util.Arrays; + +import static org.vivecraft.client_vr.VRState.mc; + +public class GuiRadialItemsList extends net.minecraft.client.gui.components.ObjectSelectionList { private final GuiRadialConfiguration parent; - private final Minecraft mc; - private Entry[] listEntries; - private int maxListLabelWidth = 0; + private final int maxListLabelWidth = 90; - public GuiRadialItemsList(GuiRadialConfiguration parent, Minecraft mc) + public GuiRadialItemsList(GuiRadialConfiguration parent) { super(mc, parent.width, parent.height, 63, parent.height - 32, 20); this.parent = parent; - this.mc = mc; - this.maxListLabelWidth = 90; this.buildList(); } public void buildList() { - KeyMapping[] akeymapping = ArrayUtils.clone(this.mc.options.keyMappings); - Arrays.sort((Object[])akeymapping); + KeyMapping[] akeymapping = ArrayUtils.clone(mc.options.keyMappings); + Arrays.sort(akeymapping); String s = null; for (KeyMapping keymapping : akeymapping) @@ -51,7 +47,7 @@ public void buildList() } } - public class CategoryEntry extends Entry + public static class CategoryEntry extends Entry { private final String labelText; private final int labelWidth; @@ -59,9 +55,10 @@ public class CategoryEntry extends Entry public CategoryEntry(String name) { this.labelText = I18n.get(name); - this.labelWidth = GuiRadialItemsList.this.mc.font.width(this.labelText); + this.labelWidth = mc.font.width(this.labelText); } + @Override public void render(GuiGraphics guiGraphics, int pIndex, int pTop, int pLeft, int pWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTicks) { guiGraphics.drawString(mc.font, this.labelText, (mc.screen.width / 2 - this.labelWidth / 2), (pTop + pHeight - 9 - 1), 6777215); @@ -85,6 +82,7 @@ private MappingEntry(KeyMapping key, GuiRadialConfiguration parent) this.parentScreen = parent; } + @Override public void render(GuiGraphics guiGraphics, int pIndex, int pTop, int pLeft, int pWidth, int pHeight, int pMouseX, int pMouseY, boolean pIsMouseOver, float pPartialTicks) { ChatFormatting chatformatting = ChatFormatting.WHITE; @@ -97,6 +95,7 @@ public void render(GuiGraphics guiGraphics, int pIndex, int pTop, int pLeft, int guiGraphics.drawString(mc.font, chatformatting + I18n.get(this.myKey.getName()), (mc.screen.width / 2 - GuiRadialItemsList.this.maxListLabelWidth / 2), (pTop + pHeight / 2 - 9 / 2), 16777215); } + @Override public boolean mouseClicked(double pMouseX, double p_94738_, int pMouseY) { this.parentScreen.setKey(this.myKey); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java index 80ace6787..f974091de 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java @@ -1,182 +1,145 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.GuiGraphics; -import org.vivecraft.mod_compat_vr.ShadersHelper; -import org.vivecraft.client_vr.VRState; import org.vivecraft.client.gui.framework.GuiVROption; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; +import org.vivecraft.mod_compat_vr.ShadersHelper; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.screens.Screen; -public class GuiRenderOpticsSettings extends GuiVROptionsBase +import javax.annotation.Nonnull; + +import static org.vivecraft.client_vr.VRState.*; + +public class GuiRenderOpticsSettings extends org.vivecraft.client.gui.framework.GuiVROptionsBase { - static VRSettings.VrOptions[] monoDisplayOptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.MONO_FOV, - VRSettings.VrOptions.DUMMY, - VRSettings.VrOptions.FSAA - }; - static VRSettings.VrOptions[] openVRDisplayOptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.RENDER_SCALEFACTOR, - VRSettings.VrOptions.MIRROR_DISPLAY, - VRSettings.VrOptions.FSAA, - VRSettings.VrOptions.STENCIL_ON, - VRSettings.VrOptions.HANDHELD_CAMERA_RENDER_SCALE, - VRSettings.VrOptions.HANDHELD_CAMERA_FOV, - VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA, - VRSettings.VrOptions.MIRROR_EYE - }; - static VRSettings.VrOptions[] MROptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE, - VRSettings.VrOptions.MIXED_REALITY_RENDER_HANDS, - VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR, - VRSettings.VrOptions.MIXED_REALITY_FOV, - VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED, - VRSettings.VrOptions.MONO_FOV, - VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK, - VRSettings.VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL - }; - static VRSettings.VrOptions[] UDOptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.MONO_FOV - }; - static VRSettings.VrOptions[] TUDOptions = new VRSettings.VrOptions[] { - VRSettings.VrOptions.MIXED_REALITY_FOV, - VRSettings.VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL - }; - private float prevRenderScaleFactor = this.settings.renderScaleFactor; - private float prevHandCameraResScale = this.settings.handCameraResScale; + public static String vrTitle = "vivecraft.options.screen.stereorendering"; + private float prevRenderScaleFactor = dh.vrSettings.renderScaleFactor; + private float prevHandCameraResScale = dh.vrSettings.handCameraResScale; public GuiRenderOpticsSettings(Screen par1Screen) { super(par1Screen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.stereorendering"; - VRSettings.VrOptions[] avrsettings$vroptions = new VRSettings.VrOptions[openVRDisplayOptions.length]; - System.arraycopy(openVRDisplayOptions, 0, avrsettings$vroptions, 0, openVRDisplayOptions.length); - - for (int i = 0; i < avrsettings$vroptions.length; ++i) - { - VRSettings.VrOptions vrsettings$vroptions = avrsettings$vroptions[i]; - - if (vrsettings$vroptions == VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA && (!VRHotkeys.hasExternalCameraConfig() || this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.MIXED_REALITY && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.THIRD_PERSON)) + super.clearWidgets(); + super.init( + VrOptions.RENDER_SCALEFACTOR, + VrOptions.MIRROR_DISPLAY, + VrOptions.FSAA, + VrOptions.STENCIL_ON, + VrOptions.HANDHELD_CAMERA_RENDER_SCALE, + VrOptions.HANDHELD_CAMERA_FOV, + switch(dh.vrSettings.displayMirrorMode){ + case MIXED_REALITY, THIRD_PERSON -> { yield VRHotkeys.hasExternalCameraConfig(); } + default -> { yield false; } + } ? VrOptions.RELOAD_EXTERNAL_CAMERA : VrOptions.DUMMY, + switch(dh.vrSettings.displayMirrorMode){ + case CROPPED, SINGLE -> { yield true; } + default -> { yield false; } + } ? VrOptions.MIRROR_EYE : VrOptions.DUMMY + ); + + switch(dh.vrSettings.displayMirrorMode){ + case MIXED_REALITY -> { - avrsettings$vroptions[i] = VRSettings.VrOptions.DUMMY; + super.init( + VrOptions.MIXED_REALITY_UNITY_LIKE, + VrOptions.MIXED_REALITY_RENDER_HANDS, + dh.vrSettings.mixedRealityAlphaMask && dh.vrSettings.mixedRealityUnityLike ? + VrOptions.DUMMY : VrOptions.MIXED_REALITY_KEY_COLOR, + VrOptions.MIXED_REALITY_FOV, + !dh.vrSettings.mixedRealityUnityLike ? VrOptions.DUMMY : VrOptions.MIXED_REALITY_UNDISTORTED, + !dh.vrSettings.mixedRealityUndistorted || !dh.vrSettings.mixedRealityUnityLike ? + VrOptions.DUMMY : VrOptions.MONO_FOV, + !dh.vrSettings.mixedRealityUnityLike ? VrOptions.DUMMY : VrOptions.MIXED_REALITY_ALPHA_MASK, + VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL + ); } - - if (vrsettings$vroptions == VRSettings.VrOptions.MIRROR_EYE && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.CROPPED && this.dataholder.vrSettings.displayMirrorMode != VRSettings.MirrorMode.SINGLE) + case FIRST_PERSON -> { - avrsettings$vroptions[i] = VRSettings.VrOptions.DUMMY; + super.init(VrOptions.MONO_FOV); } - } - - super.init(avrsettings$vroptions, true); - - if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) - { - avrsettings$vroptions = new VRSettings.VrOptions[MROptions.length]; - System.arraycopy(MROptions, 0, avrsettings$vroptions, 0, MROptions.length); - - for (int j = 0; j < avrsettings$vroptions.length; ++j) + case THIRD_PERSON -> { - VRSettings.VrOptions vrsettings$vroptions1 = avrsettings$vroptions[j]; - - if (vrsettings$vroptions1 == VRSettings.VrOptions.MONO_FOV && (!this.dataholder.vrSettings.mixedRealityUndistorted || !this.dataholder.vrSettings.mixedRealityUnityLike)) - { - avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY; - } - - if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK && !this.dataholder.vrSettings.mixedRealityUnityLike) - { - avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY; - } - - if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED && !this.dataholder.vrSettings.mixedRealityUnityLike) - { - avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY; - } - - if (vrsettings$vroptions1 == VRSettings.VrOptions.MIXED_REALITY_KEY_COLOR && this.dataholder.vrSettings.mixedRealityAlphaMask && this.dataholder.vrSettings.mixedRealityUnityLike) - { - avrsettings$vroptions[j] = VRSettings.VrOptions.DUMMY; - } + super.init( + VrOptions.MIXED_REALITY_FOV, + VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL + ); } - - super.init(avrsettings$vroptions, false); - } - else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PERSON) - { - super.init(UDOptions, false); - } - else if (this.dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) - { - super.init(TUDOptions, false); } super.addDefaultButtons(); - this.children().stream().filter((w) -> - { - return w instanceof GuiVROption; - }).forEach((w) -> - { - GuiVROption guivroption = (GuiVROption)w; +// this.children().stream().filter((w) -> w instanceof GuiVROption).forEach((w) -> +// { +// GuiVROption guivroption = (GuiVROption)w; -// if (guivroption.getOption() == VRSettings.VrOptions.HANDHELD_CAMERA_RENDER_SCALE && Config.isShaders()) //Optifine +// if (guivroption.getOption() == VrOptions.HANDHELD_CAMERA_RENDER_SCALE && Config.isShaders()) //Optifine // { // guivroption.active = false; // } - }); +// }); } - public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) + @Override + public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTick); } + @Override protected void loadDefaults() { super.loadDefaults(); - this.minecraft.options.fov().set(70); - if (VRState.vrInitialized) { - this.dataholder.vrRenderer.reinitFrameBuffers("Defaults Loaded"); + mc.options.fov().set(70); + if (vrInitialized) { + dh.vrRenderer.reinitFrameBuffers("Defaults Loaded"); } } + @Override protected void actionPerformed(AbstractWidget widget) { if (widget instanceof GuiVROption guivroption) { - - if (VRState.vrRunning && (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() || guivroption.getId() == VRSettings.VrOptions.FSAA.ordinal() || guivroption.getId() == VRSettings.VrOptions.STENCIL_ON.ordinal())) - { - if (guivroption.getId() == VRSettings.VrOptions.STENCIL_ON.ordinal() || (guivroption.getId() == VRSettings.VrOptions.MIRROR_DISPLAY.ordinal() && ShadersHelper.isShaderActive())) { - this.dataholder.vrRenderer.resizeFrameBuffers("Render Setting Changed"); - } else { - this.dataholder.vrRenderer.reinitFrameBuffers("Render Setting Changed"); + VrOptions option = guivroption.getOption(); + switch(option){ + case MIRROR_DISPLAY, FSAA, STENCIL_ON -> + { + if (vrRunning) + { + if (option == VrOptions.STENCIL_ON || option == VrOptions.MIRROR_DISPLAY && ShadersHelper.isShaderActive()) + { + dh.vrRenderer.resizeFrameBuffers("Render Setting Changed"); + } + else + { + dh.vrRenderer.reinitFrameBuffers("Render Setting Changed"); + } + } } - } - if (guivroption.getId() == VRSettings.VrOptions.RELOAD_EXTERNAL_CAMERA.ordinal()) - { - VRHotkeys.loadExternalCameraConfig(); + case RELOAD_EXTERNAL_CAMERA -> { VRHotkeys.loadExternalCameraConfig(); } } } } - public boolean mouseReleased(double pMouseX, double p_94754_, int pMouseY) + @Override + public boolean mouseReleased(double mouseX, double mouseY, int button) { - if (this.settings.renderScaleFactor != this.prevRenderScaleFactor || this.settings.handCameraResScale != this.prevHandCameraResScale) + if (dh.vrSettings.renderScaleFactor != this.prevRenderScaleFactor || dh.vrSettings.handCameraResScale != this.prevHandCameraResScale) { - this.prevRenderScaleFactor = this.settings.renderScaleFactor; - this.prevHandCameraResScale = this.settings.handCameraResScale; - if (VRState.vrRunning) { - this.dataholder.vrRenderer.resizeFrameBuffers("Render Setting Changed"); + this.prevRenderScaleFactor = dh.vrSettings.renderScaleFactor; + this.prevHandCameraResScale = dh.vrSettings.handCameraResScale; + if (vrRunning) { + dh.vrRenderer.resizeFrameBuffers("Render Setting Changed"); } } - return super.mouseReleased(pMouseX, p_94754_, pMouseY); + return super.mouseReleased(mouseX, mouseY, button); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRoomscaleSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRoomscaleSettings.java index ad7ce4246..d90de11f6 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRoomscaleSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRoomscaleSettings.java @@ -1,32 +1,33 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.screens.Screen; import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.screens.Screen; public class GuiRoomscaleSettings extends GuiVROptionsBase { - static VRSettings.VrOptions[] roomscaleSettings = new VRSettings.VrOptions[] { - VRSettings.VrOptions.WEAPON_COLLISION, - VRSettings.VrOptions.REALISTIC_JUMP, - VRSettings.VrOptions.REALISTIC_SNEAK, - VRSettings.VrOptions.REALISTIC_CLIMB, - VRSettings.VrOptions.REALISTIC_ROW, - VRSettings.VrOptions.REALISTIC_SWIM, - VRSettings.VrOptions.BOW_MODE, - VRSettings.VrOptions.BACKPACK_SWITCH, - VRSettings.VrOptions.ALLOW_CRAWLING - }; - + public static String vrTitle = "vivecraft.options.screen.roomscale"; public GuiRoomscaleSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.roomscale"; - super.init(roomscaleSettings, true); + super.clearWidgets(); + super.init( + VrOptions.WEAPON_COLLISION, + VrOptions.REALISTIC_JUMP, + VrOptions.REALISTIC_SNEAK, + VrOptions.REALISTIC_CLIMB, + VrOptions.REALISTIC_ROW, + VrOptions.REALISTIC_SWIM, + VrOptions.BOW_MODE, + VrOptions.BACKPACK_SWITCH, + VrOptions.ALLOW_CRAWLING + ); super.addDefaultButtons(); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiSeatedOptions.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiSeatedOptions.java index d2544ac8a..b9616a9ba 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiSeatedOptions.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiSeatedOptions.java @@ -1,42 +1,40 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client.gui.framework.VROptionEntry; import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client.gui.framework.VROptionPosition.POS_CENTER; public class GuiSeatedOptions extends GuiVROptionsBase { - private VROptionEntry[] seatedOptions = new VROptionEntry[] { - new VROptionEntry(VRSettings.VrOptions.X_SENSITIVITY), - new VROptionEntry(VRSettings.VrOptions.Y_SENSITIVITY), - new VROptionEntry(VRSettings.VrOptions.KEYHOLE), - new VROptionEntry(VRSettings.VrOptions.SEATED_HUD_XHAIR), - new VROptionEntry(VRSettings.VrOptions.WALK_UP_BLOCKS), - new VROptionEntry(VRSettings.VrOptions.WORLD_ROTATION_INCREMENT), - new VROptionEntry(VRSettings.VrOptions.VEHICLE_ROTATION), - new VROptionEntry(VRSettings.VrOptions.DUMMY), - new VROptionEntry(VRSettings.VrOptions.SEATED_FREE_MOVE, true), - new VROptionEntry(VRSettings.VrOptions.RIGHT_CLICK_DELAY, false), - new VROptionEntry("vivecraft.options.screen.teleport.button", (button, mousePos) -> { - this.minecraft.setScreen(new GuiTeleportSettings(this)); - return true; - }), - new VROptionEntry("vivecraft.options.screen.freemove.button", (button, mousePos) -> { - this.minecraft.setScreen(new GuiFreeMoveSettings(this)); - return true; - }) - }; - + public static String vrTitle = "vivecraft.options.screen.seated"; public GuiSeatedOptions(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.seated"; - super.init(this.seatedOptions, true); + super.clearWidgets(); + super.init( + VrOptions.X_SENSITIVITY, + VrOptions.Y_SENSITIVITY, + VrOptions.KEYHOLE, + VrOptions.SEATED_HUD_XHAIR, + VrOptions.WALK_UP_BLOCKS, + VrOptions.WORLD_ROTATION_INCREMENT, + VrOptions.VEHICLE_ROTATION, + VrOptions.DUMMY + ); + super.init(VrOptions.SEATED_FREE_MOVE, POS_CENTER); + super.init(VrOptions.RIGHT_CLICK_DELAY); + super.init( + GuiTeleportSettings.class, + GuiFreeMoveSettings.class + ); super.addDefaultButtons(); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiStandingSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiStandingSettings.java index 1d1691478..2d0c02bc0 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiStandingSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiStandingSettings.java @@ -1,40 +1,38 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.screens.Screen; import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client.gui.framework.VROptionEntry; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client.gui.framework.VROptionPosition.POS_CENTER; public class GuiStandingSettings extends GuiVROptionsBase { - private VROptionEntry[] locomotionSettings = new VROptionEntry[] { - new VROptionEntry(VRSettings.VrOptions.WALK_UP_BLOCKS), - new VROptionEntry(VRSettings.VrOptions.VEHICLE_ROTATION), - new VROptionEntry(VRSettings.VrOptions.WALK_MULTIPLIER), - new VROptionEntry(VRSettings.VrOptions.WORLD_ROTATION_INCREMENT), - new VROptionEntry(VRSettings.VrOptions.BCB_ON), - new VROptionEntry(VRSettings.VrOptions.ALLOW_STANDING_ORIGIN_OFFSET), - new VROptionEntry(VRSettings.VrOptions.FORCE_STANDING_FREE_MOVE, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry("vivecraft.options.screen.teleport.button", (button, mousePos) -> { - this.minecraft.setScreen(new GuiTeleportSettings(this)); - return true; - }), - new VROptionEntry("vivecraft.options.screen.freemove.button", (button, mousePos) -> { - this.minecraft.setScreen(new GuiFreeMoveSettings(this)); - return true; - }) - }; - + public static String vrTitle = "vivecraft.options.screen.standing"; public GuiStandingSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.standing"; - super.init(this.locomotionSettings, true); + super.clearWidgets(); + super.init( + VrOptions.WALK_UP_BLOCKS, + VrOptions.VEHICLE_ROTATION, + VrOptions.WALK_MULTIPLIER, + VrOptions.WORLD_ROTATION_INCREMENT, + VrOptions.BCB_ON, + VrOptions.ALLOW_STANDING_ORIGIN_OFFSET + ); + super.init(VrOptions.FORCE_STANDING_FREE_MOVE, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init( + GuiTeleportSettings.class, + GuiFreeMoveSettings.class + ); super.addDefaultButtons(); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiTeleportSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiTeleportSettings.java index d429926bc..1e253bd56 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiTeleportSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiTeleportSettings.java @@ -1,46 +1,48 @@ package org.vivecraft.client.gui.settings; +import org.vivecraft.client.gui.framework.GuiVROption; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client.gui.framework.GuiVROption; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; -public class GuiTeleportSettings extends GuiVROptionsBase -{ - private static VRSettings.VrOptions[] teleportSettings = new VRSettings.VrOptions[] { - VRSettings.VrOptions.SIMULATE_FALLING, - VRSettings.VrOptions.LIMIT_TELEPORT - }; - private static VRSettings.VrOptions[] limitedTeleportSettings = new VRSettings.VrOptions[] { - VRSettings.VrOptions.TELEPORT_UP_LIMIT, - VRSettings.VrOptions.TELEPORT_DOWN_LIMIT, - VRSettings.VrOptions.TELEPORT_HORIZ_LIMIT - }; +import static org.vivecraft.client_vr.VRState.dh; +public class GuiTeleportSettings extends org.vivecraft.client.gui.framework.GuiVROptionsBase +{ + public static String vrTitle = "vivecraft.options.screen.teleport"; public GuiTeleportSettings(Screen guiScreen) { super(guiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.teleport"; - super.init(teleportSettings, true); + super.clearWidgets(); + super.init( + VrOptions.SIMULATE_FALLING, + VrOptions.LIMIT_TELEPORT + ); - if (this.settings.vrLimitedSurvivalTeleport) + if (dh.vrSettings.vrLimitedSurvivalTeleport) { - super.init(limitedTeleportSettings, false); + super.init( + VrOptions.TELEPORT_UP_LIMIT, + VrOptions.TELEPORT_DOWN_LIMIT, + VrOptions.TELEPORT_HORIZ_LIMIT + ); } super.addDefaultButtons(); } + @Override protected void actionPerformed(AbstractWidget widget) { if (widget instanceof GuiVROption guivroption) { - if (guivroption.getId() == VRSettings.VrOptions.LIMIT_TELEPORT.ordinal()) + if (guivroption.getOption() == VrOptions.LIMIT_TELEPORT) { this.reinit = true; } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiTouchHotbarSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiTouchHotbarSettings.java new file mode 100644 index 000000000..8f6d22e31 --- /dev/null +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiTouchHotbarSettings.java @@ -0,0 +1,56 @@ +package org.vivecraft.client.gui.settings; + +import org.vivecraft.client.gui.framework.GuiVROption; +import org.vivecraft.client.gui.framework.GuiVROptionsBase; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client.gui.framework.VROptionPosition.POS_CENTER; +import static org.vivecraft.client_vr.VRState.dh; + +public class GuiTouchHotbarSettings extends GuiVROptionsBase +{ + + public static String vrTitle = "vivecraft.options.screen.touch_hotbar"; + public GuiTouchHotbarSettings(final Screen guiScreen) + { + super(guiScreen); + } + + @Override + public void init() + { + super.clearWidgets(); + super.init(VrOptions.TOUCH_HOTBAR, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + if (dh.vrSettings.vrTouchHotbar) { + super.init( + VrOptions.TOUCH_HOTBAR_COLOR_R, + VrOptions.TOUCH_HOTBAR_COLOR_G, + VrOptions.TOUCH_HOTBAR_COLOR_B, + VrOptions.TOUCH_HOTBAR_COLOR_A + ); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init( + VrOptions.TOUCH_OFFBAR_COLOR_R, + VrOptions.TOUCH_OFFBAR_COLOR_G, + VrOptions.TOUCH_OFFBAR_COLOR_B, + VrOptions.TOUCH_OFFBAR_COLOR_A + ); + } + super.addDefaultButtons(); + } + + @Override + protected void actionPerformed(final AbstractWidget widget) + { + if (widget instanceof final GuiVROption guivroption) + { + if(guivroption.getOption() == VrOptions.TOUCH_HOTBAR){ + this.reinit = true; + } + } + } +} diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRControls.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRControls.java index 1a060ae41..6a57b27a8 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRControls.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRControls.java @@ -1,50 +1,54 @@ package org.vivecraft.client.gui.settings; -import net.minecraft.client.gui.GuiGraphics; -import org.vivecraft.client.gui.framework.VROptionEntry; -import org.vivecraft.client.gui.framework.GuiVROptionsBase; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -public class GuiVRControls extends GuiVROptionsBase -{ - private static VROptionEntry[] controlsSettings = new VROptionEntry[] { - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY, true), - new VROptionEntry(VRSettings.VrOptions.DUMMY), - new VROptionEntry(VRSettings.VrOptions.INGAME_BINDINGS_IN_GUI), - new VROptionEntry(VRSettings.VrOptions.REVERSE_HANDS), - new VROptionEntry(VRSettings.VrOptions.RIGHT_CLICK_DELAY), - new VROptionEntry(VRSettings.VrOptions.ALLOW_ADVANCED_BINDINGS), - new VROptionEntry(VRSettings.VrOptions.THIRDPERSON_ITEMTRANSFORMS) - }; +import javax.annotation.Nonnull; +import static org.vivecraft.client.gui.framework.VROptionPosition.POS_CENTER; +import static org.vivecraft.client_vr.VRState.mc; + +public class GuiVRControls extends org.vivecraft.client.gui.framework.GuiVROptionsBase +{ + public static String vrTitle = "vivecraft.options.screen.controls"; public GuiVRControls(Screen par1GuiScreen) { super(par1GuiScreen); } + @Override public void init() { - this.vrTitle = "vivecraft.options.screen.controls"; - super.init(controlsSettings, true); + super.clearWidgets(); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init(VrOptions.DUMMY, POS_CENTER); + super.init(VrOptions.DUMMY); + super.init(GuiVRSkeletalInput.class); + super.init( + VrOptions.REVERSE_HANDS, + VrOptions.RIGHT_CLICK_DELAY, + VrOptions.ALLOW_ADVANCED_BINDINGS, + VrOptions.THIRDPERSON_ITEMTRANSFORMS + ); super.addDefaultButtons(); } - public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) + @Override + public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTick); - int middle = 240 / 2 - this.minecraft.font.lineHeight / 2 - 24; - int lineHeight = this.minecraft.font.lineHeight + 3; + int middle = 240 / 2 - mc.font.lineHeight; + int lineHeight = mc.font.lineHeight + 3; - guiGraphics.drawCenteredString(this.minecraft.font, Component.translatable("vivecraft.messages.controls.1"), this.width / 2, middle - lineHeight, 16777215); - guiGraphics.drawCenteredString(this.minecraft.font, Component.translatable("vivecraft.messages.controls.2"), this.width / 2, middle, 16777215); - guiGraphics.drawCenteredString(this.minecraft.font, Component.translatable("vivecraft.messages.controls.3"), this.width / 2, middle + lineHeight, 16777215); + guiGraphics.drawCenteredString(mc.font, Component.translatable("vivecraft.messages.controls.1"), this.width / 2, middle - lineHeight, 16777215); + guiGraphics.drawCenteredString(mc.font, Component.translatable("vivecraft.messages.controls.2"), this.width / 2, middle, 16777215); + guiGraphics.drawCenteredString(mc.font, Component.translatable("vivecraft.messages.controls.3"), this.width / 2, middle + lineHeight, 16777215); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRFingerDisplays.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRFingerDisplays.java new file mode 100644 index 000000000..cb6c653f3 --- /dev/null +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRFingerDisplays.java @@ -0,0 +1,54 @@ +package org.vivecraft.client.gui.settings; + +import org.vivecraft.client.gui.framework.GuiVROptionsBase; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.dh; + +public class GuiVRFingerDisplays extends GuiVROptionsBase { + + public static String vrTitle = "vivecraft.options.screen.controls.skeletal_input.finger_displays"; + + public GuiVRFingerDisplays(final Screen par1GuiScreen) + { + super(par1GuiScreen); + } + + @Override + public void init() + { + super.clearWidgets(); + if (dh.vrSettings.reverseHands){ + super.init( + VrOptions.MAIN_THUMB_DISPLAY, + VrOptions.OFF_THUMB_DISPLAY, + VrOptions.MAIN_INDEX_DISPLAY, + VrOptions.OFF_INDEX_DISPLAY, + VrOptions.MAIN_MIDDLE_DISPLAY, + VrOptions.OFF_MIDDLE_DISPLAY, + VrOptions.MAIN_RING_DISPLAY, + VrOptions.OFF_RING_DISPLAY, + VrOptions.MAIN_LITTLE_DISPLAY, + VrOptions.OFF_LITTLE_DISPLAY + ); + } + else + { + super.init( + VrOptions.OFF_THUMB_DISPLAY, + VrOptions.MAIN_THUMB_DISPLAY, + VrOptions.OFF_INDEX_DISPLAY, + VrOptions.MAIN_INDEX_DISPLAY, + VrOptions.OFF_MIDDLE_DISPLAY, + VrOptions.MAIN_MIDDLE_DISPLAY, + VrOptions.OFF_RING_DISPLAY, + VrOptions.MAIN_RING_DISPLAY, + VrOptions.OFF_LITTLE_DISPLAY, + VrOptions.MAIN_LITTLE_DISPLAY + ); + } + super.addDefaultButtons(); + } +} diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRSkeletalInput.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRSkeletalInput.java new file mode 100644 index 000000000..0e9e001db --- /dev/null +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiVRSkeletalInput.java @@ -0,0 +1,56 @@ +package org.vivecraft.client.gui.settings; + +import org.vivecraft.client.gui.framework.GuiVROptionsBase; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + +import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client.gui.framework.VROptionPosition.POS_CENTER; +import static org.vivecraft.client_vr.VRState.dh; + +public class GuiVRSkeletalInput extends GuiVROptionsBase { + + public static String vrTitle = "vivecraft.options.screen.controls.skeletal_input"; + + public GuiVRSkeletalInput(final Screen par1GuiScreen) + { + super(par1GuiScreen); + } + + public void init() + { + super.clearWidgets(); + if (dh.vrSettings.reverseHands){ + super.init( + VrOptions.MAIN_THUMB_THRESHOLD, + VrOptions.OFF_THUMB_THRESHOLD, + VrOptions.MAIN_INDEX_THRESHOLD, + VrOptions.OFF_INDEX_THRESHOLD, + VrOptions.MAIN_MIDDLE_THRESHOLD, + VrOptions.OFF_MIDDLE_THRESHOLD, + VrOptions.MAIN_RING_THRESHOLD, + VrOptions.OFF_RING_THRESHOLD, + VrOptions.MAIN_LITTLE_THRESHOLD, + VrOptions.OFF_LITTLE_THRESHOLD + ); + } else { + super.init( + VrOptions.OFF_THUMB_THRESHOLD, + VrOptions.MAIN_THUMB_THRESHOLD, + VrOptions.OFF_INDEX_THRESHOLD, + VrOptions.MAIN_INDEX_THRESHOLD, + VrOptions.OFF_MIDDLE_THRESHOLD, + VrOptions.MAIN_MIDDLE_THRESHOLD, + VrOptions.OFF_RING_THRESHOLD, + VrOptions.MAIN_RING_THRESHOLD, + VrOptions.OFF_LITTLE_THRESHOLD, + VrOptions.MAIN_LITTLE_THRESHOLD + ); + } + super.init(VrOptions.FINGER_COUNT); + super.init(GuiVRFingerDisplays.class); + super.init(VrOptions.FINGER_VIEW); + super.init(VrOptions.SKELETAL_INPUT, POS_CENTER); + super.addDefaultButtons(); + } +} diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java index 5b2dbf2e1..614aed931 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java @@ -1,16 +1,19 @@ package org.vivecraft.client.gui.widgets; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarrationElementOutput; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; -import org.lwjgl.glfw.GLFW; import java.util.List; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; + public class TextScrollWidget extends AbstractWidget { private int maxLines = 0; @@ -28,7 +31,7 @@ public class TextScrollWidget extends AbstractWidget { public TextScrollWidget(int x, int y, int width, int height, String text) { super(x, y, width, height, Component.literal("")); - formattedText = Minecraft.getInstance().font.getSplitter().splitLines(text, width - scrollBarWidth*2, Style.EMPTY); + formattedText = mc.font.getSplitter().splitLines(text, width - scrollBarWidth * 2, Style.EMPTY); initScroll(); } @@ -36,7 +39,7 @@ public TextScrollWidget(int x, int y, int width, int height, String text) { public TextScrollWidget(int x, int y, int width, int height, Component text) { super(x, y, width, height, Component.literal("")); - formattedText = Minecraft.getInstance().font.getSplitter().splitLines(text, width - scrollBarWidth*2, Style.EMPTY); + formattedText = mc.font.getSplitter().splitLines(text, width - scrollBarWidth * 2, Style.EMPTY); initScroll(); } @@ -45,8 +48,8 @@ private void initScroll() { maxLines = (height - 2 - padding + 3) / 12; currentLine = 0; scrollSteps = formattedText.size() - maxLines; - scrollSteps = Math.max(scrollSteps, 0); - scrollBarSize = scrollSteps == 0 ? height - 2 : (int)(Math.max(formattedText.size(), maxLines) / (float)(scrollSteps) * 12); + scrollSteps = max(scrollSteps, 0); + scrollBarSize = scrollSteps == 0 ? height - 2 : max(formattedText.size(), maxLines) / scrollSteps * 12; scrollBarOffset = height - scrollBarSize - 2; } @@ -55,22 +58,24 @@ private void initScroll() { public void renderWidget(GuiGraphics guiGraphics, int i, int j, float f) { // draw box outline guiGraphics.fill( - getX(), - getY(), - getX() + width, - getY() + this.height, - -6250336); + getX(), + getY(), + getX() + width, + getY() + this.height, + -6250336 + ); // draw box inside guiGraphics.fill( - getX() + 1, - getY() + 1, - getX() + width - 1, - getY() + this.height - 1, - -16777216); + getX() + 1, + getY() + 1, + getX() + width - 1, + getY() + this.height - 1, + -16777216 + ); // draw text for (int line = 0; line + currentLine < formattedText.size() && line < maxLines; line++) { - guiGraphics.drawString(Minecraft.getInstance().font, formattedText.get(line + currentLine).getString(), getX() + padding, getY() + padding + line * 12, 16777215); + guiGraphics.drawString(mc.font, formattedText.get(line + currentLine).getString(), getX() + padding, getY() + padding + line * 12, 16777215); } float scrollbarStart = scrollSteps == 0 ? 0 : currentLine/(float)scrollSteps * scrollBarOffset; @@ -78,20 +83,22 @@ public void renderWidget(GuiGraphics guiGraphics, int i, int j, float f) { if (isFocused() || isHovered) { // draw scroll bar outline guiGraphics.fill( - getX() + width - scrollBarWidth - 2, - (int) (getY() + 1 + scrollbarStart), - getX() + width - 1, - (int) (getY() + 1 + scrollbarStart + scrollBarSize), - -1); + getX() + width - scrollBarWidth - 2, + (int) (getY() + 1 + scrollbarStart), + getX() + width - 1, + (int) (getY() + 1 + scrollbarStart + scrollBarSize), + -1 + ); } // draw scroll bar guiGraphics.fill( - getX() + width - scrollBarWidth - (isFocused() || isHovered ? 1 : 2), - (int)(getY() + (isFocused() || isHovered ? 2 : 1) + scrollbarStart), - getX() + width - (isFocused() || isHovered ? 2 : 1), - (int)(getY() + (isFocused() || isHovered ? 0 : 1) + scrollbarStart + scrollBarSize), - -6250336); + getX() + width - scrollBarWidth - (isFocused() || isHovered ? 1 : 2), + (int)(getY() + (isFocused() || isHovered ? 2 : 1) + scrollbarStart), + getX() + width - (isFocused() || isHovered ? 2 : 1), + (int)(getY() + (isFocused() || isHovered ? 0 : 1) + scrollbarStart + scrollBarSize), + -6250336 + ); } @Override @@ -148,8 +155,8 @@ public boolean mouseScrolled(double x, double y, double scrollAmount) { @Override public boolean keyPressed(int key, int scancode, int mods) { - if (key == GLFW.GLFW_KEY_UP || key == GLFW.GLFW_KEY_DOWN) { - if (mouseScrolled(0, 0, key == GLFW.GLFW_KEY_UP ? 1 : -1)) { + if (key == GLFW_KEY_UP || key == GLFW_KEY_DOWN) { + if (mouseScrolled(0, 0, key == GLFW_KEY_UP ? 1 : -1)) { return true; } } diff --git a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java index f5554c0fa..656deee08 100644 --- a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java +++ b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java @@ -1,35 +1,42 @@ package org.vivecraft.client.network; -import com.google.common.base.Charsets; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.vivecraft.client_vr.settings.AutoCalibration; +import org.vivecraft.client_vr.settings.VRSettings.ChatServerPluginMessage; +import org.vivecraft.client_vr.settings.VRSettings.ServerOverrides.Setting; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; +import org.vivecraft.common.CommonDataHolder; +import org.vivecraft.common.VRServerPerms; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; +import org.vivecraft.common.network.VRPlayerState; + import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.client.Minecraft; + import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; -import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; +import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.Rot; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.settings.AutoCalibration; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.common.CommonDataHolder; -import org.vivecraft.common.VRServerPerms; -import org.vivecraft.common.network.VrPlayerState; import java.util.UUID; +import static org.vivecraft.client.utils.Utils.message; +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; + public class ClientNetworking { public static boolean displayedChatMessage = false; @@ -50,7 +57,7 @@ public class ClientNetworking { public static boolean needsReset = true; - public static ServerboundCustomPayloadPacket getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators command, byte[] payload) { + public static ServerboundCustomPayloadPacket getVivecraftClientPacket(PacketDiscriminators command, byte[] payload) { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeBytes(payload); @@ -58,8 +65,8 @@ public static ServerboundCustomPayloadPacket getVivecraftClientPacket(CommonNetw } public static ServerboundCustomPayloadPacket createVRActivePacket(boolean vrActive) { - var buffer = new FriendlyByteBuf(Unpooled.buffer()); - buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.IS_VR_ACTIVE.ordinal()); + FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer()); + buffer.writeByte(PacketDiscriminators.IS_VR_ACTIVE.ordinal()); buffer.writeBoolean(vrActive); return new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); } @@ -73,37 +80,37 @@ public static void resetServerSettings() { serverAllowsCrawling = false; serverAllowsVrSwitching = false; usedNetworkVersion = -1; - //DataHolder.getInstance().vrSettings.overrides.resetAll(); move to mixin + //dh.vrSettings.overrides.resetAll(); move to mixin } public static void sendVersionInfo() { String s = CommonNetworkHelper.CHANNEL.toString(); FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeBytes(s.getBytes()); - Minecraft.getInstance().getConnection().send(new ServerboundCustomPayloadPacket(new ResourceLocation("minecraft:register"), friendlybytebuf)); + mc.getConnection().send(new ServerboundCustomPayloadPacket(new ResourceLocation("minecraft:register"), friendlybytebuf)); // send version string, with currently running - Minecraft.getInstance().getConnection().send(getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.VERSION, - (CommonDataHolder.getInstance().versionIdentifier + (VRState.vrRunning ? " VR" : " NONVR") + mc.getConnection().send(getVivecraftClientPacket(PacketDiscriminators.VERSION, + (CommonDataHolder.getInstance().versionIdentifier + (vrRunning ? " VR" : " NONVR") + "\n" + CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION + "\n" + CommonNetworkHelper.MIN_SUPPORTED_NETWORK_VERSION - ).getBytes(Charsets.UTF_8))); + ).getBytes(java.nio.charset.StandardCharsets.UTF_8))); } public static void sendVRPlayerPositions(VRPlayer vrPlayer) { - var connection = Minecraft.getInstance().getConnection(); + var connection = mc.getConnection(); if (!serverWantsData || connection == null) { return; } - float worldScale = ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_post.worldScale; + float worldScale = dh.vrPlayer.vrdata_world_post.worldScale; if (worldScale != worldScallast) { ByteBuf bytebuf = Unpooled.buffer(); bytebuf.writeFloat(worldScale); byte[] abyte = new byte[bytebuf.readableBytes()]; bytebuf.readBytes(abyte); - ServerboundCustomPayloadPacket serverboundcustompayloadpacket = getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.WORLDSCALE, abyte); - Minecraft.getInstance().getConnection().send(serverboundcustompayloadpacket); + ServerboundCustomPayloadPacket serverboundcustompayloadpacket = getVivecraftClientPacket(PacketDiscriminators.WORLDSCALE, abyte); + mc.getConnection().send(serverboundcustompayloadpacket); worldScallast = worldScale; } @@ -114,79 +121,79 @@ public static void sendVRPlayerPositions(VRPlayer vrPlayer) { bytebuf2.writeFloat(f1 / 1.52F); byte[] abyte3 = new byte[bytebuf2.readableBytes()]; bytebuf2.readBytes(abyte3); - ServerboundCustomPayloadPacket serverboundcustompayloadpacket1 = getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.HEIGHT, abyte3); - Minecraft.getInstance().getConnection().send(serverboundcustompayloadpacket1); + ServerboundCustomPayloadPacket serverboundcustompayloadpacket1 = getVivecraftClientPacket(PacketDiscriminators.HEIGHT, abyte3); + mc.getConnection().send(serverboundcustompayloadpacket1); heightlast = f1; } - var vrPlayerState = VrPlayerState.create(vrPlayer); + VRPlayerState vrPlayerState = VRPlayerState.create(vrPlayer); if (usedNetworkVersion >= 0) { connection.send(createVrPlayerStatePacket(vrPlayerState)); } else { sendLegacyPackets(connection, vrPlayerState); } - VRPlayersClient.getInstance().Update(Minecraft.getInstance().player.getGameProfile().getId(), vrPlayerState, worldScale, f1 / 1.52F, true); + VRPlayersClient.getInstance().Update(mc.player.getGameProfile().getId(), vrPlayerState, worldScale, f1 / 1.52F, true); } - public static ServerboundCustomPayloadPacket createVrPlayerStatePacket(VrPlayerState vrPlayerState) { - var buffer = new FriendlyByteBuf(Unpooled.buffer()); - buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.VR_PLAYER_STATE.ordinal()); + public static ServerboundCustomPayloadPacket createVrPlayerStatePacket(VRPlayerState vrPlayerState) { + FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer()); + buffer.writeByte(PacketDiscriminators.VR_PLAYER_STATE.ordinal()); vrPlayerState.serialize(buffer); return new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); } - public static void sendLegacyPackets(ClientPacketListener connection, VrPlayerState vrPlayerState) { + public static void sendLegacyPackets(ClientPacketListener connection, VRPlayerState vrPlayerState) { // left controller packet FriendlyByteBuf controller0Buffer = new FriendlyByteBuf(Unpooled.buffer()); - controller0Buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.CONTROLLER0DATA.ordinal()); - controller0Buffer.writeBoolean(ClientDataHolderVR.getInstance().vrSettings.reverseHands); + controller0Buffer.writeByte(PacketDiscriminators.CONTROLLER0DATA.ordinal()); + controller0Buffer.writeBoolean(dh.vrSettings.reverseHands); vrPlayerState.controller0().serialize(controller0Buffer); connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, controller0Buffer)); // right controller packet FriendlyByteBuf controller1Buffer = new FriendlyByteBuf(Unpooled.buffer()); - controller1Buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.CONTROLLER1DATA.ordinal()); - controller1Buffer.writeBoolean(ClientDataHolderVR.getInstance().vrSettings.reverseHands); + controller1Buffer.writeByte(PacketDiscriminators.CONTROLLER1DATA.ordinal()); + controller1Buffer.writeBoolean(dh.vrSettings.reverseHands); vrPlayerState.controller1().serialize(controller1Buffer); connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, controller1Buffer)); // hmd packet FriendlyByteBuf headBuffer = new FriendlyByteBuf(Unpooled.buffer()); - headBuffer.writeByte(CommonNetworkHelper.PacketDiscriminators.HEADDATA.ordinal()); - headBuffer.writeBoolean(ClientDataHolderVR.getInstance().vrSettings.seated); + headBuffer.writeByte(PacketDiscriminators.HEADDATA.ordinal()); + headBuffer.writeBoolean(dh.vrSettings.seated); vrPlayerState.hmd().serialize(headBuffer); connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, headBuffer)); } public static boolean isLimitedSurvivalTeleport() { - return ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.LIMIT_TELEPORT).getBoolean(); + return dh.vrSettings.overrides.getSetting(VrOptions.LIMIT_TELEPORT).getBoolean(); } public static int getTeleportUpLimit() { - return ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.TELEPORT_UP_LIMIT).getInt(); + return dh.vrSettings.overrides.getSetting(VrOptions.TELEPORT_UP_LIMIT).getInt(); } public static int getTeleportDownLimit() { - return ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.TELEPORT_DOWN_LIMIT).getInt(); + return dh.vrSettings.overrides.getSetting(VrOptions.TELEPORT_DOWN_LIMIT).getInt(); } public static int getTeleportHorizLimit() { - return ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.TELEPORT_HORIZ_LIMIT).getInt(); + return dh.vrSettings.overrides.getSetting(VrOptions.TELEPORT_HORIZ_LIMIT).getInt(); } public static void sendActiveHand(byte c) { if (serverWantsData) { - ServerboundCustomPayloadPacket serverboundcustompayloadpacket = getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.ACTIVEHAND, new byte[]{c}); + ServerboundCustomPayloadPacket serverboundcustompayloadpacket = getVivecraftClientPacket(PacketDiscriminators.ACTIVEHAND, new byte[]{c}); - if (Minecraft.getInstance().getConnection() != null) { - Minecraft.getInstance().getConnection().send(serverboundcustompayloadpacket); + if (mc.getConnection() != null) { + mc.getConnection().send(serverboundcustompayloadpacket); } } } public static void overridePose(LocalPlayer player) { - if (ClientDataHolderVR.getInstance().crawlTracker.crawling) { + if (dh.crawlTracker.crawling) { player.setPose(Pose.SWIMMING); } } @@ -195,9 +202,9 @@ public static void overrideLook(Player player, Vec3 view) { if (!serverWantsData) { capturedPitch = player.getXRot(); capturedYaw = player.getYRot(); - float f = (float) Math.toDegrees(Math.asin(-view.y / view.length())); - float f1 = (float) Math.toDegrees(Math.atan2(-view.x, view.z)); - ((LocalPlayer) player).connection.send(new ServerboundMovePlayerPacket.Rot(f1, f, player.onGround())); + float f = (float) toDegrees(asin(-view.y / view.length())); + float f1 = (float) toDegrees(atan2(-view.x, view.z)); + ((LocalPlayer) player).connection.send(new Rot(f1, f, player.onGround())); overrideActive = true; } } @@ -205,31 +212,29 @@ public static void overrideLook(Player player, Vec3 view) { public static void restoreLook(Player player) { if (!serverWantsData) { if (overrideActive) { - ((LocalPlayer) player).connection.send(new ServerboundMovePlayerPacket.Rot(capturedYaw, capturedPitch, player.onGround())); + ((LocalPlayer) player).connection.send(new Rot(capturedYaw, capturedPitch, player.onGround())); overrideActive = false; } } } - public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetID, FriendlyByteBuf buffer) { - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - Minecraft mc = Minecraft.getInstance(); + public static void handlePacket(PacketDiscriminators packetID, FriendlyByteBuf buffer) { switch (packetID) { case VERSION -> { String s11 = buffer.readUtf(1024); - VRServerPerms.INSTANCE.setTeleportSupported(true); - if (VRState.vrInitialized) { - dataholder.vrPlayer.teleportWarning = false; - dataholder.vrPlayer.vrSwitchWarning = true; + VRServerPerms.setTeleportSupported(true); + if (vrInitialized) { + dh.vrPlayer.teleportWarning = false; + dh.vrPlayer.vrSwitchWarning = true; } - if (!ClientNetworking.displayedChatMessage - && (dataholder.vrSettings.showServerPluginMessage == VRSettings.ChatServerPluginMessage.ALWAYS - || (dataholder.vrSettings.showServerPluginMessage == VRSettings.ChatServerPluginMessage.SERVER_ONLY && !Minecraft.getInstance().isLocalServer()))) { - ClientNetworking.displayedChatMessage = true; - mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.serverplugin", s11)); + if (!displayedChatMessage + && (dh.vrSettings.showServerPluginMessage == ChatServerPluginMessage.ALWAYS + || (dh.vrSettings.showServerPluginMessage == ChatServerPluginMessage.SERVER_ONLY && !mc.isLocalServer()))) { + displayedChatMessage = true; + message(Component.translatable("vivecraft.messages.serverplugin", s11)); } - if (VRState.vrEnabled && dataholder.vrSettings.manualCalibration == -1.0F && !dataholder.vrSettings.seated) { - mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.calibrateheight")); + if (vrEnabled && dh.vrSettings.manualCalibration == -1.0F && !dh.vrSettings.seated) { + message(Component.translatable("vivecraft.messages.calibrateheight")); } } case IS_VR_ACTIVE -> { @@ -237,12 +242,12 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI VRPlayersClient.getInstance().disableVR(buffer.readUUID()); } } - case REQUESTDATA -> ClientNetworking.serverWantsData = true; + case REQUESTDATA -> serverWantsData = true; case CLIMBING -> { - ClientNetworking.serverAllowsClimbey = buffer.readBoolean(); + serverAllowsClimbey = buffer.readBoolean(); if (buffer.readableBytes() > 0) { - dataholder.climbTracker.serverblockmode = buffer.readByte(); - dataholder.climbTracker.blocklist.clear(); + dh.climbTracker.serverblockmode = buffer.readByte(); + dh.climbTracker.blocklist.clear(); while (buffer.readableBytes() > 0) { String s12 = buffer.readUtf(16384); @@ -250,15 +255,15 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI // if the block is not there AIR is returned if (block != Blocks.AIR) { - dataholder.climbTracker.blocklist.add(block); + dh.climbTracker.blocklist.add(block); } } } } - case TELEPORT -> ClientNetworking.serverSupportsDirectTeleport = true; + case TELEPORT -> serverSupportsDirectTeleport = true; case UBERPACKET -> { UUID uuid = buffer.readUUID(); - var vrPlayerState = VrPlayerState.deserialize(buffer); + VRPlayerState vrPlayerState = VRPlayerState.deserialize(buffer); float worldScale = buffer.readFloat(); float heightScale = buffer.readFloat(); VRPlayersClient.getInstance().Update(uuid, vrPlayerState, worldScale, heightScale); @@ -269,8 +274,8 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI String s14 = buffer.readUtf(16384); String[] astring = s13.split("\\.", 2); - if (dataholder.vrSettings.overrides.hasSetting(astring[0])) { - VRSettings.ServerOverrides.Setting vrsettings$serveroverrides$setting = dataholder.vrSettings.overrides.getSetting(astring[0]); + if (dh.vrSettings.overrides.hasSetting(astring[0])) { + Setting vrsettings$serveroverrides$setting = dh.vrSettings.overrides.getSetting(astring[0]); try { if (astring.length > 1) { @@ -287,7 +292,7 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI Object object = vrsettings$serveroverrides$setting.getOriginalValue(); if (object instanceof Boolean) { - vrsettings$serveroverrides$setting.setValue(s14.equals("true")); + vrsettings$serveroverrides$setting.setValue("true".equals(s14)); } else if (!(object instanceof Integer) && !(object instanceof Byte) && !(object instanceof Short)) { if (!(object instanceof Float) && !(object instanceof Double)) { vrsettings$serveroverrides$setting.setValue(s14); @@ -299,23 +304,23 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI } } - System.out.println("Server setting override: " + s13 + " = " + s14); + logger.info("Server setting override: {} = {}", s13, s14); } catch (Exception exception) { exception.printStackTrace(); } } } } - case CRAWL -> ClientNetworking.serverAllowsCrawling = true; + case CRAWL -> serverAllowsCrawling = true; case NETWORK_VERSION -> // cast to unsigned byte - ClientNetworking.usedNetworkVersion = buffer.readByte() & 0xFF; + usedNetworkVersion = buffer.readByte() & 0xFF; case VR_SWITCHING -> { - ClientNetworking.serverAllowsVrSwitching = buffer.readBoolean(); - if (VRState.vrInitialized) { - if (!ClientNetworking.serverAllowsVrSwitching) { - Minecraft.getInstance().gui.getChat().addMessage(Component.translatable("vivecraft.messages.novrhotswitching")); + serverAllowsVrSwitching = buffer.readBoolean(); + if (vrInitialized) { + if (!serverAllowsVrSwitching) { + message(Component.translatable("vivecraft.messages.novrhotswitching")); } - dataholder.vrPlayer.vrSwitchWarning = false; + dh.vrPlayer.vrSwitchWarning = false; } } } diff --git a/common/src/main/java/org/vivecraft/client/network/PatreonReceiver.java b/common/src/main/java/org/vivecraft/client/network/PatreonReceiver.java index 4da27c86a..d2d91c275 100644 --- a/common/src/main/java/org/vivecraft/client/network/PatreonReceiver.java +++ b/common/src/main/java/org/vivecraft/client/network/PatreonReceiver.java @@ -1,21 +1,25 @@ package org.vivecraft.client.network; +import org.vivecraft.client.VRPlayersClient; + +import org.apache.commons.io.IOUtils; + +import net.minecraft.world.entity.player.Player; + import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; -import net.minecraft.world.entity.player.Player; -import org.apache.commons.io.IOUtils; -import org.vivecraft.client.VRPlayersClient; +import static org.vivecraft.common.utils.Utils.logger; public class PatreonReceiver { private static final Object lock = new Object(); - private static List queuedPlayers = new LinkedList<>(); + private static final List queuedPlayers = new ArrayList<>(); private static Map cache; private static boolean downloadStarted; private static boolean downloadFailed; @@ -49,7 +53,7 @@ private static void fileDownloadFinished(String url, String data) } catch (Exception exception1) { - System.out.println("error with donors txt " + exception1.getMessage()); + logger.error("error with donors txt {}", exception1.getMessage()); } } @@ -57,7 +61,7 @@ private static void fileDownloadFinished(String url, String data) } catch (Exception exception1) { - System.out.println("Error parsing data: " + url + ", " + exception1.getClass().getName() + ": " + exception1.getMessage()); + logger.error("Error parsing data: {}, {}: {}", url, exception1.getClass().getName(), exception1.getMessage()); downloadFailed = true; } } diff --git a/common/src/main/java/org/vivecraft/client/render/HMDLayer.java b/common/src/main/java/org/vivecraft/client/render/HMDLayer.java index b12cc961e..ff6a4946d 100644 --- a/common/src/main/java/org/vivecraft/client/render/HMDLayer.java +++ b/common/src/main/java/org/vivecraft/client/render/HMDLayer.java @@ -1,7 +1,10 @@ package org.vivecraft.client.render; +import org.vivecraft.client.VRPlayersClient; + import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.model.PlayerModel; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; @@ -11,7 +14,6 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; -import org.vivecraft.client.VRPlayersClient; public class HMDLayer extends RenderLayer> { @@ -24,33 +26,17 @@ public HMDLayer(RenderLayerParent this.BLACK_HMD; + case 2 -> this.GOLD_HMD; + case 3, 4 -> this.DIAMOND_HMD; + default -> null; + }; + if (hmd != null) { + poseStack.pushPose(); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolid(hmd)); + ((VRPlayerModel)this.getParentModel()).renderHMDR(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); } - poseStack.pushPose(); - VertexConsumer vertexConsumer = multiBufferSource.getBuffer(RenderType.entitySolid(hmd)); - ((VRPlayerModel)this.getParentModel()).renderHMDR(poseStack, vertexConsumer, i, OverlayTexture.NO_OVERLAY); - poseStack.popPose(); } } diff --git a/common/src/main/java/org/vivecraft/client/render/OpenGLdebugging.java b/common/src/main/java/org/vivecraft/client/render/OpenGLdebugging.java index 8c0b5bf0b..7546057e0 100644 --- a/common/src/main/java/org/vivecraft/client/render/OpenGLdebugging.java +++ b/common/src/main/java/org/vivecraft/client/render/OpenGLdebugging.java @@ -1,5 +1,9 @@ package org.vivecraft.client.render; +import org.apache.commons.io.IOUtils; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11C; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -8,17 +12,14 @@ import java.nio.IntBuffer; import java.util.HashMap; import java.util.Map; -import org.apache.commons.io.IOUtils; -import org.lwjgl.BufferUtils; -import org.lwjgl.opengl.GL11; public class OpenGLdebugging { - private static Map dumpedComplete = new HashMap<>(); - private static Map dumped = new HashMap<>(); - private static Map dumpedType = new HashMap<>(); + private static final Map dumpedComplete = new HashMap<>(); + private static final Map dumped = new HashMap<>(); + private static final Map dumpedType = new HashMap<>(); public static OpenGLdebugging instance = new OpenGLdebugging(); - public GLproperty[] propertyList = new GLproperty[] {new GLproperty(2816, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), new GLproperty(2817, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), new GLproperty(2819, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), new GLproperty(2818, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), new GLproperty(2823, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), new GLproperty(2825, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), new GLproperty(2820, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), new GLproperty(2821, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), new GLproperty(2822, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), new GLproperty(2824, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), new GLproperty(2883, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), new GLproperty(32884, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32890, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), new GLproperty(32891, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32892, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), new GLproperty(32910, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), new GLproperty(32885, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32894, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32895, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), new GLproperty(32911, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), new GLproperty(32886, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32897, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), new GLproperty(32898, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), new GLproperty(32899, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), new GLproperty(32912, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), new GLproperty(32887, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32901, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), new GLproperty(32902, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), new GLproperty(32913, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), new GLproperty(32888, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32904, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), new GLproperty(32905, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32906, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32914, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), new GLproperty(32889, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32908, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), new GLproperty(32915, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), new GLproperty(2982, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2983, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2984, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2978, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), new GLproperty(2928, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), new GLproperty(2979, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2980, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2981, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2976, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), new GLproperty(2977, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), new GLproperty(2918, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), new GLproperty(2913, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), new GLproperty(2914, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), new GLproperty(2915, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), new GLproperty(2916, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), new GLproperty(2917, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), new GLproperty(2912, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), new GLproperty(2900, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), new GLproperty(2896, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), new GLproperty(2903, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), new GLproperty(2902, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), new GLproperty(2901, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), new GLproperty(4608, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), new GLproperty(4609, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), new GLproperty(4610, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), new GLproperty(5632, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), new GLproperty(5633, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), new GLproperty(2899, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), new GLproperty(2897, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), new GLproperty(2898, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), new GLproperty(4608, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4609, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4610, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4611, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), new GLproperty(4615, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4616, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4617, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4612, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), new GLproperty(4613, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), new GLproperty(4614, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), new GLproperty(16384, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16385, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16386, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16387, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16388, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16389, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16390, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16391, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(5635, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), new GLproperty(2833, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), new GLproperty(2832, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), new GLproperty(2849, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), new GLproperty(2848, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), new GLproperty(2853, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), new GLproperty(2854, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), new GLproperty(2852, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), new GLproperty(2884, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), new GLproperty(2885, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), new GLproperty(2886, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), new GLproperty(2881, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), new GLproperty(2880, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), new GLproperty(32824, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), new GLproperty(10753, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(10754, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(32823, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(2882, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), new GLproperty(3552, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), new GLproperty(3553, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), new GLproperty(32872, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), new GLproperty(32873, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), new GLproperty(5890, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), new GLproperty(4096, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4097, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4101, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32860, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32861, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32862, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32863, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32864, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32865, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4100, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), new GLproperty(10241, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), new GLproperty(10240, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), new GLproperty(10242, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), new GLproperty(10243, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), new GLproperty(32870, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), new GLproperty(8704, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), new GLproperty(8705, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), new GLproperty(3168, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3169, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3170, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3171, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(9474, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), new GLproperty(9473, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), new GLproperty(9472, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), new GLproperty(3089, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), new GLproperty(3088, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), new GLproperty(3008, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3009, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), new GLproperty(3010, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), new GLproperty(2960, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), new GLproperty(2962, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2963, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2967, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2964, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2965, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2966, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2929, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), new GLproperty(2932, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), new GLproperty(3042, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3041, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), new GLproperty(3040, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), new GLproperty(3024, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3057, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3058, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3056, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), new GLproperty(3073, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), new GLproperty(3105, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), new GLproperty(3107, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), new GLproperty(2930, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), new GLproperty(2968, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), new GLproperty(3106, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), new GLproperty(3104, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), new GLproperty(2931, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), new GLproperty(2961, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2944, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), new GLproperty(3312, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), new GLproperty(3313, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), new GLproperty(3314, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), new GLproperty(3315, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), new GLproperty(3316, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), new GLproperty(3317, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), new GLproperty(3328, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), new GLproperty(3329, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), new GLproperty(3330, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), new GLproperty(3331, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), new GLproperty(3332, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), new GLproperty(3333, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), new GLproperty(3344, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), new GLproperty(3345, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), new GLproperty(3346, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), new GLproperty(3347, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), new GLproperty(3350, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), new GLproperty(3351, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), new GLproperty(3074, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), new GLproperty(2561, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), new GLproperty(2561, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), new GLproperty(2560, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), new GLproperty(2560, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), new GLproperty(2562, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), new GLproperty(2562, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), new GLproperty(3536, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), new GLproperty(3538, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), new GLproperty(3537, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), new GLproperty(3539, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), new GLproperty(3456, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), new GLproperty(3152, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), new GLproperty(3153, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3154, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3155, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3156, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), new GLproperty(3377, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), new GLproperty(3378, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), new GLproperty(3382, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), new GLproperty(3384, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), new GLproperty(3385, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), new GLproperty(3408, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), new GLproperty(3379, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), new GLproperty(3380, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), new GLproperty(3383, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), new GLproperty(2865, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), new GLproperty(3376, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), new GLproperty(3386, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), new GLproperty(3381, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), new GLproperty(3387, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), new GLproperty(3072, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), new GLproperty(3121, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), new GLproperty(3120, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), new GLproperty(3122, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), new GLproperty(3123, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), new GLproperty(2834, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), new GLproperty(2835, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), new GLproperty(2850, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), new GLproperty(2851, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), new GLproperty(3410, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3411, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3412, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3413, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3409, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3414, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), new GLproperty(3415, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), new GLproperty(3416, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3417, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3418, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3419, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(2866, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), new GLproperty(2867, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), new GLproperty(2864, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), new GLproperty(2992, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), new GLproperty(2993, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), new GLproperty(3440, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), new GLproperty(3136, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), new GLproperty(3571, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), new GLproperty(3572, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), new GLproperty(3568, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), new GLproperty(3569, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), new GLproperty(3570, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()")}; + public GLproperty[] propertyList = {new GLproperty(2816, "GL_CURRENT_COLOR", "Current color", "current", "glGetFloatv()"), new GLproperty(2817, "GL_CURRENT_INDEX", "Current color index", "current", "glGetFloatv()"), new GLproperty(2819, "GL_CURRENT_TEXTURE_COORDS", "Current texture coordinates", "current", "glGetFloatv()"), new GLproperty(2818, "GL_CURRENT_NORMAL", "Current normal", "current", "glGetFloatv()"), new GLproperty(2823, "GL_CURRENT_RASTER_POSITION", "Current raster position", "current", "glGetFloatv()"), new GLproperty(2825, "GL_CURRENT_RASTER_DISTANCE", "Current raster distance", "current", "glGetFloatv()"), new GLproperty(2820, "GL_CURRENT_RASTER_COLOR", "Color associated with raster position", "current", "glGetFloatv()"), new GLproperty(2821, "GL_CURRENT_RASTER_INDEX", "Color index associated with raster position", "current", "glGetFloatv()"), new GLproperty(2822, "GL_CURRENT_RASTER_TEXTURE_COORDS", "Texture coordinates associated with raster position", "current", "glGetFloatv()"), new GLproperty(2824, "GL_CURRENT_RASTER_POSITION_VALID", "Raster position valid bit", "current", "glGetBooleanv()"), new GLproperty(2883, "GL_EDGE_FLAG", "Edge flag", "current", "glGetBooleanv()"), new GLproperty(32884, "GL_VERTEX_ARRAY", "Vertex array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32890, "GL_VERTEX_ARRAY_SIZE", "Coordinates per vertex", "vertex-array", "glGetIntegerv()"), new GLproperty(32891, "GL_VERTEX_ARRAY_TYPE", "Type of vertex coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32892, "GL_VERTEX_ARRAY_STRIDE", "Stride between vertices", "vertex-array", "glGetIntegerv()"), new GLproperty(32910, "GL_VERTEX_ARRAY_POINTER", "Pointer to the vertex array", "vertex-array", "glGetPointerv()"), new GLproperty(32885, "GL_NORMAL_ARRAY", "Normal array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32894, "GL_NORMAL_ARRAY_TYPE", "Type of normal coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32895, "GL_NORMAL_ARRAY_STRIDE", "Stride between normals", "vertex-array", "glGetIntegerv()"), new GLproperty(32911, "GL_NORMAL_ARRAY_POINTER", "Pointer to the normal array", "vertex-array", "glGetPointerv()"), new GLproperty(32886, "GL_COLOR_ARRAY", "RGBA color array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32897, "GL_COLOR_ARRAY_SIZE", "Colors per vertex", "vertex-array", "glGetIntegerv()"), new GLproperty(32898, "GL_COLOR_ARRAY_TYPE", "Type of color components", "vertex-array", "glGetIntegerv()"), new GLproperty(32899, "GL_COLOR_ARRAY_STRIDE", "Stride between colors", "vertex-array", "glGetIntegerv()"), new GLproperty(32912, "GL_COLOR_ARRAY_POINTER", "Pointer to the color array", "vertex-array", "glGetPointerv()"), new GLproperty(32887, "GL_INDEX_ARRAY", "Color-index array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32901, "GL_INDEX_ARRAY_TYPE", "Type of color indices", "vertex-array", "glGetIntegerv()"), new GLproperty(32902, "GL_INDEX_ARRAY_STRIDE", "Stride between color indices", "vertex-array", "glGetIntegerv()"), new GLproperty(32913, "GL_INDEX_ARRAY_POINTER", "Pointer to the index array", "vertex-array", "glGetPointerv()"), new GLproperty(32888, "GL_TEXTURE_COORD_ARRAY", "Texture coordinate array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32904, "GL_TEXTURE_COORD_ARRAY_SIZE", "Texture coordinates per element", "vertex-array", "glGetIntegerv()"), new GLproperty(32905, "GL_TEXTURE_COORD_ARRAY_TYPE", "Type of texture coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32906, "GL_TEXTURE_COORD_ARRAY_STRIDE", "Stride between texture coordinates", "vertex-array", "glGetIntegerv()"), new GLproperty(32914, "GL_TEXTURE_COORD_ARRAY_POINTER", "Pointer to the texture coordinate array", "vertex-array", "glGetPointerv()"), new GLproperty(32889, "GL_EDGE_FLAG_ARRAY", "Edge flag array enable", "vertex-array", "glIsEnabled()"), new GLproperty(32908, "GL_EDGE_FLAG_ARRAY_STRIDE", "Stride between edge flags", "vertex-array", "glGetIntegerv()"), new GLproperty(32915, "GL_EDGE_FLAG_ARRAY_POINTER", "Pointer to the edge flag array", "vertex-array", "glGetPointerv()"), new GLproperty(2982, "GL_MODELVIEW_MATRIX", "Modelview matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2983, "GL_PROJECTION_MATRIX", "Projection matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2984, "GL_TEXTURE_MATRIX", "Texture matrix stack", "matrix", "glGetFloatv()"), new GLproperty(2978, "GL_VIEWPORT", "Viewport origin and extent", "viewport", "glGetIntegerv()"), new GLproperty(2928, "GL_DEPTH_RANGE", "Depth range near and far", "viewport", "glGetFloatv()"), new GLproperty(2979, "GL_MODELVIEW_STACK_DEPTH", "Modelview matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2980, "GL_PROJECTION_STACK_DEPTH", "Projection matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2981, "GL_TEXTURE_STACK_DEPTH", "Texture matrix stack pointer", "matrix", "glGetIntegerv()"), new GLproperty(2976, "GL_MATRIX_MODE", "Current matrix mode", "transform", "glGetIntegerv()"), new GLproperty(2977, "GL_NORMALIZE", "Current normal normalization on/off", "transform/ enable", "glIsEnabled()"), new GLproperty(2918, "GL_FOG_COLOR", "Fog color", "fog", "glGetFloatv()"), new GLproperty(2913, "GL_FOG_INDEX", "Fog index", "fog", "glGetFloatv()"), new GLproperty(2914, "GL_FOG_DENSITY", "Exponential fog density", "fog", "glGetFloatv()"), new GLproperty(2915, "GL_FOG_START", "Linear fog start", "fog", "glGetFloatv()"), new GLproperty(2916, "GL_FOG_END", "Linear fog end", "fog", "glGetFloatv()"), new GLproperty(2917, "GL_FOG_MODE", "Fog mode", "fog", "glGetIntegerv()"), new GLproperty(2912, "GL_FOG", "True if fog enabled", "fog/enable", "glIsEnabled()"), new GLproperty(2900, "GL_SHADE_MODEL", "glShadeModel() setting", "lighting", "glGetIntegerv()"), new GLproperty(2896, "GL_LIGHTING", "True if lighting is enabled", "lighting/e nable", "glIsEnabled()"), new GLproperty(2903, "GL_COLOR_MATERIAL", "True if color tracking is enabled", "lighting", "glIsEnabled()"), new GLproperty(2902, "GL_COLOR_MATERIAL_PARAMETER", "Material properties tracking current color", "lighting", "glGetIntegerv()"), new GLproperty(2901, "GL_COLOR_MATERIAL_FACE", "Face(s) affected by color tracking", "lighting", "glGetIntegerv()"), new GLproperty(4608, "GL_AMBIENT", "Ambient material color", "lighting", "glGetMaterialfv()"), new GLproperty(4609, "GL_DIFFUSE", "Diffuse material color", "lighting", "glGetMaterialfv()"), new GLproperty(4610, "GL_SPECULAR", "Specular material color", "lighting", "glGetMaterialfv()"), new GLproperty(5632, "GL_EMISSION", "Emissive material color", "lighting", "glGetMaterialfv()"), new GLproperty(5633, "GL_SHININESS", "Specular exponent of material", "lighting", "glGetMaterialfv()"), new GLproperty(2899, "GL_LIGHT_MODEL_AMBIENT", "Ambient scene color", "lighting", "glGetFloatv()"), new GLproperty(2897, "GL_LIGHT_MODEL_LOCAL_VIEWER", "Viewer is local", "lighting", "glGetBooleanv()"), new GLproperty(2898, "GL_LIGHT_MODEL_TWO_SIDE", "Use two-sided lighting", "lighting", "glGetBooleanv()"), new GLproperty(4608, "GL_AMBIENT", "Ambient intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4609, "GL_DIFFUSE", "Diffuse intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4610, "GL_SPECULAR", "Specular intensity of light i", "lighting", "glGetLightfv()"), new GLproperty(4611, "GL_POSITION", "Position of light i", "lighting", "glGetLightfv()"), new GLproperty(4615, "GL_CONSTANT_ATTENUATION", "Constant attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4616, "GL_LINEAR_ATTENUATION", "Linear attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4617, "GL_QUADRATIC_ATTENUATION", "Quadratic attenuation factor", "lighting", "glGetLightfv()"), new GLproperty(4612, "GL_SPOT_DIRECTION", "Spotlight direction of light i", "lighting", "glGetLightfv()"), new GLproperty(4613, "GL_SPOT_EXPONENT", "Spotlight exponent of light i", "lighting", "glGetLightfv()"), new GLproperty(4614, "GL_SPOT_CUTOFF", "Spotlight angle of light i", "lighting", "glGetLightfv()"), new GLproperty(16384, "GL_LIGHT0", "True if light 0 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16385, "GL_LIGHT1", "True if light 1 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16386, "GL_LIGHT2", "True if light 2 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16387, "GL_LIGHT3", "True if light 3 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16388, "GL_LIGHT4", "True if light 4 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16389, "GL_LIGHT5", "True if light 5 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16390, "GL_LIGHT6", "True if light 6 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(16391, "GL_LIGHT7", "True if light 7 enabled", "lighting/enable", "glIsEnabled()"), new GLproperty(5635, "GL_COLOR_INDEXES", "ca, cd, and cs for color-index lighting", "lighting/e nable", "glGetMaterialfv()"), new GLproperty(2833, "GL_POINT_SIZE", "Point size", "point", "glGetFloatv()"), new GLproperty(2832, "GL_POINT_SMOOTH", "Point antialiasing on", "point/enable", "glIsEnabled()"), new GLproperty(2849, "GL_LINE_WIDTH", "Line width", "line", "glGetFloatv()"), new GLproperty(2848, "GL_LINE_SMOOTH", "Line antialiasing on", "line/enable", "glIsEnabled()"), new GLproperty(2853, "GL_LINE_STIPPLE_PATTERN", "Line stipple", "line", "glGetIntegerv()"), new GLproperty(2854, "GL_LINE_STIPPLE_REPEAT", "Line stipple repeat", "line", "glGetIntegerv()"), new GLproperty(2852, "GL_LINE_STIPPLE", "Line stipple enable", "line/enable", "glIsEnabled()"), new GLproperty(2884, "GL_CULL_FACE", "Polygon culling enabled", "polygon/enable", "glIsEnabled()"), new GLproperty(2885, "GL_CULL_FACE_MODE", "Cull front-/back-facing polygons", "polygon", "glGetIntegerv()"), new GLproperty(2886, "GL_FRONT_FACE", "Polygon front-face CW/CCW indicator", "polygon", "glGetIntegerv()"), new GLproperty(2881, "GL_POLYGON_SMOOTH", "Polygon antialiasing on", "polygon/enable", "glIsEnabled()"), new GLproperty(2880, "GL_POLYGON_MODE", "Polygon rasterization mode (front and back)", "polygon", "glGetIntegerv()"), new GLproperty(32824, "GL_POLYGON_OFFSET_FACTOR", "Polygon offset factor", "polygon", "glGetFloatv()"), new GLproperty(10753, "GL_POLYGON_OFFSET_POINT", "Polygon offset enable for GL_POINT mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(10754, "GL_POLYGON_OFFSET_LINE", "Polygon offset enable for GL_LINE mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(32823, "GL_POLYGON_OFFSET_FILL", "Polygon offset enable for GL_FILL mode rasterization", "polygon/enable", "glIsEnabled()"), new GLproperty(2882, "GL_POLYGON_STIPPLE", "Polygon stipple enable", "polygon/enable", "glIsEnabled()"), new GLproperty(3552, "GL_TEXTURE_1D", "True if 1-D texturing enabled ", "texture/enable", "glIsEnabled()"), new GLproperty(3553, "GL_TEXTURE_2D", "True if 2-D texturing enabled ", "texture/enable", "glIsEnabled()"), new GLproperty(32872, "GL_TEXTURE_BINDING_1D", "Texture object bound to GL_TEXTURE_1D", "texture", "glGetIntegerv()"), new GLproperty(32873, "GL_TEXTURE_BINDING_2D", "Texture object bound to GL_TEXTURE_2D", "texture", "glGetIntegerv()"), new GLproperty(5890, "GL_TEXTURE", "x-D texture image at level of detail i", "UNUSED", "glGetTexImage()"), new GLproperty(4096, "GL_TEXTURE_WIDTH", "x-D texture image i's width", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4097, "GL_TEXTURE_HEIGHT", "x-D texture image i's height", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4101, "GL_TEXTURE_BORDER", "x-D texture image i's border width", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32860, "GL_TEXTURE_RED_SIZE", "x-D texture image i's red resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32861, "GL_TEXTURE_GREEN_SIZE", "x-D texture image i's green resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32862, "GL_TEXTURE_BLUE_SIZE", "x-D texture image i's blue resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32863, "GL_TEXTURE_ALPHA_SIZE", "x-D texture image i's alpha resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32864, "GL_TEXTURE_LUMINANCE_SIZE", "x-D texture image i's luminance resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(32865, "GL_TEXTURE_INTENSITY_SIZE", "x-D texture image i's intensity resolution", "UNUSED", "glGetTexLevelParameter*()"), new GLproperty(4100, "GL_TEXTURE_BORDER_COLOR", "Texture border color", "texture", "glGetTexParameter*()"), new GLproperty(10241, "GL_TEXTURE_MIN_FILTER", "Texture minification function", "texture", "glGetTexParameter*()"), new GLproperty(10240, "GL_TEXTURE_MAG_FILTER", "Texture magnification function", "texture", "glGetTexParameter*()"), new GLproperty(10242, "GL_TEXTURE_WRAP_S", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), new GLproperty(10243, "GL_TEXTURE_WRAP_T", "Texture wrap mode (x is S or T)", "texture", "glGetTexParameter*()"), new GLproperty(32870, "GL_TEXTURE_PRIORITY", "Texture object priority", "texture", "glGetTexParameter*()"), new GLproperty(8704, "GL_TEXTURE_ENV_MODE", "Texture application function", "texture", "glGetTexEnviv()"), new GLproperty(8705, "GL_TEXTURE_ENV_COLOR", "Texture environment color", "texture", "glGetTexEnvfv()"), new GLproperty(3168, "GL_TEXTURE_GEN_S", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3169, "GL_TEXTURE_GEN_T", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3170, "GL_TEXTURE_GEN_R", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(3171, "GL_TEXTURE_GEN_Q", "Texgen enabled (x is S, T, R, or Q)", "texture/enable", "glIsEnabled()"), new GLproperty(9474, "GL_EYE_PLANE", "Texgen plane equation coefficients", "texture", "glGetTexGenfv()"), new GLproperty(9473, "GL_OBJECT_PLANE", "Texgen object linear coefficients", "texture", "glGetTexGenfv()"), new GLproperty(9472, "GL_TEXTURE_GEN_MODE", "Function used for texgen", "texture", "glGetTexGeniv()"), new GLproperty(3089, "GL_SCISSOR_TEST", "Scissoring enabled", "scissor/enable", "glIsEnabled()"), new GLproperty(3088, "GL_SCISSOR_BOX", "Scissor box", "scissor", "glGetIntegerv()"), new GLproperty(3008, "GL_ALPHA_TEST", "Alpha test enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3009, "GL_ALPHA_TEST_FUNC", "Alpha test function", "color-buffer", "glGetIntegerv()"), new GLproperty(3010, "GL_ALPHA_TEST_REF", "Alpha test reference value", "color-buffer", "glGetIntegerv()"), new GLproperty(2960, "GL_STENCIL_TEST", "Stenciling enabled", "stencil-buffer/enable", "glIsEnabled()"), new GLproperty(2962, "GL_STENCIL_FUNC", "Stencil function", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2963, "GL_STENCIL_VALUE_MASK", "Stencil mask", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2967, "GL_STENCIL_REF", "Stencil reference value", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2964, "GL_STENCIL_FAIL", "Stencil fail action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2965, "GL_STENCIL_PASS_DEPTH_FAIL", "Stencil depth buffer fail action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2966, "GL_STENCIL_PASS_DEPTH_PASS", "Stencil depth buffer pass action", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2929, "GL_DEPTH_TEST", "Depth buffer enabled", "depth-buffer/ena ble", "glIsEnabled()"), new GLproperty(2932, "GL_DEPTH_FUNC", "Depth buffer test function", "depth-buffer", "glGetIntegerv()"), new GLproperty(3042, "GL_BLEND", "Blending enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3041, "GL_BLEND_SRC", "Blending source function", "color-buffer", "glGetIntegerv()"), new GLproperty(3040, "GL_BLEND_DST", "Blending destination function", "color-buffer", "glGetIntegerv()"), new GLproperty(3024, "GL_DITHER", "Dithering enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3057, "GL_INDEX_LOGIC_OP", "Color index logical operation enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3058, "GL_COLOR_LOGIC_OP", "RGBA color logical operation enabled", "color-buffer/enable", "glIsEnabled()"), new GLproperty(3056, "GL_LOGIC_OP_MODE", "Logical operation function", "color-buffer", "glGetIntegerv()"), new GLproperty(3073, "GL_DRAW_BUFFER", "Buffers selected for drawing", "color-buffer", "glGetIntegerv()"), new GLproperty(3105, "GL_INDEX_WRITEMASK", "Color-index writemask", "color-buffer", "glGetIntegerv()"), new GLproperty(3107, "GL_COLOR_WRITEMASK", "Color write enables; R, G, B, or A", "color-buffer", "glGetBooleanv()"), new GLproperty(2930, "GL_DEPTH_WRITEMASK", "Depth buffer enabled for writing", "depth-buffer", "glGetBooleanv()"), new GLproperty(2968, "GL_STENCIL_WRITEMASK", "Stencil-buffer writemask", "stencil-buffer", "glGetIntegerv()"), new GLproperty(3106, "GL_COLOR_CLEAR_VALUE", "Color-buffer clear value (RGBA mode)", "color-buffer", "glGetFloatv()"), new GLproperty(3104, "GL_INDEX_CLEAR_VALUE", "Color-buffer clear value (color-index mode)", "color-buffer", "glGetFloatv()"), new GLproperty(2931, "GL_DEPTH_CLEAR_VALUE", "Depth-buffer clear value", "depth-buffer", "glGetIntegerv()"), new GLproperty(2961, "GL_STENCIL_CLEAR_VALUE", "Stencil-buffer clear value", "stencil-buffer", "glGetIntegerv()"), new GLproperty(2944, "GL_ACCUM_CLEAR_VALUE", "Accumulation-buffer clear value", "accum-buffer", "glGetFloatv()"), new GLproperty(3312, "GL_UNPACK_SWAP_BYTES", "Value of GL_UNPACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), new GLproperty(3313, "GL_UNPACK_LSB_FIRST", "Value of GL_UNPACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), new GLproperty(3314, "GL_UNPACK_ROW_LENGTH", "Value of GL_UNPACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), new GLproperty(3315, "GL_UNPACK_SKIP_ROWS", "Value of GL_UNPACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), new GLproperty(3316, "GL_UNPACK_SKIP_PIXELS", "Value of GL_UNPACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), new GLproperty(3317, "GL_UNPACK_ALIGNMENT", "Value of GL_UNPACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), new GLproperty(3328, "GL_PACK_SWAP_BYTES", "Value of GL_PACK_SWAP_BYTES", "pixel-store", "glGetBooleanv()"), new GLproperty(3329, "GL_PACK_LSB_FIRST", "Value of GL_PACK_LSB_FIRST", "pixel-store", "glGetBooleanv()"), new GLproperty(3330, "GL_PACK_ROW_LENGTH", "Value of GL_PACK_ROW_LENGTH", "pixel-store", "glGetIntegerv()"), new GLproperty(3331, "GL_PACK_SKIP_ROWS", "Value of GL_PACK_SKIP_ROWS", "pixel-store", "glGetIntegerv()"), new GLproperty(3332, "GL_PACK_SKIP_PIXELS", "Value of GL_PACK_SKIP_PIXELS", "pixel-store", "glGetIntegerv()"), new GLproperty(3333, "GL_PACK_ALIGNMENT", "Value of GL_PACK_ALIGNMENT", "pixel-store", "glGetIntegerv()"), new GLproperty(3344, "GL_MAP_COLOR", "True if colors are mapped", "pixel", "glGetBooleanv()"), new GLproperty(3345, "GL_MAP_STENCIL", "True if stencil values are mapped", "pixel", "glGetBooleanv()"), new GLproperty(3346, "GL_INDEX_SHIFT", "Value of GL_INDEX_SHIFT", "pixel", "glGetIntegerv()"), new GLproperty(3347, "GL_INDEX_OFFSET", "Value of GL_INDEX_OFFSET", "pixel", "glGetIntegerv()"), new GLproperty(3350, "GL_ZOOM_X", "x zoom factor", "pixel", "glGetFloatv()"), new GLproperty(3351, "GL_ZOOM_Y", "y zoom factor", "pixel", "glGetFloatv()"), new GLproperty(3074, "GL_READ_BUFFER", "Read source buffer", "pixel", "glGetIntegerv()"), new GLproperty(2561, "GL_ORDER", "1D map order", "capability", "glGetMapiv()"), new GLproperty(2561, "GL_ORDER", "2D map orders", "capability", "glGetMapiv()"), new GLproperty(2560, "GL_COEFF", "1D control points", "capability", "glGetMapfv()"), new GLproperty(2560, "GL_COEFF", "2D control points", "capability", "glGetMapfv()"), new GLproperty(2562, "GL_DOMAIN", "1D domain endpoints", "capability", "glGetMapfv()"), new GLproperty(2562, "GL_DOMAIN", "2D domain endpoints", "capability", "glGetMapfv()"), new GLproperty(3536, "GL_MAP1_GRID_DOMAIN", "1D grid endpoints", "eval", "glGetFloatv()"), new GLproperty(3538, "GL_MAP2_GRID_DOMAIN", "2D grid endpoints", "eval", "glGetFloatv()"), new GLproperty(3537, "GL_MAP1_GRID_SEGMENTS", "1D grid divisions", "eval", "glGetFloatv()"), new GLproperty(3539, "GL_MAP2_GRID_SEGMENTS", "2D grid divisions", "eval", "glGetFloatv()"), new GLproperty(3456, "GL_AUTO_NORMAL", "True if automatic normal generation enabled", "eval", "glIsEnabled()"), new GLproperty(3152, "GL_PERSPECTIVE_CORRECTION_HINT", "Perspective correction hint", "hint", "glGetIntegerv()"), new GLproperty(3153, "GL_POINT_SMOOTH_HINT", "Point smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3154, "GL_LINE_SMOOTH_HINT", "Line smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3155, "GL_POLYGON_SMOOTH_HINT", "Polygon smooth hint", "hint", "glGetIntegerv()"), new GLproperty(3156, "GL_FOG_HINT", "Fog hint", "hint", "glGetIntegerv()"), new GLproperty(3377, "GL_MAX_LIGHTS", "Maximum number of lights", "capability", "glGetIntegerv()"), new GLproperty(3378, "GL_MAX_CLIP_PLANES", "Maximum number of user clipping planes", "capability", "glGetIntegerv()"), new GLproperty(3382, "GL_MAX_MODELVIEW_STACK_DEPTH", "Maximum modelview-matrix stack depth", "capability", "glGetIntegerv()"), new GLproperty(3384, "GL_MAX_PROJECTION_STACK_DEPTH", "Maximum projection-matrix stack depth", "capability", "glGetIntegerv()"), new GLproperty(3385, "GL_MAX_TEXTURE_STACK_DEPTH", "Maximum depth of texture matrix stack", "capability", "glGetIntegerv()"), new GLproperty(3408, "GL_SUBPIXEL_BITS", "Number of bits of subpixel precision in x and y", "capability", "glGetIntegerv()"), new GLproperty(3379, "GL_MAX_TEXTURE_SIZE", "See discussion in Texture Proxy in Chapter 9", "capability", "glGetIntegerv()"), new GLproperty(3380, "GL_MAX_PIXEL_MAP_TABLE", "Maximum size of a glPixelMap() translation table", "capability", "glGetIntegerv()"), new GLproperty(3383, "GL_MAX_NAME_STACK_DEPTH", "Maximum selection-name stack depth", "capability", "glGetIntegerv()"), new GLproperty(2865, "GL_MAX_LIST_NESTING", "Maximum display-list call nesting", "capability", "glGetIntegerv()"), new GLproperty(3376, "GL_MAX_EVAL_ORDER", "Maximum evaluator polynomial order", "capability", "glGetIntegerv()"), new GLproperty(3386, "GL_MAX_VIEWPORT_DIMS", "Maximum viewport dimensions", "capability", "glGetIntegerv()"), new GLproperty(3381, "GL_MAX_ATTRIB_STACK_DEPTH", "Maximum depth of the attribute stack", "capability", "glGetIntegerv()"), new GLproperty(3387, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", "Maximum depth of the client attribute stack", "capability", "glGetIntegerv()"), new GLproperty(3072, "GL_AUX_BUFFERS", "Number of auxiliary buffers", "capability", "glGetBooleanv()"), new GLproperty(3121, "GL_RGBA_MODE", "True if color buffers store RGBA", "capability", "glGetBooleanv()"), new GLproperty(3120, "GL_INDEX_MODE", "True if color buffers store indices", "capability", "glGetBooleanv()"), new GLproperty(3122, "GL_DOUBLEBUFFER", "True if front and back buffers exist", "capability", "glGetBooleanv()"), new GLproperty(3123, "GL_STEREO", "True if left and right buffers exist", "capability", "glGetBooleanv()"), new GLproperty(2834, "GL_POINT_SIZE_RANGE", "Range (low to high) of antialiased point sizes", "capability", "glGetFloatv()"), new GLproperty(2835, "GL_POINT_SIZE_GRANULARITY", "Antialiased point-size granularity", "capability", "glGetFloatv()"), new GLproperty(2850, "GL_LINE_WIDTH_RANGE", "Range (low to high) of antialiased line widths", "capability", "glGetFloatv()"), new GLproperty(2851, "GL_LINE_WIDTH_GRANULARITY", "Antialiased line-width granularity", "capability", "glGetFloatv()"), new GLproperty(3410, "GL_RED_BITS", "Number of bits per red component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3411, "GL_GREEN_BITS", "Number of bits per green component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3412, "GL_BLUE_BITS", "Number of bits per blue component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3413, "GL_ALPHA_BITS", "Number of bits per alpha component in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3409, "GL_INDEX_BITS", "Number of bits per index in color buffers", "capability", "glGetIntegerv()"), new GLproperty(3414, "GL_DEPTH_BITS", "Number of depth-buffer bitplanes", "capability", "glGetIntegerv()"), new GLproperty(3415, "GL_STENCIL_BITS", "Number of stencil bitplanes", "capability", "glGetIntegerv()"), new GLproperty(3416, "GL_ACCUM_RED_BITS", "Number of bits per red component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3417, "GL_ACCUM_GREEN_BITS", "Number of bits per green component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3418, "GL_ACCUM_BLUE_BITS", "Number of bits per blue component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(3419, "GL_ACCUM_ALPHA_BITS", "Number of bits per alpha component in the accumulation buffer", "capability", "glGetIntegerv()"), new GLproperty(2866, "GL_LIST_BASE", "Setting of glListBase()", "list", "glGetIntegerv()"), new GLproperty(2867, "GL_LIST_INDEX", "Number of display list under construction; 0 if none", "current", "glGetIntegerv()"), new GLproperty(2864, "GL_LIST_MODE", "Mode of display list under construction; undefined if none", "current", "glGetIntegerv()"), new GLproperty(2992, "GL_ATTRIB_STACK_DEPTH", "Attribute stack pointer", "current", "glGetIntegerv()"), new GLproperty(2993, "GL_CLIENT_ATTRIB_STACK_DEPTH", "Client attribute stack pointer", "current", "glGetIntegerv()"), new GLproperty(3440, "GL_NAME_STACK_DEPTH", "Name stack depth", "current", "glGetIntegerv()"), new GLproperty(3136, "GL_RENDER_MODE", "glRenderMode() setting", "current", "glGetIntegerv()"), new GLproperty(3571, "GL_SELECTION_BUFFER_POINTER", "Pointer to selection buffer", "select", "glGetPointerv()"), new GLproperty(3572, "GL_SELECTION_BUFFER_SIZE", "Size of selection buffer", "select", "glGetIntegerv()"), new GLproperty(3568, "GL_FEEDBACK_BUFFER_POINTER", "Pointer to feedback buffer", "feedback", "glGetPointerv()"), new GLproperty(3569, "GL_FEEDBACK_BUFFER_SIZE", "Size of feedback buffer", "feedback", "glGetIntegerv()"), new GLproperty(3570, "GL_FEEDBACK_BUFFER_TYPE", "Type of feedback buffer", "feedback", "glGetIntegerv()")}; public static String dumpOpenGLstate() { @@ -26,10 +27,10 @@ public static String dumpOpenGLstate() for (int i = 0; i < instance.propertyList.length; ++i) { - stringbuilder.append(instance.propertyList[i].name + ":"); - stringbuilder.append(GL11.glIsEnabled(instance.propertyList[i].gLconstant) + ":"); + stringbuilder.append(instance.propertyList[i].name).append(":"); + stringbuilder.append(GL11C.glIsEnabled(instance.propertyList[i].gLconstant)).append(":"); stringbuilder.append(getPropertyAsString(i)); - stringbuilder.append(" (" + instance.propertyList[i].description + ")\n"); + stringbuilder.append(" (").append(instance.propertyList[i].description).append(")\n"); } return stringbuilder.toString(); @@ -65,11 +66,11 @@ public static String dumpAllIsEnabled() for (int i = 0; i < instance.propertyList.length; ++i) { - if (instance.propertyList[i].fetchCommand == "glIsEnabled()") + if ("glIsEnabled()".equals(instance.propertyList[i].fetchCommand)) { - stringbuilder.append(instance.propertyList[i].name + ":"); - stringbuilder.append(GL11.glIsEnabled(instance.propertyList[i].gLconstant)); - stringbuilder.append(" (" + instance.propertyList[i].description + ")\n"); + stringbuilder.append(instance.propertyList[i].name).append(":"); + stringbuilder.append(GL11C.glIsEnabled(instance.propertyList[i].gLconstant)); + stringbuilder.append(" (").append(instance.propertyList[i].description).append(")\n"); } } @@ -108,9 +109,9 @@ public static String dumpAllType(String type) { if (instance.propertyList[i].category.equals(type)) { - stringbuilder.append(instance.propertyList[i].name + ":"); + stringbuilder.append(instance.propertyList[i].name).append(":"); stringbuilder.append(getPropertyAsString(i)); - stringbuilder.append(" (" + instance.propertyList[i].description + ")\n"); + stringbuilder.append(" (").append(instance.propertyList[i].description).append(")\n"); } } @@ -145,56 +146,40 @@ private static String getPropertyAsString(int propertyListIndex) { int i = instance.propertyList[propertyListIndex].gLconstant; - if (instance.propertyList[propertyListIndex].fetchCommand.equals("glIsEnabled()")) - { - return "" + GL11.glIsEnabled(i); - } - else if (instance.propertyList[propertyListIndex].fetchCommand == "glGetBooleanv()") - { - ByteBuffer bytebuffer = BufferUtils.createByteBuffer(16); - GL11.glGetBooleanv(i, bytebuffer); - String s2 = ""; - - for (int l = 0; l < bytebuffer.capacity(); ++l) - { - s2 = s2 + (l == 0 ? "" : ", ") + bytebuffer.get(l); + return switch (instance.propertyList[propertyListIndex].fetchCommand) { + case "glIsEnabled()" -> String.valueOf(GL11C.glIsEnabled(i)); + case "glGetBooleanv()" -> { + ByteBuffer bytebuffer = BufferUtils.createByteBuffer(16); + GL11C.glGetBooleanv(i, bytebuffer); + String s2 = ""; + for (int l = 0; l < bytebuffer.capacity(); ++l) { + s2 = s2 + (l == 0 ? "" : ", ") + bytebuffer.get(l); + } + yield s2; } - - return s2; - } - else if (instance.propertyList[propertyListIndex].fetchCommand == "glGetIntegerv()") - { - IntBuffer intbuffer = BufferUtils.createIntBuffer(16); - GL11.glGetIntegerv(i, intbuffer); - String s1 = ""; - - for (int k = 0; k < intbuffer.capacity(); ++k) - { - s1 = s1 + (k == 0 ? "" : ", ") + intbuffer.get(k); + case "glGetIntegerv()" -> { + IntBuffer intbuffer = BufferUtils.createIntBuffer(16); + GL11C.glGetIntegerv(i, intbuffer); + String s1 = ""; + for (int k = 0; k < intbuffer.capacity(); ++k) { + s1 = s1 + (k == 0 ? "" : ", ") + intbuffer.get(k); + } + yield s1; } - - return s1; - } - else if (instance.propertyList[propertyListIndex].fetchCommand == "glGetFloatv()") - { - FloatBuffer floatbuffer = BufferUtils.createFloatBuffer(16); - GL11.glGetFloatv(i, floatbuffer); - String s = ""; - - for (int j = 0; j < floatbuffer.capacity(); ++j) - { - s = s + (j == 0 ? "" : ", ") + floatbuffer.get(j); + case "glGetFloatv()" -> { + FloatBuffer floatbuffer = BufferUtils.createFloatBuffer(16); + GL11C.glGetFloatv(i, floatbuffer); + String s = ""; + for (int j = 0; j < floatbuffer.capacity(); ++j) { + s = s + (j == 0 ? "" : ", ") + floatbuffer.get(j); + } + yield s; } - - return s; - } - else - { - return ""; - } + default -> ""; + }; } - public class GLproperty + public static class GLproperty { public int gLconstant; public String name; diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java index c89b7e935..c78555ba9 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java @@ -1,7 +1,11 @@ package org.vivecraft.client.render; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.VRPlayersClient.RotInfo; + import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; @@ -11,13 +15,14 @@ import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import org.vivecraft.client.VRPlayersClient; + +import static org.joml.Math.*; public class VRPlayerModel extends PlayerModel { private final boolean slim; public ModelPart vrHMD; - VRPlayersClient.RotInfo rotInfo; + RotInfo rotInfo; private boolean laying; public VRPlayerModel(ModelPart modelPart, boolean isSlim) @@ -27,58 +32,58 @@ public VRPlayerModel(ModelPart modelPart, boolean isSlim) this.vrHMD = modelPart.getChild("vrHMD"); } - public static MeshDefinition createMesh(CubeDeformation p_170826_, boolean p_170827_) + public static MeshDefinition createMesh(CubeDeformation cubeDeformation, boolean slim) { - MeshDefinition meshdefinition = PlayerModel.createMesh(p_170826_, p_170827_); - PartDefinition partdefinition = meshdefinition.getRoot(); - partdefinition.addOrReplaceChild("vrHMD", CubeListBuilder.create().texOffs(0, 0).addBox(-3.5F, -6.0F, -7.5F, 7.0F, 4.0F, 5.0F, p_170826_), PartPose.ZERO); - return meshdefinition; + MeshDefinition meshdefinition = PlayerModel.createMesh(cubeDeformation, slim); + PartDefinition partdefinition = meshdefinition.getRoot(); + partdefinition.addOrReplaceChild("vrHMD", CubeListBuilder.create().texOffs(0, 0).addBox(-3.5F, -6.0F, -7.5F, 7.0F, 4.0F, 5.0F, cubeDeformation), PartPose.ZERO); + return meshdefinition; } public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { - super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); - this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); - VRPlayersClient.RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); + super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); + this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); + RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); - if (rotinfo == null) return; //how + if (rotinfo == null) return; //how - double d0 = (double)(-1.501F * rotinfo.heightScale); - float f = (float)Math.toRadians((double)pEntity.getYRot()); - float f1 = (float)Math.atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); - float f2 = (float)Math.asin(rotinfo.headRot.y / rotinfo.headRot.length()); - double d1 = rotinfo.getBodyYawRadians(); - this.head.xRot = -f2; - this.head.yRot = (float)(Math.PI - (double)f1 - d1); - this.laying = this.swimAmount > 0.0F || pEntity.isFallFlying() && !pEntity.isAutoSpinAttack(); + double d0 = -1.501F * rotinfo.heightScale; + float f = toRadians(pEntity.getYRot()); + float f1 = (float)atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); + float f2 = (float)asin(rotinfo.headRot.y / rotinfo.headRot.length()); + double d1 = rotinfo.getBodyYawRadians(); + this.head.xRot = -f2; + this.head.yRot = (float)(PI - (double)f1 - d1); + this.laying = this.swimAmount > 0.0F || pEntity.isFallFlying() && !pEntity.isAutoSpinAttack(); - if (this.laying) - { - this.head.z = 0.0F; - this.head.x = 0.0F; - this.head.y = -4.0F; - this.head.xRot = (float)((double)this.head.xRot - (Math.PI / 2D)); - } else if (this.crouching) { - // move head down when crouching - this.head.z = 0.0F; - this.head.x = 0.0F; - this.head.y = 4.2f; - } - else - { - this.head.z = 0.0F; - this.head.x = 0.0F; - this.head.y = 0.0F; - } + if (this.laying) + { + this.head.z = 0.0F; + this.head.x = 0.0F; + this.head.y = -4.0F; + this.head.xRot = (float)(this.head.xRot - (PI / 2.0D)); + } else if (this.crouching) { + // move head down when crouching + this.head.z = 0.0F; + this.head.x = 0.0F; + this.head.y = 4.2F; + } + else + { + this.head.z = 0.0F; + this.head.x = 0.0F; + this.head.y = 0.0F; + } - this.vrHMD.visible = true; + this.vrHMD.visible = true; - this.vrHMD.copyFrom(this.head); + this.vrHMD.copyFrom(this.head); this.hat.copyFrom(this.head); } - public void renderHMDR(PoseStack poseStack, VertexConsumer vertexConsumer, int i, int noOverlay) { - this.vrHMD.render(poseStack, vertexConsumer, i, noOverlay); - } + public void renderHMDR(PoseStack poseStack, VertexConsumer vertexConsumer, int i, int noOverlay) { + this.vrHMD.render(poseStack, vertexConsumer, i, noOverlay); + } } diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java index 2a1d91176..de180cb9b 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java @@ -1,10 +1,15 @@ package org.vivecraft.client.render; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.VRPlayersClient.RotInfo; +import org.vivecraft.client.Xplat; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; +import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; + import com.google.common.collect.ImmutableList; + import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Axis; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.ModelPart.Polygon; import net.minecraft.client.model.geom.ModelPart.Vertex; @@ -13,249 +18,246 @@ import net.minecraft.client.model.geom.builders.CubeListBuilder; import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; -import net.minecraft.util.Mth; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; -import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; -import org.vivecraft.client.Xplat; + +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; public class VRPlayerModel_WithArms extends VRPlayerModel { - private final boolean slim; - public ModelPart leftShoulder; - public ModelPart rightShoulder; - public ModelPart leftShoulder_sleeve; - public ModelPart rightShoulder_sleeve; - public ModelPart leftHand; - public ModelPart rightHand; - VRPlayersClient.RotInfo rotInfo; - private boolean laying; - - public VRPlayerModel_WithArms(ModelPart modelPart, boolean isSlim) - { - super(modelPart, isSlim); - this.slim = isSlim; - // use left/right arm as shoulders - this.leftShoulder = modelPart.getChild("left_arm"); - this.rightShoulder = modelPart.getChild("right_arm"); - this.leftShoulder_sleeve = modelPart.getChild("leftShoulder_sleeve"); - this.rightShoulder_sleeve = modelPart.getChild("rightShoulder_sleeve"); - this.rightHand = modelPart.getChild("rightHand"); - this.leftHand = modelPart.getChild("leftHand"); - - - //finger hax - // some mods remove the base parts - if (!leftShoulder.cubes.isEmpty()) { - copyUV(leftShoulder.cubes.get(0).polygons[1], leftHand.cubes.get(0).polygons[1]); - copyUV(leftShoulder.cubes.get(0).polygons[1], leftHand.cubes.get(0).polygons[0]); - } - if (!rightShoulder.cubes.isEmpty()) { - copyUV(rightShoulder.cubes.get(0).polygons[1], this.rightHand.cubes.get(0).polygons[1]); - copyUV(rightShoulder.cubes.get(0).polygons[1], this.rightHand.cubes.get(0).polygons[0]); - } - - if (!rightSleeve.cubes.isEmpty()) { - copyUV(rightShoulder_sleeve.cubes.get(0).polygons[1], this.rightSleeve.cubes.get(0).polygons[1]); - copyUV(rightShoulder_sleeve.cubes.get(0).polygons[1], this.rightSleeve.cubes.get(0).polygons[0]); - } - if (!leftSleeve.cubes.isEmpty()) { - copyUV(leftShoulder_sleeve.cubes.get(0).polygons[1], leftSleeve.cubes.get(0).polygons[1]); - copyUV(leftShoulder_sleeve.cubes.get(0).polygons[1], leftSleeve.cubes.get(0).polygons[0]); - } - } - - private void copyUV(Polygon source, Polygon dest) { - for (int i = 0; i < source.vertices.length; i++) { - dest.vertices[i] = new Vertex(dest.vertices[i].pos, source.vertices[i].u, source.vertices[i].v); - if (OptifineHelper.isOptifineLoaded()) { - OptifineHelper.copyRenderPositions(source.vertices[i], dest.vertices[i]); - } - } - } - - public static MeshDefinition createMesh(CubeDeformation p_170826_, boolean p_170827_) - { - MeshDefinition meshdefinition = VRPlayerModel.createMesh(p_170826_, p_170827_); - PartDefinition partdefinition = meshdefinition.getRoot(); - - if(p_170827_) { - partdefinition.addOrReplaceChild("leftHand", CubeListBuilder.create().texOffs(32, 55).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 55).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("rightHand", CubeListBuilder.create().texOffs(40, 23).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 39).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("leftShoulder_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("rightShoulder_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(-5.0F, 2.5F, 0.0F)); - }else { - partdefinition.addOrReplaceChild("leftHand", CubeListBuilder.create().texOffs(32, 55).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 55).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("rightHand", CubeListBuilder.create().texOffs(40, 23).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 39).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("leftShoulder_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(5.0F, 2.5F, 0.0F)); - partdefinition.addOrReplaceChild("rightShoulder_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25f)), PartPose.offset(-5.0F, 2.5F, 0.0F)); - - } - return meshdefinition; - } - - - protected Iterable bodyParts() - { + private final boolean slim; + public ModelPart leftShoulder; + public ModelPart rightShoulder; + public ModelPart leftShoulder_sleeve; + public ModelPart rightShoulder_sleeve; + public ModelPart leftHand; + public ModelPart rightHand; + RotInfo rotInfo; + private boolean laying; + + public VRPlayerModel_WithArms(ModelPart modelPart, boolean isSlim) + { + super(modelPart, isSlim); + this.slim = isSlim; + // use left/right arm as shoulders + this.leftShoulder = modelPart.getChild("left_arm"); + this.rightShoulder = modelPart.getChild("right_arm"); + this.leftShoulder_sleeve = modelPart.getChild("leftShoulder_sleeve"); + this.rightShoulder_sleeve = modelPart.getChild("rightShoulder_sleeve"); + this.rightHand = modelPart.getChild("rightHand"); + this.leftHand = modelPart.getChild("leftHand"); + + + //finger hax + // some mods remove the base parts + if (!leftShoulder.cubes.isEmpty()) { + copyUV(leftShoulder.cubes.get(0).polygons[1], leftHand.cubes.get(0).polygons[1]); + copyUV(leftShoulder.cubes.get(0).polygons[1], leftHand.cubes.get(0).polygons[0]); + } + if (!rightShoulder.cubes.isEmpty()) { + copyUV(rightShoulder.cubes.get(0).polygons[1], this.rightHand.cubes.get(0).polygons[1]); + copyUV(rightShoulder.cubes.get(0).polygons[1], this.rightHand.cubes.get(0).polygons[0]); + } + + if (!rightSleeve.cubes.isEmpty()) { + copyUV(rightShoulder_sleeve.cubes.get(0).polygons[1], this.rightSleeve.cubes.get(0).polygons[1]); + copyUV(rightShoulder_sleeve.cubes.get(0).polygons[1], this.rightSleeve.cubes.get(0).polygons[0]); + } + if (!leftSleeve.cubes.isEmpty()) { + copyUV(leftShoulder_sleeve.cubes.get(0).polygons[1], leftSleeve.cubes.get(0).polygons[1]); + copyUV(leftShoulder_sleeve.cubes.get(0).polygons[1], leftSleeve.cubes.get(0).polygons[0]); + } + } + + private void copyUV(Polygon source, Polygon dest) { + for (int i = 0; i < source.vertices.length; i++) { + dest.vertices[i] = new Vertex(dest.vertices[i].pos, source.vertices[i].u, source.vertices[i].v); + if (OptifineHelper.isOptifineLoaded()) { + OptifineHelper.copyRenderPositions(source.vertices[i], dest.vertices[i]); + } + } + } + + public static MeshDefinition createMesh(CubeDeformation p_170826_, boolean p_170827_) + { + MeshDefinition meshdefinition = VRPlayerModel.createMesh(p_170826_, p_170827_); + PartDefinition partdefinition = meshdefinition.getRoot(); + + if(p_170827_) { + partdefinition.addOrReplaceChild("leftHand", CubeListBuilder.create().texOffs(32, 55).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 55).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("rightHand", CubeListBuilder.create().texOffs(40, 23).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 39).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("leftShoulder_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("rightShoulder_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 3.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(-5.0F, 2.5F, 0.0F)); + }else { + partdefinition.addOrReplaceChild("leftHand", CubeListBuilder.create().texOffs(32, 55).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("left_sleeve", CubeListBuilder.create().texOffs(48, 55).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("rightHand", CubeListBuilder.create().texOffs(40, 23).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("right_sleeve", CubeListBuilder.create().texOffs(40, 39).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_), PartPose.offset(-5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("leftShoulder_sleeve", CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(5.0F, 2.5F, 0.0F)); + partdefinition.addOrReplaceChild("rightShoulder_sleeve", CubeListBuilder.create().texOffs(40, 32).addBox(-2.0F, -2.0F, -2.0F, 4.0F, 5.0F, 4.0F, p_170826_.extend(0.25F)), PartPose.offset(-5.0F, 2.5F, 0.0F)); + + } + return meshdefinition; + } + + + protected Iterable bodyParts() + { return ImmutableList.of(this.body, this.leftHand, this.rightHand,this.leftShoulder, this.rightShoulder,this.leftShoulder_sleeve, this.rightShoulder_sleeve, this.rightLeg, this.leftLeg, this.hat, this.leftPants, this.rightPants, this.leftSleeve, this.rightSleeve, this.jacket); - } - - public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) - { - super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); - this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); - VRPlayersClient.RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); - - if (rotinfo == null) return; - - double d0 = (double)(-1.501F * rotinfo.heightScale); - float f = (float)Math.toRadians((double)pEntity.getYRot()); - float f1 = (float)Math.atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); - float f2 = (float)Math.asin(rotinfo.headRot.y / rotinfo.headRot.length()); - float f3 = (float)Math.atan2(-rotinfo.leftArmRot.x, -rotinfo.leftArmRot.z); - float f4 = (float)Math.asin(rotinfo.leftArmRot.y / rotinfo.leftArmRot.length()); - float f5 = (float)Math.atan2(-rotinfo.rightArmRot.x, -rotinfo.rightArmRot.z); - float f6 = (float)Math.asin(rotinfo.rightArmRot.y / rotinfo.rightArmRot.length()); - double d1 = rotinfo.getBodyYawRadians(); - - this.laying = this.swimAmount > 0.0F || pEntity.isFallFlying() && !pEntity.isAutoSpinAttack(); - - if (!rotinfo.reverse) - { - this.rightShoulder.setPos(-Mth.cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, Mth.sin(this.body.yRot) * 5.0F); - this.leftShoulder.setPos(Mth.cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, -Mth.sin(this.body.yRot) * 5.0F); - } - else - { - this.leftShoulder.setPos(-Mth.cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, Mth.sin(this.body.yRot) * 5.0F); - this.rightShoulder.setPos(Mth.cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, -Mth.sin(this.body.yRot) * 5.0F); - } - - if (this.crouching) - { - this.rightShoulder.y += 3.2F; - this.leftShoulder.y += 3.2F; - } - - Vec3 vec3 = rotinfo.leftArmPos; - Vec3 vec32 = rotinfo.rightArmPos; - if (Xplat.isModLoaded("pehkui")){ - // remove pehkui scale from that, since the whole entity is scaled - vec3 = vec3.scale(1.0F / PehkuiHelper.getPlayerScale(pEntity, Minecraft.getInstance().getFrameTime())); - vec32 = vec32.scale(1.0F / PehkuiHelper.getPlayerScale(pEntity, Minecraft.getInstance().getFrameTime())); - } + } + + public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) + { + super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); + this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); + RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player)pEntity).getUUID()); + + if (rotinfo == null) return; + + double d0 = -1.501F * rotinfo.heightScale; + float f = toRadians(pEntity.getYRot()); + float f1 = (float)atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); + float f2 = (float)asin(rotinfo.headRot.y / rotinfo.headRot.length()); + float f3 = (float)atan2(-rotinfo.leftArmRot.x, -rotinfo.leftArmRot.z); + float f4 = (float)asin(rotinfo.leftArmRot.y / rotinfo.leftArmRot.length()); + float f5 = (float)atan2(-rotinfo.rightArmRot.x, -rotinfo.rightArmRot.z); + float f6 = (float)asin(rotinfo.rightArmRot.y / rotinfo.rightArmRot.length()); + double d1 = rotinfo.getBodyYawRadians(); + + this.laying = this.swimAmount > 0.0F || pEntity.isFallFlying() && !pEntity.isAutoSpinAttack(); + + if (!rotinfo.reverse) + { + this.rightShoulder.setPos(-cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, sin(this.body.yRot) * 5.0F); + this.leftShoulder.setPos(cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, -sin(this.body.yRot) * 5.0F); + } + else + { + this.leftShoulder.setPos(-cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, sin(this.body.yRot) * 5.0F); + this.rightShoulder.setPos(cos(this.body.yRot) * 5.0F, this.slim ? 2.5F : 2.0F, -sin(this.body.yRot) * 5.0F); + } + + if (this.crouching) + { + this.rightShoulder.y += 3.2F; + this.leftShoulder.y += 3.2F; + } + + Vec3 vec3 = rotinfo.leftArmPos; + Vec3 vec32 = rotinfo.rightArmPos; + if (Xplat.isModLoaded("pehkui")){ + // remove pehkui scale from that, since the whole entity is scaled + vec3 = vec3.scale(1.0F / PehkuiHelper.getPlayerScale(pEntity, mc.getFrameTime())); + vec32 = vec32.scale(1.0F / PehkuiHelper.getPlayerScale(pEntity, mc.getFrameTime())); + } vec3 = vec3.add(0.0D, d0, 0.0D); - vec3 = vec3.yRot((float)(-Math.PI + d1)); + vec3 = vec3.yRot((float)(-PI + d1)); vec3 = vec3.scale((double)(16.0F / rotinfo.heightScale)); - this.leftHand.setPos((float)(-vec3.x), (float)(-vec3.y), (float)vec3.z); - this.leftHand.xRot = (float)((double)(-f4) + (Math.PI * 1.5D)); - this.leftHand.yRot = (float)(Math.PI - (double)f3 - d1); - this.leftHand.zRot = 0.0F; + this.leftHand.setPos((float)(-vec3.x), (float)(-vec3.y), (float)vec3.z); + this.leftHand.xRot = (float)((-f4) + (PI * 1.5D)); + this.leftHand.yRot = (float)(PI - f3 - d1); + this.leftHand.zRot = 0.0F; Vec3 vec31 = new Vec3((double)this.leftShoulder.x + vec3.x, (double)this.leftShoulder.y + vec3.y, (double)this.leftShoulder.z - vec3.z); - float f7 = (float)Math.atan2(vec31.x, vec31.z); - float f8 = (float)((Math.PI * 1.5D) - Math.asin(vec31.y / vec31.length())); - this.leftShoulder.zRot = 0.0F; - this.leftShoulder.xRot = f8; - this.leftShoulder.yRot = f7; - - if (this.leftShoulder.yRot > 0.0F) - { - this.leftShoulder.yRot = 0.0F; - } - - switch (this.leftArmPose) - { - case THROW_SPEAR: - this.leftHand.xRot = (float)((double)this.leftHand.xRot - (Math.PI / 2D)); - default: - } - - vec32 = vec32.add(0.0D, d0, 0.0D); - vec32 = vec32.yRot((float)(-Math.PI + d1)); + float f7 = (float)atan2(vec31.x, vec31.z); + float f8 = (float)((PI * 1.5D) - asin(vec31.y / vec31.length())); + this.leftShoulder.zRot = 0.0F; + this.leftShoulder.xRot = f8; + this.leftShoulder.yRot = f7; + + if (this.leftShoulder.yRot > 0.0F) + { + this.leftShoulder.yRot = 0.0F; + } + + if (this.leftArmPose == ArmPose.THROW_SPEAR) + { + this.leftHand.xRot = (float) (this.leftHand.xRot - (PI / 2.0D)); + } + + vec32 = vec32.add(0.0D, d0, 0.0D); + vec32 = vec32.yRot((float)(-PI + d1)); vec32 = vec32.scale((double)(16.0F / rotinfo.heightScale)); - this.rightHand.setPos((float)(-vec32.x), -((float)vec32.y), (float)vec32.z); - this.rightHand.xRot = (float)((double)(-f6) + (Math.PI * 1.5D)); - this.rightHand.yRot = (float)(Math.PI - (double)f5 - d1); - this.rightHand.zRot = 0.0F; + this.rightHand.setPos((float)(-vec32.x), -((float)vec32.y), (float)vec32.z); + this.rightHand.xRot = (float)((-f6) + (PI * 1.5D)); + this.rightHand.yRot = (float)(PI - f5 - d1); + this.rightHand.zRot = 0.0F; Vec3 vec33 = new Vec3((double)this.rightShoulder.x + vec32.x, (double)this.rightShoulder.y + vec32.y, (double)this.rightShoulder.z - vec32.z); - float f9 = (float)Math.atan2(vec33.x, vec33.z); - float f10 = (float)((Math.PI * 1.5D) - Math.asin(vec33.y / vec33.length())); - this.rightShoulder.zRot = 0.0F; - this.rightShoulder.xRot = f10; - this.rightShoulder.yRot = f9; - - if (this.rightShoulder.yRot < 0.0F) - { - this.rightShoulder.yRot = 0.0F; - } - - switch (this.rightArmPose) - { - case THROW_SPEAR: - this.rightHand.xRot = (float)((double)this.rightHand.xRot - (Math.PI / 2D)); - default: - } - - if (this.laying) - { - this.rightShoulder.xRot = (float)((double)this.rightShoulder.xRot - (Math.PI / 2D)); - this.leftShoulder.xRot = (float)((double)this.leftShoulder.xRot - (Math.PI / 2D)); - } - - this.leftSleeve.copyFrom(this.leftHand); - this.rightSleeve.copyFrom(this.rightHand); - this.leftShoulder_sleeve.copyFrom(this.leftShoulder); - this.rightShoulder_sleeve.copyFrom(this.rightShoulder); - this.leftShoulder_sleeve.visible = this.leftSleeve.visible; - this.rightShoulder_sleeve.visible = this.rightSleeve.visible; - } - - public void setAllVisible(boolean pVisible) - { - super.setAllVisible(pVisible); - - this.rightShoulder.visible = pVisible; - this.leftShoulder.visible = pVisible; - this.rightShoulder_sleeve.visible = pVisible; - this.leftShoulder_sleeve.visible = pVisible; - this.rightHand.visible = pVisible; - this.leftHand.visible = pVisible; - - } - - protected ModelPart getArm(HumanoidArm pSide) - { - return pSide == HumanoidArm.LEFT ? this.leftHand : this.rightHand; - } - - public void translateToHand(HumanoidArm pSide, PoseStack pMatrixStack) - { - ModelPart modelpart = this.getArm(pSide); - - if (this.laying) - { - pMatrixStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); - } - - modelpart.translateAndRotate(pMatrixStack); - pMatrixStack.mulPose(Axis.XP.rotation((float)Math.sin((double)this.attackTime * Math.PI))); - pMatrixStack.translate(0.0D, -0.5D, 0.0D); - } + float f9 = (float)atan2(vec33.x, vec33.z); + float f10 = (float)((PI * 1.5D) - asin(vec33.y / vec33.length())); + this.rightShoulder.zRot = 0.0F; + this.rightShoulder.xRot = f10; + this.rightShoulder.yRot = f9; + + if (this.rightShoulder.yRot < 0.0F) + { + this.rightShoulder.yRot = 0.0F; + } + + if (this.rightArmPose == ArmPose.THROW_SPEAR) { + this.rightHand.xRot = (float) (this.rightHand.xRot - (PI / 2.0D)); + } + + if (this.laying) + { + this.rightShoulder.xRot = (float)(this.rightShoulder.xRot - (PI / 2.0D)); + this.leftShoulder.xRot = (float)(this.leftShoulder.xRot - (PI / 2.0D)); + } + + this.leftSleeve.copyFrom(this.leftHand); + this.rightSleeve.copyFrom(this.rightHand); + this.leftShoulder_sleeve.copyFrom(this.leftShoulder); + this.rightShoulder_sleeve.copyFrom(this.rightShoulder); + this.leftShoulder_sleeve.visible = this.leftSleeve.visible; + this.rightShoulder_sleeve.visible = this.rightSleeve.visible; + } + + public void setAllVisible(boolean pVisible) + { + super.setAllVisible(pVisible); + + this.rightShoulder.visible = pVisible; + this.leftShoulder.visible = pVisible; + this.rightShoulder_sleeve.visible = pVisible; + this.leftShoulder_sleeve.visible = pVisible; + this.rightHand.visible = pVisible; + this.leftHand.visible = pVisible; + + } + + protected ModelPart getArm(HumanoidArm pSide) + { + return pSide == HumanoidArm.LEFT ? this.leftHand : this.rightHand; + } + + public void translateToHand(HumanoidArm pSide, PoseStack pMatrixStack) + { + ModelPart modelpart = this.getArm(pSide); + + if (this.laying) + { + float ang = toRadians(-90.0F); + pMatrixStack.last().pose().rotateX(ang); + pMatrixStack.last().normal().rotateX(ang); + } + + modelpart.translateAndRotate(pMatrixStack); + float ang = sin((float) PI * this.attackTime); + pMatrixStack.last().normal().rotateX(ang); + pMatrixStack.last().pose().rotateX(ang).translate(0.0F, -0.5F, 0.0F); + } // public void renderToBuffer(PoseStack pMatrixStack, VertexConsumer pBuffer, int pPackedLight, int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) // { @@ -282,7 +284,9 @@ public void translateToHand(HumanoidArm pSide, PoseStack pMatrixStack) // // if (this.laying) // { -// pMatrixStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); +// float ang = toRadians(-90.0F); +// pMatrixStack.last().pose().rotateX(ang); +// pMatrixStack.last().normal().rotateX(ang); // } // // this.rightHand.render(pMatrixStack, pBuffer, pPackedLight, pPackedOverlay, pRed, pGreen, pBlue, pAlpha); diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerRenderer.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerRenderer.java index 0e227038c..c01d9c290 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerRenderer.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerRenderer.java @@ -1,37 +1,39 @@ package org.vivecraft.client.render; -import java.util.UUID; - -import net.minecraft.client.Minecraft; import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.client_vr.ClientDataHolderVR; +import org.vivecraft.client.VRPlayersClient.RotInfo; +import org.vivecraft.client_vr.render.RenderPass; + import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.geom.builders.CubeDeformation; import net.minecraft.client.model.geom.builders.LayerDefinition; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.render.RenderPass; -public class VRPlayerRenderer extends PlayerRenderer +import java.util.UUID; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + +import static net.minecraft.client.renderer.entity.EntityRendererProvider.Context; + +public class VRPlayerRenderer extends net.minecraft.client.renderer.entity.player.PlayerRenderer { - static LayerDefinition VRLayerDef = LayerDefinition.create(VRPlayerModel.createMesh(CubeDeformation.NONE, false), 64, 64); - static LayerDefinition VRLayerDef_arms = LayerDefinition.create(VRPlayerModel_WithArms.createMesh(CubeDeformation.NONE, false), 64, 64); + static LayerDefinition VRLayerDef = LayerDefinition.create(VRPlayerModel.createMesh(CubeDeformation.NONE, false), 64, 64); + static LayerDefinition VRLayerDef_arms = LayerDefinition.create(VRPlayerModel_WithArms.createMesh(CubeDeformation.NONE, false), 64, 64); static LayerDefinition VRLayerDef_slim = LayerDefinition.create(VRPlayerModel.createMesh(CubeDeformation.NONE, true), 64, 64); - static LayerDefinition VRLayerDef_arms_slim = LayerDefinition.create(VRPlayerModel_WithArms.createMesh(CubeDeformation.NONE, true), 64, 64); - - public VRPlayerRenderer(EntityRendererProvider.Context context, boolean slim, boolean seated) { - super(context, slim); - model = !slim ? - (seated ? - new VRPlayerModel<>(VRLayerDef.bakeRoot(), slim) : - new VRPlayerModel_WithArms<>(VRLayerDef_arms.bakeRoot(), slim)) : - (seated ? - new VRPlayerModel<>(VRLayerDef_slim.bakeRoot(), slim) : - new VRPlayerModel_WithArms<>(VRLayerDef_arms_slim.bakeRoot(), slim)); + static LayerDefinition VRLayerDef_arms_slim = LayerDefinition.create(VRPlayerModel_WithArms.createMesh(CubeDeformation.NONE, true), 64, 64); + + public VRPlayerRenderer(Context context, boolean slim, boolean seated) { + super(context, slim); + this.model = (seated ? + new VRPlayerModel<>(slim ? VRLayerDef_slim.bakeRoot() : VRLayerDef.bakeRoot(), slim) : + new VRPlayerModel_WithArms<>(slim ? VRLayerDef_arms_slim.bakeRoot() : VRLayerDef_arms.bakeRoot(), slim) + ); this.addLayer(new HMDLayer(this)); } @@ -40,7 +42,7 @@ public VRPlayerRenderer(EntityRendererProvider.Context context, boolean slim, bo public void render(AbstractClientPlayer entityIn, float pEntityYaw, float pPartialTicks, PoseStack matrixStackIn, MultiBufferSource pBuffer, int pPackedLight) { - VRPlayersClient.RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(entityIn.getUUID()); + RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(entityIn.getUUID()); if (playermodelcontroller$rotinfo != null) { @@ -53,7 +55,7 @@ public void render(AbstractClientPlayer entityIn, float pEntityYaw, float pParti @Override public Vec3 getRenderOffset(AbstractClientPlayer pEntity, float pPartialTicks) { - //idk why we do this anymore + //idk why we do this anymore return pEntity.isVisuallySwimming() ? new Vec3(0.0D, -0.125D, 0.0D) : Vec3.ZERO; // return pEntity.isCrouching() ? new Vec3(0.0D, -0.125D, 0.0D) : super.getRenderOffset(pEntity, pPartialTicks); } @@ -65,7 +67,7 @@ public void setModelProperties(AbstractClientPlayer pClientPlayer) this.getModel().crouching &= !pClientPlayer.isVisuallySwimming(); - if (pClientPlayer == Minecraft.getInstance().player && this.getModel() instanceof VRPlayerModel_WithArms armsModel && ClientDataHolderVR.getInstance().currentPass == RenderPass.CAMERA && ClientDataHolderVR.getInstance().cameraTracker.isQuickMode() && ClientDataHolderVR.getInstance().grabScreenShot) { + if (pClientPlayer == mc.player && this.getModel() instanceof VRPlayerModel_WithArms armsModel && dh.currentPass == RenderPass.CAMERA && dh.cameraTracker.isQuickMode() && dh.grabScreenShot) { // player hands block the camera, so disable them for the screenshot armsModel.leftHand.visible = false; armsModel.rightHand.visible = false; @@ -77,12 +79,12 @@ public void setModelProperties(AbstractClientPlayer pClientPlayer) @Override protected void setupRotations(AbstractClientPlayer pEntityLiving, PoseStack pMatrixStack, float pAgeInTicks, float pRotationYaw, float pPartialTicks) { - UUID uuid = pEntityLiving.getUUID(); - if (ClientDataHolderVR.getInstance().currentPass != RenderPass.GUI && VRPlayersClient.getInstance().isTracked(uuid)) - { - VRPlayersClient.RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(uuid); - pRotationYaw = (float)Math.toDegrees(playermodelcontroller$rotinfo.getBodyYawRadians()); - } + UUID uuid = pEntityLiving.getUUID(); + if (dh.currentPass != RenderPass.GUI && VRPlayersClient.getInstance().isTracked(uuid)) + { + RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(uuid); + pRotationYaw = (float)toDegrees(playermodelcontroller$rotinfo.getBodyYawRadians()); + } //vanilla below here super.setupRotations(pEntityLiving, pMatrixStack, pAgeInTicks, pRotationYaw, pPartialTicks); diff --git a/common/src/main/java/org/vivecraft/client/utils/Debug.java b/common/src/main/java/org/vivecraft/client/utils/Debug.java index 4953b1a45..961eb44c3 100644 --- a/common/src/main/java/org/vivecraft/client/utils/Debug.java +++ b/common/src/main/java/org/vivecraft/client/utils/Debug.java @@ -1,37 +1,44 @@ package org.vivecraft.client.utils; +import org.vivecraft.common.utils.color.Color; + +import org.joml.Quaternionf; +import org.joml.Vector3f; + import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; -import java.awt.Color; -import java.util.ArrayList; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.debug.DebugRenderer; -import net.minecraft.world.entity.player.Player; +import net.minecraft.client.renderer.debug.DebugRenderer.SimpleDebugRenderer; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; + +import java.util.ArrayList; + +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; + +import static java.lang.Math.pow; +import static org.joml.Math.*; public class Debug { Vec3 root; - Quaternion rotation; + Quaternionf rotation; public static boolean isEnabled = true; static Polygon cross = new Polygon(6); static Polygon arrowHead = new Polygon(8); - private static DebugRendererManual renderer = new DebugRendererManual(); + private static final DebugRendererManual renderer = new DebugRendererManual(); public Debug(Vec3 root) { this.root = root; - this.rotation = new Quaternion(); + this.rotation = new Quaternionf(); } - public Debug(Vec3 root, Quaternion rotation) + public Debug(Vec3 root, Quaternionf rotation) { this.root = root; this.rotation = rotation; @@ -39,7 +46,7 @@ public Debug(Vec3 root, Quaternion rotation) public void drawPoint(Vec3 point, Color color) { - point = this.rotation.multiply(point); + point = convertToVec3(this.rotation.transformUnit(convertToVector3f(point), new Vector3f())); Vec3 vec3 = this.root.add(point); Polygon debug$polygon = cross.offset(vec3); @@ -57,13 +64,19 @@ public void drawPoint(Vec3 point, Color color) public void drawVector(Vec3 start, Vec3 direction, Color color) { Polygon debug$polygon = new Polygon(2); - start = this.rotation.multiply(start); - direction = this.rotation.multiply(direction); + start = convertToVec3(this.rotation.transformUnit(convertToVector3f(start), new Vector3f())); + direction = convertToVec3(this.rotation.transformUnit(convertToVector3f(direction), new Vector3f())); debug$polygon.vertices[0] = this.root.add(start); debug$polygon.colors[0] = new Color(0, 0, 0, 0); debug$polygon.vertices[1] = this.root.add(start).add(direction); debug$polygon.colors[1] = color; - Quaternion quaternion = Quaternion.createFromToVector(new Vector3(0.0F, 1.0F, 0.0F), new Vector3(direction.normalize())); + // TODO JOML probably has functions for this + Vec3 from = convertToVec3(up); + Vec3 to = direction.normalize(); + float f = (float)(sqrt(pow(from.length(), 2.0D) * pow(to.length(), 2.0D)) + from.dot(to)); + Vec3 vector3 = from.cross(to); + Quaternionf quaternion = new Quaternionf((float)vector3.x, (float)vector3.y, (float)vector3.z, f).normalize(new Quaternionf()); + // Polygon debug$polygon1 = arrowHead.rotated(quaternion).offset(this.root.add(start).add(direction)); for (int i = 0; i < debug$polygon1.colors.length; ++i) @@ -80,8 +93,8 @@ public void drawVector(Vec3 start, Vec3 direction, Color color) public void drawLine(Vec3 start, Vec3 end, Color color) { - start = this.rotation.multiply(start); - end = this.rotation.multiply(end); + start = convertToVec3(this.rotation.transformUnit(convertToVector3f(start), new Vector3f())); + end = convertToVec3(this.rotation.transformUnit(convertToVector3f(end), new Vector3f())); Polygon debug$polygon = new Polygon(2); debug$polygon.vertices[0] = this.root.add(start); debug$polygon.colors[0] = new Color(0, 0, 0, 0); @@ -107,15 +120,15 @@ public void drawBoundingBox(AABB box, Color color) for (int j = 0; j < 4; ++j) { - avec3[j] = this.root.add(this.rotation.multiply(avec3[j])); - avec31[j] = this.root.add(this.rotation.multiply(avec31[j])); + avec3[j] = this.root.add(convertToVec3(this.rotation.transformUnit(convertToVector3f(avec3[j]), new Vector3f()))); + avec31[j] = this.root.add(convertToVec3(this.rotation.transformUnit(convertToVector3f(avec31[j]), new Vector3f()))); } for (int k = 0; k < 5; ++k) { if (k == 0) { - debug$polygon.colors[i] = new Color(0, 0, 0, 0); + debug$polygon.colors[i] = new Color(Color.OFF); } else { @@ -136,7 +149,7 @@ public void drawBoundingBox(AABB box, Color color) for (int i1 = 1; i1 < 4; ++i1) { debug$polygon.vertices[i] = avec3[i1]; - debug$polygon.colors[i] = new Color(0, 0, 0, 0); + debug$polygon.colors[i] = new Color(Color.OFF); ++i; debug$polygon.vertices[i] = avec31[i1]; debug$polygon.colors[i] = color; @@ -153,40 +166,39 @@ public static DebugRendererManual getRenderer() static { - cross.colors[0] = new Color(0, 0, 0, 0); + cross.colors[0] = new Color(Color.OFF); cross.vertices[0] = new Vec3(0.0D, -0.1D, 0.0D); cross.vertices[1] = new Vec3(0.0D, 0.1D, 0.0D); - cross.colors[2] = new Color(0, 0, 0, 0); + cross.colors[2] = new Color(Color.OFF); cross.vertices[2] = new Vec3(0.0D, 0.0D, -0.1D); cross.vertices[3] = new Vec3(0.0D, 0.0D, 0.1D); - cross.colors[4] = new Color(0, 0, 0, 0); + cross.colors[4] = new Color(Color.OFF); cross.vertices[4] = new Vec3(-0.1D, 0.0D, 0.0D); cross.vertices[5] = new Vec3(0.1D, 0.0D, 0.0D); - arrowHead.colors[0] = new Color(0, 0, 0, 0); + arrowHead.colors[0] = new Color(Color.OFF); arrowHead.vertices[0] = new Vec3(0.0D, 0.0D, 0.0D); arrowHead.vertices[1] = new Vec3(-0.05D, -0.05D, 0.0D); - arrowHead.colors[2] = new Color(0, 0, 0, 0); + arrowHead.colors[2] = new Color(Color.OFF); arrowHead.vertices[2] = new Vec3(0.0D, 0.0D, 0.0D); arrowHead.vertices[3] = new Vec3(0.05D, -0.05D, 0.0D); - arrowHead.colors[4] = new Color(0, 0, 0, 0); + arrowHead.colors[4] = new Color(Color.OFF); arrowHead.vertices[4] = new Vec3(0.0D, 0.0D, 0.0D); arrowHead.vertices[5] = new Vec3(0.0D, -0.05D, -0.05D); - arrowHead.colors[6] = new Color(0, 0, 0, 0); + arrowHead.colors[6] = new Color(Color.OFF); arrowHead.vertices[6] = new Vec3(0.0D, 0.0D, 0.0D); arrowHead.vertices[7] = new Vec3(0.0D, -0.05D, 0.05D); } - public static class DebugRendererManual implements DebugRenderer.SimpleDebugRenderer + public static class DebugRendererManual implements SimpleDebugRenderer { public boolean manualClearing = false; ArrayList toDraw = new ArrayList<>(); public void render(float partialTicks, long finishTimeNano) { - Player player = Minecraft.getInstance().player; - double d0 = player.xOld + (player.getX() - player.xOld) * (double)partialTicks; - double d1 = player.yOld + (player.getY() - player.yOld) * (double)partialTicks; - double d2 = player.zOld + (player.getZ() - player.zOld) * (double)partialTicks; + double d0 = mc.player.xOld + (mc.player.getX() - mc.player.xOld) * (double)partialTicks; + double d1 = mc.player.yOld + (mc.player.getY() - mc.player.yOld) * (double)partialTicks; + double d2 = mc.player.zOld + (mc.player.getZ() - mc.player.zOld) * (double)partialTicks; // GlStateManager.lineWidth(5.0F); //GlStateManager._disableLighting(); RenderSystem.depthMask(false); @@ -221,10 +233,10 @@ public void clear() void renderVertex(BufferBuilder buffer, Vec3 vert, Color color, double offX, double offY, double offZ) { - buffer.vertex(vert.x - offX, vert.y - offY, vert.z - offZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex(); + buffer.vertex(vert.x - offX, vert.y - offY, vert.z - offZ).color(color.R(), color.G(), color.B(), color.A()).endVertex(); } - public void render(PoseStack pMatrixStack, MultiBufferSource pBuffer, double pCamX, double p_113510_, double pCamY) + public void render(PoseStack pMatrixStack, MultiBufferSource pBuffer, double camX, double camY, double camZ) { } } @@ -253,13 +265,18 @@ public Polygon offset(Vec3 offset) return debug$polygon; } - public Polygon rotated(Quaternion quat) + public Polygon rotated(Quaternionf quat) { Polygon debug$polygon = new Polygon(this.vertices.length); for (int i = 0; i < this.vertices.length; ++i) { - debug$polygon.vertices[i] = quat.multiply(new Vector3(this.vertices[i])).toVector3d(); + debug$polygon.vertices[i] = convertToVec3( + quat.transformUnit( + new Vector3f().set(this.vertices[i].x, this.vertices[i].y, this.vertices[i].z), + new Vector3f() + ) + ); debug$polygon.colors[i] = this.colors[i]; } diff --git a/common/src/main/java/org/vivecraft/client/utils/UpdateChecker.java b/common/src/main/java/org/vivecraft/client/utils/UpdateChecker.java index 57c3113c1..7c7d4758f 100644 --- a/common/src/main/java/org/vivecraft/client/utils/UpdateChecker.java +++ b/common/src/main/java/org/vivecraft/client/utils/UpdateChecker.java @@ -1,11 +1,12 @@ package org.vivecraft.client.utils; +import org.vivecraft.client.Xplat; + import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.mojang.logging.LogUtils; + import net.minecraft.SharedConstants; -import org.vivecraft.client.Xplat; import java.io.BufferedReader; import java.io.IOException; @@ -13,9 +14,13 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; -import java.util.*; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; import java.util.stream.Collectors; +import static org.vivecraft.common.utils.Utils.logger; + public class UpdateChecker { public static boolean hasUpdate = false; @@ -25,7 +30,7 @@ public class UpdateChecker { public static String newestVersion = ""; public static boolean checkForUpdates() { - System.out.println("Checking for Vivecraft Updates"); + logger.info("Checking for Updates..."); try { String apiURL = "https://api.modrinth.com/v2/project/vivecraft/version?loaders=[%22" + Xplat.getModloader() + "%22]&game_versions=[%22" + SharedConstants.VERSION_STRING + "%22]"; HttpURLConnection conn = (HttpURLConnection) new URL(apiURL).openConnection(); @@ -36,7 +41,7 @@ public static boolean checkForUpdates() { conn.connect(); if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { - LogUtils.getLogger().error("Error " + conn.getResponseCode() + " fetching Vivecraft updates"); + logger.error("Error {} fetching updates", conn.getResponseCode()); return false; } @@ -60,10 +65,12 @@ public static boolean checkForUpdates() { String currentVersionNumber = Xplat.getModVersion() + "-" +Xplat.getModloader(); Version current = new Version(currentVersionNumber,currentVersionNumber,""); + StringBuilder changelogBuilder = new StringBuilder(changelog); for (Version v : versions) { if (current.compareTo(v) > 0) { - changelog += "§a"+v.fullVersion+"§r" + ": \n" + v.changelog + "\n\n"; + changelogBuilder.append("§a").append(v.fullVersion).append("§r: \n") + .append(v.changelog).append("\n\n"); if (newestVersion.isEmpty()) { newestVersion = v.fullVersion; } @@ -71,9 +78,9 @@ public static boolean checkForUpdates() { } } // no carriage returns please - changelog = changelog.replaceAll("\\r", ""); + changelog = changelogBuilder.toString().replaceAll("\\r", ""); if (hasUpdate) { - LogUtils.getLogger().info("Vivecraft update found: " + newestVersion); + logger.info("Update Found: {}", newestVersion); } } catch (IOException e) { e.printStackTrace(); @@ -123,7 +130,7 @@ public Version(String version, String version_number, String changelog) { } @Override - public int compareTo(UpdateChecker.Version o) { + public int compareTo(Version o) { long result = this.compareNumber() - o.compareNumber(); if (result < 0) { return 1; diff --git a/common/src/main/java/org/vivecraft/client/utils/Utils.java b/common/src/main/java/org/vivecraft/client/utils/Utils.java index d29b5628a..a2468028a 100644 --- a/common/src/main/java/org/vivecraft/client/utils/Utils.java +++ b/common/src/main/java/org/vivecraft/client/utils/Utils.java @@ -1,65 +1,23 @@ package org.vivecraft.client.utils; -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Formatter; -import java.util.List; -import java.util.Optional; -import java.util.Random; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import javax.annotation.Nullable; - -import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.LogManager; -import org.lwjgl.openvr.HmdMatrix44; import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.render.VRShaders; import org.vivecraft.client_vr.utils.LoaderUtils; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector2; -import org.vivecraft.common.utils.math.Vector3; -import org.vivecraft.common.utils.lwjgl.Matrix3f; -import org.vivecraft.common.utils.lwjgl.Matrix4f; -import org.vivecraft.common.utils.lwjgl.Vector2f; -import org.vivecraft.common.utils.lwjgl.Vector3f; -import org.vivecraft.common.utils.lwjgl.Vector4f; - -import com.google.common.base.Charsets; + import com.google.common.collect.Lists; import com.google.common.io.Files; +import org.apache.commons.io.IOUtils; + import com.mojang.blaze3d.pipeline.RenderTarget; import net.minecraft.ChatFormatting; import net.minecraft.client.ComponentCollector; -import net.minecraft.client.Minecraft; import net.minecraft.client.Screenshot; import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.Style; import net.minecraft.resources.ResourceLocation; @@ -67,13 +25,40 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.phys.Vec3; +import javax.annotation.Nullable; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; + public class Utils { - private static final char[] illegalChars = new char[] {'"', '<', '>', '|', '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', '\b', '\t', '\n', '\u000b', '\f', '\r', '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f', ':', '*', '?', '\\', '/'}; + private static final char[] illegalChars = {'"', '<', '>', '|', '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', '\b', '\t', '\n', '\u000b', '\f', '\r', '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f', ':', '*', '?', '\\', '/'}; private static final int CONNECT_TIMEOUT = 5000; private static final int READ_TIMEOUT = 20000; private static final Random avRandomizer = new Random(); + public static void message(final Component literal) + { + if (mc.level != null) { + mc.gui.getChat().addMessage(literal); + } + } + public static String sanitizeFileName(String fileName) { StringBuilder stringbuilder = new StringBuilder(); @@ -95,90 +80,9 @@ public static String sanitizeFileName(String fileName) return stringbuilder.toString(); } - public static Vector3 convertToOVRVector(Vector3f vector) - { - return new Vector3(vector.x, vector.y, vector.z); - } - - public static Vector3 convertToOVRVector(Vec3 vector) - { - return new Vector3((float)vector.x, (float)vector.y, (float)vector.z); - } - - public static Matrix4f convertOVRMatrix(org.vivecraft.common.utils.math.Matrix4f matrix) - { - Matrix4f matrix4f = new Matrix4f(); - matrix4f.m00 = matrix.M[0][0]; - matrix4f.m01 = matrix.M[0][1]; - matrix4f.m02 = matrix.M[0][2]; - matrix4f.m03 = matrix.M[0][3]; - matrix4f.m10 = matrix.M[1][0]; - matrix4f.m11 = matrix.M[1][1]; - matrix4f.m12 = matrix.M[1][2]; - matrix4f.m13 = matrix.M[1][3]; - matrix4f.m20 = matrix.M[2][0]; - matrix4f.m21 = matrix.M[2][1]; - matrix4f.m22 = matrix.M[2][2]; - matrix4f.m23 = matrix.M[2][3]; - matrix4f.m30 = matrix.M[3][0]; - matrix4f.m31 = matrix.M[3][1]; - matrix4f.m32 = matrix.M[3][2]; - matrix4f.m33 = matrix.M[3][3]; - matrix4f.transpose(matrix4f); - return matrix4f; - } - - public static org.vivecraft.common.utils.math.Matrix4f convertToOVRMatrix(Matrix4f matrixIn) - { - Matrix4f matrix4f = new Matrix4f(); - matrixIn.transpose(matrix4f); - org.vivecraft.common.utils.math.Matrix4f matrix4f1 = new org.vivecraft.common.utils.math.Matrix4f(); - matrix4f1.M[0][0] = matrix4f.m00; - matrix4f1.M[0][1] = matrix4f.m01; - matrix4f1.M[0][2] = matrix4f.m02; - matrix4f1.M[0][3] = matrix4f.m03; - matrix4f1.M[1][0] = matrix4f.m10; - matrix4f1.M[1][1] = matrix4f.m11; - matrix4f1.M[1][2] = matrix4f.m12; - matrix4f1.M[1][3] = matrix4f.m13; - matrix4f1.M[2][0] = matrix4f.m20; - matrix4f1.M[2][1] = matrix4f.m21; - matrix4f1.M[2][2] = matrix4f.m22; - matrix4f1.M[2][3] = matrix4f.m23; - matrix4f1.M[3][0] = matrix4f.m30; - matrix4f1.M[3][1] = matrix4f.m31; - matrix4f1.M[3][2] = matrix4f.m32; - matrix4f1.M[3][3] = matrix4f.m33; - return matrix4f1; - } - - public static double lerp(double from, double to, double percent) - { - return from + (to - from) * percent; - } - - public static double lerpMod(double from, double to, double percent, double mod) - { - return Math.abs(to - from) < mod / 2.0D ? from + (to - from) * percent : from + (to - from - Math.signum(to - from) * mod) * percent; - } - - public static double absLerp(double value, double target, double stepSize) - { - double d0 = Math.abs(stepSize); - - if (target - value > d0) - { - return value + d0; - } - else - { - return target - value < -d0 ? value - d0 : target; - } - } - public static float angleDiff(float a, float b) { - float f = Math.abs(a - b) % 360.0F; + float f = abs(a - b) % 360.0F; float f1 = f > 180.0F ? 360.0F - f : f; int i = (!(a - b >= 0.0F) || !(a - b <= 180.0F)) && (!(a - b <= -180.0F) || !(a - b >= -360.0F)) ? -1 : 1; return f1 * (float)i; @@ -196,14 +100,6 @@ public static float angleNormalize(float angle) return angle; } - public static Vector3f directionFromMatrix(Matrix4f matrix, float x, float y, float z) - { - Vector4f vector4f = new Vector4f(x, y, z, 0.0F); - Matrix4f.transform(matrix, vector4f, vector4f); - vector4f.normalise(vector4f); - return new Vector3f(vector4f.x, vector4f.y, vector4f.z); - } - public static void wordWrap(String in, int length, ArrayList wrapped) { // can't wrap with length 0, so return the original string @@ -233,7 +129,7 @@ else if (flag) } else { - int i = Math.max(Math.max(in.lastIndexOf(" ", length), in.lastIndexOf("\t", length)), in.lastIndexOf("-", length)); + int i = max(max(in.lastIndexOf(' ', length), in.lastIndexOf('\t', length)), in.lastIndexOf('-', length)); if (i == -1) { @@ -246,77 +142,6 @@ else if (flag) } } - public static Vector2f convertVector(Vector2 vector) - { - return new Vector2f(vector.getX(), vector.getY()); - } - - public static Vector2 convertVector(Vector2f vector) - { - return new Vector2(vector.getX(), vector.getY()); - } - - public static Vector3f convertVector(Vector3 vector) - { - return new Vector3f(vector.getX(), vector.getY(), vector.getZ()); - } - - public static Vector3 convertVector(Vector3f vector) - { - return new Vector3(vector.getX(), vector.getY(), vector.getZ()); - } - - public static Vector3 convertVector(Vec3 vector) - { - return new Vector3((float)vector.x, (float)vector.y, (float)vector.z); - } - - public static Vector3f convertToVector3f(Vec3 vector) - { - return new Vector3f((float)vector.x, (float)vector.y, (float)vector.z); - } - - public static Vec3 convertToVector3d(Vector3 vector) - { - return new Vec3((double)vector.getX(), (double)vector.getY(), (double)vector.getZ()); - } - - public static Vec3 convertToVector3d(Vector3f vector) - { - return new Vec3((double)vector.x, (double)vector.y, (double)vector.z); - } - - public static Vector3f transformVector(Matrix4f matrix, Vector3f vector, boolean point) - { - Vector4f vector4f = Matrix4f.transform(matrix, new Vector4f(vector.x, vector.y, vector.z, point ? 1.0F : 0.0F), (Vector4f)null); - return new Vector3f(vector4f.x, vector4f.y, vector4f.z); - } - - public static Quaternion quatLerp(Quaternion start, Quaternion end, float fraction) - { - Quaternion quaternion = new Quaternion(); - quaternion.w = start.w + (end.w - start.w) * fraction; - quaternion.x = start.x + (end.x - start.x) * fraction; - quaternion.y = start.y + (end.y - start.y) * fraction; - quaternion.z = start.z + (end.z - start.z) * fraction; - return quaternion; - } - - public static Matrix4f matrix3to4(Matrix3f matrix) - { - Matrix4f matrix4f = new Matrix4f(); - matrix4f.m00 = matrix.m00; - matrix4f.m01 = matrix.m01; - matrix4f.m02 = matrix.m02; - matrix4f.m10 = matrix.m10; - matrix4f.m11 = matrix.m11; - matrix4f.m12 = matrix.m12; - matrix4f.m20 = matrix.m20; - matrix4f.m21 = matrix.m21; - matrix4f.m22 = matrix.m22; - return matrix4f; - } - public static InputStream getAssetAsStream(String name, boolean required) { InputStream inputstream = null; @@ -325,7 +150,7 @@ public static InputStream getAssetAsStream(String name, boolean required) { try { - Optional resource = Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("vivecraft", name)); + Optional resource = mc.getResourceManager().getResource(new ResourceLocation("vivecraft", name)); if (resource.isPresent()) { inputstream = resource.get().open(); } @@ -396,7 +221,7 @@ public static byte[] loadAsset(String name, boolean required) public static String loadAssetAsString(String name, boolean required) { byte[] abyte = loadAsset(name, required); - return abyte == null ? null : new String(abyte, Charsets.UTF_8); + return abyte == null ? null : new String(abyte, StandardCharsets.UTF_8); } public static void loadAssetToFile(String name, File file, boolean required) @@ -425,7 +250,7 @@ private static void handleAssetException(Throwable e, String name, boolean requi } else { - System.out.println("Failed to load asset: " + name); + logger.error("Failed to load asset: {}", name); e.printStackTrace(); } } @@ -448,22 +273,22 @@ public static void unpackNatives(String directory) if (path1.toFile().exists()) { - System.out.println("Copying " + directory + " natives..."); + logger.info("Copying {} natives...", directory); for (File file1 : path1.toFile().listFiles()) { - System.out.println(file1.getName()); + logger.info(file1.getName()); Files.copy(file1, new File("openvr/" + directory + "/" + file1.getName())); } return; } } - catch (Exception exception) + catch (Exception ignored) { } - System.out.println("Unpacking " + directory + " natives..."); + logger.info("Unpacking {} natives...", directory); Path jarPath = Xplat.getJarPath(); boolean didExtractSomething = false; @@ -472,12 +297,12 @@ public static void unpackNatives(String directory) for (Path file : natives.collect(Collectors.toCollection(ArrayList::new))) { didExtractSomething = true; - System.out.println(file); + logger.info(file.toString()); java.nio.file.Files.copy(file, new File("openvr/" + directory + "/" + file.getFileName()).toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); } } catch (IOException e) { - System.out.println("Failed to unpack natives from jar"); + logger.info("Failed to unpack natives from jar"); } if (!didExtractSomething) { ZipFile zipfile = LoaderUtils.getVivecraftZip(); @@ -490,7 +315,7 @@ public static void unpackNatives(String directory) if (zipentry.getName().startsWith("natives/" + directory)) { String s = Paths.get(zipentry.getName()).getFileName().toString(); - System.out.println(s); + logger.info(s); writeStreamToFile(zipfile.getInputStream(zipentry), new File("openvr/" + directory + "/" + s)); } } @@ -500,7 +325,7 @@ public static void unpackNatives(String directory) } catch (Exception exception1) { - System.out.println("Failed to unpack natives"); + logger.error("Failed to unpack natives"); exception1.printStackTrace(); } } @@ -584,7 +409,7 @@ public static String httpReadAllString(String url) throws IOException return new String(httpReadAll(url), StandardCharsets.UTF_8); } - public static void httpReadToFile(String url, File file, boolean writeWhenComplete) throws MalformedURLException, IOException + public static void httpReadToFile(String url, File file, boolean writeWhenComplete) throws IOException { HttpURLConnection httpurlconnection = (HttpURLConnection)(new URL(url)).openConnection(); httpurlconnection.setConnectTimeout(5000); @@ -654,7 +479,7 @@ public static List httpReadList(String url) throws IOException return list; } - public static String getFileChecksum(File file, String algorithm) throws FileNotFoundException, IOException, NoSuchAlgorithmException + public static String getFileChecksum(File file, String algorithm) throws IOException, NoSuchAlgorithmException { InputStream inputstream = new FileInputStream(file); byte[] abyte = new byte[(int)file.length()]; @@ -674,15 +499,15 @@ public static String getFileChecksum(File file, String algorithm) throws FileNot return s; } - public static byte[] readFile(File file) throws FileNotFoundException, IOException + public static byte[] readFile(File file) throws IOException { FileInputStream fileinputstream = new FileInputStream(file); return readFully(fileinputstream); } - public static String readFileString(File file) throws FileNotFoundException, IOException + public static String readFileString(File file) throws IOException { - return new String(readFile(file), "UTF-8"); + return new String(readFile(file), StandardCharsets.UTF_8); } public static byte[] readFully(InputStream in) throws IOException @@ -700,33 +525,6 @@ public static byte[] readFully(InputStream in) throws IOException return bytearrayoutputstream.toByteArray(); } - public static Quaternion slerp(Quaternion start, Quaternion end, float alpha) - { - float f = start.x * end.x + start.y * end.y + start.z * end.z + start.w * end.w; - float f1 = f < 0.0F ? -f : f; - float f2 = 1.0F - alpha; - float f3 = alpha; - - if ((double)(1.0F - f1) > 0.1D) - { - float f4 = (float)Math.acos((double)f1); - float f5 = 1.0F / (float)Math.sin((double)f4); - f2 = (float)Math.sin((double)((1.0F - alpha) * f4)) * f5; - f3 = (float)Math.sin((double)(alpha * f4)) * f5; - } - - if (f < 0.0F) - { - f3 = -f3; - } - - float f8 = f2 * start.x + f3 * end.x; - float f9 = f2 * start.y + f3 * end.y; - float f6 = f2 * start.z + f3 * end.z; - float f7 = f2 * start.w + f3 * end.w; - return new Quaternion(f7, f8, f9, f6); - } - public static Vec3 vecLerp(Vec3 start, Vec3 end, double fraction) { double d0 = start.x + (end.x - start.x) * fraction; @@ -740,9 +538,9 @@ public static float applyDeadzone(float axis, float deadzone) float f = 1.0F / (1.0F - deadzone); float f1 = 0.0F; - if (Math.abs(axis) > deadzone) + if (abs(axis) > deadzone) { - f1 = (Math.abs(axis) - deadzone) * f * Math.signum(axis); + f1 = (abs(axis) - deadzone) * f * signum(axis); } return f1; @@ -750,8 +548,6 @@ public static float applyDeadzone(float axis, float deadzone) public static void spawnParticles(ParticleOptions type, int count, Vec3 position, Vec3 size, double speed) { - Minecraft minecraft = Minecraft.getInstance(); - for (int i = 0; i < count; ++i) { double d0 = avRandomizer.nextGaussian() * size.x; @@ -763,11 +559,11 @@ public static void spawnParticles(ParticleOptions type, int count, Vec3 position try { - minecraft.level.addParticle(type, position.x + d0, position.y + d1, position.z + d2, d3, d4, d5); + mc.level.addParticle(type, position.x + d0, position.y + d1, position.z + d2, d3, d4, d5); } catch (Throwable throwable) { - LogManager.getLogger().warn("Could not spawn particle effect {}", (Object)type); + logger.warn("Could not spawn particle effect {}", type); return; } } @@ -789,11 +585,10 @@ public static int getCombinedLightWithMin(BlockAndTintGetter lightReader, BlockP public static void takeScreenshot(RenderTarget fb) { - Minecraft minecraft = Minecraft.getInstance(); - Screenshot.grab(minecraft.gameDirectory, fb, (text) -> + Screenshot.grab(mc.gameDirectory, fb, (text) -> { - minecraft.execute(() -> { - minecraft.gui.getChat().addMessage(text); + mc.execute(() -> { + mc.gui.getChat().addMessage(text); }); }); } @@ -811,7 +606,7 @@ public static List wrapText(FormattedText text, int width, Font f { list.add(sameLine && linePrefix != null ? FormattedText.composite(linePrefix, lineText) : lineText); }); - return (List)(list.isEmpty() ? Lists.newArrayList(FormattedText.EMPTY) : list); + return list.isEmpty() ? Lists.newArrayList(FormattedText.EMPTY) : list; } public static List styleToFormats(Style style) @@ -877,187 +672,6 @@ public static String styleToFormatString(Style style) return formatsToString(styleToFormats(style)); } - public static long microTime() - { - return System.nanoTime() / 1000L; - } - - public static long milliTime() - { - return System.nanoTime() / 1000000L; - } - - public static void printStackIfContainsClass(String className) - { - StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace(); - boolean flag = false; - - for (StackTraceElement stacktraceelement : astacktraceelement) - { - if (stacktraceelement.getClassName().equals(className)) - { - flag = true; - break; - } - } - - if (flag) - { - Thread.dumpStack(); - } - } - - public static org.joml.Matrix4f Matrix4fFromOpenVR(HmdMatrix44 in) - { - return new org.joml.Matrix4f(in.m(0), in.m(4), in.m(8), in.m(12), - in.m(1), in.m(5), in.m(9), in.m(13), - in.m(2), in.m(6), in.m(10), in.m(14), - in.m(3), in.m(7), in.m(11), in.m(15)); - } - - public static Quaternion convertMatrix4ftoRotationQuat(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22) - { - double d0 = (double)(m00 * m00 + m10 * m10 + m20 * m20); - - if (d0 != 1.0D && d0 != 0.0D) - { - d0 = 1.0D / Math.sqrt(d0); - m00 = (float)((double)m00 * d0); - m10 = (float)((double)m10 * d0); - m20 = (float)((double)m20 * d0); - } - - d0 = (double)(m01 * m01 + m11 * m11 + m21 * m21); - - if (d0 != 1.0D && d0 != 0.0D) - { - d0 = 1.0D / Math.sqrt(d0); - m01 = (float)((double)m01 * d0); - m11 = (float)((double)m11 * d0); - m21 = (float)((double)m21 * d0); - } - - d0 = (double)(m02 * m02 + m12 * m12 + m22 * m22); - - if (d0 != 1.0D && d0 != 0.0D) - { - d0 = 1.0D / Math.sqrt(d0); - m02 = (float)((double)m02 * d0); - m12 = (float)((double)m12 * d0); - m22 = (float)((double)m22 * d0); - } - - float f = m00 + m11 + m22; - Quaternion quaternion = new Quaternion(); - - if (f >= 0.0F) - { - double d1 = Math.sqrt((double)(f + 1.0F)); - quaternion.w = (float)(0.5D * d1); - d1 = 0.5D / d1; - quaternion.x = (float)((double)(m21 - m12) * d1); - quaternion.y = (float)((double)(m02 - m20) * d1); - quaternion.z = (float)((double)(m10 - m01) * d1); - } - else if (m00 > m11 && m00 > m22) - { - double d4 = Math.sqrt(1.0D + (double)m00 - (double)m11 - (double)m22); - quaternion.x = (float)(d4 * 0.5D); - d4 = 0.5D / d4; - quaternion.y = (float)((double)(m10 + m01) * d4); - quaternion.z = (float)((double)(m02 + m20) * d4); - quaternion.w = (float)((double)(m21 - m12) * d4); - } - else if (m11 > m22) - { - double d2 = Math.sqrt(1.0D + (double)m11 - (double)m00 - (double)m22); - quaternion.y = (float)(d2 * 0.5D); - d2 = 0.5D / d2; - quaternion.x = (float)((double)(m10 + m01) * d2); - quaternion.z = (float)((double)(m21 + m12) * d2); - quaternion.w = (float)((double)(m02 - m20) * d2); - } - else - { - double d3 = Math.sqrt(1.0D + (double)m22 - (double)m00 - (double)m11); - quaternion.z = (float)(d3 * 0.5D); - d3 = 0.5D / d3; - quaternion.x = (float)((double)(m02 + m20) * d3); - quaternion.y = (float)((double)(m21 + m12) * d3); - quaternion.w = (float)((double)(m10 - m01) * d3); - } - - return quaternion; - } - - public static org.vivecraft.common.utils.math.Matrix4f rotationXMatrix(float angle) - { - float f = (float)Math.sin((double)angle); - float f1 = (float)Math.cos((double)angle); - return new org.vivecraft.common.utils.math.Matrix4f(1.0F, 0.0F, 0.0F, 0.0F, f1, -f, 0.0F, f, f1); - } - - public static org.vivecraft.common.utils.math.Matrix4f rotationZMatrix(float angle) - { - float f = (float)Math.sin((double)angle); - float f1 = (float)Math.cos((double)angle); - return new org.vivecraft.common.utils.math.Matrix4f(f1, -f, 0.0F, f, f1, 0.0F, 0.0F, 0.0F, 1.0F); - } - - public static Vector3 convertMatrix4ftoTranslationVector(org.vivecraft.common.utils.math.Matrix4f mat) - { - return new Vector3(mat.M[0][3], mat.M[1][3], mat.M[2][3]); - } - - public static void Matrix4fSet(org.vivecraft.common.utils.math.Matrix4f mat, float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) - { - mat.M[0][0] = m11; - mat.M[0][1] = m12; - mat.M[0][2] = m13; - mat.M[0][3] = m14; - mat.M[1][0] = m21; - mat.M[1][1] = m22; - mat.M[1][2] = m23; - mat.M[1][3] = m24; - mat.M[2][0] = m31; - mat.M[2][1] = m32; - mat.M[2][2] = m33; - mat.M[2][3] = m34; - mat.M[3][0] = m41; - mat.M[3][1] = m42; - mat.M[3][2] = m43; - mat.M[3][3] = m44; - } - - public static void Matrix4fCopy(org.vivecraft.common.utils.math.Matrix4f source, org.vivecraft.common.utils.math.Matrix4f dest) - { - dest.M[0][0] = source.M[0][0]; - dest.M[0][1] = source.M[0][1]; - dest.M[0][2] = source.M[0][2]; - dest.M[0][3] = source.M[0][3]; - dest.M[1][0] = source.M[1][0]; - dest.M[1][1] = source.M[1][1]; - dest.M[1][2] = source.M[1][2]; - dest.M[1][3] = source.M[1][3]; - dest.M[2][0] = source.M[2][0]; - dest.M[2][1] = source.M[2][1]; - dest.M[2][2] = source.M[2][2]; - dest.M[2][3] = source.M[2][3]; - dest.M[3][0] = source.M[3][0]; - dest.M[3][1] = source.M[3][1]; - dest.M[3][2] = source.M[3][2]; - dest.M[3][3] = source.M[3][3]; - } - - public static org.vivecraft.common.utils.math.Matrix4f Matrix4fSetIdentity(org.vivecraft.common.utils.math.Matrix4f mat) - { - mat.M[0][0] = mat.M[1][1] = mat.M[2][2] = mat.M[3][3] = 1.0F; - mat.M[0][1] = mat.M[1][0] = mat.M[2][3] = mat.M[3][1] = 0.0F; - mat.M[0][2] = mat.M[1][2] = mat.M[2][0] = mat.M[3][2] = 0.0F; - mat.M[0][3] = mat.M[1][3] = mat.M[2][1] = mat.M[3][0] = 0.0F; - return mat; - } - static { Arrays.sort(illegalChars); diff --git a/common/src/main/java/org/vivecraft/client/utils/math/BezierCurve.java b/common/src/main/java/org/vivecraft/client/utils/math/BezierCurve.java deleted file mode 100644 index 338aeb87f..000000000 --- a/common/src/main/java/org/vivecraft/client/utils/math/BezierCurve.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.vivecraft.client.utils.math; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat.Mode; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.Arrays; -import net.minecraft.client.Minecraft; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.phys.Vec3; - -public class BezierCurve -{ - public ArrayList nodes = new ArrayList<>(); - boolean circular; - - public BezierCurve(Node[] nodes, boolean circular) - { - this.nodes.addAll(Arrays.asList(nodes)); - this.circular = circular; - } - - public BezierCurve(boolean circular) - { - this.circular = circular; - } - - Vec3 getIntermediate(Node n1, Node n2, double perc) - { - Vec3 vec3 = n1.vertex; - Vec3 vec31 = n1.controlOut; - Vec3 vec32 = n2.controlIn; - Vec3 vec33 = n2.vertex; - return vec3.scale(Math.pow(1.0D - perc, 3.0D)).add(vec31.scale(3.0D * Math.pow(1.0D - perc, 2.0D) * perc)).add(vec32.scale(3.0D * (1.0D - perc) * Math.pow(perc, 2.0D))).add(vec33.scale(Math.pow(perc, 3.0D))); - } - - public Vec3 getPointOnPath(double perc) - { - int i = this.circular ? this.nodes.size() : this.nodes.size() - 1; - double d0 = perc * (double)i; - int j = (int)Math.floor(d0) % this.nodes.size(); - int k = (int)Math.ceil(d0) % this.nodes.size(); - - if (j == k) - { - return (this.nodes.get(j)).vertex; - } - else - { - Node beziercurve$node = this.nodes.get(j); - Node beziercurve$node1 = this.nodes.get(k); - return this.getIntermediate(beziercurve$node, beziercurve$node1, d0 - (double)j); - } - } - - public Vec3[] getLinearInterpolation(int verticesPerNode) - { - if (this.nodes.size() == 0) - { - return new Vec3[0]; - } - else - { - int i = verticesPerNode * (this.circular ? this.nodes.size() : this.nodes.size() - 1) + 1; - Vec3[] avec3 = new Vec3[i]; - - for (int j = 0; j < i; ++j) - { - double d0 = (double)j / (double)Math.max(1, i - 1); - avec3[j] = this.getPointOnPath(d0); - } - - return avec3; - } - } - - public void render(int vertexCount, Color c, float partialTicks) - { - Player player = Minecraft.getInstance().player; - double d0 = player.xOld + (player.getX() - player.xOld) * (double)partialTicks; - double d1 = player.yOld + (player.getY() - player.yOld) * (double)partialTicks; - double d2 = player.zOld + (player.getZ() - player.zOld) * (double)partialTicks; - //GlStateManager._disableLighting(); - RenderSystem.depthMask(false); - Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferbuilder = tesselator.getBuilder(); - bufferbuilder.begin(Mode.LINES, DefaultVertexFormat.POSITION_COLOR); - Vec3[] avec3 = this.getLinearInterpolation(vertexCount / this.nodes.size()); - - for (int i = 0; i < avec3.length; ++i) - { - this.renderVertex(bufferbuilder, avec3[i], c, d0, d1, d2); - } - - tesselator.end(); - //GlStateManager._enableLighting(); - RenderSystem.depthMask(true); - } - - void renderVertex(BufferBuilder buffer, Vec3 vert, Color color, double offX, double offY, double offZ) - { - buffer.vertex(vert.x - offX, vert.y - offY, vert.z - offZ).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex(); - } - - public static class Node - { - Vec3 vertex; - Vec3 controlIn; - Vec3 controlOut; - - public Node(Vec3 vertex, Vec3 controlIn, Vec3 controlOut) - { - this.vertex = vertex; - this.controlIn = controlIn; - this.controlOut = controlOut; - } - - public Node(Vec3 vertex, Vec3 controlDir, double controlLenIn, double controlLenOut) - { - this(vertex, vertex.add(controlDir.normalize().scale(-controlLenIn)), vertex.add(controlDir.normalize().scale(controlLenOut))); - } - } -} diff --git a/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java b/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java index 0f69f1e8a..1d300165b 100644 --- a/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java @@ -1,7 +1,5 @@ package org.vivecraft.client_vr; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.model.ModelResourceLocation; import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.gameplay.trackers.*; import org.vivecraft.client_vr.menuworlds.MenuWorldRenderer; @@ -10,6 +8,10 @@ import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.settings.VRSettings; +import net.minecraft.client.resources.model.ModelResourceLocation; + +import javax.annotation.Nonnull; + public class ClientDataHolderVR { public static boolean kiosk; @@ -17,66 +19,44 @@ public class ClientDataHolderVR { public static boolean katvr; public static boolean infinadeck; public static boolean viewonly; - public static ModelResourceLocation thirdPersonCameraModel = new ModelResourceLocation("vivecraft", "camcorder", ""); - public static ModelResourceLocation thirdPersonCameraDisplayModel = new ModelResourceLocation("vivecraft", "camcorder_display", ""); - private static ClientDataHolderVR INSTANCE; + public static final ModelResourceLocation thirdPersonCameraModel = new ModelResourceLocation("vivecraft", "camcorder", ""); + public static final ModelResourceLocation thirdPersonCameraDisplayModel = new ModelResourceLocation("vivecraft", "camcorder_display", ""); public VRPlayer vrPlayer; public MCVR vr; public VRRenderer vrRenderer; - public MenuWorldRenderer menuWorldRenderer; - public BackpackTracker backpackTracker = new BackpackTracker(Minecraft.getInstance(), this); - public BowTracker bowTracker = new BowTracker(Minecraft.getInstance(), this); - public SwimTracker swimTracker = new SwimTracker(Minecraft.getInstance(), this); - public EatingTracker autoFood = new EatingTracker(Minecraft.getInstance(), this); - public JumpTracker jumpTracker = new JumpTracker(Minecraft.getInstance(), this); - public SneakTracker sneakTracker = new SneakTracker(Minecraft.getInstance(), this); - public ClimbTracker climbTracker = new ClimbTracker(Minecraft.getInstance(), this); - public RunTracker runTracker = new RunTracker(Minecraft.getInstance(), this); - public RowTracker rowTracker = new RowTracker(Minecraft.getInstance(), this); - public TeleportTracker teleportTracker = new TeleportTracker(Minecraft.getInstance(), this); - public SwingTracker swingTracker = new SwingTracker(Minecraft.getInstance(), this); - public HorseTracker horseTracker = new HorseTracker(Minecraft.getInstance(), this); - public VehicleTracker vehicleTracker = new VehicleTracker(Minecraft.getInstance(), this); - public InteractTracker interactTracker = new InteractTracker(Minecraft.getInstance(), this); - public CrawlTracker crawlTracker = new CrawlTracker(Minecraft.getInstance(), this); - public CameraTracker cameraTracker = new CameraTracker(Minecraft.getInstance(), this); public VRSettings vrSettings; + public MenuWorldRenderer menuWorldRenderer; + public final BackpackTracker backpackTracker = new BackpackTracker(); + public final BowTracker bowTracker = new BowTracker(); + public final CameraTracker cameraTracker = new CameraTracker(); + public final ClimbTracker climbTracker = new ClimbTracker(); + public final CrawlTracker crawlTracker = new CrawlTracker(); + public final EatingTracker eatingTracker = new EatingTracker(); + public final HorseTracker horseTracker = new HorseTracker(); + public final InteractTracker interactTracker = new InteractTracker(); + public final JumpTracker jumpTracker = new JumpTracker(); + public final RowTracker rowTracker = new RowTracker(); + public final RunTracker runTracker = new RunTracker(); + public final SneakTracker sneakTracker = new SneakTracker(); + public final SwimTracker swimTracker = new SwimTracker(); + public final SwingTracker swingTracker = new SwingTracker(); + public final TeleportTracker teleportTracker = new TeleportTracker(); + public final TelescopeTracker telescopeTracker = new TelescopeTracker(); + public final VehicleTracker vehicleTracker = new VehicleTracker(); public boolean integratedServerLaunchInProgress = false; public boolean grabScreenShot = false; public long frameIndex = 0L; - public RenderPass currentPass; + @Nonnull public RenderPass currentPass = RenderPass.VANILLA; public int tickCounter; public float watereffect; public float portaleffect; public float pumpkineffect; public static boolean isfphand; public boolean isFirstPass; - long mirroNotifyStart; - String mirrorNotifyText; - boolean mirrorNotifyClear; - long mirroNotifyLen; // showed chat notifications public boolean showedUpdateNotification; public boolean skipStupidGoddamnChunkBoundaryClipping; - - - public static ClientDataHolderVR getInstance() { - if (INSTANCE == null) { - INSTANCE = new ClientDataHolderVR(); - } - return INSTANCE; - } - - public void printChatMessage(String string) { - // TODO Auto-generated method stub - - } - - public void print(String string) { - string = string.replace("\n", "\n[Minecrift] "); - System.out.println("[Minecrift] " + string); - } } diff --git a/common/src/main/java/org/vivecraft/client_vr/ItemTags.java b/common/src/main/java/org/vivecraft/client_vr/ItemTags.java index db3ce568f..3a5d5f396 100644 --- a/common/src/main/java/org/vivecraft/client_vr/ItemTags.java +++ b/common/src/main/java/org/vivecraft/client_vr/ItemTags.java @@ -6,37 +6,37 @@ import net.minecraft.world.item.Item; public class ItemTags { - public final static TagKey VIVECRAFT_ARROWS = tag("arrows"); + public static final TagKey VIVECRAFT_ARROWS = tag("arrows"); - public final static TagKey VIVECRAFT_BRUSHES = tag("brushes"); + public static final TagKey VIVECRAFT_BRUSHES = tag("brushes"); - public final static TagKey VIVECRAFT_COMPASSES = tag("compasses"); + public static final TagKey VIVECRAFT_COMPASSES = tag("compasses"); - public final static TagKey VIVECRAFT_CROSSBOWS = tag("crossbows"); + public static final TagKey VIVECRAFT_CROSSBOWS = tag("crossbows"); - public final static TagKey VIVECRAFT_FISHING_RODS = tag("fishing_rods"); + public static final TagKey VIVECRAFT_FISHING_RODS = tag("fishing_rods"); - public final static TagKey VIVECRAFT_FOOD_STICKS = tag("food_sticks"); + public static final TagKey VIVECRAFT_FOOD_STICKS = tag("food_sticks"); - public final static TagKey VIVECRAFT_HOES = tag("hoes"); + public static final TagKey VIVECRAFT_HOES = tag("hoes"); - public final static TagKey VIVECRAFT_MAPS = tag("maps"); + public static final TagKey VIVECRAFT_MAPS = tag("maps"); - public final static TagKey VIVECRAFT_SCYTHES = tag("scythes"); + public static final TagKey VIVECRAFT_SCYTHES = tag("scythes"); - public final static TagKey VIVECRAFT_SHIELDS = tag("shields"); + public static final TagKey VIVECRAFT_SHIELDS = tag("shields"); - public final static TagKey VIVECRAFT_SPEARS = tag("spears"); + public static final TagKey VIVECRAFT_SPEARS = tag("spears"); - public final static TagKey VIVECRAFT_SWORDS = tag("swords"); + public static final TagKey VIVECRAFT_SWORDS = tag("swords"); - public final static TagKey VIVECRAFT_TELESCOPE = tag("telescope"); + public static final TagKey VIVECRAFT_TELESCOPE = tag("telescope"); - public final static TagKey VIVECRAFT_THROW_ITEMS = tag("throw_items"); + public static final TagKey VIVECRAFT_THROW_ITEMS = tag("throw_items"); - public final static TagKey VIVECRAFT_TOOLS = tag("tools"); + public static final TagKey VIVECRAFT_TOOLS = tag("tools"); - private static TagKey tag(String name){ + private static TagKey tag(final String name){ return TagKey.create(Registries.ITEM, new ResourceLocation("vivecraft", name)); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/MethodHolder.java b/common/src/main/java/org/vivecraft/client_vr/MethodHolder.java deleted file mode 100644 index 045a235a6..000000000 --- a/common/src/main/java/org/vivecraft/client_vr/MethodHolder.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.vivecraft.client_vr; - -import com.mojang.math.Axis; -import org.joml.AxisAngle4f; -import org.lwjgl.glfw.GLFW; -import org.vivecraft.client_vr.provider.InputSimulator; - -import com.mojang.blaze3d.vertex.PoseStack; -import org.joml.Quaternionf; - -import net.minecraft.client.Minecraft; - -public abstract class MethodHolder { - - public static boolean isKeyDown(int i) { - return GLFW.glfwGetKey(Minecraft.getInstance().getWindow().getWindow(), i) == 1 || InputSimulator.isKeyDown(i); - } - - public static void notifyMirror(String text, boolean clear, int lengthMs) - { - ClientDataHolderVR clientDataHolderVR = ClientDataHolderVR.getInstance(); - clientDataHolderVR.mirroNotifyStart = System.currentTimeMillis(); - clientDataHolderVR.mirroNotifyLen = (long)lengthMs; - clientDataHolderVR.mirrorNotifyText = text; - clientDataHolderVR.mirrorNotifyClear = clear; - } - - public static void rotateDeg(PoseStack pose, float angle, float x, float y, float z) { - pose.mulPose(new Quaternionf(new AxisAngle4f(angle * 0.017453292F, x, y, z))); - } - - public static void rotateDegXp(PoseStack matrix, int i) { - matrix.mulPose(Axis.XP.rotationDegrees(i)); - } -} diff --git a/common/src/main/java/org/vivecraft/client_vr/ScreenUtils.java b/common/src/main/java/org/vivecraft/client_vr/ScreenUtils.java index 3021889e5..49b9e8785 100644 --- a/common/src/main/java/org/vivecraft/client_vr/ScreenUtils.java +++ b/common/src/main/java/org/vivecraft/client_vr/ScreenUtils.java @@ -1,12 +1,13 @@ package org.vivecraft.client_vr; -import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; -import org.vivecraft.client_vr.ClientDataHolderVR; + +import java.util.ArrayList; +import java.util.List; + +import static org.vivecraft.client_vr.VRState.dh; public class ScreenUtils { @@ -40,25 +41,21 @@ public static AbstractWidget getSelectedButton(Screen screen, int x, int y) } public static int getBGFrom(){ - if(ClientDataHolderVR.getInstance().vrSettings==null || ClientDataHolderVR.getInstance().vrSettings.menuBackground) + if(dh.vrSettings == null || dh.vrSettings.menuBackground) return -1072689136; return 0; } public static int getBGTo(){ - if(ClientDataHolderVR.getInstance().vrSettings==null || ClientDataHolderVR.getInstance().vrSettings.menuBackground) + if(dh.vrSettings == null || dh.vrSettings.menuBackground) return -804253680; return 0; } public static AbstractWidget getSelectedButton(int x, int y, List listButtons) { - for (int i = 0; i < listButtons.size(); ++i) - { - AbstractWidget abstractwidget = listButtons.get(i); - - if (abstractwidget.visible) - { + for (AbstractWidget abstractwidget : listButtons) { + if (abstractwidget.visible) { int j = abstractwidget.getWidth(); int k = abstractwidget.getHeight(); @@ -72,4 +69,4 @@ public static AbstractWidget getSelectedButton(int x, int y, List this.eye0; + case RIGHT -> this.eye1; + case THIRD -> this.c2; + case SCOPER -> this.t0; + case SCOPEL -> this.t1; + case CAMERA -> this.cam; + default -> this.hmd; + }; } public String toString() @@ -176,11 +190,7 @@ public String toString() return "data:\r\n \t\t origin: " + this.origin + "\r\n \t\t rotation: " + String.format("%.2f", this.rotation_radians) + "\r\n \t\t scale: " + String.format("%.2f", this.worldScale) + "\r\n \t\t hmd " + this.hmd + "\r\n \t\t c0 " + this.c0 + "\r\n \t\t c1 " + this.c1 + "\r\n \t\t c2 " + this.c2; } - protected Vec3 vecMult(Vec3 in, float factor) - { - return new Vec3(in.x * (double)factor, in.y * (double)factor, in.z * (double)factor); - } - + @ParametersAreNonnullByDefault public class VRDevicePose { final VRData data; @@ -191,50 +201,48 @@ public class VRDevicePose public VRDevicePose(VRData data, Matrix4f matrix, Vec3 pos, Vec3 dir) { this.data = data; - this.matrix = matrix.transposed().transposed(); + this.matrix = new Matrix4f(matrix); this.pos = new Vec3(pos.x, pos.y, pos.z); this.dir = new Vec3(dir.x, dir.y, dir.z); } public Vec3 getPosition() { - Vec3 vec3 = this.pos.scale((double)VRData.this.worldScale); - vec3 = vec3.yRot(this.data.rotation_radians); - return vec3.add(this.data.origin.x, this.data.origin.y, this.data.origin.z); + return this.pos.scale(this.data.worldScale).yRot(this.data.rotation_radians).add(this.data.origin); } public Vec3 getDirection() { - return (new Vec3(this.dir.x, this.dir.y, this.dir.z)).yRot(this.data.rotation_radians); + return this.dir.yRot(this.data.rotation_radians); } public Vec3 getCustomVector(Vec3 axis) { - Vector3 vector3 = this.matrix.transform(new Vector3((float)axis.x, (float)axis.y, (float)axis.z)); - return vector3.toVector3d().yRot(this.data.rotation_radians); + return convertToVec3( + new Vector3f((float)axis.x, (float)axis.y, (float)axis.z).mulProject(this.matrix).rotateY(this.data.rotation_radians) + ); } public float getYaw() { Vec3 vec3 = this.getDirection(); - return (float)Math.toDegrees(Math.atan2(-vec3.x, vec3.z)); + return (float)toDegrees(atan2(-vec3.x, vec3.z)); } public float getPitch() { Vec3 vec3 = this.getDirection(); - return (float)Math.toDegrees(Math.asin(vec3.y / vec3.length())); + return (float)toDegrees(asin(vec3.y / vec3.length())); } public float getRoll() { - return (float)(-Math.toDegrees(Math.atan2((double)this.matrix.M[1][0], (double)this.matrix.M[1][1]))); + return (float)(-toDegrees(atan2(this.matrix.m10(), this.matrix.m11()))); } public Matrix4f getMatrix() { - Matrix4f matrix4f = Matrix4f.rotationY(VRData.this.rotation_radians); - return Matrix4f.multiply(matrix4f, this.matrix); + return new Matrix4f(this.matrix).rotateY(this.data.rotation_radians); } public String toString() diff --git a/common/src/main/java/org/vivecraft/client_vr/VRState.java b/common/src/main/java/org/vivecraft/client_vr/VRState.java index 145a5f82a..d636c0139 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRState.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRState.java @@ -1,23 +1,41 @@ package org.vivecraft.client_vr; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import org.lwjgl.glfw.GLFW; -import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client.gui.screens.ErrorScreen; +import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.menuworlds.MenuWorldRenderer; import org.vivecraft.client_vr.provider.nullvr.NullVR; import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR; import org.vivecraft.client_vr.render.RenderConfigException; -import org.vivecraft.client_vr.settings.VRSettings; import org.vivecraft.client_xr.render_pass.RenderPassManager; import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; +import net.minecraft.network.chat.Component; + +import javax.annotation.Nonnull; + +/** + * The VR State Controller. + *
+ * Holds global toggles and other data holders. + */ public class VRState { public static boolean vrRunning = false; public static boolean vrEnabled = false; public static boolean vrInitialized = false; + /** + * The MC Data Holder. + * @apiNote Intended for use internal to Vivecraft. + *
+ * Other mods should {@link net.minecraft.client.Minecraft#getInstance()} instead. + * @see org.vivecraft.mixin.client_vr.MinecraftVRMixin#initVivecraft(net.minecraft.client.gui.screens.Overlay) + */ + @Nonnull public static net.minecraft.client.Minecraft mc = net.minecraft.client.Minecraft.getInstance(); + /** + * The VR Data Holder. + * @see org.vivecraft.mixin.client_vr.MinecraftVRMixin#initVivecraft(net.minecraft.client.gui.screens.Overlay) + */ + @Nonnull public static final ClientDataHolderVR dh = new ClientDataHolderVR(); public static void initializeVR() { if (vrInitialized) { @@ -29,63 +47,61 @@ public static void initializeVR() { } vrInitialized = true; - ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); - if (dh.vrSettings.stereoProviderPluginID == VRSettings.VRProvider.OPENVR) { - dh.vr = new MCOpenVR(Minecraft.getInstance(), dh); - } else { - dh.vr = new NullVR(Minecraft.getInstance(), dh); - } - if (!dh.vr.init()) { - throw new RenderConfigException("VR init Error", Component.translatable("vivecraft.messages.rendersetupfailed", dh.vr.initStatus + "\nVR provider: " + dh.vr.getName())); - } + dh.vr = switch (dh.vrSettings.stereoProviderPluginID) { + case OPENVR -> new MCOpenVR(); + default -> new NullVR(); + }; + if (dh.vr.init()) { + dh.vrRenderer = dh.vr.createVRRenderer(); + dh.vrRenderer.lastGuiScale = mc.options.guiScale().get(); + try + { + dh.vrRenderer.setupRenderConfiguration(); + RenderPassManager.setVanillaRenderPass(); + } catch (RenderConfigException renderConfigException) + { + throw new RenderConfigException("VR Render Error", Component.translatable("vivecraft.messages.rendersetupfailed", renderConfigException.error.getString() + "\nVR provider: " + dh.vr.getName())); + } catch (Exception e) + { + e.printStackTrace(); + } - dh.vrRenderer = dh.vr.createVRRenderer(); - dh.vrRenderer.lastGuiScale = Minecraft.getInstance().options.guiScale().get(); - try { - dh.vrRenderer.setupRenderConfiguration(); - RenderPassManager.setVanillaRenderPass(); - } catch(RenderConfigException renderConfigException) { - throw new RenderConfigException("VR Render Error", Component.translatable("vivecraft.messages.rendersetupfailed", renderConfigException.error.getString() + "\nVR provider: " + dh.vr.getName())); - } catch(Exception e) { - e.printStackTrace(); - } - - dh.vrPlayer = new VRPlayer(); - dh.vrPlayer.registerTracker(dh.backpackTracker); - dh.vrPlayer.registerTracker(dh.bowTracker); - dh.vrPlayer.registerTracker(dh.climbTracker); - dh.vrPlayer.registerTracker(dh.autoFood); - dh.vrPlayer.registerTracker(dh.jumpTracker); - dh.vrPlayer.registerTracker(dh.rowTracker); - dh.vrPlayer.registerTracker(dh.runTracker); - dh.vrPlayer.registerTracker(dh.sneakTracker); - dh.vrPlayer.registerTracker(dh.swimTracker); - dh.vrPlayer.registerTracker(dh.swingTracker); - dh.vrPlayer.registerTracker(dh.interactTracker); - dh.vrPlayer.registerTracker(dh.teleportTracker); - dh.vrPlayer.registerTracker(dh.horseTracker); - dh.vrPlayer.registerTracker(dh.vehicleTracker); - dh.vrPlayer.registerTracker(dh.crawlTracker); - dh.vrPlayer.registerTracker(dh.cameraTracker); + dh.vrPlayer = new VRPlayer(); + dh.vrPlayer.registerTracker(dh.backpackTracker); + dh.vrPlayer.registerTracker(dh.bowTracker); + dh.vrPlayer.registerTracker(dh.climbTracker); + dh.vrPlayer.registerTracker(dh.eatingTracker); + dh.vrPlayer.registerTracker(dh.jumpTracker); + dh.vrPlayer.registerTracker(dh.rowTracker); + dh.vrPlayer.registerTracker(dh.runTracker); + dh.vrPlayer.registerTracker(dh.sneakTracker); + dh.vrPlayer.registerTracker(dh.swimTracker); + dh.vrPlayer.registerTracker(dh.swingTracker); + dh.vrPlayer.registerTracker(dh.interactTracker); + dh.vrPlayer.registerTracker(dh.teleportTracker); + dh.vrPlayer.registerTracker(dh.horseTracker); + dh.vrPlayer.registerTracker(dh.vehicleTracker); + dh.vrPlayer.registerTracker(dh.crawlTracker); + dh.vrPlayer.registerTracker(dh.cameraTracker); - dh.vr.postinit(); + dh.vr.postinit(); - dh.menuWorldRenderer = new MenuWorldRenderer(); + dh.menuWorldRenderer = new MenuWorldRenderer(); - dh.menuWorldRenderer.init(); + dh.menuWorldRenderer.init(); + } + else + { + throw new RenderConfigException("VR init Error", Component.translatable("vivecraft.messages.rendersetupfailed", dh.vr.initStatus + "\nVR provider: " + dh.vr.getName())); + } } catch (RenderConfigException renderConfigException) { vrEnabled = false; destroyVR(true); - Minecraft.getInstance().setScreen(new ErrorScreen(renderConfigException.title, renderConfigException.error)); + mc.setScreen(new ErrorScreen(renderConfigException.title, renderConfigException.error)); } } - public static void startVR() { - GLFW.glfwSwapInterval(0); - } - public static void destroyVR(boolean disableVRSetting) { - ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); if (dh.vr != null) { dh.vr.destroy(); } @@ -103,12 +119,8 @@ public static void destroyVR(boolean disableVRSetting) { vrInitialized = false; vrRunning = false; if (disableVRSetting) { - ClientDataHolderVR.getInstance().vrSettings.vrEnabled = false; - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); + dh.vrSettings.vrEnabled = false; + dh.vrSettings.saveOptions(); } } - - public static void pauseVR() { - // GLFW.glfwSwapInterval(bl ? 1 : 0); - } } diff --git a/common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java b/common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java index 50e095fdf..36ba4a012 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRTextureTarget.java @@ -1,10 +1,11 @@ package org.vivecraft.client_vr; -import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.systems.RenderSystem; import org.vivecraft.client.Xplat; import org.vivecraft.client.extensions.RenderTargetExtension; +import com.mojang.blaze3d.pipeline.RenderTarget; +import com.mojang.blaze3d.systems.RenderSystem; + public class VRTextureTarget extends RenderTarget { private final String name; @@ -24,15 +25,19 @@ public VRTextureTarget(String name, int width, int height, boolean usedepth, boo @Override public String toString() { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("\n"); - if (this.name != null) { - stringbuilder.append("Name: " + this.name).append("\n"); - } - stringbuilder.append("Size: " + this.viewWidth + " x " + this.viewHeight).append("\n"); - stringbuilder.append("FB ID: " + this.frameBufferId).append("\n"); - stringbuilder.append("Tex ID: " + this.colorTextureId).append("\n"); - return stringbuilder.toString(); + return """ + Texture Target: + Name: %s + Size: %d x %d + FB ID: %d + Tex ID: %d + """.formatted( + this.name, + this.viewWidth, + this.viewHeight, + this.frameBufferId, + this.colorTextureId + ); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java index a7505fe8a..e9dde6f9c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java +++ b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java @@ -1,48 +1,58 @@ package org.vivecraft.client_vr; -import java.util.LinkedList; -import java.util.ListIterator; +import org.joml.Vector3d; +import org.joml.Vector3dc; +import org.joml.Vector3f; + import net.minecraft.Util; import net.minecraft.world.phys.Vec3; +import java.util.ArrayDeque; +import java.util.Deque; + +import static java.util.stream.Stream.generate; + public class Vec3History { - private int _capacity = 450; - private LinkedList _data = new LinkedList<>(); + private final int _capacity = 450; + private final Deque _data = new ArrayDeque<>(_capacity); + { + _data.addAll(generate(entry::new).limit(_capacity).toList()); + } - public void add(Vec3 in) + public void add(double x, double y, double z) + { + this._data.addFirst(this._data.removeLast().set(x, y, z)); + } + + public void add(Vector3dc in) { - this._data.add(new entry(in)); + this.add(in.x(), in.y(), in.z()); + } - if (this._data.size() > this._capacity) - { - this._data.removeFirst(); - } + public void add(Vec3 in) + { + this.add(in.x(), in.y(), in.z()); } - public void clear() + public Vector3d latest(Vector3d dest) { - this._data.clear(); + return dest.set((this._data.getFirst()).data); } - public Vec3 latest() + public Vector3f latest(Vector3f dest) { - return (this._data.getLast()).data; + return dest.set((this._data.getFirst()).data); } public double totalMovement(double seconds) { long i = Util.getMillis(); - ListIterator listiterator = this._data.listIterator(this._data.size()); entry vec3history$entry = null; double d0 = 0.0D; - int j = 0; - while (listiterator.hasPrevious()) + for (entry vec3history$entry1: this._data) { - entry vec3history$entry1 = listiterator.previous(); - ++j; - if ((double)(i - vec3history$entry1.ts) > seconds * 1000.0D) { break; @@ -54,25 +64,47 @@ public double totalMovement(double seconds) } else { - d0 += vec3history$entry.data.distanceTo(vec3history$entry1.data); + d0 += vec3history$entry.data.distance(vec3history$entry1.data); } } return d0; } - public Vec3 netMovement(double seconds) + public Vector3d netMovement(double seconds, Vector3d dest) { long i = Util.getMillis(); - ListIterator listiterator = this._data.listIterator(this._data.size()); entry vec3history$entry = null; entry vec3history$entry1 = null; - double d0 = 0.0D; - while (listiterator.hasPrevious()) + for (entry vec3history$entry2 : this._data) { - entry vec3history$entry2 = listiterator.previous(); + if ((double)(i - vec3history$entry2.ts) > seconds * 1000.0D) + { + break; + } + + if (vec3history$entry == null) + { + vec3history$entry = vec3history$entry2; + } + else + { + vec3history$entry1 = vec3history$entry2; + } + } + + return vec3history$entry != null && vec3history$entry1 != null ? vec3history$entry.data.sub(vec3history$entry1.data, dest) : dest.set(0); + } + + public Vector3f netMovement(double seconds, Vector3f dest) + { + long i = Util.getMillis(); + entry vec3history$entry = null; + entry vec3history$entry1 = null; + for (entry vec3history$entry2 : this._data) + { if ((double)(i - vec3history$entry2.ts) > seconds * 1000.0D) { break; @@ -88,21 +120,18 @@ public Vec3 netMovement(double seconds) } } - return vec3history$entry != null && vec3history$entry1 != null ? vec3history$entry.data.subtract(vec3history$entry1.data) : new Vec3(0.0D, 0.0D, 0.0D); + return vec3history$entry != null && vec3history$entry1 != null ? dest.set(vec3history$entry.data).sub((float)vec3history$entry1.data.x, (float)vec3history$entry1.data.y, (float)vec3history$entry1.data.z) : dest.set(0); } public double averageSpeed(double seconds) { long i = Util.getMillis(); - ListIterator listiterator = this._data.listIterator(this._data.size()); double d0 = 0.0D; entry vec3history$entry = null; int j = 0; - while (listiterator.hasPrevious()) + for (entry vec3history$entry1 : this._data) { - entry vec3history$entry1 = listiterator.previous(); - if ((double)(i - vec3history$entry1.ts) > seconds * 1000.0D) { break; @@ -115,46 +144,63 @@ public double averageSpeed(double seconds) else { ++j; - double d1 = 0.001D * (double)(vec3history$entry.ts - vec3history$entry1.ts); - double d2 = vec3history$entry.data.subtract(vec3history$entry1.data).length(); + double d1 = 0.001D * (vec3history$entry.ts - vec3history$entry1.ts); + double d2 = vec3history$entry.data.distance(vec3history$entry1.data); d0 += d2 / d1; } } - return j == 0 ? d0 : d0 / (double)j; + return j == 0 ? d0 : d0 / j; } - public Vec3 averagePosition(double seconds) + public Vector3d averagePosition(double seconds, Vector3d dest) { long i = Util.getMillis(); - ListIterator listiterator = this._data.listIterator(this._data.size()); - Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); - int j; - entry vec3history$entry; + int j = 0; - for (j = 0; listiterator.hasPrevious(); vec3 = vec3.add(vec3history$entry.data)) + for (entry vec3history$entry: this._data) { - vec3history$entry = listiterator.previous(); + if ((double)(i - vec3history$entry.ts) > seconds * 1000.0D) + { + break; + } + + dest.add(vec3history$entry.data); + ++j; + } + return j == 0 ? dest : dest.mul(1.0D / j); + } + + public Vector3f averagePosition(double seconds, Vector3f dest) + { + long i = Util.getMillis(); + int j = 0; + + for (entry vec3history$entry: this._data) + { if ((double)(i - vec3history$entry.ts) > seconds * 1000.0D) { break; } + dest.add((float) vec3history$entry.data.x, (float) vec3history$entry.data.y, (float)vec3history$entry.data.z); ++j; } - return j == 0 ? vec3 : vec3.scale(1.0D / (double)j); + return j == 0 ? dest : dest.mul(1.0F / j); } - private class entry + private static class entry { public long ts = Util.getMillis(); - public Vec3 data; + public Vector3d data = new Vector3d(); - public entry(Vec3 in) + public entry set(double x, double y, double z) { - this.data = in; + this.ts = Util.getMillis(); + this.data.set(x, y, z); + return this; } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/EntityRenderDispatcherVRExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/EntityRenderDispatcherVRExtension.java index 1f14500b7..044a7be74 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/EntityRenderDispatcherVRExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/EntityRenderDispatcherVRExtension.java @@ -1,8 +1,9 @@ package org.vivecraft.client_vr.extensions; -import org.joml.Quaternionf; import org.vivecraft.client_vr.render.VRArmRenderer; +import org.joml.Quaternionf; + import java.util.Map; public interface EntityRenderDispatcherVRExtension { diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java index f0c206b32..b0cc57f13 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java @@ -4,7 +4,7 @@ public interface FrustumExtension { - public void setCameraPosition(double var1, double var3, double var5); + void setCameraPosition(double var1, double var3, double var5); - public boolean isBoundingBoxInFrustum(AABB var1); + boolean isBoundingBoxInFrustum(AABB var1); } diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java index a72548d73..6fcc73b7e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java @@ -1,14 +1,15 @@ package org.vivecraft.client_vr.extensions; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.world.entity.LivingEntity; -import org.joml.Matrix4f; import org.vivecraft.client_vr.render.RenderPass; +import org.joml.Matrix4f; + import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.phys.Vec3; public interface GameRendererExtension { @@ -51,10 +52,10 @@ public interface GameRendererExtension { double getRveY(); - void renderVrFast(float partialTicks, boolean secondpass, boolean menuhandright, boolean menuHandleft, + void renderVrFast(float partialTicks, boolean secondpass, boolean menuHandRight, boolean menuHandLeft, PoseStack poseStack); - void renderVRFabulous(float f, LevelRenderer levelRenderer, boolean menuhandright, boolean menuHandleft, PoseStack poseStack); + void renderVRFabulous(float f, LevelRenderer levelRenderer, boolean menuHandRight, boolean menuHandLeft, PoseStack poseStack); void restoreRVEPos(LivingEntity e); diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/ItemInHandRendererExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/ItemInHandRendererExtension.java index 4a514b905..c3a371bbf 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/ItemInHandRendererExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/ItemInHandRendererExtension.java @@ -1,11 +1,12 @@ package org.vivecraft.client_vr.extensions; +import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; + import org.apache.commons.lang3.tuple.Triple; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; public interface ItemInHandRendererExtension { diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/LevelRendererExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/LevelRendererExtension.java index 3c55dfab7..9501632ad 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/LevelRendererExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/LevelRendererExtension.java @@ -1,6 +1,7 @@ package org.vivecraft.client_vr.extensions; import com.mojang.blaze3d.pipeline.RenderTarget; + import net.minecraft.world.entity.Entity; public interface LevelRendererExtension { diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/PlayerExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/PlayerExtension.java index f95794bed..8c8790ada 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/PlayerExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/PlayerExtension.java @@ -1,18 +1,15 @@ package org.vivecraft.client_vr.extensions; -import net.minecraft.client.player.LocalPlayer; import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.Vec3; public interface PlayerExtension { int getMovementTeleportTimer(); void setMovementTeleportTimer(int value); - void addMovementTeleportTimer(int value); boolean hasTeleported(); void setTeleported(boolean teleported); @@ -23,7 +20,7 @@ public interface PlayerExtension { boolean isClimbeyClimbEquipped(); - void stepSound(BlockPos blockpos, Vec3 vec3); + void stepSound(BlockPos blockpos, double soundPosX, double soundPosY, double soundPosZ); void swingArm(InteractionHand interactionhand, VRFirstPersonArmSwing interact); @@ -32,5 +29,4 @@ public interface PlayerExtension { float getMuhSpeedFactor(); double getRoomYOffsetFromPose(); boolean getInitFromServer(); - void updateSyncFields(LocalPlayer old); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRMovementStyle.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRMovementStyle.java index ca94b4f96..6a4792b49 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRMovementStyle.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRMovementStyle.java @@ -1,10 +1,12 @@ package org.vivecraft.client_vr.gameplay; -import org.vivecraft.client_vr.ClientDataHolderVR; - -import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import static org.vivecraft.client.utils.Utils.message; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class VRMovementStyle { public String name; @@ -29,12 +31,10 @@ public class VRMovementStyle public float endTeleportingSoundVolume; public boolean teleportOnRelease; public boolean arcAiming; - public ClientDataHolderVR dataholder; private static final ResourceLocation beamPng = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); - public VRMovementStyle(ClientDataHolderVR dataholder) + public VRMovementStyle() { - this.dataholder = dataholder; this.setStyle("Arc"); } @@ -42,120 +42,123 @@ public void setStyle(String requestedStyle) { boolean flag = true; - if (requestedStyle == "Minimal") - { - this.name = requestedStyle; - this.cameraSlide = false; - this.airSparkles = true; - this.destinationSparkles = true; - this.showBeam = false; - this.startTeleportingSound = null; - this.endTeleportingSoundVolume = 0.8F; - this.endTeleportingSound = "mob.endermen.portal"; - this.teleportOnRelease = false; - this.arcAiming = false; - } - else if (requestedStyle == "Beam") - { - this.name = requestedStyle; - this.cameraSlide = false; - this.airSparkles = true; - this.destinationSparkles = true; - this.showBeam = true; - this.beamWave = false; - this.beamArc = false; - this.beamSpiral = false; - this.beamGrow = true; - this.beamHalfWidth = 0.1F; - this.beamSegmentLength = 0.1F; - this.beamVStrips = 16; - this.renderVerticalStrip = true; - this.textureScrollSpeed = 3.0F; - this.texture = beamPng; - this.startTeleportingSound = null; - this.endTeleportingSoundVolume = 0.8F; - this.endTeleportingSound = "mob.endermen.portal"; - this.teleportOnRelease = false; - this.arcAiming = false; - } - else if (requestedStyle == "Tunnel") - { - this.name = requestedStyle; - this.cameraSlide = false; - this.airSparkles = true; - this.destinationSparkles = true; - this.showBeam = true; - this.beamWave = false; - this.beamArc = false; - this.beamSpiral = true; - this.beamGrow = true; - this.beamHalfWidth = 0.1F; - this.beamSpiralRadius = 1.6F; - this.renderVerticalStrip = true; - this.beamVStrips = 16; - this.textureScrollSpeed = 3.0F; - this.texture = beamPng; - this.startTeleportingSound = null; - this.endTeleportingSoundVolume = 0.8F; - this.endTeleportingSound = "mob.endermen.portal"; - this.teleportOnRelease = false; - this.arcAiming = false; - } - else if (requestedStyle == "Grapple") - { - this.name = requestedStyle; - this.cameraSlide = true; - this.airSparkles = false; - this.destinationSparkles = true; - this.showBeam = true; - this.beamWave = true; - this.beamArc = false; - this.beamSpiral = false; - this.beamGrow = true; - this.beamHalfWidth = 0.05F; - this.beamSegmentLength = 0.05F; - this.renderVerticalStrip = false; - this.beamVStrips = 2; - this.textureScrollSpeed = 7.0F; - this.texture = beamPng; - this.startTeleportingSoundVolume = 0.5F; - this.endTeleportingSoundVolume = 0.5F; - this.startTeleportingSound = null; - this.endTeleportingSound = "mob.endermen.portal"; - this.teleportOnRelease = false; - this.arcAiming = false; - } - else if (requestedStyle == "Arc") - { - this.name = requestedStyle; - this.cameraSlide = false; - this.airSparkles = false; - this.destinationSparkles = false; - this.showBeam = true; - this.beamWave = false; - this.beamArc = false; - this.beamSpiral = false; - this.beamGrow = false; - this.beamHalfWidth = 0.1F; - this.beamVStrips = 1; - this.renderVerticalStrip = true; - this.textureScrollSpeed = 3.0F; - this.texture = beamPng; - this.startTeleportingSound = null; - this.endTeleportingSoundVolume = 0.7F; - this.endTeleportingSound = null; - this.teleportOnRelease = true; - this.arcAiming = true; - } - else + switch (requestedStyle) { - flag = false; - ClientDataHolderVR.getInstance().printChatMessage("Unknown teleport style requested: " + requestedStyle); + case "Minimal" -> + { + this.name = requestedStyle; + this.cameraSlide = false; + this.airSparkles = true; + this.destinationSparkles = true; + this.showBeam = false; + this.startTeleportingSound = null; + this.endTeleportingSoundVolume = 0.8F; + this.endTeleportingSound = "mob.endermen.portal"; + this.teleportOnRelease = false; + this.arcAiming = false; + } + case "Beam" -> + { + this.name = requestedStyle; + this.cameraSlide = false; + this.airSparkles = true; + this.destinationSparkles = true; + this.showBeam = true; + this.beamWave = false; + this.beamArc = false; + this.beamSpiral = false; + this.beamGrow = true; + this.beamHalfWidth = 0.1F; + this.beamSegmentLength = 0.1F; + this.beamVStrips = 16; + this.renderVerticalStrip = true; + this.textureScrollSpeed = 3.0F; + this.texture = beamPng; + this.startTeleportingSound = null; + this.endTeleportingSoundVolume = 0.8F; + this.endTeleportingSound = "mob.endermen.portal"; + this.teleportOnRelease = false; + this.arcAiming = false; + } + case "Tunnel" -> + { + this.name = requestedStyle; + this.cameraSlide = false; + this.airSparkles = true; + this.destinationSparkles = true; + this.showBeam = true; + this.beamWave = false; + this.beamArc = false; + this.beamSpiral = true; + this.beamGrow = true; + this.beamHalfWidth = 0.1F; + this.beamSpiralRadius = 1.6F; + this.renderVerticalStrip = true; + this.beamVStrips = 16; + this.textureScrollSpeed = 3.0F; + this.texture = beamPng; + this.startTeleportingSound = null; + this.endTeleportingSoundVolume = 0.8F; + this.endTeleportingSound = "mob.endermen.portal"; + this.teleportOnRelease = false; + this.arcAiming = false; + } + case "Grapple" -> + { + this.name = requestedStyle; + this.cameraSlide = true; + this.airSparkles = false; + this.destinationSparkles = true; + this.showBeam = true; + this.beamWave = true; + this.beamArc = false; + this.beamSpiral = false; + this.beamGrow = true; + this.beamHalfWidth = 0.05F; + this.beamSegmentLength = 0.05F; + this.renderVerticalStrip = false; + this.beamVStrips = 2; + this.textureScrollSpeed = 7.0F; + this.texture = beamPng; + this.startTeleportingSoundVolume = 0.5F; + this.endTeleportingSoundVolume = 0.5F; + this.startTeleportingSound = null; + this.endTeleportingSound = "mob.endermen.portal"; + this.teleportOnRelease = false; + this.arcAiming = false; + } + case "Arc" -> + { + this.name = requestedStyle; + this.cameraSlide = false; + this.airSparkles = false; + this.destinationSparkles = false; + this.showBeam = true; + this.beamWave = false; + this.beamArc = false; + this.beamSpiral = false; + this.beamGrow = false; + this.beamHalfWidth = 0.1F; + this.beamVStrips = 1; + this.renderVerticalStrip = true; + this.textureScrollSpeed = 3.0F; + this.texture = beamPng; + this.startTeleportingSound = null; + this.endTeleportingSoundVolume = 0.7F; + this.endTeleportingSound = null; + this.teleportOnRelease = true; + this.arcAiming = true; + } + default -> + { + flag = false; + message(Component.translatableWithFallback("vivecraft.options.teleport.style", "Unknown teleport style requested: " + requestedStyle, requestedStyle)); + } } - if (flag && Minecraft.getInstance() != null && dataholder != null) + if (flag && mc != null && dh != null) { - dataholder.printChatMessage("Teleport style (RCTRL-M): " + this.name); + message(Component.translatableWithFallback("vivecraft.options.teleport.style", "Teleport style (RCTRL-M): " + this.name, this.name)); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java index 80e69c1b3..d40b57ec7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java @@ -1,5 +1,23 @@ package org.vivecraft.client_vr.gameplay; +import org.vivecraft.client.VivecraftVRMod; +import org.vivecraft.client.Xplat; +import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.client_vr.ItemTags; +import org.vivecraft.client_vr.VRData; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.extensions.PlayerExtension; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; +import org.vivecraft.client_vr.gameplay.trackers.Tracker; +import org.vivecraft.client_vr.gameplay.trackers.Tracker.EntryPoint; +import org.vivecraft.client_vr.gameplay.trackers.VehicleTracker; +import org.vivecraft.client_vr.settings.VRSettings.FreeMove; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; +import org.vivecraft.common.VRServerPerms; +import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.particle.TerrainParticle; import net.minecraft.client.player.LocalPlayer; @@ -10,51 +28,38 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BowItem; -import net.minecraft.world.item.CrossbowItem; -import net.minecraft.world.item.EggItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.PotionItem; -import net.minecraft.world.item.SnowballItem; -import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.world.item.*; import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.common.VRServerPerms; -import org.vivecraft.client_vr.gameplay.trackers.Tracker; -import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; -import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.ItemTags; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.extensions.PlayerExtension; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client_vr.gameplay.trackers.VehicleTracker; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Random; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import static java.lang.Math.pow; +import static org.joml.Math.*; + public class VRPlayer { - Minecraft mc = Minecraft.getInstance(); - ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); public VRData vrdata_room_pre; public VRData vrdata_world_pre; public VRData vrdata_room_post; public VRData vrdata_world_post; + @Nullable public VRData vrdata_world_render; ArrayList trackers = new ArrayList<>(); - public float worldScale = ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.WORLD_SCALE).getFloat(); - private float rawWorldScale = ClientDataHolderVR.getInstance().vrSettings.overrides.getSetting(VRSettings.VrOptions.WORLD_SCALE).getFloat(); + public float worldScale = dh.vrSettings.overrides.getSetting(VrOptions.WORLD_SCALE).getFloat(); + private float rawWorldScale = dh.vrSettings.overrides.getSetting(VrOptions.WORLD_SCALE).getFloat(); private boolean teleportOverride = false; public boolean teleportWarning = false; public boolean vrSwitchWarning = false; @@ -74,39 +79,31 @@ public void registerTracker(Tracker tracker) public VRPlayer() { - this.vrdata_room_pre = new VRData(new Vec3(0.0D, 0.0D, 0.0D), this.dh.vrSettings.walkMultiplier, 1.0F, 0.0F); - this.vrdata_room_post = new VRData(new Vec3(0.0D, 0.0D, 0.0D), this.dh.vrSettings.walkMultiplier, 1.0F, 0.0F); - this.vrdata_world_post = new VRData(new Vec3(0.0D, 0.0D, 0.0D), this.dh.vrSettings.walkMultiplier, 1.0F, 0.0F); - this.vrdata_world_pre = new VRData(new Vec3(0.0D, 0.0D, 0.0D), this.dh.vrSettings.walkMultiplier, 1.0F, 0.0F); + this.vrdata_room_pre = new VRData(); + this.vrdata_room_post = new VRData(); + this.vrdata_world_post = new VRData(); + this.vrdata_world_pre = new VRData(); } + @Nonnull public VRData getVRDataWorld() { return this.vrdata_world_render != null ? this.vrdata_world_render : this.vrdata_world_pre; } - public static VRPlayer get() - { - return ClientDataHolderVR.getInstance().vrPlayer; - } - public static Vec3 room_to_world_pos(Vec3 pos, VRData data) { - Vec3 vec3 = new Vec3(pos.x * (double)data.worldScale, pos.y * (double)data.worldScale, pos.z * (double)data.worldScale); - vec3 = vec3.yRot(data.rotation_radians); - return vec3.add(data.origin.x, data.origin.y, data.origin.z); + return pos.scale(data.worldScale).yRot(data.rotation_radians).add(data.origin); } public static Vec3 world_to_room_pos(Vec3 pos, VRData data) { - Vec3 vec3 = pos.add(-data.origin.x, -data.origin.y, -data.origin.z); - vec3 = new Vec3(vec3.x / (double)data.worldScale, vec3.y / (double)data.worldScale, vec3.z / (double)data.worldScale); - return vec3.yRot(-data.rotation_radians); + return pos.subtract(data.origin).scale(pow(data.worldScale, -1)).yRot(-data.rotation_radians); } public void postPoll() { - this.vrdata_room_pre = new VRData(new Vec3(0.0D, 0.0D, 0.0D), this.dh.vrSettings.walkMultiplier, 1.0F, 0.0F); + this.vrdata_room_pre = new VRData(); GuiHandler.processGui(); KeyboardHandler.processGui(); RadialHandler.processGui(); @@ -115,17 +112,17 @@ public void postPoll() public void preTick() { this.onTick = true; - this.vrdata_world_pre = new VRData(this.roomOrigin, this.dh.vrSettings.walkMultiplier, this.worldScale, (float)Math.toRadians((double)this.dh.vrSettings.worldRotation)); - float f = this.dh.vrSettings.overrides.getSetting(VRSettings.VrOptions.WORLD_SCALE).getFloat(); + this.vrdata_world_pre = new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)); + float f = dh.vrSettings.overrides.getSetting(VrOptions.WORLD_SCALE).getFloat(); - if (((GameRendererExtension) this.mc.gameRenderer).isInMenuRoom()) + if (((GameRendererExtension) mc.gameRenderer).isInMenuRoom()) { this.worldScale = 1.0F; } else { - if (this.wfCount > 0 && !this.mc.isPaused()) { + if (this.wfCount > 0 && !mc.isPaused()) { if (this.wfCount < 40) { - this.rawWorldScale = (float) ((double) this.rawWorldScale - this.wfMode); + this.rawWorldScale = (float) (this.rawWorldScale - this.wfMode); if (this.wfMode > 0.0D) { if (this.rawWorldScale < f) { @@ -135,7 +132,7 @@ public void preTick() this.rawWorldScale = f; } } else { - this.rawWorldScale = (float) ((double) this.rawWorldScale + this.wfMode); + this.rawWorldScale = (float) (this.rawWorldScale + this.wfMode); if (this.wfMode > 0.0D) { if (this.rawWorldScale > 20.0F) { @@ -164,69 +161,68 @@ else if (this.worldScale < 0.025F) //minClip + player position indicator offset } } - if (this.dh.vrSettings.seated && !((GameRendererExtension) this.mc.gameRenderer).isInMenuRoom()) + if (dh.vrSettings.seated && !((GameRendererExtension) mc.gameRenderer).isInMenuRoom()) { - this.dh.vrSettings.worldRotation = this.dh.vr.seatedRot; + dh.vrSettings.worldRotation = dh.vr.seatedRot; } } public void postTick() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - VRData vrdata = new VRData(this.vrdata_world_pre.origin, dataholder.vrSettings.walkMultiplier, this.vrdata_world_pre.worldScale, this.vrdata_world_pre.rotation_radians); - VRData vrdata1 = new VRData(this.vrdata_world_pre.origin, dataholder.vrSettings.walkMultiplier, this.worldScale, this.vrdata_world_pre.rotation_radians); + VRData vrdata = new VRData(this.vrdata_world_pre.origin, this.vrdata_world_pre.worldScale, this.vrdata_world_pre.rotation_radians); + VRData vrdata1 = new VRData(this.vrdata_world_pre.origin, this.worldScale, this.vrdata_world_pre.rotation_radians); Vec3 vec3 = vrdata1.hmd.getPosition().subtract(vrdata.hmd.getPosition()); this.roomOrigin = this.roomOrigin.subtract(vec3); - VRData vrdata2 = new VRData(this.roomOrigin, dataholder.vrSettings.walkMultiplier, this.worldScale, this.vrdata_world_pre.rotation_radians); - float f = dataholder.vrSettings.worldRotation; - float f1 = (float)Math.toDegrees((double)this.vrdata_world_pre.rotation_radians); - this.rotateOriginAround(-f + f1, vrdata2.getHeadPivot()); - this.vrdata_room_post = new VRData(new Vec3(0.0D, 0.0D, 0.0D), dataholder.vrSettings.walkMultiplier, 1.0F, 0.0F); - this.vrdata_world_post = new VRData(this.roomOrigin, dataholder.vrSettings.walkMultiplier, this.worldScale, (float)Math.toRadians((double)dataholder.vrSettings.worldRotation)); - this.doPermanantLookOverride(minecraft.player, this.vrdata_world_post); + VRData vrdata2 = new VRData(this.roomOrigin, this.worldScale, this.vrdata_world_pre.rotation_radians); + float rad = this.vrdata_world_pre.rotation_radians - toRadians(dh.vrSettings.worldRotation); + Vec3 o = vrdata2.getHeadPivot(); + if (rad != 0.0F) + { + this.setRoomOrigin(cos(rad) * (this.roomOrigin.x - o.x) - sin(rad) * (this.roomOrigin.z - o.z) + o.x, this.roomOrigin.y, sin(rad) * (this.roomOrigin.x - o.x) + cos(rad) * (this.roomOrigin.z - o.z) + o.z, false); + } + this.vrdata_room_post = new VRData(); + this.vrdata_world_post = new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)); + this.doPermanentLookOverride(mc.player, this.vrdata_world_post); ClientNetworking.sendVRPlayerPositions(this); this.onTick = false; } public void preRender(float par1) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); float f = this.vrdata_world_post.worldScale * par1 + this.vrdata_world_pre.worldScale * (1.0F - par1); float f1 = this.vrdata_world_post.rotation_radians; float f2 = this.vrdata_world_pre.rotation_radians; - float f3 = Math.abs(f1 - f2); + float f3 = abs(f1 - f2); - if ((double)f3 > Math.PI) + if (f3 > (float)PI) { if (f1 > f2) { - f2 = (float)((double)f2 + (Math.PI * 2D)); + f2 += (float)PI * 2F; } else { - f1 = (float)((double)f1 + (Math.PI * 2D)); + f1 += (float)PI * 2F; } } float f4 = f1 * par1 + f2 * (1.0F - par1); Vec3 vec3 = new Vec3(this.vrdata_world_pre.origin.x + (this.vrdata_world_post.origin.x - this.vrdata_world_pre.origin.x) * (double)par1, this.vrdata_world_pre.origin.y + (this.vrdata_world_post.origin.y - this.vrdata_world_pre.origin.y) * (double)par1, this.vrdata_world_pre.origin.z + (this.vrdata_world_post.origin.z - this.vrdata_world_pre.origin.z) * (double)par1); - this.vrdata_world_render = new VRData(vec3, dataholder.vrSettings.walkMultiplier, f, f4); + this.vrdata_world_render = new VRData(vec3, f, f4); for (Tracker tracker : this.trackers) { - if (tracker.getEntryPoint() == Tracker.EntryPoint.SPECIAL_ITEMS) + if (tracker.getEntryPoint() == EntryPoint.SPECIAL_ITEMS) { - tracker.idleTick(minecraft.player); + tracker.idleTick(); - if (tracker.isActive(minecraft.player)) + if (tracker.isActive()) { - tracker.doProcess(minecraft.player); + tracker.doProcess(); } else { - tracker.reset(minecraft.player); + tracker.reset(); } } } @@ -246,66 +242,50 @@ public void setRoomOrigin(double x, double y, double z, boolean reset) this.roomOrigin = new Vec3(x, y, z); } - public void snapRoomOriginToPlayerEntity(LocalPlayer player, boolean reset, boolean instant) + public void snapRoomOriginToPlayerEntity(boolean reset, boolean instant) { - if (!Thread.currentThread().getName().equals("Server thread")) + if (!"Server thread".equals(Thread.currentThread().getName())) { - if (player != null && player.position() != Vec3.ZERO) + if (mc.player != null && mc.player.position() != Vec3.ZERO) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.sneakTracker.sneakCounter <= 0) + if (dh.sneakTracker.sneakCounter <= 0) { VRData vrdata = this.vrdata_world_pre; if (instant) { - vrdata = new VRData(this.roomOrigin, dataholder.vrSettings.walkMultiplier, this.worldScale, (float)Math.toRadians((double)dataholder.vrSettings.worldRotation)); + vrdata = new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)); } Vec3 vec3 = vrdata.getHeadPivot().subtract(vrdata.origin); - double d0 = player.getX() - vec3.x; - double d2 = player.getZ() - vec3.z; - double d1 = player.getY() + ((PlayerExtension) player).getRoomYOffsetFromPose(); + double d0 = mc.player.getX() - vec3.x; + double d2 = mc.player.getZ() - vec3.z; + double d1 = mc.player.getY() + ((PlayerExtension) mc.player).getRoomYOffsetFromPose(); this.setRoomOrigin(d0, d1, d2, reset); } } } } - public float rotDiff_Degrees(float start, float end) - { - double d0 = Math.toRadians((double)end); - double d1 = Math.toRadians((double)start); - return (float)Math.toDegrees(Math.atan2(Math.sin(d0 - d1), Math.cos(d0 - d1))); - } - - public void rotateOriginAround(float degrees, Vec3 o) - { - Vec3 vec3 = this.roomOrigin; - float f = (float)Math.toRadians((double)degrees); - - if (f != 0.0F) - { - this.setRoomOrigin(Math.cos((double)f) * (vec3.x - o.x) - Math.sin((double)f) * (vec3.z - o.z) + o.x, vec3.y, Math.sin((double)f) * (vec3.x - o.x) + Math.cos((double)f) * (vec3.z - o.z) + o.z, false); - } - } - public void tick(LocalPlayer player, Minecraft mc, RandomSource rand) { if (((PlayerExtension) player).getInitFromServer()) { if (!this.initdone) { - System.out.println(""); - System.out.println("Room object: " + this); - System.out.println("Room origin: " + this.vrdata_world_pre.origin); - System.out.println("Hmd position room: " + this.vrdata_room_pre.hmd.getPosition()); - System.out.println("Hmd position world: " + this.vrdata_world_pre.hmd.getPosition()); - System.out.println("Hmd Projection Left: " + dh.vrRenderer.eyeproj[0]); - System.out.println("Hmd Projection Right: " + dh.vrRenderer.eyeproj[1]); - System.out.println(""); + logger.info( + """ + {} + Hmd Projection Left: + {} + Hmd Projection Right: + {} + """, + this, + dh.vrRenderer.eyeproj[0], + dh.vrRenderer.eyeproj[1] + ); this.initdone = true; } @@ -313,17 +293,17 @@ public void tick(LocalPlayer player, Minecraft mc, RandomSource rand) for (Tracker tracker : this.trackers) { - if (tracker.getEntryPoint() == Tracker.EntryPoint.LIVING_UPDATE) + if (tracker.getEntryPoint() == EntryPoint.LIVING_UPDATE) { - tracker.idleTick(mc.player); + tracker.idleTick(); - if (tracker.isActive(mc.player)) + if (tracker.isActive()) { - tracker.doProcess(mc.player); + tracker.doProcess(); } else { - tracker.reset(mc.player); + tracker.reset(); } } } @@ -332,19 +312,17 @@ public void tick(LocalPlayer player, Minecraft mc, RandomSource rand) { Entity entity = mc.player.getVehicle(); - if (entity instanceof AbstractHorse) + if (entity instanceof AbstractHorse abstracthorse) { - AbstractHorse abstracthorse = (AbstractHorse)entity; - if (abstracthorse.isControlledByLocalInstance() && abstracthorse.isSaddled() && !dh.horseTracker.isActive(mc.player)) + if (abstracthorse.isControlledByLocalInstance() && abstracthorse.isSaddled() && !dh.horseTracker.isActive()) { abstracthorse.yBodyRot = this.vrdata_world_pre.getBodyYaw(); dh.vehicleTracker.rotationCooldown = 10; } } - else if (entity instanceof Mob) + else if (entity instanceof Mob mob) { - Mob mob = (Mob)entity; if (mob.isControlledByLocalInstance()) { @@ -364,102 +342,129 @@ public void doPlayerMoveInRoom(LocalPlayer player) } else { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (player != null) + if (player != null && !player.isShiftKeyDown() && !player.isSleeping() && !dh.jumpTracker.isjumping() && + !dh.climbTracker.isGrabbingLadder() && player.isAlive() + ) { - if (!player.isShiftKeyDown()) + VRData vrdata = new VRData( + this.roomOrigin, + this.worldScale, + this.vrdata_world_pre.rotation_radians + ); + + if (dh.vehicleTracker.canRoomscaleDismount()) { - if (!player.isSleeping()) + Vec3 vec35 = mc.player.getVehicle().position(); + Vec3 vec36 = vrdata.getHeadPivot(); + double d6 = sqrt( + (vec36.x - vec35.x) * (vec36.x - vec35.x) + (vec36.z - vec35.z) * (vec36.z - vec35.z)); + + if (d6 > 1.0D) { - if (!dataholder.jumpTracker.isjumping()) + dh.sneakTracker.sneakCounter = 5; + } + } + else + { + float f = player.getBbWidth() / 2.0F; + float f1 = player.getBbHeight(); + Vec3 vec3 = vrdata.getHeadPivot(); + double d0 = vec3.x; + double d1 = player.getY(); + double d2 = vec3.z; + AABB aabb = new AABB( + d0 - (double) f, + d1, + d2 - (double) f, + d0 + (double) f, + d1 + (double) f1, + d2 + (double) f + ); + Vec3 vec31 = null; + float f2 = 0.0625F; + boolean flag = mc.level.noCollision(player, aabb); + + if (flag) + { + player.setPosRaw(d0, !dh.vrSettings.simulateFalling ? d1 : player.getY(), d2); + player.setBoundingBox(new AABB( + aabb.minX, + aabb.minY, + aabb.minZ, + aabb.maxX, + aabb.minY + (double) f1, + aabb.maxZ + )); + player.fallDistance = 0.0F; + this.getEstimatedTorsoPosition(d0, d1, d2); + } + else if ( + (dh.vrSettings.walkUpBlocks && ((PlayerExtension) player).getMuhJumpFactor() == 1.0F || + dh.climbTracker.isGrabbingLadder() && dh.vrSettings.realisticClimbEnabled + ) && player.fallDistance == 0.0F) + { + if (vec31 == null) + { + vec31 = this.getEstimatedTorsoPosition(d0, d1, d2); + } + + float f3 = player.getDimensions(player.getPose()).width * 0.45F; + double d3 = (double) (f - f3); + AABB aabb1 = new AABB( + vec31.x - d3, + aabb.minY, + vec31.z - d3, + vec31.x + d3, + aabb.maxY, + vec31.z + d3 + ); + boolean flag1 = !mc.level.noCollision(player, aabb1); + + if (flag1) { - if (!dataholder.climbTracker.isGrabbingLadder()) + double d4 = vec31.x - d0; + double d5 = vec31.z - d2; + aabb = aabb.move(d4, 0.0D, d5); + int i = 0; + + if (player.onClimbable() && dh.vrSettings.realisticClimbEnabled) { - if (player.isAlive()) + i = 6; + } + + for (int j = 0; j <= 10 + i; ++j) + { + aabb = aabb.move(0.0D, 0.1D, 0.0D); + flag = mc.level.noCollision(player, aabb); + + if (flag) { - VRData vrdata = new VRData(this.roomOrigin, dataholder.vrSettings.walkMultiplier, this.worldScale, this.vrdata_world_pre.rotation_radians); - - if (dataholder.vehicleTracker.canRoomscaleDismount(minecraft.player)) - { - Vec3 vec35 = minecraft.player.getVehicle().position(); - Vec3 vec36 = vrdata.getHeadPivot(); - double d6 = Math.sqrt((vec36.x - vec35.x) * (vec36.x - vec35.x) + (vec36.z - vec35.z) * (vec36.z - vec35.z)); - - if (d6 > 1.0D) - { - dataholder.sneakTracker.sneakCounter = 5; - } - } - else - { - float f = player.getBbWidth() / 2.0F; - float f1 = player.getBbHeight(); - Vec3 vec3 = vrdata.getHeadPivot(); - double d0 = vec3.x; - double d1 = player.getY(); - double d2 = vec3.z; - AABB aabb = new AABB(d0 - (double)f, d1, d2 - (double)f, d0 + (double)f, d1 + (double)f1, d2 + (double)f); - Vec3 vec31 = null; - float f2 = 0.0625F; - boolean flag = minecraft.level.noCollision(player, aabb); - - if (flag) - { - player.setPosRaw(d0, !dataholder.vrSettings.simulateFalling ? d1 : player.getY(), d2); - player.setBoundingBox(new AABB(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.minY + (double)f1, aabb.maxZ)); - player.fallDistance = 0.0F; - this.getEstimatedTorsoPosition(d0, d1, d2); - } - else if ((dataholder.vrSettings.walkUpBlocks && ((PlayerExtension) player).getMuhJumpFactor() == 1.0F || dataholder.climbTracker.isGrabbingLadder() && dataholder.vrSettings.realisticClimbEnabled) && player.fallDistance == 0.0F) - { - if (vec31 == null) - { - vec31 = this.getEstimatedTorsoPosition(d0, d1, d2); - } - - float f3 = player.getDimensions(player.getPose()).width * 0.45F; - double d3 = (double)(f - f3); - AABB aabb1 = new AABB(vec31.x - d3, aabb.minY, vec31.z - d3, vec31.x + d3, aabb.maxY, vec31.z + d3); - boolean flag1 = !minecraft.level.noCollision(player, aabb1); - - if (flag1) - { - double d4 = vec31.x - d0; - double d5 = vec31.z - d2; - aabb = aabb.move(d4, 0.0D, d5); - int i = 0; - - if (player.onClimbable() && dataholder.vrSettings.realisticClimbEnabled) - { - i = 6; - } - - for (int j = 0; j <= 10 + i; ++j) - { - aabb = aabb.move(0.0D, 0.1D, 0.0D); - flag = minecraft.level.noCollision(player, aabb); - - if (flag) - { - d0 = d0 + d4; - d2 = d2 + d5; - d1 = d1 + (double)(0.1F * (float)j); - player.setPosRaw(d0, d1, d2); - player.setBoundingBox(new AABB(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ)); - Vec3 vec32 = this.roomOrigin.add(d4, (double)(0.1F * (float)j), d5); - this.setRoomOrigin(vec32.x, vec32.y, vec32.z, false); - Vec3 vec33 = player.getLookAngle(); - Vec3 vec34 = (new Vec3(vec33.x, 0.0D, vec33.z)).normalize(); - player.fallDistance = 0.0F; - ((PlayerExtension) minecraft.player).stepSound(BlockPos.containing(player.position()), player.position()); - break; - } - } - } - } - } + d0 = d0 + d4; + d2 = d2 + d5; + d1 = d1 + (double) (0.1F * (float) j); + player.setPosRaw(d0, d1, d2); + player.setBoundingBox(new AABB( + aabb.minX, + aabb.minY, + aabb.minZ, + aabb.maxX, + aabb.maxY, + aabb.maxZ + )); + Vec3 vec32 = this.roomOrigin.add(d4, (double) (0.1F * (float) j), d5); + this.setRoomOrigin(vec32.x, vec32.y, vec32.z, false); + Vec3 vec33 = player.getLookAngle(); + Vec3 vec34 = (new Vec3(vec33.x, 0.0D, vec33.z)).normalize(); + player.fallDistance = 0.0F; + Vec3 pos = player.position(); + ((PlayerExtension) mc.player).stepSound( + BlockPos.containing(pos), + pos.x(), + pos.y(), + pos.z() + ); + break; } } } @@ -471,7 +476,7 @@ else if ((dataholder.vrSettings.walkUpBlocks && ((PlayerExtension) player).getMu public Vec3 getEstimatedTorsoPosition(double x, double y, double z) { - Entity entity = Minecraft.getInstance().player; + Entity entity = mc.player; Vec3 vec3 = entity.getLookAngle(); Vec3 vec31 = (new Vec3(vec3.x, 0.0D, vec3.z)).normalize(); float f = (float)vec3.y * 0.25F; @@ -481,26 +486,25 @@ public Vec3 getEstimatedTorsoPosition(double x, double y, double z) public void blockDust(double x, double y, double z, int count, BlockPos bp, BlockState bs, float scale, float velscale) { new Random(); - Minecraft minecraft = Minecraft.getInstance(); for (int i = 0; i < count; ++i) { - TerrainParticle terrainparticle = new TerrainParticle(minecraft.level, x, y, z, 0.0D, 0.0D, 0.0D, bs); + TerrainParticle terrainparticle = new TerrainParticle(mc.level, x, y, z, 0.0D, 0.0D, 0.0D, bs); terrainparticle.setPower(velscale); //TODO: check // minecraft.particleEngine.add(terrainparticle.init(bp).scale(scale)); - minecraft.particleEngine.add(terrainparticle.scale(scale)); + mc.particleEngine.add(terrainparticle.scale(scale)); } } public void updateFreeMove() { - if (this.dh.teleportTracker.isAiming()) + if (dh.teleportTracker.isAiming()) { this.isFreeMoveCurrent = false; } - if (this.mc.player.input.forwardImpulse != 0.0F || this.mc.player.input.leftImpulse != 0.0F) + if (mc.player.input.forwardImpulse != 0.0F || mc.player.input.leftImpulse != 0.0F) { this.isFreeMoveCurrent = true; } @@ -510,28 +514,28 @@ public void updateFreeMove() public boolean getFreeMove() { - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { - return this.dh.vrSettings.seatedFreeMove || !this.isTeleportEnabled(); + return dh.vrSettings.seatedFreeMove || !this.isTeleportEnabled(); } else { - return this.isFreeMoveCurrent || this.dh.vrSettings.forceStandingFreeMove; + return this.isFreeMoveCurrent || dh.vrSettings.forceStandingFreeMove; } } public String toString() { - return "VRPlayer: \r\n \t origin: " + this.roomOrigin + "\r\n \t rotation: " + String.format("%.3f", ClientDataHolderVR.getInstance().vrSettings.worldRotation) + "\r\n \t scale: " + String.format("%.3f", this.worldScale) + "\r\n \t room_pre " + this.vrdata_room_pre + "\r\n \t world_pre " + this.vrdata_world_pre + "\r\n \t world_post " + this.vrdata_world_post + "\r\n \t world_render " + this.vrdata_world_render; + return "VRPlayer: \r\n \t origin: " + this.roomOrigin + "\r\n \t rotation: " + String.format("%.3f", dh.vrSettings.worldRotation) + "\r\n \t scale: " + String.format("%.3f", this.worldScale) + "\r\n \t room_pre " + this.vrdata_room_pre + "\r\n \t world_pre " + this.vrdata_world_pre + "\r\n \t world_post " + this.vrdata_world_post + "\r\n \t world_render " + this.vrdata_world_render; } public Vec3 getRightClickLookOverride(Player entity, int c) { Vec3 vec3 = entity.getLookAngle(); - if (((GameRendererExtension) this.mc.gameRenderer).getCrossVec() != null) + if (((GameRendererExtension) mc.gameRenderer).getCrossVec() != null) { - vec3 = entity.getEyePosition(1.0F).subtract(((GameRendererExtension) this.mc.gameRenderer).getCrossVec()).normalize().reverse(); + vec3 = entity.getEyePosition(1.0F).subtract(((GameRendererExtension) mc.gameRenderer).getCrossVec()).normalize().reverse(); } ItemStack itemstack; @@ -554,11 +558,11 @@ public Vec3 getRightClickLookOverride(Player entity, int c) } } - VRData vrdata = this.dh.vrPlayer.vrdata_world_pre; + VRData vrdata = dh.vrPlayer.vrdata_world_pre; vec3 = vrdata.getController(c).getDirection(); - Vec3 vec31 = this.dh.bowTracker.getAimVector(); + Vec3 vec31 = dh.bowTracker.getAimVector(); - if (this.dh.bowTracker.isNotched() && vec31 != null && vec31.lengthSqr() > 0.0D) + if (dh.bowTracker.isNotched() && vec31 != null && vec31.lengthSqr() > 0.0D) { vec3 = vec31.reverse(); } @@ -566,78 +570,85 @@ public Vec3 getRightClickLookOverride(Player entity, int c) return vec3; } - if (itemstack.getItem() == Items.BUCKET && this.dh.interactTracker.bukkit[c]) + if (itemstack.getItem() == Items.BUCKET && dh.interactTracker.bukkit[c]) { - vec3 = entity.getEyePosition(1.0F).subtract(this.dh.vrPlayer.vrdata_world_pre.getController(c).getPosition()).normalize().reverse(); + vec3 = entity.getEyePosition(1.0F).subtract(dh.vrPlayer.vrdata_world_pre.getController(c).getPosition()).normalize().reverse(); } return vec3; } - public void doPermanantLookOverride(LocalPlayer entity, VRData data) + public void doPermanentLookOverride(LocalPlayer entity, VRData data) { - if (entity == null) - return; + if (entity == null) + return; - if (entity.isPassenger()) + if (entity.isPassenger()) { - //Server-side movement - Vec3 vec3 = VehicleTracker.getSteeringDirection(entity); + //Server-side movement + Vec3 vec3 = VehicleTracker.getSteeringDirection(entity); - if (vec3 != null) - { - entity.setXRot((float)Math.toDegrees(Math.asin(-vec3.y / vec3.length()))); - entity.setYRot((float)Math.toDegrees(Math.atan2(-vec3.x, vec3.z))); + if (vec3 != null) + { + entity.setXRot((float)toDegrees(asin(-vec3.y / vec3.length()))); + entity.setYRot((float)toDegrees(atan2(-vec3.x, vec3.z))); entity.setYHeadRot(entity.getYRot()); - } - } else if(entity.isBlocking()) { - //block direction - if (entity.getUsedItemHand() == InteractionHand.MAIN_HAND) { - entity.setYRot(data.getController(0).getYaw()); - entity.setYHeadRot(entity.getYRot()); - entity.setXRot(-data.getController(0).getPitch()); - } else { - entity.setYRot(data.getController(1).getYaw()); - entity.setYHeadRot(entity.getYRot()); - entity.setXRot(-data.getController(1).getPitch()); - } - } - else if (entity.isSprinting() && (entity.input.jumping || mc.options.keyJump.isDown()) || entity.isFallFlying() || entity.isSwimming() && entity.zza > 0.0F) + } + } + else if(entity.isBlocking()) + { + //block direction + if (entity.getUsedItemHand() == InteractionHand.MAIN_HAND) { - //Server-side movement - VRSettings.FreeMove freeMoveType = entity.isFallFlying() && this.dh.vrSettings.vrFreeMoveFlyMode != VRSettings.FreeMove.AUTO ? this.dh.vrSettings.vrFreeMoveFlyMode : this.dh.vrSettings.vrFreeMoveMode; - + entity.setYRot(data.getController(0).getYaw()); + entity.setYHeadRot(entity.getYRot()); + entity.setXRot(-data.getController(0).getPitch()); + } + else + { + entity.setYRot(data.getController(1).getYaw()); + entity.setYHeadRot(entity.getYRot()); + entity.setXRot(-data.getController(1).getPitch()); + } + } + else if (entity.isSprinting() && (entity.input.jumping || mc.options.keyJump.isDown()) || entity.isFallFlying() || entity.isSwimming() && entity.zza > 0.0F) + { + //Server-side movement + FreeMove freeMoveType = entity.isFallFlying() && dh.vrSettings.vrFreeMoveFlyMode != FreeMove.AUTO ? dh.vrSettings.vrFreeMoveFlyMode : dh.vrSettings.vrFreeMoveMode; - if (freeMoveType == VRSettings.FreeMove.CONTROLLER) - { - entity.setYRot(data.getController(1).getYaw()); - entity.setYHeadRot(entity.getYRot()); - entity.setXRot(-data.getController(1).getPitch()); - } - else - { - entity.setYRot(data.hmd.getYaw()); - entity.setYHeadRot(entity.getYRot()); - entity.setXRot(-data.hmd.getPitch()); - } + if (freeMoveType == FreeMove.CONTROLLER) + { + entity.setYRot(data.getController(1).getYaw()); + entity.setYHeadRot(entity.getYRot()); + entity.setXRot(-data.getController(1).getPitch()); + } + else + { + entity.setYRot(data.hmd.getYaw()); + entity.setYHeadRot(entity.getYRot()); + entity.setXRot(-data.hmd.getPitch()); } - else if (((GameRendererExtension)mc.gameRenderer).getCrossVec() != null){ - //Look AT the crosshair by default, most compatible with mods. - Vec3 playerToCrosshair = entity.getEyePosition(1).subtract(((GameRendererExtension)mc.gameRenderer).getCrossVec()); //backwards - double what = playerToCrosshair.y/playerToCrosshair.length(); - if(what > 1) what = 1; - if(what < -1) what = -1; - float pitch = (float)Math.toDegrees(Math.asin(what)); - float yaw = (float)Math.toDegrees(Math.atan2(playerToCrosshair.x, -playerToCrosshair.z)); - entity.setXRot(pitch); - entity.setYRot(yaw); - entity.setYHeadRot(yaw); - } else { - //use HMD only if no crosshair hit. - entity.setYRot(data.hmd.getYaw()); + } + else if (((GameRendererExtension)mc.gameRenderer).getCrossVec() != null) + { + //Look AT the crosshair by default, most compatible with mods. + Vec3 playerToCrosshair = entity.getEyePosition(1).subtract(((GameRendererExtension)mc.gameRenderer).getCrossVec()); //backwards + double what = playerToCrosshair.y/playerToCrosshair.length(); + if(what > 1) what = 1; + if(what < -1) what = -1; + float pitch = (float)toDegrees(asin(what)); + float yaw = (float)toDegrees(atan2(playerToCrosshair.x, -playerToCrosshair.z)); + entity.setXRot(pitch); + entity.setYRot(yaw); + entity.setYHeadRot(yaw); + } + else + { + //use HMD only if no crosshair hit. + entity.setYRot(data.hmd.getYaw()); entity.setYHeadRot(entity.getYRot()); - entity.setXRot(-data.hmd.getPitch()); + entity.setXRot(-data.hmd.getPitch()); } } @@ -648,16 +659,16 @@ public Vec3 AimedPointAtDistance(VRData source, int controller, double distance) return vec3.add(vec31.x * distance, vec31.y * distance, vec31.z * distance); } - public HitResult rayTraceBlocksVR(VRData source, int controller, double blockReachDistance, boolean p_174822_4_) + public HitResult rayTraceBlocksVR(VRData source, int controller, double blockReachDistance, boolean fluid) { Vec3 vec3 = source.getController(controller).getPosition(); Vec3 vec31 = this.AimedPointAtDistance(source, controller, blockReachDistance); - return this.mc.level.clip(new ClipContext(vec3, vec31, ClipContext.Block.OUTLINE, p_174822_4_ ? ClipContext.Fluid.ANY : ClipContext.Fluid.NONE, this.mc.player)); + return mc.level.clip(new ClipContext(vec3, vec31, Block.OUTLINE, fluid ? Fluid.ANY : Fluid.NONE, mc.player)); } public boolean isTeleportSupported() { - return !VRServerPerms.INSTANCE.noTeleportClient; + return !VRServerPerms.noTeleportClient; } public boolean isTeleportOverridden() @@ -667,15 +678,15 @@ public boolean isTeleportOverridden() public boolean isTeleportEnabled() { - boolean flag = !VRServerPerms.INSTANCE.noTeleportClient || this.teleportOverride; + boolean flag = !VRServerPerms.noTeleportClient || this.teleportOverride; - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { return flag; } else { - return flag && !this.dh.vrSettings.forceStandingFreeMove; + return flag && !dh.vrSettings.forceStandingFreeMove; } } @@ -687,7 +698,7 @@ public void setTeleportOverride(boolean override) public void updateTeleportKeys() { - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyTeleport).setEnabled(this.isTeleportEnabled()); - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyTeleportFallback).setEnabled(!this.isTeleportEnabled()); + dh.vr.getInputAction(VivecraftVRMod.keyTeleport).setEnabled(this.isTeleportEnabled()); + dh.vr.getInputAction(VivecraftVRMod.keyTeleportFallback).setEnabled(!this.isTeleportEnabled()); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java index fc3e95e79..e0bb147d6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java @@ -1,10 +1,22 @@ package org.vivecraft.client_vr.gameplay.screenhandlers; +import org.vivecraft.client_vr.VRData.VRDevicePose; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.client_vr.provider.HandedKeyBinding; +import org.vivecraft.client_vr.provider.InputSimulator; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.settings.VRSettings.HUDLock; + +import org.joml.Matrix4f; +import org.joml.Vector2f; +import org.joml.Vector3f; + import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.WinScreen; @@ -12,31 +24,20 @@ import net.minecraft.client.gui.screens.inventory.AbstractSignEditScreen; import net.minecraft.client.gui.screens.inventory.BookEditScreen; import net.minecraft.world.entity.vehicle.ContainerEntity; -import net.minecraft.world.phys.*; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult.Type; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; -import org.joml.Vector2f; +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.*; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.provider.HandedKeyBinding; -import org.vivecraft.client_vr.provider.InputSimulator; -import org.vivecraft.client_vr.provider.MCVR; -import org.vivecraft.client_vr.provider.openvr_lwjgl.OpenVRUtil; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; public class GuiHandler { - public static Minecraft mc = Minecraft.getInstance(); - public static ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); static boolean lastPressedLeftClick; static boolean lastPressedRightClick; static boolean lastPressedMiddleClick; @@ -50,12 +51,8 @@ public class GuiHandler public static boolean guiAppearOverBlockActive = false; public static float guiScale = 1.0F; public static float guiScaleApplied = 1.0F; - public static Vec3 IPoint = new Vec3(0.0D, 0.0D, 0.0D); - public static Vec3 guiPos_room = null; - public static Matrix4f guiRotation_room = null; - public static float hudScale = 1.0F; - public static Vec3 hudPos_room = new Vec3(0.0D, 0.0D, 0.0D); - public static Matrix4f hudRotation_room = new Matrix4f(); + public static Vec3 guiPos_room; + public static Matrix4f guiRotation_room; public static final KeyMapping keyLeftClick = new KeyMapping("vivecraft.key.guiLeftClick", -1, "vivecraft.key.category.gui"); public static final KeyMapping keyRightClick = new KeyMapping("vivecraft.key.guiRightClick", -1, "vivecraft.key.category.gui"); public static final KeyMapping keyMiddleClick = new KeyMapping("vivecraft.key.guiMiddleClick", -1, "vivecraft.key.category.gui"); @@ -69,7 +66,7 @@ public class GuiHandler { public boolean isPriorityOnController(ControllerType type) { - if (KeyboardHandler.Showing && !GuiHandler.dh.vrSettings.physicalKeyboard) + if (KeyboardHandler.isShowing() && !dh.vrSettings.physicalKeyboard) { return KeyboardHandler.isUsingController(type); } @@ -83,9 +80,9 @@ public boolean isPriorityOnController(ControllerType type) { public boolean isPriorityOnController(ControllerType type) { - if (KeyboardHandler.Showing) + if (KeyboardHandler.isShowing()) { - return GuiHandler.dh.vrSettings.physicalKeyboard ? true : KeyboardHandler.isUsingController(type); + return dh.vrSettings.physicalKeyboard || KeyboardHandler.isUsingController(type); } else { @@ -93,7 +90,7 @@ public boolean isPriorityOnController(ControllerType type) } } }; - public static RenderTarget guiFramebuffer = null; + public static RenderTarget guiFramebuffer; public static int guiWidth = 1280; public static int guiHeight = 720; public static int guiScaleFactor = calculateScale(0, false, guiWidth, guiHeight); @@ -103,11 +100,14 @@ public boolean isPriorityOnController(ControllerType type) public static int calculateScale(int scaleIn, boolean forceUnicode, int framebufferWidth, int framebufferHeight) { int j = 1; - while(j != scaleIn && - j < framebufferWidth && - j < framebufferHeight && - framebufferWidth / (j + 1) >= 320 && - framebufferHeight / (j + 1) >= 240) { + while( + j != scaleIn && + j < framebufferWidth && + j < framebufferHeight && + framebufferWidth / (j + 1) >= 320 && + framebufferHeight / (j + 1) >= 240 + ) + { ++j; } @@ -126,101 +126,92 @@ public static int calculateScale(int scaleIn, boolean forceUnicode, int framebuf public static void processGui() { - if (mc.screen != null) + if (mc.screen != null && !dh.vrSettings.seated && guiRotation_room != null && dh.vr.isControllerTracking(0)) { - if (!dh.vrSettings.seated) + Vec2 vec2 = getTexCoordsForCursor( + guiPos_room, + guiRotation_room, + guiScale, + dh.vrPlayer.vrdata_room_pre.getController(0) + ); + float f = vec2.x; + float f1 = vec2.y; + + if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) { - if (guiRotation_room != null) + if (controllerMouseX == -1.0D) { - if (MCVR.get().isControllerTracking(0)) - { - Vec2 vec2 = getTexCoordsForCursor(guiPos_room, guiRotation_room, mc.screen, guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); - float f = vec2.x; - float f1 = vec2.y; + controllerMouseX = (int) (f * (float) mc.getWindow().getScreenWidth()); + controllerMouseY = (int) (f1 * (float) mc.getWindow().getScreenHeight()); + } + else + { + float f2 = (int) (f * (float) mc.getWindow().getScreenWidth()); + float f3 = (int) (f1 * (float) mc.getWindow().getScreenHeight()); + controllerMouseX = controllerMouseX * (double) 0.7F + (double) (f2 * 0.3F); + controllerMouseY = controllerMouseY * (double) 0.7F + (double) (f3 * 0.3F); + } + } + else + { + controllerMouseX = -1.0D; + controllerMouseY = -1.0D; + } - if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) - { - if (controllerMouseX == -1.0D) - { - controllerMouseX = (double)((int)(f * (float)mc.getWindow().getScreenWidth())); - controllerMouseY = (double)((int)(f1 * (float)mc.getWindow().getScreenHeight())); - } - else - { - float f2 = (float)((int)(f * (float)mc.getWindow().getScreenWidth())); - float f3 = (float)((int)(f1 * (float)mc.getWindow().getScreenHeight())); - controllerMouseX = controllerMouseX * (double)0.7F + (double)(f2 * 0.3F); - controllerMouseY = controllerMouseY * (double)0.7F + (double)(f3 * 0.3F); - } - } - else - { - controllerMouseX = -1.0D; - controllerMouseY = -1.0D; - } + if (controllerMouseX >= 0.0D && controllerMouseX < (double) mc.getWindow().getScreenWidth() && + controllerMouseY >= 0.0D && controllerMouseY < (double) mc.getWindow().getScreenHeight()) + { + double d1 = clamp((int) controllerMouseX, 0, mc.getWindow().getScreenWidth()); + double d0 = clamp((int) controllerMouseY, 0, mc.getWindow().getScreenHeight()); - if (controllerMouseX >= 0.0D && controllerMouseX < (double)mc.getWindow().getScreenWidth() && controllerMouseY >= 0.0D && controllerMouseY < (double)mc.getWindow().getScreenHeight()) - { - double d1 = (double)Math.min(Math.max((int)controllerMouseX, 0), mc.getWindow().getScreenWidth()); - double d0 = (double)Math.min(Math.max((int)controllerMouseY, 0), mc.getWindow().getScreenHeight()); - int i = 0; - int j = 0; - - if (MCVR.get().isControllerTracking(ControllerType.RIGHT)) - { - InputSimulator.setMousePos(d1, d0); - controllerMouseValid = true; - } - } - else - { - if (controllerMouseTicks == 0) - { - controllerMouseValid = false; - } - - if (controllerMouseTicks > 0) - { - --controllerMouseTicks; - } - } - } + if (dh.vr.isControllerTracking(ControllerType.RIGHT)) + { + InputSimulator.setMousePos(d1, d0); + controllerMouseValid = true; + } + } + else + { + if (controllerMouseTicks == 0) + { + controllerMouseValid = false; + } + + if (controllerMouseTicks > 0) + { + --controllerMouseTicks; } } } } - public static Vec2 getTexCoordsForCursor(Vec3 guiPos_room, Matrix4f guiRotation_room, Screen screen, float guiScale, VRData.VRDevicePose controller) + public static Vec2 getTexCoordsForCursor(Vec3 guiPos_room, Matrix4f guiRotation_room, float guiScale, VRDevicePose controller) { Vec3 vec3 = controller.getPosition(); - Vector3 vector3 = new Vector3(vec3); + Vector3f vector3 = convertToVector3f(vec3); Vec3 vec31 = controller.getDirection(); - Vector3 vector31 = new Vector3((float)vec31.x, (float)vec31.y, (float)vec31.z); - Vector3 vector32 = new Vector3(0.0F, 0.0F, 1.0F); - Vector3 vector33 = guiRotation_room.transform(vector32); - Vector3 vector34 = guiRotation_room.transform(new Vector3(1.0F, 0.0F, 0.0F)); - Vector3 vector35 = guiRotation_room.transform(new Vector3(0.0F, 1.0F, 0.0F)); + Vector3f vector31 = convertToVector3f(vec31); + Vector3f vector33 = new Vector3f(backward).mulProject(guiRotation_room); + Vector3f vector34 = new Vector3f(right).mulProject(guiRotation_room); + Vector3f vector35 = new Vector3f(up).mulProject(guiRotation_room); float f = vector33.dot(vector31); - if (Math.abs(f) > 1.0E-5F) + if (abs(f) > 1.0E-5F) { float f1 = 1.0F; float f2 = f1 * 0.5F; float f3 = 1.0F; float f4 = f3 * 0.5F; - Vector3 vector36 = new Vector3(); - vector36.setX((float)guiPos_room.x); - vector36.setY((float)guiPos_room.y); - vector36.setZ((float)guiPos_room.z); - Vector3 vector37 = vector36.subtract(vector35.divide(1.0F / f4)).subtract(vector34.divide(1.0F / f2)); - float f5 = -vector33.dot(vector3.subtract(vector37)) / f; + Vector3f vector36 = convertToVector3f(guiPos_room); + Vector3f vector37 = vector36.sub(vector35.div(1.0F / f4, new Vector3f()), new Vector3f()).sub(vector34.div(1.0F / f2, new Vector3f()), new Vector3f()); + float f5 = -vector33.dot(vector3.sub(vector37, new Vector3f())) / f; if (f5 > 0.0F) { - Vector3 vector38 = vector3.add(vector31.divide(1.0F / f5)); - Vector3 vector39 = vector38.subtract(vector37); - float f6 = vector39.dot(vector34.divide(1.0F / f1)); - float f7 = vector39.dot(vector35.divide(1.0F / f1)); + Vector3f vector38 = vector3.add(vector31.div(1.0F / f5, new Vector3f()), new Vector3f()); + Vector3f vector39 = vector38.sub(vector37, new Vector3f()); + float f6 = vector39.dot(vector34.div(1.0F / f1, new Vector3f())); + float f7 = vector39.dot(vector35.div(1.0F / f1, new Vector3f())); float f8 = (float)mc.getWindow().getGuiScaledHeight() / (float)mc.getWindow().getGuiScaledWidth(); f6 = (f6 - 0.5F) / 1.5F / guiScale + 0.5F; f7 = (f7 - 0.5F) / f8 / 1.5F / guiScale + 0.5F; @@ -238,73 +229,73 @@ public static void processBindingsGui() if (keyLeftClick.consumeClick() && mc.screen != null && flag) { - InputSimulator.pressMouse(0); + InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_LEFT); lastPressedLeftClick = true; } if (!keyLeftClick.isDown() && lastPressedLeftClick) { - InputSimulator.releaseMouse(0); + InputSimulator.releaseMouse(GLFW_MOUSE_BUTTON_LEFT); lastPressedLeftClick = false; } if (keyRightClick.consumeClick() && mc.screen != null && flag) { - InputSimulator.pressMouse(1); + InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_RIGHT); lastPressedRightClick = true; } if (!keyRightClick.isDown() && lastPressedRightClick) { - InputSimulator.releaseMouse(1); + InputSimulator.releaseMouse(GLFW_MOUSE_BUTTON_RIGHT); lastPressedRightClick = false; } if (keyMiddleClick.consumeClick() && mc.screen != null && flag) { - InputSimulator.pressMouse(2); + InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_MIDDLE); lastPressedMiddleClick = true; } if (!keyMiddleClick.isDown() && lastPressedMiddleClick) { - InputSimulator.releaseMouse(2); + InputSimulator.releaseMouse(GLFW_MOUSE_BUTTON_MIDDLE); lastPressedMiddleClick = false; } if (keyShift.consumeClick() && mc.screen != null) { - InputSimulator.pressKey(340); + InputSimulator.pressKey(GLFW_KEY_LEFT_SHIFT); lastPressedShift = true; } if (!keyShift.isDown() && lastPressedShift) { - InputSimulator.releaseKey(340); + InputSimulator.releaseKey(GLFW_KEY_LEFT_SHIFT); lastPressedShift = false; } if (keyCtrl.consumeClick() && mc.screen != null) { - InputSimulator.pressKey(341); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); lastPressedCtrl = true; } if (!keyCtrl.isDown() && lastPressedCtrl) { - InputSimulator.releaseKey(341); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); lastPressedCtrl = false; } if (keyAlt.consumeClick() && mc.screen != null) { - InputSimulator.pressKey(342); + InputSimulator.pressKey(GLFW_KEY_LEFT_ALT); lastPressedAlt = true; } if (!keyAlt.isDown() && lastPressedAlt) { - InputSimulator.releaseKey(342); + InputSimulator.releaseKey(GLFW_KEY_LEFT_ALT); lastPressedAlt = false; } @@ -321,7 +312,7 @@ public static void processBindingsGui() public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, boolean unpressKeys) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } @@ -343,7 +334,7 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b } else { - RadialHandler.setOverlayShowing(false, (ControllerType)null); + RadialHandler.setOverlayShowing(false, null); } if (mc.level != null && !(newScreen instanceof WinScreen)) @@ -361,20 +352,16 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b } // check if the new screen is meant to show the MenuRoom, instead of the current screen - boolean staticScreen = mc.gameRenderer == null || (((GameRendererExtension) mc.gameRenderer).willBeInMenuRoom(newScreen)); + boolean staticScreen = ((GameRendererExtension) mc.gameRenderer).willBeInMenuRoom(newScreen); staticScreen = staticScreen & (!dh.vrSettings.seated && !dh.vrSettings.menuAlwaysFollowFace); if (staticScreen) { guiScale = 2.0F; - Vector2f afloat = MCVR.get().getPlayAreaSize(); + Vector2f afloat = dh.vr.getPlayAreaSize(); // slight offset to center of the room, to prevent z fighting - guiPos_room = new Vec3(0.02D, (double)1.3F, (double)(-Math.max(afloat != null ? afloat.y / 2.0F : 0.0F, 1.5F))); + guiPos_room = new Vec3(0.02D, (double)1.3F, (double)(-max(afloat != null ? afloat.y / 2.0F : 0.0F, 1.5F))); guiRotation_room = new Matrix4f(); - guiRotation_room.M[0][0] = guiRotation_room.M[1][1] = guiRotation_room.M[2][2] = guiRotation_room.M[3][3] = 1.0F; - guiRotation_room.M[0][1] = guiRotation_room.M[1][0] = guiRotation_room.M[2][3] = guiRotation_room.M[3][1] = 0.0F; - guiRotation_room.M[0][2] = guiRotation_room.M[1][2] = guiRotation_room.M[2][0] = guiRotation_room.M[3][2] = 0.0F; - guiRotation_room.M[0][3] = guiRotation_room.M[1][3] = guiRotation_room.M[2][1] = guiRotation_room.M[3][0] = 0.0F; } else { @@ -384,7 +371,7 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b // and if the pointed at block is the same that was last interacted with boolean isBlockScreen = newScreen instanceof AbstractContainerScreen && mc.hitResult != null - && (mc.hitResult.getType() == HitResult.Type.BLOCK); + && (mc.hitResult.getType() == Type.BLOCK); // check if screen is a container screen // and if the pointed at entity is the same that was last interacted with @@ -392,6 +379,8 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b && mc.hitResult instanceof EntityHitResult && ((EntityHitResult) mc.hitResult).getEntity() instanceof ContainerEntity; + Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); + if (guiAppearOverBlockActive && (isBlockScreen || isEntityScreen) && dh.vrSettings.guiAppearOverBlock) { Vec3 sourcePos; @@ -404,9 +393,8 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b } Vec3 roomPos = VRPlayer.world_to_room_pos(sourcePos, dh.vrPlayer.vrdata_world_pre); - Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); double distance = roomPos.subtract(hmdPos).length(); - guiScale = (float)Math.sqrt(distance); + guiScale = (float)sqrt(distance); Vec3 sourcePosWorld = new Vec3(sourcePos.x, sourcePos.y + 1.1D + (double)(0.5F * guiScale / 2.0F), sourcePos.z); guiPos_room = VRPlayer.world_to_room_pos(sourcePosWorld, dh.vrPlayer.vrdata_world_pre); } @@ -423,27 +411,20 @@ else if (newScreen instanceof BookEditScreen || newScreen instanceof AbstractSig vec3 = new Vec3(0.0D, 0.25D, -2.0D); } - Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector(vec3); guiPos_room = new Vec3(vec32.x / 2.0D + hmdPos.x, vec32.y / 2.0D + hmdPos.y, vec32.z / 2.0D + hmdPos.z); - if (dh.vrSettings.physicalKeyboard && KeyboardHandler.Showing && guiPos_room.y < hmdPos.y + 0.2D) + if (dh.vrSettings.physicalKeyboard && KeyboardHandler.isShowing() && guiPos_room.y < hmdPos.y + 0.2D) { guiPos_room = new Vec3(guiPos_room.x, hmdPos.y + 0.2D, guiPos_room.z); } } // orient screen - Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vector3 look = new Vector3(); - look.setX((float)(guiPos_room.x - hmdPos.x)); - look.setY((float)(guiPos_room.y - hmdPos.y)); - look.setZ((float)(guiPos_room.z - hmdPos.z)); - float pitch = (float)Math.asin((look.getY() / look.length())); - float yaw = (float)(Math.PI + Math.atan2(look.getX(), look.getZ())); - guiRotation_room = Matrix4f.rotationY(yaw); - Matrix4f tilt = Utils.rotationXMatrix(pitch); - guiRotation_room = Matrix4f.multiply(guiRotation_room, tilt); + Vector3f look = new Vector3f((float)(guiPos_room.x - hmdPos.x), (float)(guiPos_room.y - hmdPos.y), (float)(guiPos_room.z - hmdPos.z)); + float pitch = asin((look.y / look.length())); + float yaw = (float)(PI + atan2(look.x, look.z)); + guiRotation_room = new Matrix4f().rotationY(yaw).rotateX(pitch); } KeyboardHandler.orientOverlay(newScreen != null); @@ -457,13 +438,14 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixSt if (mc.screen != null && guiPos_room == null) { - //naughty mods! - onScreenChanged((Screen)null, mc.screen, false); - } else if (mc.screen == null && guiPos_room != null) + //naughty mods! + onScreenChanged(null, mc.screen, false); + } + else if (mc.screen == null && guiPos_room != null) { //even naughtier mods! // someone canceled the setScreen, so guiPos didn't get reset - onScreenChanged((Screen)null, null, false); + onScreenChanged(null, null, false); } Vec3 guipos = guiPos_room; @@ -473,73 +455,60 @@ public static Vec3 applyGUIModelView(RenderPass currentPass, PoseStack pMatrixSt if (guipos == null) { - guirot = null; + guirot = guirot == null ? new Matrix4f() : guirot; scale = 1.0F; if (mc.level != null && (mc.screen == null || !dh.vrSettings.floatInventory)) { - int i = 1; - - if (dh.vrSettings.reverseHands) - { - i = -1; - } - - if (!dh.vrSettings.seated && dh.vrSettings.vrHudLockMode != VRSettings.HUDLock.HEAD) + int hand = dh.vrSettings.reverseHands ? -1 : 1; + switch(dh.vrSettings.seated ? HUDLock.HEAD : dh.vrSettings.vrHudLockMode) { - if (dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.HAND) + case HAND -> { - Matrix4f matrix4f5 = dh.vr.getAimRotation(1); - Matrix4f matrix4f7 = Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians); - Matrix4f matrix4f9 = Matrix4f.multiply(matrix4f7, matrix4f5); - guirot = Matrix4f.multiply(matrix4f9, Utils.rotationXMatrix((-(float)Math.PI / 5F))); - guirot = Matrix4f.multiply(guirot, Matrix4f.rotationY(((float)Math.PI / 10F) * (float)i)); + guirot + .rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians) + .mul0(dh.vr.getAimRotation(1)) + .rotateX(-(float)PI / 5F) + .rotateY(((float)PI * 0.1F) * hand); scale = 0.58823526F; - guilocal = new Vec3(guilocal.x, 0.32D * (double)dh.vrPlayer.vrdata_world_render.worldScale, guilocal.z); + guilocal = new Vec3(guilocal.x, 0.32F * dh.vrPlayer.vrdata_world_render.worldScale, guilocal.z); guipos = ((GameRendererExtension) mc.gameRenderer).getControllerRenderPos(1); dh.vr.hudPopup = true; } - else if (dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.WRIST) + case WRIST -> { - Matrix4f matrix4f6 = dh.vr.getAimRotation(1); - Matrix4f matrix4f8 = Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians); - guirot = Matrix4f.multiply(matrix4f8, matrix4f6); - guirot = Matrix4f.multiply(guirot, Utils.rotationZMatrix(((float)Math.PI / 2F) * (float)i)); - guirot = Matrix4f.multiply(guirot, Matrix4f.rotationY(0.9424779F * (float)i)); + guirot.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians) + .mul0(dh.vr.getAimRotation(1)) + .rotateZ(((float)PI / 2F) * hand) + .rotateY(((float)PI * 0.3F) * hand); guipos = ((GameRendererExtension) mc.gameRenderer).getControllerRenderPos(1); dh.vr.hudPopup = true; - boolean flag = mc.player.getModelName().equals("slim"); scale = 0.4F; - guilocal = new Vec3((double)((float)i * -0.136F * dh.vrPlayer.vrdata_world_render.worldScale), (flag ? 0.13D : 0.12D) * (double)dh.vrPlayer.vrdata_world_render.worldScale, 0.06D * (double)dh.vrPlayer.vrdata_world_render.worldScale); - guirot = Matrix4f.multiply(guirot, Matrix4f.rotationY(((float)Math.PI / 5F) * (float)i)); + guilocal = new Vec3(hand * -0.136F * dh.vrPlayer.vrdata_world_render.worldScale, (mc.player.getModelName().equals("slim") ? 0.13F : 0.12F) * dh.vrPlayer.vrdata_world_render.worldScale, 0.06F * dh.vrPlayer.vrdata_world_render.worldScale); + guirot.rotateY(((float)PI / 5F) * hand); } - } - else - { - Matrix4f matrix4f1 = Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians); - Matrix4f matrix4f2 = Matrix4f.multiply(matrix4f1, dh.vr.hmdRotation); - Vec3 vec33 = dh.vrPlayer.vrdata_world_render.hmd.getPosition(); - Vec3 vec34 = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); - - if (dh.vrSettings.seated && dh.vrSettings.seatedHudAltMode) + default -> { - vec34 = dh.vrPlayer.vrdata_world_render.getController(0).getDirection(); - matrix4f2 = Matrix4f.multiply(matrix4f1, dh.vr.getAimRotation(0)); - } + guirot.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians).mul0(dh.vr.hmdRotation); + Vec3 vec33 = dh.vrPlayer.vrdata_world_render.hmd.getPosition(); + Vec3 vec34 = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); - guipos = new Vec3(vec33.x + vec34.x * (double)dh.vrPlayer.vrdata_world_render.worldScale * (double)dh.vrSettings.hudDistance, vec33.y + vec34.y * (double)dh.vrPlayer.vrdata_world_render.worldScale * (double)dh.vrSettings.hudDistance, vec33.z + vec34.z * (double)dh.vrPlayer.vrdata_world_render.worldScale * (double)dh.vrSettings.hudDistance); - Quaternion quaternion = OpenVRUtil.convertMatrix4ftoRotationQuat(matrix4f2); - guirot = new Matrix4f(quaternion); - scale = dh.vrSettings.hudScale; + if (dh.vrSettings.seated && dh.vrSettings.seatedHudAltMode) + { + vec34 = dh.vrPlayer.vrdata_world_render.getController(0).getDirection(); + guirot.mul0(dh.vr.getAimRotation(0)); + } + + guipos = new Vec3(vec33.x + vec34.x * dh.vrPlayer.vrdata_world_render.worldScale * dh.vrSettings.hudDistance, vec33.y + vec34.y * dh.vrPlayer.vrdata_world_render.worldScale * dh.vrSettings.hudDistance, vec33.z + vec34.z * dh.vrPlayer.vrdata_world_render.worldScale * dh.vrSettings.hudDistance); + scale = dh.vrSettings.hudScale; + } } } } else { - VRPlayer vrplayer1 = dh.vrPlayer; guipos = VRPlayer.room_to_world_pos(guipos, dh.vrPlayer.vrdata_world_render); - Matrix4f matrix4f4 = Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians); - guirot = Matrix4f.multiply(matrix4f4, guirot); + guirot = new Matrix4f(guirot).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); } if ((dh.vrSettings.seated || dh.vrSettings.menuAlwaysFollowFace) && ((GameRendererExtension) mc.gameRenderer).isInMenuRoom()) @@ -560,25 +529,20 @@ else if (dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.WRIST) f1 += f3; } - f1 = f1 / (float)dh.vr.hmdYawSamples.size(); - f1 = (float)Math.toRadians((double)f1); - Vec3 vec38 = new Vec3(-Math.sin((double)f1), 0.0D, Math.cos((double)f1)); + f1 /= dh.vr.hmdYawSamples.size(); + f1 = toRadians(f1); + Vec3 vec38 = new Vec3(-sin(f1), 0.0D, cos(f1)); float f4 = ((GameRendererExtension) mc.gameRenderer).isInMenuRoom() ? 2.5F * dh.vrPlayer.vrdata_world_render.worldScale : dh.vrSettings.hudDistance; Vec3 vec39 = vec35.add(new Vec3(vec38.x * (double)f4, vec38.y * (double)f4, vec38.z * (double)f4)); Vec3 vec310 = new Vec3(vec39.x, vec39.y, vec39.z); - Matrix4f matrix4f3 = Matrix4f.rotationY((float)Math.PI - f1); - guirot = Matrix4f.multiply(matrix4f3, Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians)); - VRPlayer vrplayer = dh.vrPlayer; guipos = VRPlayer.room_to_world_pos(vec310, dh.vrPlayer.vrdata_world_render); - guiRotation_room = matrix4f3; + guiRotation_room = guirot.rotationY((float)PI - f1).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); guiScale = 2.0F; guiPos_room = vec310; } - //GL11.glMultMatrixf(dh.vrPlayer.vrdata_world_render.getEye(currentPass).getMatrix().toFloatBuffer()); - if (guipos == null) { - VRSettings.logger.error("guipos was null, how did that happen. vrRunning: {}", VRState.vrRunning); + logger.error("guipos was null, how did that happen. vrRunning: {}", vrRunning); new RuntimeException().printStackTrace(); guiPos_room = new Vec3(0,0,0); guipos = VRPlayer.room_to_world_pos(guiPos_room, dh.vrPlayer.vrdata_world_render); @@ -588,9 +552,11 @@ else if (dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.WRIST) } Vec3 vec36 = guipos.subtract(vec3); - pMatrixStack.translate(vec36.x, vec36.y, vec36.z); - pMatrixStack.mulPoseMatrix(guirot.toMCMatrix()); - pMatrixStack.translate(guilocal.x, guilocal.y, guilocal.z); + pMatrixStack.last().pose() + .translate((float) vec36.x, (float) vec36.y, (float) vec36.z) + .mul(guirot) + .translate((float) guilocal.x, (float) guilocal.y, (float) guilocal.z) + ; float f2 = scale * dh.vrPlayer.vrdata_world_render.worldScale; pMatrixStack.scale(f2, f2, f2); guiScaleApplied = f2; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java index 885c05290..b6258276f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java @@ -1,29 +1,30 @@ package org.vivecraft.client_vr.gameplay.screenhandlers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.common.utils.lwjgl.Matrix4f; import org.vivecraft.client_vr.gui.GuiKeyboard; import org.vivecraft.client_vr.gui.PhysicalKeyboard; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.lwjgl.Vector3f; -import org.vivecraft.common.utils.math.Vector3; +import org.vivecraft.client_vr.provider.ControllerType; + +import org.joml.Matrix4f; +import org.joml.Vector3f; import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.Minecraft; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; + +import static org.joml.Math.*; + public class KeyboardHandler { - public static Minecraft mc = Minecraft.getInstance(); - public static ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); - public static boolean Showing = false; + private static boolean Showing = false; public static GuiKeyboard UI = new GuiKeyboard(); public static PhysicalKeyboard physicalKeyboard = new PhysicalKeyboard(); public static Vec3 Pos_room = new Vec3(0.0D, 0.0D, 0.0D); - public static org.vivecraft.common.utils.math.Matrix4f Rotation_room = new org.vivecraft.common.utils.math.Matrix4f(); + public static Matrix4f Rotation_room = new Matrix4f(); private static boolean lpl; private static boolean lps; private static boolean PointedL; @@ -36,7 +37,7 @@ public class KeyboardHandler public static boolean setOverlayShowing(boolean showingState) { - if (ClientDataHolderVR.kiosk) + if (dh.kiosk) { return false; } @@ -60,7 +61,7 @@ public static boolean setOverlayShowing(boolean showingState) } else { - UI.init(Minecraft.getInstance(), j, k); + UI.init(mc, j, k); } Showing = true; @@ -98,8 +99,8 @@ public static void processGui() } else { - Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, mc.screen, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); - Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, mc.screen, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); + Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); + Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); float f = vec21.x; float f1 = vec21.y; @@ -109,7 +110,6 @@ public static void processGui() { UI.cursorX2 = (float)((int)(f * (float)mc.getWindow().getScreenWidth())); UI.cursorY2 = (float)((int)(f1 * (float)mc.getWindow().getScreenHeight())); - PointedR = true; } else { @@ -117,8 +117,8 @@ public static void processGui() float f3 = (float)((int)(f1 * (float)mc.getWindow().getScreenHeight())); UI.cursorX2 = UI.cursorX2 * 0.7F + f2 * 0.3F; UI.cursorY2 = UI.cursorY2 * 0.7F + f3 * 0.3F; - PointedR = true; } + PointedR = true; } else { @@ -136,7 +136,6 @@ public static void processGui() { UI.cursorX1 = (float)((int)(f * (float)mc.getWindow().getScreenWidth())); UI.cursorY1 = (float)((int)(f1 * (float)mc.getWindow().getScreenHeight())); - PointedL = true; } else { @@ -144,8 +143,8 @@ public static void processGui() float f5 = (float)((int)(f1 * (float)mc.getWindow().getScreenHeight())); UI.cursorX1 = UI.cursorX1 * 0.7F + f4 * 0.3F; UI.cursorY1 = UI.cursorY1 * 0.7F + f5 * 0.3F; - PointedL = true; } + PointedL = true; } else { @@ -161,38 +160,30 @@ public static void processGui() public static void orientOverlay(boolean guiRelative) { - keyboardForGui = false; - if (Showing) { keyboardForGui = guiRelative; - Matrix4f matrix4f = new Matrix4f(); if (dh.vrSettings.physicalKeyboard) { Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); Vec3 vec31 = new Vec3(0.0D, -0.5D, 0.3D); - vec31 = vec31.yRot((float)Math.toRadians((double)(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw()))); + vec31 = vec31.yRot(toRadians(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw())); Pos_room = new Vec3(vec3.x + vec31.x, vec3.y + vec31.y, vec3.z + vec31.z); - float f = (float)Math.PI + (float)Math.toRadians((double)(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw())); - Rotation_room = org.vivecraft.common.utils.math.Matrix4f.rotationY(f); - Rotation_room = org.vivecraft.common.utils.math.Matrix4f.multiply(Rotation_room, Utils.rotationXMatrix(2.5132742F)); + float f = (float)PI + toRadians(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw()); + Rotation_room.rotationY(f).rotateX((float)PI * 0.8F); } else if (guiRelative && GuiHandler.guiRotation_room != null) { - Matrix4f matrix4f1 = Utils.convertOVRMatrix(GuiHandler.guiRotation_room); - Vec3 vec35 = new Vec3((double)matrix4f1.m10, (double)matrix4f1.m11, (double)matrix4f1.m12); - Vec3 vec37 = (new Vec3((double)matrix4f1.m20, (double)matrix4f1.m21, (double)matrix4f1.m22)).scale(0.25D * GuiHandler.guiScale); - vec35 = vec35.scale((double)0.8F); - matrix4f.translate(new Vector3f((float)(GuiHandler.guiPos_room.x - vec35.x), (float)(GuiHandler.guiPos_room.y - vec35.y), (float)(GuiHandler.guiPos_room.z - vec35.z))); - matrix4f.translate(new Vector3f((float)vec37.x, (float)vec37.y, (float)vec37.z)); - Matrix4f.mul(matrix4f, matrix4f1, matrix4f); - matrix4f.rotate((float)Math.toRadians(30.0D), new Vector3f(-1.0F, 0.0F, 0.0F)); - Rotation_room = Utils.convertToOVRMatrix(matrix4f); - Pos_room = new Vec3((double)Rotation_room.M[0][3], (double)Rotation_room.M[1][3], (double)Rotation_room.M[2][3]); - Rotation_room.M[0][3] = 0.0F; - Rotation_room.M[1][3] = 0.0F; - Rotation_room.M[2][3] = 0.0F; + Vector3f vec35 = GuiHandler.guiRotation_room.getColumn(1, new Vector3f()).mul(0.8F); + Vector3f vec37 = GuiHandler.guiRotation_room.getColumn(2, new Vector3f()).mul(0.25F * GuiHandler.guiScale); + Matrix4f matrix4f = new Matrix4f() + .translate((float)(GuiHandler.guiPos_room.x - vec35.x), (float)(GuiHandler.guiPos_room.y - vec35.y), (float)(GuiHandler.guiPos_room.z - vec35.z)) + .translate(vec37) + .mul(GuiHandler.guiRotation_room) + .rotateX(toRadians(-30.0F)); + Pos_room = convertToVec3(matrix4f.getTranslation(new Vector3f())); + Rotation_room.set(matrix4f.setTranslation(new Vector3f(0.0F, 0.0F, 0.0F))); } else { @@ -201,15 +192,20 @@ else if (guiRelative && GuiHandler.guiRotation_room != null) Vec3 vec36 = dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector(vec34); Pos_room = new Vec3(vec36.x / 2.0D + vec33.x, vec36.y / 2.0D + vec33.y, vec36.z / 2.0D + vec33.z); Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vector3 vector3 = new Vector3(); - vector3.setX((float)(Pos_room.x - vec32.x)); - vector3.setY((float)(Pos_room.y - vec32.y)); - vector3.setZ((float)(Pos_room.z - vec32.z)); - float f1 = (float)Math.asin((double)(vector3.getY() / vector3.length())); - float f2 = (float)((double)(float)Math.PI + Math.atan2((double)vector3.getX(), (double)vector3.getZ())); - Rotation_room = org.vivecraft.common.utils.math.Matrix4f.rotationY(f2); + Vector3f vector3 = new Vector3f( + (float)(Pos_room.x - vec32.x), + (float)(Pos_room.y - vec32.y), + (float)(Pos_room.z - vec32.z) + ); + float f1 = asin(vector3.y / vector3.length()); + float f2 = (float)PI + atan2(vector3.x, vector3.z); + Rotation_room.rotationY(f2); } } + else + { + keyboardForGui = false; + } } public static void processBindings() @@ -222,33 +218,33 @@ public static void processBindings() return; } - double d0 = (double)Math.min(Math.max((int)UI.cursorX1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); - double d1 = (double)Math.min(Math.max((int)UI.cursorY1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); + double d0 = (double)min(max((int)UI.cursorX1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); + double d1 = (double)min(max((int)UI.cursorY1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); if (PointedL && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.LEFT)) { - UI.mouseClicked((double)((int)d0), (double)((int)d1), 0); + UI.mouseClicked(d0, d1, 0); lastPressedClickL = true; } if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.LEFT) && lastPressedClickL) { - UI.mouseReleased((double)((int)d0), (double)((int)d1), 0); + UI.mouseReleased(d0, d1, 0); lastPressedClickL = false; } - d0 = (double)Math.min(Math.max((int)UI.cursorX2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); - d1 = (double)Math.min(Math.max((int)UI.cursorY2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); + d0 = (double)min(max((int)UI.cursorX2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); + d1 = (double)min(max((int)UI.cursorY2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); if (PointedR && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.RIGHT)) { - UI.mouseClicked((double)((int)d0), (double)((int)d1), 0); + UI.mouseClicked(d0, d1, 0); lastPressedClickR = true; } if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.RIGHT) && lastPressedClickR) { - UI.mouseReleased((double)((int)d0), (double)((int)d1), 0); + UI.mouseReleased(d0, d1, 0); lastPressedClickR = false; } @@ -266,6 +262,10 @@ public static void processBindings() } } + public static boolean isShowing() + { + return Showing; + } public static boolean isUsingController(ControllerType type) { return type == ControllerType.LEFT ? PointedL : PointedR; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java index bc4f7004c..b345340fa 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java @@ -1,24 +1,25 @@ package org.vivecraft.client_vr.gameplay.screenhandlers; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.gui.GuiRadial; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Vector3; +import org.vivecraft.client_vr.provider.ControllerType; + +import org.joml.Matrix4f; +import org.joml.Vector3f; import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.Minecraft; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class RadialHandler { - public static Minecraft mc = Minecraft.getInstance(); - public static ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); private static boolean Showing = false; public static GuiRadial UI = new GuiRadial(); public static Vec3 Pos_room = new Vec3(0.0D, 0.0D, 0.0D); @@ -27,7 +28,7 @@ public class RadialHandler private static boolean lps; private static boolean PointedL; private static boolean PointedR; - public static RenderTarget Framebuffer = null; + public static RenderTarget Framebuffer; private static ControllerType activecontroller; private static boolean lastPressedClickL; private static boolean lastPressedClickR; @@ -36,7 +37,7 @@ public class RadialHandler public static boolean setOverlayShowing(boolean showingState, ControllerType controller) { - if (ClientDataHolderVR.kiosk) + if (dh.kiosk) { return false; } @@ -53,7 +54,7 @@ public static boolean setOverlayShowing(boolean showingState, ControllerType con { int j = mc.getWindow().getGuiScaledWidth(); int k = mc.getWindow().getGuiScaledHeight(); - UI.init(Minecraft.getInstance(), j, k); + UI.init(mc, j, k); Showing = true; activecontroller = controller; orientOverlay(activecontroller); @@ -79,8 +80,8 @@ public static void processGui() { if (Rotation_room != null) { - Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, mc.screen, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); - Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, mc.screen, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); + Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); + Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); float f = vec21.x; float f1 = vec21.y; @@ -143,35 +144,28 @@ public static void orientOverlay(ControllerType controller) { if (isShowing()) { - VRData.VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.hmd; + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.hmd; float f = 2.0F; - int i = 0; - - if (controller == ControllerType.LEFT) - { - i = 1; - } + int con = (controller == ControllerType.LEFT) ? 1 : 0; if (dh.vrSettings.radialModeHold) { - vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(i); + vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(con); f = 1.2F; } - new Matrix4f(); Vec3 vec3 = vrdata$vrdevicepose.getPosition(); - Vec3 vec31 = new Vec3(0.0D, 0.0D, (double)(-f)); + Vec3 vec31 = new Vec3(0.0D, 0.0D, -f); Vec3 vec32 = vrdata$vrdevicepose.getCustomVector(vec31); Pos_room = new Vec3(vec32.x / 2.0D + vec3.x, vec32.y / 2.0D + vec3.y, vec32.z / 2.0D + vec3.z); - Vector3 vector3 = new Vector3(); - vector3.setX((float)(Pos_room.x - vec3.x)); - vector3.setY((float)(Pos_room.y - vec3.y)); - vector3.setZ((float)(Pos_room.z - vec3.z)); - float f1 = (float)Math.asin((double)(vector3.getY() / vector3.length())); - float f2 = (float)((double)(float)Math.PI + Math.atan2((double)vector3.getX(), (double)vector3.getZ())); - Rotation_room = Matrix4f.rotationY(f2); - Matrix4f matrix4f = Utils.rotationXMatrix(f1); - Rotation_room = Matrix4f.multiply(Rotation_room, matrix4f); + Vector3f vector3 = new Vector3f( + (float)(Pos_room.x - vec3.x), + (float)(Pos_room.y - vec3.y), + (float)(Pos_room.z - vec3.z) + ); + float f1 = asin(vector3.y / vector3.length()); + float f2 = (float)PI + atan2(vector3.x, vector3.z); + Rotation_room.rotationY(f2).rotateX(f1); } } @@ -203,10 +197,10 @@ public static void processBindings() lastPressedShiftR = false; } - double d0 = (double)Math.min(Math.max((int)UI.cursorX1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); - double d1 = (double)Math.min(Math.max((int)UI.cursorY1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); - double d2 = (double)Math.min(Math.max((int)UI.cursorX2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); - double d3 = (double)Math.min(Math.max((int)UI.cursorY2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); + double d0 = (double)min(max((int)UI.cursorX1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); + double d1 = (double)min(max((int)UI.cursorY1, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); + double d2 = (double)min(max((int)UI.cursorX2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledWidth() / (double)mc.getWindow().getScreenWidth(); + double d3 = (double)min(max((int)UI.cursorY2, 0), mc.getWindow().getScreenWidth()) * (double)mc.getWindow().getGuiScaledHeight() / (double)mc.getWindow().getScreenHeight(); if (dh.vrSettings.radialModeHold) { @@ -215,43 +209,43 @@ public static void processBindings() return; } - if (!VivecraftVRMod.INSTANCE.keyRadialMenu.isDown()) + if (!VivecraftVRMod.keyRadialMenu.isDown()) { if (activecontroller == ControllerType.LEFT) { - UI.mouseClicked((double)((int)d0), (double)((int)d1), 0); + UI.mouseClicked(d0, d1, 0); } else { - UI.mouseClicked((double)((int)d2), (double)((int)d3), 0); + UI.mouseClicked(d2, d3, 0); } - setOverlayShowing(false, (ControllerType)null); + setOverlayShowing(false, null); } } else { if (PointedL && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.LEFT)) { - UI.mouseClicked((double)((int)d0), (double)((int)d1), 0); + UI.mouseClicked(d0, d1, 0); lastPressedClickL = true; } if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.LEFT) && lastPressedClickL) { - UI.mouseReleased((double)((int)d0), (double)((int)d1), 0); + UI.mouseReleased(d0, d1, 0); lastPressedClickL = false; } if (PointedR && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.RIGHT)) { - UI.mouseClicked((double)((int)d2), (double)((int)d3), 0); + UI.mouseClicked(d2, d3, 0); lastPressedClickR = true; } if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.RIGHT) && lastPressedClickR) { - UI.mouseReleased((double)((int)d2), (double)((int)d3), 0); + UI.mouseReleased(d2, d3, 0); lastPressedClickR = false; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java index 0540d73e2..bbdd967af 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java @@ -1,82 +1,72 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class BackpackTracker extends Tracker { public boolean[] wasIn = new boolean[2]; public int previousSlot = 0; - private Vec3 down = new Vec3(0.0D, -1.0D, 0.0D); - - public BackpackTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } + private final Vec3 down = new Vec3(0.0D, -1.0D, 0.0D); - public boolean isActive(LocalPlayer p) + public boolean isActive() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!dataholder.vrSettings.backpackSwitching) + else if (!dh.vrSettings.backpackSwitching) { return false; } - else if (p == null) + else if (mc.player == null) { return false; } - else if (minecraft.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (p.isSleeping()) + else if (mc.player.isSleeping()) { return false; } else { - return !dataholder.bowTracker.isDrawing; + return !dh.bowTracker.isDrawing; } } - public void doProcess(LocalPlayer player) + public void doProcess() { - VRPlayer vrplayer = this.dh.vrPlayer; - Vec3 vec3 = vrplayer.vrdata_room_pre.getHeadRear(); + Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadRear(); for (int i = 0; i < 2; ++i) { - Vec3 vec31 = vrplayer.vrdata_room_pre.getController(i).getPosition(); - Vec3 vec32 = vrplayer.vrdata_room_pre.getHand(i).getDirection(); - Vec3 vec33 = vrplayer.vrdata_room_pre.hmd.getDirection(); + Vec3 vec31 = dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(); + Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.getHand(i).getDirection(); + Vec3 vec33 = dh.vrPlayer.vrdata_room_pre.hmd.getDirection(); Vec3 vec34 = vec3.subtract(vec31); double d0 = vec32.dot(this.down); double d1 = vec34.dot(vec33); - boolean flag = Math.abs(vec3.y - vec31.y) < 0.25D; + boolean flag = abs(vec3.y - vec31.y) < 0.25D; boolean flag1 = d1 > 0.0D && vec34.length() > 0.05D; boolean flag2 = d0 > 0.6D; boolean flag3 = d1 < 0.0D && vec34.length() > 0.25D; boolean flag4 = d0 < 0.0D; boolean flag5 = flag && flag1 && flag2; - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); if (flag5) { @@ -84,33 +74,33 @@ public void doProcess(LocalPlayer player) { if (i == 0) { - if (!dataholder.climbTracker.isGrabbingLadder() || !dataholder.climbTracker.isClaws(minecraft.player.getMainHandItem())) + if (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getMainHandItem())) { - if (player.getInventory().selected != 0) + if (mc.player.getInventory().selected != 0) { - this.previousSlot = player.getInventory().selected; - player.getInventory().selected = 0; + this.previousSlot = mc.player.getInventory().selected; + mc.player.getInventory().selected = 0; } else { - player.getInventory().selected = this.previousSlot; + mc.player.getInventory().selected = this.previousSlot; this.previousSlot = 0; } } } - else if (!dataholder.climbTracker.isGrabbingLadder() || !dataholder.climbTracker.isClaws(minecraft.player.getOffhandItem())) + else if (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getOffhandItem())) { - if (dataholder.vrSettings.physicalGuiEnabled) + if (dh.vrSettings.physicalGuiEnabled) { //minecraft.physicalGuiManager.toggleInventoryBag(); } else { - player.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); + mc.player.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); } } - dataholder.vr.triggerHapticPulse(i, 1500); + dh.vr.triggerHapticPulse(i, 1500); this.wasIn[i] = true; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java index 105f62ea6..9c991b3fe 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java @@ -1,30 +1,31 @@ package org.vivecraft.client_vr.gameplay.trackers; -import java.nio.ByteBuffer; - -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; import org.vivecraft.client.Xplat; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.VRData; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.common.utils.math.Vector3; +import org.vivecraft.client_vr.extensions.PlayerExtension; +import org.vivecraft.client_vr.settings.VRSettings.BowMode; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.UseAnim; import net.minecraft.world.phys.Vec3; +import javax.annotation.Nullable; +import java.nio.ByteBuffer; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVector3f; + +import static org.joml.Math.*; + public class BowTracker extends Tracker { private double lastcontrollersDist; @@ -47,11 +48,6 @@ public class BowTracker extends Tracker int hapcounter = 0; int lasthapStep = 0; - public BowTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - public Vec3 getAimVector() { return this.aim; @@ -73,11 +69,11 @@ public static boolean isBow(ItemStack itemStack) { return false; } - else if (ClientDataHolderVR.getInstance().vrSettings.bowMode == VRSettings.BowMode.OFF) + else if (dh.vrSettings.bowMode == BowMode.OFF) { return false; } - else if (ClientDataHolderVR.getInstance().vrSettings.bowMode == VRSettings.BowMode.VANILLA) + else if (dh.vrSettings.bowMode == BowMode.VANILLA) { return itemStack.getItem() == Items.BOW; } @@ -87,37 +83,51 @@ else if (ClientDataHolderVR.getInstance().vrSettings.bowMode == VRSettings.BowMo } } - public static boolean isHoldingBow(LivingEntity e, InteractionHand hand) + public static boolean isHoldingBow(InteractionHand hand) + { + return !dh.vrSettings.seated && isBow(mc.player.getItemInHand(hand)); + } + + public static boolean isHoldingBowEither() { - return ClientDataHolderVR.getInstance().vrSettings.seated ? false : isBow(e.getItemInHand(hand)); + return isHoldingBow(InteractionHand.MAIN_HAND) || isHoldingBow(InteractionHand.OFF_HAND); } - public static boolean isHoldingBowEither(LivingEntity e) + @Override public boolean isActive() { - return isHoldingBow(e, InteractionHand.MAIN_HAND) || isHoldingBow(e, InteractionHand.OFF_HAND); + return this.isActive(null); } - public boolean isActive(LocalPlayer p) + /** + * Test a specific hand isActive. + * @param hand the hand to test or either hand (null) + * @return bow tracker isActive for the specified hand or either hand + */ + public boolean isActive(@Nullable InteractionHand hand) { - if (p == null) + if (mc.player == null) { return false; } - else if (this.mc.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (p.isSleeping()) + else if (mc.player.isSleeping()) { return false; } + else if (hand != null) + { + return isHoldingBow(hand); + } else { - return isHoldingBow(p, InteractionHand.MAIN_HAND) || isHoldingBow(p, InteractionHand.OFF_HAND); + return isHoldingBowEither(); } } @@ -126,28 +136,21 @@ public boolean isCharged() return Util.getMillis() - this.startDrawTime >= this.maxDrawMillis; } - public void reset(LocalPlayer player) + @Override public void reset() { this.isDrawing = false; } - public EntryPoint getEntryPoint() + @Override public EntryPoint getEntryPoint() { return EntryPoint.SPECIAL_ITEMS; } - public void doProcess(LocalPlayer player) + @Override public void doProcess() { - VRData vrdata = this.dh.vrPlayer.vrdata_world_render; - - if (vrdata == null) - { - vrdata = this.dh.vrPlayer.vrdata_world_pre; - } - - VRPlayer vrplayer = this.dh.vrPlayer; + VRData vrdata = dh.vrPlayer.getVRDataWorld(); - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { this.aim = vrdata.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, 1.0D)); } @@ -158,11 +161,11 @@ public void doProcess(LocalPlayer player) this.lastpressed = this.pressed; this.lastDraw = this.currentDraw; this.lastcanDraw = this.canDraw; - this.maxDraw = (double)this.mc.player.getBbHeight() * 0.22D; + this.maxDraw = (double)mc.player.getBbHeight() * 0.22D; if (Xplat.isModLoaded("pehkui")) { // this is meant to be relative to the base Bb height, not the scaled one - this.maxDraw /= PehkuiHelper.getPlayerBbScale(player, mc.getFrameTime()); + this.maxDraw /= PehkuiHelper.getPlayerBbScale(mc.player, mc.getFrameTime()); } Vec3 vec3 = vrdata.getController(0).getPosition(); @@ -173,30 +176,28 @@ public void doProcess(LocalPlayer player) double d0 = vec3.distanceTo(vec33); this.aim = vec3.subtract(vec31).normalize(); Vec3 vec34 = vrdata.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)); - Vector3 vector3 = new Vector3((float)vec34.x, (float)vec34.y, (float)vec34.z); Vec3 vec35 = vrdata.getHand(1).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); - Vector3 vector31 = new Vector3((float)vec35.x, (float)vec35.y, (float)vec35.z); - this.controllersDot = (180D / Math.PI) * Math.acos((double)vector31.dot(vector3)); - this.pressed = this.mc.options.keyAttack.isDown(); + this.controllersDot = (180D / PI) * acos((double) convertToVector3f(vec35).dot(convertToVector3f(vec34))); + this.pressed = mc.options.keyAttack.isDown(); float f = 0.15F * vrdata.worldScale; - boolean flag = isHoldingBow(player, InteractionHand.MAIN_HAND); + boolean flag = isHoldingBow(InteractionHand.MAIN_HAND); InteractionHand interactionhand = flag ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; ItemStack itemstack = ItemStack.EMPTY; ItemStack itemstack1 = ItemStack.EMPTY; if (flag) { - itemstack1 = player.getMainHandItem(); - itemstack = player.getProjectile(itemstack1); + itemstack1 = mc.player.getMainHandItem(); + itemstack = mc.player.getProjectile(itemstack1); } else { - if (player.getMainHandItem().is(ItemTags.ARROWS)) + if (mc.player.getMainHandItem().is(ItemTags.ARROWS)) { - itemstack = player.getMainHandItem(); + itemstack = mc.player.getMainHandItem(); } - itemstack1 = player.getOffhandItem(); + itemstack1 = mc.player.getOffhandItem(); } int i = itemstack1.getUseDuration(); @@ -215,33 +216,33 @@ public void doProcess(LocalPlayer player) if (!this.isDrawing) { - ((PlayerExtension) player).setItemInUseClient(itemstack1, interactionhand); - ((PlayerExtension) player).setItemInUseCountClient(i); + ((PlayerExtension) mc.player).setItemInUseClient(itemstack1, interactionhand); + ((PlayerExtension) mc.player).setItemInUseCountClient(i); //Minecraft.getInstance().physicalGuiManager.preClickAction(); } } else if ((float)Util.getMillis() - this.tsNotch > 500.0F) { this.canDraw = false; - ((PlayerExtension) player).setItemInUseClient(ItemStack.EMPTY, interactionhand); + ((PlayerExtension) mc.player).setItemInUseClient(ItemStack.EMPTY, interactionhand); } if (!this.isDrawing && this.canDraw && this.pressed && !this.lastpressed) { this.isDrawing = true; //Minecraft.getInstance().physicalGuiManager.preClickAction(); - this.mc.gameMode.useItem(player, interactionhand); + mc.gameMode.useItem(mc.player, interactionhand); } if (this.isDrawing && !this.pressed && this.lastpressed && (double)this.getDrawPercent() > 0.0D) { - this.dh.vr.triggerHapticPulse(0, 500); - this.dh.vr.triggerHapticPulse(1, 3000); + dh.vr.triggerHapticPulse(0, 500); + dh.vr.triggerHapticPulse(1, 3000); ServerboundCustomPayloadPacket serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(this.getDrawPercent()).array()); - Minecraft.getInstance().getConnection().send(serverboundcustompayloadpacket); - this.mc.gameMode.releaseUsingItem(player); + mc.getConnection().send(serverboundcustompayloadpacket); + mc.gameMode.releaseUsingItem(mc.player); serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(0.0F).array()); - Minecraft.getInstance().getConnection().send(serverboundcustompayloadpacket); + mc.getConnection().send(serverboundcustompayloadpacket); this.isDrawing = false; } @@ -252,8 +253,8 @@ else if ((float)Util.getMillis() - this.tsNotch > 500.0F) if (!this.isDrawing && this.canDraw && !this.lastcanDraw) { - this.dh.vr.triggerHapticPulse(1, 800); - this.dh.vr.triggerHapticPulse(0, 800); + dh.vr.triggerHapticPulse(1, 800); + dh.vr.triggerHapticPulse(0, 800); } if (this.isDrawing) @@ -273,37 +274,37 @@ else if ((float)Util.getMillis() - this.tsNotch > 500.0F) } int l = (int)((float)itemstack1.getUseDuration() - this.getDrawPercent() * (float)this.maxDrawMillis); - ((PlayerExtension) player).setItemInUseClient(itemstack1, interactionhand); - double d1 = (double)this.getDrawPercent(); + ((PlayerExtension) mc.player).setItemInUseClient(itemstack1, interactionhand); + double d1 = this.getDrawPercent(); if (d1 >= 1.0D) { - ((PlayerExtension) player).setItemInUseCountClient(k); + ((PlayerExtension) mc.player).setItemInUseCountClient(k); } else if (d1 > 0.4D) { - ((PlayerExtension) player).setItemInUseCountClient(j); + ((PlayerExtension) mc.player).setItemInUseCountClient(j); } else { - ((PlayerExtension) player).setItemInUseCountClient(i); + ((PlayerExtension) mc.player).setItemInUseCountClient(i); } int i1 = (int)(d1 * 4.0D * 4.0D * 3.0D); if (i1 % 2 == 0 && this.lasthapStep != i1) { - this.dh.vr.triggerHapticPulse(0, j1); + dh.vr.triggerHapticPulse(0, j1); if (d1 == 1.0D) { - this.dh.vr.triggerHapticPulse(1, j1); + dh.vr.triggerHapticPulse(1, j1); } } if (this.isCharged() && this.hapcounter % 4 == 0) { - this.dh.vr.triggerHapticPulse(1, 200); + dh.vr.triggerHapticPulse(1, 200); } this.lasthapStep = i1; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java index 7c53a8bc8..bbb1aa883 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java @@ -1,43 +1,39 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRData; +import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; +import org.joml.Matrix4f; +import org.joml.Quaternionf; +import org.joml.Vector3f; + import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class CameraTracker extends Tracker { public static final ModelResourceLocation cameraModel = new ModelResourceLocation("vivecraft", "camera", ""); public static final ModelResourceLocation cameraDisplayModel = new ModelResourceLocation("vivecraft", "camera_display", ""); private boolean visible = false; private Vec3 position = new Vec3(0.0D, 0.0D, 0.0D); - private Quaternion rotation = new Quaternion(); + private Quaternionf rotation = new Quaternionf(); private int startController; - private VRData.VRDevicePose startControllerPose; + private VRDevicePose startControllerPose; private Vec3 startPosition; - private Quaternion startRotation; + private Quaternionf startRotation; private boolean quickMode; - public CameraTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer player) + @Override + public boolean isActive() { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (this.dh.vrSettings.seated) + else if (dh.vrSettings.seated) { return false; } @@ -47,38 +43,42 @@ else if (this.dh.vrSettings.seated) } } - public void doProcess(LocalPlayer player) + @Override + public void doProcess() { if (this.startControllerPose != null) { - VRData.VRDevicePose vrdata$vrdevicepose = this.dh.vrPlayer.vrdata_world_render.getController(this.startController); + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_render.getController(this.startController); Vec3 vec3 = this.startControllerPose.getPosition(); Vec3 vec31 = vrdata$vrdevicepose.getPosition().subtract(vec3); - Matrix4f matrix4f = Matrix4f.multiply(vrdata$vrdevicepose.getMatrix(), this.startControllerPose.getMatrix().inverted()); - Vector3 vector3 = new Vector3((float)this.startPosition.x - (float)vec3.x, (float)this.startPosition.y - (float)vec3.y, (float)this.startPosition.z - (float)vec3.z); - Vector3 vector31 = matrix4f.transform(vector3); - this.position = new Vec3(this.startPosition.x + (double)((float)vec31.x) + (double)(vector31.getX() - vector3.getX()), this.startPosition.y + (double)((float)vec31.y) + (double)(vector31.getY() - vector3.getY()), this.startPosition.z + (double)((float)vec31.z) + (double)(vector31.getZ() - vector3.getZ())); - this.rotation = this.startRotation.multiply(new Quaternion(Utils.convertOVRMatrix(matrix4f))); + Matrix4f matrix4f = vrdata$vrdevicepose.getMatrix().mul0(this.startControllerPose.getMatrix().invertAffine(), new Matrix4f()); + Vector3f vector3 = new Vector3f((float)this.startPosition.x - (float)vec3.x, (float)this.startPosition.y - (float)vec3.y, (float)this.startPosition.z - (float)vec3.z); + Vector3f vector31 = vector3.mulProject(matrix4f, new Vector3f()); + this.position = new Vec3(this.startPosition.x + (double)((float)vec31.x) + (double)(vector31.x - vector3.x), this.startPosition.y + (double)((float)vec31.y) + (double)(vector31.y - vector3.y), this.startPosition.z + (double)((float)vec31.z) + (double)(vector31.z - vector3.z)); + this.rotation.setFromNormalized(matrix4f); + this.startRotation.mul(this.rotation, this.rotation); } - if (this.quickMode && !this.isMoving() && !this.dh.grabScreenShot) + if (this.quickMode && !this.isMoving() && !dh.grabScreenShot) { this.visible = false; } - if (this.dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().distanceTo(this.position) > (double)(this.mc.options.getEffectiveRenderDistance() * 12)) + if (dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().distanceTo(this.position) > (double)(mc.options.getEffectiveRenderDistance() * 12)) { this.visible = false; } } - public void reset(LocalPlayer player) + @Override + public void reset() { this.visible = false; this.quickMode = false; this.stopMoving(); } + @Override public EntryPoint getEntryPoint() { return EntryPoint.SPECIAL_ITEMS; @@ -104,12 +104,12 @@ public void setPosition(Vec3 position) this.position = position; } - public Quaternion getRotation() + public Quaternionf getRotation() { return this.rotation; } - public void setRotation(Quaternion rotation) + public void setRotation(Quaternionf rotation) { this.rotation = rotation; } @@ -132,9 +132,9 @@ public boolean isQuickMode() public void startMoving(int controller, boolean quickMode) { this.startController = controller; - this.startControllerPose = this.dh.vrPlayer.vrdata_world_pre.getController(controller); + this.startControllerPose = dh.vrPlayer.vrdata_world_pre.getController(controller); this.startPosition = this.position; - this.startRotation = this.rotation.copy(); + this.startRotation = new Quaternionf(this.rotation); this.quickMode = quickMode; } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java index fbb660252..4fae83d11 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java @@ -1,25 +1,18 @@ package org.vivecraft.client_vr.gameplay.trackers; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Random; -import java.util.Set; - -import net.minecraft.network.chat.contents.TranslatableContents; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; +import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.BlockTags; -import org.vivecraft.common.network.CommonNetworkHelper; import org.vivecraft.client_vr.extensions.PlayerExtension; -import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.common.network.CommonNetworkHelper; + +import org.joml.Vector3d; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.effect.MobEffects; @@ -33,6 +26,14 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; +import java.util.*; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; + +import static org.joml.Math.*; + public class ClimbTracker extends Tracker { private boolean[] latched = new boolean[2]; @@ -61,11 +62,6 @@ public class ClimbTracker extends Tracker private Random rand = new Random(); boolean unsetflag; - public ClimbTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - public boolean isGrabbingLadder() { return this.latched[0] || this.latched[1]; @@ -110,33 +106,33 @@ else if (!i.hasTag() || !i.getTag().getBoolean("Unbreakable")) } } - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!this.dh.vrPlayer.getFreeMove() && !ClientDataHolderVR.getInstance().vrSettings.simulateFalling) + else if (!dh.vrPlayer.getFreeMove() && !dh.vrSettings.simulateFalling) { return false; } - else if (!this.dh.vrSettings.realisticClimbEnabled) + else if (!dh.vrSettings.realisticClimbEnabled) { return false; } - else if (p != null && p.isAlive()) + else if (mc.player != null && mc.player.isAlive()) { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (p.isPassenger()) + else if (mc.player.isPassenger()) { return false; } else { - return this.isClimbeyClimbEquipped() || p.zza == 0.0F && p.xxa == 0.0F; + return this.isClimbeyClimbEquipped() || mc.player.zza == 0.0F && mc.player.xxa == 0.0F; } } else @@ -147,22 +143,22 @@ else if (p.isPassenger()) public boolean isClimbeyClimb() { - return !this.isActive(this.mc.player) ? false : this.isClimbeyClimbEquipped(); + return this.isActive() && this.isClimbeyClimbEquipped(); } public boolean isClimbeyClimbEquipped() { - return ClientNetworking.serverAllowsClimbey && ((PlayerExtension) this.mc.player).isClimbeyClimbEquipped(); + return ClientNetworking.serverAllowsClimbey && ((PlayerExtension) mc.player).isClimbeyClimbEquipped(); } - private boolean canstand(BlockPos bp, LocalPlayer p) + private boolean canstand(BlockPos bp) { - AABB aabb = p.level().getBlockState(bp).getCollisionShape(p.level(), bp).bounds(); + AABB aabb = mc.player.level().getBlockState(bp).getCollisionShape(mc.player.level(), bp).bounds(); if (aabb != null && aabb.maxY != 0.0D) { BlockPos blockpos = bp.above(); - AABB aabb1 = p.level().getBlockState(blockpos).getCollisionShape(p.level(), blockpos).bounds(); + AABB aabb1 = mc.player.level().getBlockState(blockpos).getCollisionShape(mc.player.level(), blockpos).bounds(); if (aabb1 != null && aabb1.maxY > 0.0D) { @@ -171,7 +167,7 @@ private boolean canstand(BlockPos bp, LocalPlayer p) else { BlockPos blockpos1 = blockpos.above(); - AABB aabb2 = p.level().getBlockState(blockpos1).getCollisionShape(p.level(), blockpos1).bounds(); + AABB aabb2 = mc.player.level().getBlockState(blockpos1).getCollisionShape(mc.player.level(), blockpos1).bounds(); return aabb2 == null || !(aabb2.maxY > 0.0D); } } @@ -181,9 +177,9 @@ private boolean canstand(BlockPos bp, LocalPlayer p) } } - public void idleTick(LocalPlayer player) + public void idleTick() { - if (!this.isActive(player)) + if (!this.isActive()) { this.waslatched[0] = false; this.waslatched[1] = false; @@ -193,24 +189,24 @@ public void idleTick(LocalPlayer player) { this.forceActivate = true; } - else if (this.mc.player.onGround() || this.mc.player.getAbilities().flying) + else if (mc.player.onGround() || mc.player.getAbilities().flying) { this.forceActivate = false; } - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyClimbeyGrab).setEnabled(ControllerType.RIGHT, this.isClimbeyClimb() && (this.isGrabbingLadder() || this.inblock[0] || this.forceActivate)); - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyClimbeyGrab).setEnabled(ControllerType.LEFT, this.isClimbeyClimb() && (this.isGrabbingLadder() || this.inblock[1] || this.forceActivate)); + dh.vr.getInputAction(VivecraftVRMod.keyClimbeyGrab).setEnabled(ControllerType.RIGHT, this.isClimbeyClimb() && (this.isGrabbingLadder() || this.inblock[0] || this.forceActivate)); + dh.vr.getInputAction(VivecraftVRMod.keyClimbeyGrab).setEnabled(ControllerType.LEFT, this.isClimbeyClimb() && (this.isGrabbingLadder() || this.inblock[1] || this.forceActivate)); } - public void reset(LocalPlayer player) + public void reset() { this.latchStartController = -1; this.latched[0] = false; this.latched[1] = false; - player.setNoGravity(false); + mc.player.setNoGravity(false); } - public void doProcess(LocalPlayer player) + public void doProcess() { boolean[] aboolean = new boolean[2]; boolean[] aboolean1 = new boolean[2]; @@ -222,13 +218,13 @@ public void doProcess(LocalPlayer player) for (int i = 0; i < 2; ++i) { - avec3[i] = this.dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); - Vec3 vec3 = this.dh.vrPlayer.vrdata_world_pre.getController(i).getDirection(); + avec3[i] = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getDirection(); this.inblock[i] = false; BlockPos blockpos = BlockPos.containing(avec3[i]); - BlockState blockstate = this.mc.level.getBlockState(blockpos); + BlockState blockstate = mc.level.getBlockState(blockpos); Block block = blockstate.getBlock(); - VoxelShape voxelshape = blockstate.getCollisionShape(this.mc.level, blockpos); + VoxelShape voxelshape = blockstate.getCollisionShape(mc.level, blockpos); if (voxelshape.isEmpty()) { @@ -239,9 +235,9 @@ public void doProcess(LocalPlayer player) this.box[i] = voxelshape.bounds(); } - if (!this.dh.climbTracker.isClimbeyClimb()) + if (!dh.climbTracker.isClimbeyClimb()) { - Vec3 vec31 = this.dh.vrPlayer.vrdata_world_pre.getController(i).getPosition().subtract(vec3.scale(0.2D)); + Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition().subtract(vec3.scale(0.2D)); AABB aabb = new AABB(avec3[i], vec31); flag3 = true; boolean flag4 = block instanceof LadderBlock || block instanceof VineBlock || blockstate.is(BlockTags.VIVECRAFT_CLIMBABLE); @@ -249,7 +245,7 @@ public void doProcess(LocalPlayer player) if (!flag4) { BlockPos blockpos1 = BlockPos.containing(vec31); - BlockState blockstate1 = this.mc.level.getBlockState(blockpos1); + BlockState blockstate1 = mc.level.getBlockState(blockpos1); Block block1 = blockstate1.getBlock(); if (block1 instanceof LadderBlock || block1 instanceof VineBlock || blockstate1.is(BlockTags.VIVECRAFT_CLIMBABLE)) @@ -258,7 +254,7 @@ public void doProcess(LocalPlayer player) blockstate = blockstate1; block = blockstate1.getBlock(); avec3[i] = vec31; - VoxelShape voxelshape1 = blockstate1.getCollisionShape(this.mc.level, blockpos1); + VoxelShape voxelshape1 = blockstate1.getCollisionShape(mc.level, blockpos1); if (voxelshape1.isEmpty()) { @@ -315,22 +311,22 @@ public void doProcess(LocalPlayer player) flag4 = true; this.box[i] = new AABB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); - if (blockstate.getValue(VineBlock.NORTH) && this.mc.level.getBlockState(blockpos.north()).canOcclude()) + if (blockstate.getValue(VineBlock.NORTH) && mc.level.getBlockState(blockpos.north()).canOcclude()) { list.add(this.southBB); } - if (blockstate.getValue(VineBlock.EAST) && this.mc.level.getBlockState(blockpos.east()).canOcclude()) + if (blockstate.getValue(VineBlock.EAST) && mc.level.getBlockState(blockpos.east()).canOcclude()) { list.add(this.westBB); } - if (blockstate.getValue(VineBlock.SOUTH) && this.mc.level.getBlockState(blockpos.south()).canOcclude()) + if (blockstate.getValue(VineBlock.SOUTH) && mc.level.getBlockState(blockpos.south()).canOcclude()) { list.add(this.northbb); } - if (blockstate.getValue(VineBlock.WEST) && this.mc.level.getBlockState(blockpos.west()).canOcclude()) + if (blockstate.getValue(VineBlock.WEST) && mc.level.getBlockState(blockpos.west()).canOcclude()) { list.add(this.eastBB); } @@ -380,7 +376,7 @@ else if (aabb2 == this.westBB) else { BlockPos blockpos5 = BlockPos.containing(this.latchStart[i]); - BlockState blockstate2 = this.mc.level.getBlockState(blockpos5); + BlockState blockstate2 = mc.level.getBlockState(blockpos5); this.inblock[i] = this.wasinblock[i] && blockstate2.getBlock() instanceof LadderBlock || blockstate2.getBlock() instanceof VineBlock || blockstate2.is(BlockTags.VIVECRAFT_CLIMBABLE); } } @@ -390,18 +386,18 @@ else if (aabb2 == this.westBB) } else { - if (this.mc.player.onGround()) + if (mc.player.onGround()) { - this.mc.player.setOnGround(!this.latched[0] && !this.latched[1]); + mc.player.setOnGround(!this.latched[0] && !this.latched[1]); } if (i == 0) { - aboolean[i] = VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.RIGHT); + aboolean[i] = VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT); } else { - aboolean[i] = VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.LEFT); + aboolean[i] = VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT); } this.inblock[i] = this.box[i] != null && this.box[i].move(blockpos).contains(avec3[i]); @@ -428,11 +424,11 @@ else if (aabb2 == this.westBB) if (i == 0) { - VivecraftVRMod.INSTANCE.keyClimbeyGrab.unpressKey(ControllerType.RIGHT); + VivecraftVRMod.keyClimbeyGrab.unpressKey(ControllerType.RIGHT); } else { - VivecraftVRMod.INSTANCE.keyClimbeyGrab.unpressKey(ControllerType.LEFT); + VivecraftVRMod.keyClimbeyGrab.unpressKey(ControllerType.LEFT); } flag2 = true; @@ -442,7 +438,7 @@ else if (aabb2 == this.westBB) { if (!this.wasinblock[i] && this.inblock[i]) { - this.dh.vr.triggerHapticPulse(i, 750); + dh.vr.triggerHapticPulse(i, 750); } if (!this.wasinblock[i] && this.inblock[i] && aboolean[i] || !this.wasbutton[i] && aboolean[i] && this.inblock[i]) @@ -450,8 +446,8 @@ else if (aabb2 == this.westBB) flag1 = true; this.wantjump = false; this.latchStart[i] = avec3[i]; - this.latchStart_room[i] = this.dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(); - this.latchStartBody[i] = player.position(); + this.latchStart_room[i] = dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(); + this.latchStartBody[i] = mc.player.position(); this.latchStartController = i; this.latchbox[i] = this.box[i]; this.latched[i] = true; @@ -466,12 +462,12 @@ else if (aabb2 == this.westBB) this.latched[0] = false; } - this.dh.vr.triggerHapticPulse(i, 2000); - ((PlayerExtension) this.mc.player).stepSound(blockpos, this.latchStart[i]); + dh.vr.triggerHapticPulse(i, 2000); + ((PlayerExtension) mc.player).stepSound(blockpos, this.latchStart[i].x(), this.latchStart[i].y(), this.latchStart[i].z()); if (!flag3) { - this.dh.vrPlayer.blockDust(this.latchStart[i].x, this.latchStart[i].y, this.latchStart[i].z, 5, blockpos, blockstate, 0.1F, 0.2F); + dh.vrPlayer.blockDust(this.latchStart[i].x(), this.latchStart[i].y(), this.latchStart[i].z(), 5, blockpos, blockstate, 0.1F, 0.2F); } } } @@ -488,19 +484,19 @@ else if (aabb2 == this.westBB) { flag1 = true; this.latchStart[k] = avec3[k]; - this.latchStart_room[k] = this.dh.vrPlayer.vrdata_room_pre.getController(k).getPosition(); - this.latchStartBody[k] = player.position(); + this.latchStart_room[k] = dh.vrPlayer.vrdata_room_pre.getController(k).getPosition(); + this.latchStartBody[k] = mc.player.position(); this.latchStartController = k; this.latched[k] = true; this.latchbox[k] = this.box[k]; this.wantjump = false; - this.dh.vr.triggerHapticPulse(k, 2000); + dh.vr.triggerHapticPulse(k, 2000); BlockPos blockpos4 = BlockPos.containing(this.latchStart[k]); - BlockState blockstate4 = this.mc.level.getBlockState(blockpos4); + BlockState blockstate4 = mc.level.getBlockState(blockpos4); if (!flag3) { - this.dh.vrPlayer.blockDust(this.latchStart[k].x, this.latchStart[k].y, this.latchStart[k].z, 5, blockpos4, blockstate4, 0.1F, 0.2F); + dh.vrPlayer.blockDust(this.latchStart[k].x, this.latchStart[k].y, this.latchStart[k].z, 5, blockpos4, blockstate4, 0.1F, 0.2F); } } } @@ -508,7 +504,7 @@ else if (aabb2 == this.westBB) if (!this.wantjump && !flag3) { - this.wantjump = VivecraftVRMod.INSTANCE.keyClimbeyJump.isDown() && this.dh.jumpTracker.isClimbeyJumpEquipped(); + this.wantjump = VivecraftVRMod.keyClimbeyJump.isDown() && dh.jumpTracker.isClimbeyJumpEquipped(); } flag2 = flag2 & this.wantjump; @@ -516,23 +512,23 @@ else if (aabb2 == this.westBB) if ((this.latched[0] || this.latched[1]) && !this.gravityOverride) { this.unsetflag = true; - player.setNoGravity(true); + mc.player.setNoGravity(true); this.gravityOverride = true; } if (!this.latched[0] && !this.latched[1] && this.gravityOverride) { - player.setNoGravity(false); + mc.player.setNoGravity(false); this.gravityOverride = false; } if (!this.latched[0] && !this.latched[1] && !flag2) { - if (player.onGround() && this.unsetflag) + if (mc.player.onGround() && this.unsetflag) { this.unsetflag = false; - VivecraftVRMod.INSTANCE.keyClimbeyGrab.unpressKey(ControllerType.RIGHT); - VivecraftVRMod.INSTANCE.keyClimbeyGrab.unpressKey(ControllerType.LEFT); + VivecraftVRMod.keyClimbeyGrab.unpressKey(ControllerType.RIGHT); + VivecraftVRMod.keyClimbeyGrab.unpressKey(ControllerType.LEFT); } this.latchStartController = -1; @@ -541,25 +537,24 @@ else if (aabb2 == this.westBB) { if ((this.latched[0] || this.latched[1]) && this.rand.nextInt(20) == 10) { - this.mc.player.causeFoodExhaustion(0.1F); + mc.player.causeFoodExhaustion(0.1F); BlockPos blockpos3 = BlockPos.containing(this.latchStart[this.latchStartController]); - BlockState blockstate3 = this.mc.level.getBlockState(blockpos3); + BlockState blockstate3 = mc.level.getBlockState(blockpos3); if (!flag3) { - this.dh.vrPlayer.blockDust(this.latchStart[this.latchStartController].x, this.latchStart[this.latchStartController].y, this.latchStart[this.latchStartController].z, 1, blockpos3, blockstate3, 0.1F, 0.2F); + dh.vrPlayer.blockDust(this.latchStart[this.latchStartController].x, this.latchStart[this.latchStartController].y, this.latchStart[this.latchStartController].z, 1, blockpos3, blockstate3, 0.1F, 0.2F); } } - Vec3 vec34 = this.dh.vrPlayer.vrdata_world_pre.getController(this.latchStartController).getPosition(); - VRPlayer vrplayer = this.dh.vrPlayer; - Vec3 vec35 = VRPlayer.room_to_world_pos(this.latchStart_room[this.latchStartController], this.dh.vrPlayer.vrdata_world_pre); + Vec3 vec34 = dh.vrPlayer.vrdata_world_pre.getController(this.latchStartController).getPosition(); + Vec3 vec35 = VRPlayer.room_to_world_pos(this.latchStart_room[this.latchStartController], dh.vrPlayer.vrdata_world_pre); Vec3 vec36 = vec34.subtract(vec35); - this.latchStart_room[this.latchStartController] = this.dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition(); + this.latchStart_room[this.latchStartController] = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition(); if (this.wantjump) { - this.dh.vr.triggerHapticPulse(this.latchStartController, 200); + dh.vr.triggerHapticPulse(this.latchStartController, 200); } if (!flag2) @@ -568,17 +563,17 @@ else if (aabb2 == this.westBB) if (flag1) { - player.setDeltaMovement(0.0D, 0.0D, 0.0D); + mc.player.setDeltaMovement(0.0D, 0.0D, 0.0D); } else { - player.setDeltaMovement(player.getDeltaMovement().x, 0.0D, player.getDeltaMovement().z); + mc.player.setDeltaMovement(mc.player.getDeltaMovement().x, 0.0D, mc.player.getDeltaMovement().z); } - player.fallDistance = 0.0F; - double d4 = player.getX(); - double d6 = player.getY(); - double d8 = player.getZ(); + mc.player.fallDistance = 0.0F; + double d4 = mc.player.getX(); + double d6 = mc.player.getY(); + double d8 = mc.player.getZ(); double d10 = d4; double d0 = d8; double d11 = d6 - vec36.y; @@ -599,37 +594,37 @@ else if (aabb2 == this.westBB) { d0 = d8 - vec36.z; d10 = (double)((float)blockpos2.getX() + 0.5F); - d10 += (1.0 - Math.min(ClientDataHolderVR.getInstance().vrPlayer.worldScale, 1.0)) * (j == 4 ? 0.5 : -0.5); + d10 += (1.0 - min(dh.vrPlayer.worldScale, 1.0)) * (j == 4 ? 0.5 : -0.5); } } else { d10 = d4 - vec36.x; d0 = (double)((float)blockpos2.getZ() + 0.5F); - d0 += (1.0 - Math.min(ClientDataHolderVR.getInstance().vrPlayer.worldScale, 1.0)) * (j == 2 ? 0.5 : -0.5); + d0 += (1.0 - min(dh.vrPlayer.worldScale, 1.0)) * (j == 2 ? 0.5 : -0.5); } } - double d12 = this.dh.vrPlayer.vrdata_room_pre.getHeadPivot().y; - double d1 = this.dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition().y; + double d12 = dh.vrPlayer.vrdata_room_pre.getHeadPivot().y; + double d1 = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition().y; if (!this.wantjump && this.latchbox[this.latchStartController] != null && d1 <= d12 / 2.0D && this.latchStart[this.latchStartController].y > this.latchbox[this.latchStartController].maxY * 0.8D + (double)blockpos2.getY()) { - Vec3 vec32 = this.dh.vrPlayer.vrdata_world_pre.hmd.getDirection().scale((double)0.1F); + Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.hmd.getDirection().scale((double)0.1F); Vec3 vec33 = (new Vec3(vec32.x, 0.0D, vec32.z)).normalize().scale(0.1D); - boolean flag5 = this.mc.level.noCollision(player, player.getBoundingBox().move(vec33.x, this.latchbox[this.latchStartController].maxY + (double)blockpos2.getY() - player.getY(), vec33.z)); + boolean flag5 = mc.level.noCollision(mc.player, mc.player.getBoundingBox().move(vec33.x, this.latchbox[this.latchStartController].maxY + (double)blockpos2.getY() - mc.player.getY(), vec33.z)); if (flag5) { - d10 = player.getX() + vec33.x; + d10 = mc.player.getX() + vec33.x; d11 = this.latchbox[this.latchStartController].maxY + (double)blockpos2.getY(); - d0 = player.getZ() + vec33.z; + d0 = mc.player.getZ() + vec33.z; this.latchStartController = -1; this.latched[0] = false; this.latched[1] = false; this.wasinblock[0] = false; this.wasinblock[1] = false; - player.setNoGravity(false); + mc.player.setNoGravity(false); } } @@ -674,16 +669,16 @@ else if (aabb2 == this.westBB) d3 = d8; } - player.setPos(d13, d2, d3); - AABB aabb1 = player.getBoundingBox(); - flag6 = this.mc.level.noCollision(player, aabb1); + mc.player.setPos(d13, d2, d3); + AABB aabb1 = mc.player.getBoundingBox(); + flag6 = mc.level.noCollision(mc.player, aabb1); if (flag6) { if (l > 1) { - this.dh.vr.triggerHapticPulse(0, 100); - this.dh.vr.triggerHapticPulse(1, 100); + dh.vr.triggerHapticPulse(0, 100); + dh.vr.triggerHapticPulse(1, 100); } break; @@ -692,16 +687,16 @@ else if (aabb2 == this.westBB) if (!flag6) { - player.setPos(d4, d6, d8); - this.dh.vr.triggerHapticPulse(0, 100); - this.dh.vr.triggerHapticPulse(1, 100); + mc.player.setPos(d4, d6, d8); + dh.vr.triggerHapticPulse(0, 100); + dh.vr.triggerHapticPulse(1, 100); } - if (this.mc.isLocalServer()) + if (mc.isLocalServer()) { - for (ServerPlayer serverplayer : this.mc.getSingleplayerServer().getPlayerList().getPlayers()) + for (ServerPlayer serverplayer : mc.getSingleplayerServer().getPlayerList().getPlayers()) { - if (serverplayer.getId() == this.mc.player.getId()) + if (serverplayer.getId() == mc.player.getId()) { serverplayer.fallDistance = 0.0F; } @@ -711,18 +706,18 @@ else if (aabb2 == this.westBB) { ServerboundCustomPayloadPacket serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.CLIMBING, new byte[0]); - if (this.mc.getConnection() != null) + if (mc.getConnection() != null) { - this.mc.getConnection().send(serverboundcustompayloadpacket); + mc.getConnection().send(serverboundcustompayloadpacket); } } } else { this.wantjump = false; - Vec3 vec38 = player.position().subtract(vec36); - Vec3 vec39 = this.dh.vr.controllerHistory[this.latchStartController].netMovement(0.3D); - double d5 = this.dh.vr.controllerHistory[this.latchStartController].averageSpeed((double)0.3F); + Vec3 vec38 = mc.player.position().subtract(vec36); + Vec3 vec39 = convertToVec3(dh.vr.controllerHistory[this.latchStartController].netMovement(0.3D, new Vector3d())); + double d5 = dh.vr.controllerHistory[this.latchStartController].averageSpeed(0.3D); vec39 = vec39.scale(0.66D * d5); float f = 0.66F; @@ -731,20 +726,20 @@ else if (aabb2 == this.westBB) vec39 = vec39.scale((double)f / vec39.length()); } - if (player.hasEffect(MobEffects.JUMP)) + if (mc.player.hasEffect(MobEffects.JUMP)) { - vec39 = vec39.scale((double)player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); + vec39 = vec39.scale((double)mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); } - vec39 = vec39.yRot(this.dh.vrPlayer.vrdata_world_pre.rotation_radians); - player.setDeltaMovement(vec39.multiply(-1.0D, -1.0D, -1.0D)); - player.xOld = vec38.x; - player.yOld = vec38.y; - player.zOld = vec38.z; - vec38 = vec38.add(player.getDeltaMovement().x, player.getDeltaMovement().y, player.getDeltaMovement().z); - player.setPos(vec38.x, vec38.y, vec38.z); - this.dh.vrPlayer.snapRoomOriginToPlayerEntity(player, false, false); - this.mc.player.causeFoodExhaustion(0.3F); + vec39 = vec39.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); + mc.player.setDeltaMovement(vec39.multiply(-1.0D, -1.0D, -1.0D)); + mc.player.xOld = vec38.x; + mc.player.yOld = vec38.y; + mc.player.zOld = vec38.z; + vec38 = vec38.add(mc.player.getDeltaMovement().x, mc.player.getDeltaMovement().y, mc.player.getDeltaMovement().z); + mc.player.setPos(vec38.x, vec38.y, vec38.z); + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); + mc.player.causeFoodExhaustion(0.3F); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java index 27c25393e..8ae9c7962 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java @@ -1,15 +1,17 @@ package org.vivecraft.client_vr.gameplay.trackers; import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; + +import org.joml.Vector3d; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; import net.minecraft.world.entity.Pose; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; public class CrawlTracker extends Tracker { @@ -17,18 +19,13 @@ public class CrawlTracker extends Tracker public boolean crawling; public boolean crawlsteresis; - public CrawlTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer player) + public boolean isActive() { - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!this.dh.vrSettings.allowCrawling) + else if (!dh.vrSettings.allowCrawling) { return false; } @@ -36,48 +33,48 @@ else if (!ClientNetworking.serverAllowsCrawling) { return false; } - else if (!player.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (player.isSpectator()) + else if (mc.player.isSpectator()) { return false; } - else if (player.isSleeping()) + else if (mc.player.isSleeping()) { return false; } else { - return !player.isPassenger(); + return !mc.player.isPassenger(); } } - public void reset(LocalPlayer player) + public void reset() { this.crawling = false; this.crawlsteresis = false; - this.updateState(player); + this.updateState(); } - public void doProcess(LocalPlayer player) + public void doProcess() { double scaleMultiplier = 1.0; if (Xplat.isModLoaded("pehkui")) { - scaleMultiplier /= PehkuiHelper.getPlayerScale(player, mc.getFrameTime()); + scaleMultiplier /= PehkuiHelper.getPlayerScale(mc.player, mc.getFrameTime()); } - this.crawling = this.dh.vr.hmdPivotHistory.averagePosition((double)0.2F).y * (double)this.dh.vrPlayer.worldScale * scaleMultiplier + (double)0.1F < (double)this.dh.vrSettings.crawlThreshold; - this.updateState(player); + this.crawling = dh.vr.hmdPivotHistory.averagePosition(0.2D, new Vector3d()).y * dh.vrPlayer.worldScale * scaleMultiplier + 0.1D < (double)dh.vrSettings.crawlThreshold; + this.updateState(); } - private void updateState(LocalPlayer player) + private void updateState() { if (this.crawling != this.wasCrawling) { if (this.crawling) { - player.setPose(Pose.SWIMMING); + mc.player.setPose(Pose.SWIMMING); this.crawlsteresis = true; } @@ -85,16 +82,16 @@ private void updateState(LocalPlayer player) { ServerboundCustomPayloadPacket serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(CommonNetworkHelper.PacketDiscriminators.CRAWL, new byte[] {(byte)(this.crawling ? 1 : 0)}); - if (this.mc.getConnection() != null) + if (mc.getConnection() != null) { - this.mc.getConnection().send(serverboundcustompayloadpacket); + mc.getConnection().send(serverboundcustompayloadpacket); } } this.wasCrawling = this.crawling; } - if (!this.crawling && player.getPose() != Pose.SWIMMING) + if (!this.crawling && mc.player.getPose() != Pose.SWIMMING) { this.crawlsteresis = false; } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java index ad46f36be..c46b3fa75 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java @@ -1,18 +1,19 @@ package org.vivecraft.client_vr.gameplay.trackers; -import java.util.Random; - -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.joml.Vector3d; import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.UseAnim; import net.minecraft.world.phys.Vec3; +import java.util.Random; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; + public class EatingTracker extends Tracker { float mouthtoEyeDistance = 0.0F; @@ -22,43 +23,38 @@ public class EatingTracker extends Tracker long eatStart; private Random r = new Random(); - public EatingTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - public boolean isEating() { return this.eating[0] || this.eating[1]; } - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (ClientDataHolderVR.getInstance().vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (p == null) + else if (mc.player == null) { return false; } - else if (this.mc.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (p.isSleeping()) + else if (mc.player.isSleeping()) { return false; } else { - if (p.getMainHandItem() != null) + if (mc.player.getMainHandItem() != null) { - UseAnim useanim = p.getMainHandItem().getUseAnimation(); + UseAnim useanim = mc.player.getMainHandItem().getUseAnimation(); if (useanim == UseAnim.EAT || useanim == UseAnim.DRINK || useanim == UseAnim.TOOT_HORN) { @@ -66,9 +62,9 @@ else if (p.isSleeping()) } } - if (p.getOffhandItem() != null) + if (mc.player.getOffhandItem() != null) { - UseAnim useanim1 = p.getOffhandItem().getUseAnimation(); + UseAnim useanim1 = mc.player.getOffhandItem().getUseAnimation(); if (useanim1 == UseAnim.EAT || useanim1 == UseAnim.DRINK || useanim1 == UseAnim.TOOT_HORN) { @@ -80,30 +76,31 @@ else if (p.isSleeping()) } } - public void reset(LocalPlayer player) + public void reset() { this.eating[0] = false; this.eating[1] = false; } - public void doProcess(LocalPlayer player) { - VRPlayer vrplayer = this.dh.vrPlayer; - Vec3 hmdPos = vrplayer.vrdata_room_pre.hmd.getPosition(); - Vec3 mouthPos = vrplayer.vrdata_room_pre.getController(0).getCustomVector(new Vec3(0.0D, (double)(-this.mouthtoEyeDistance), 0.0D)).add(hmdPos); + public void doProcess() + { + Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); + Vec3 mouthPos = dh.vrPlayer.vrdata_room_pre.getController(0).getCustomVector(new Vec3(0.0D, (double)(-this.mouthtoEyeDistance), 0.0D)).add(hmdPos); for (int c = 0; c < 2; ++c) { - Vec3 controllerPos = this.dh.vr.controllerHistory[c].averagePosition(0.333D).add(vrplayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0.0D, 0.0D, -0.1D))); - controllerPos = controllerPos.add(this.dh.vrPlayer.vrdata_room_pre.getController(c).getDirection().scale(0.1D)); + Vec3 controllerPos = convertToVec3(dh.vr.controllerHistory[c].averagePosition(0.333D, new Vector3d())).add(dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0.0D, 0.0D, -0.1D))); + controllerPos = controllerPos.add(dh.vrPlayer.vrdata_room_pre.getController(c).getDirection().scale(0.1D)); - if (mouthPos.distanceTo(controllerPos) < (double)this.threshold) { - ItemStack itemstack = c == 0 ? player.getMainHandItem() : player.getOffhandItem(); + if (mouthPos.distanceTo(controllerPos) < (double)this.threshold) + { + ItemStack itemstack = c == 0 ? mc.player.getMainHandItem() : mc.player.getOffhandItem(); if (itemstack == ItemStack.EMPTY) continue; int crunchiness = 0; if (itemstack.getUseAnimation() == UseAnim.DRINK){//thats how liquid works. - if(vrplayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0,1,0)).y > 0) continue; + if(dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0,1,0)).y > 0) continue; } else if (itemstack.getUseAnimation() == UseAnim.EAT) { crunchiness = 2; @@ -119,9 +116,9 @@ else if (itemstack.getUseAnimation() == UseAnim.TOOT_HORN) { { //Minecraft.getInstance().physicalGuiManager.preClickAction(); - if (this.mc.gameMode.useItem(player, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND).consumesAction()) + if (mc.gameMode.useItem(mc.player, c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND).consumesAction()) { - this.mc.gameRenderer.itemInHandRenderer.itemUsed(c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + mc.gameRenderer.itemInHandRenderer.itemUsed(c == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); this.eating[c] = true; this.eatStart = Util.getMillis(); } @@ -129,11 +126,11 @@ else if (itemstack.getUseAnimation() == UseAnim.TOOT_HORN) { if (this.eating[c]) { - long k = (long)player.getUseItemRemainingTicks(); + long k = (long)mc.player.getUseItemRemainingTicks(); if (k > 0L && k % 5L <= (long)crunchiness) { - this.dh.vr.triggerHapticPulse(c, 700); + dh.vr.triggerHapticPulse(c, 700); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java index 31ddc5027..97806387e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java @@ -1,16 +1,18 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Quaternion; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; +import org.joml.Quaternionf; +import org.joml.Vector3d; +import org.joml.Vector3f; + import net.minecraft.world.entity.animal.horse.Horse; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; + +import static org.joml.Math.*; + public class HorseTracker extends Tracker { double boostTrigger = 1.4D; @@ -21,52 +23,44 @@ public class HorseTracker extends Tracker long lastBoostMillis = -1L; double turnspeed = 6.0D; double bodyturnspeed = 0.2D; - double baseSpeed = 0.2D; + float baseSpeed = 0.2F; Horse horse = null; ModelInfo info = new ModelInfo(); - public HorseTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) + public void reset() { - return false; - } - - public void reset(LocalPlayer player) - { - super.reset(player); - if (this.horse != null) { this.horse.setNoAi(false); } } - public void doProcess(LocalPlayer player) + public void doProcess() { - this.horse = (Horse)player.getVehicle(); + this.horse = (Horse)mc.player.getVehicle(); this.horse.setNoAi(true); float f = (this.horse.getYRot() + 360.0F) % 360.0F; float f1 = (this.horse.yBodyRot + 360.0F) % 360.0F; - Vec3 vec3 = this.dh.vr.controllerHistory[1].netMovement(0.1D).scale(10.0D); - Vec3 vec31 = this.dh.vr.controllerHistory[0].netMovement(0.1D).scale(10.0D); - double d0 = Math.min(-vec3.y, -vec31.y); + Vec3 vec3 = convertToVec3(dh.vr.controllerHistory[1].netMovement(0.1D, new Vector3d())).scale(10.0D); + Vec3 vec31 = convertToVec3(dh.vr.controllerHistory[0].netMovement(0.1D, new Vector3d())).scale(10.0D); + double d0 = min(-vec3.y, -vec31.y); if (d0 > this.boostTrigger) { this.boost(); } - Quaternion quaternion = new Quaternion(0.0F, -this.horse.yBodyRot, 0.0F); - Vec3 vec32 = quaternion.multiply(new Vec3(0.0D, 0.0D, -1.0D)); - Vec3 vec33 = quaternion.multiply(new Vec3(1.0D, 0.0D, 0.0D)); - Vec3 vec34 = quaternion.multiply(new Vec3(-1.0D, 0.0D, 0.0D)); - Quaternion quaternion1 = new Quaternion(0.0F, VRSettings.inst.worldRotation, 0.0F); - Vec3 vec35 = VRPlayer.get().roomOrigin.add(quaternion1.multiply(this.dh.vr.controllerHistory[1].latest())); - Vec3 vec36 = VRPlayer.get().roomOrigin.add(quaternion1.multiply(this.dh.vr.controllerHistory[0].latest())); + Quaternionf quaternion = new Quaternionf().setAngleAxis(-this.horse.yBodyRot, 0.0F, 1.0F, 0.0F) + .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F), new Quaternionf()) + .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F), new Quaternionf()); + Vec3 vec32 = convertToVec3(quaternion.transformUnit(forward, new Vector3f())); + Vec3 vec33 = convertToVec3(quaternion.transformUnit(right, new Vector3f())); + Vec3 vec34 = convertToVec3(quaternion.transformUnit(left, new Vector3f())); + Quaternionf quaternion1 = new Quaternionf().setAngleAxis(toRadians(dh.vrSettings.worldRotation), 0.0F, 1.0F, 0.0F) + .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F), new Quaternionf()) + .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F), new Quaternionf()); + Vec3 vec35 = dh.vrPlayer.roomOrigin.add(convertToVec3(quaternion1.transformUnit(dh.vr.controllerHistory[1].latest(new Vector3f()), new Vector3f()))); + Vec3 vec36 = dh.vrPlayer.roomOrigin.add(convertToVec3(quaternion1.transformUnit(dh.vr.controllerHistory[0].latest(new Vector3f()), new Vector3f()))); double d1 = vec35.subtract(this.info.leftReinPos).dot(vec32) + vec35.subtract(this.info.leftReinPos).dot(vec33); double d2 = vec36.subtract(this.info.rightReinPos).dot(vec32) + vec36.subtract(this.info.rightReinPos).dot(vec34); @@ -75,7 +69,7 @@ public void doProcess(LocalPlayer player) this.speedLevel = 0; } - if (d1 > this.pullTrigger + 0.3D && d2 > this.pullTrigger + 0.3D && Math.abs(d2 - d1) < 0.1D) + if (d1 > this.pullTrigger + 0.3D && d2 > this.pullTrigger + 0.3D && abs(d2 - d1) < 0.1D) { if (this.speedLevel <= 0 && System.currentTimeMillis() > this.lastBoostMillis + (long)this.coolDownMillis) { @@ -104,9 +98,12 @@ public void doProcess(LocalPlayer player) this.horse.setYRot((float)((double)f + (d4 - d3) * this.turnspeed)); } - this.horse.yBodyRot = (float)Utils.lerpMod((double)f1, (double)f, this.bodyturnspeed, 360.0D); + this.horse.yBodyRot = (float)(abs(f - f1) < 360.0D / 2.0D ? + f1 + (f - f1) * this.bodyturnspeed : + f1 + (f - f1 - signum(f - f1) * 360.0D) * this.bodyturnspeed + ); this.horse.yHeadRot = f; - Vec3 vec37 = quaternion.multiply(new Vec3(0.0D, 0.0D, (double)this.speedLevel * this.baseSpeed)); + Vector3f vec37 = quaternion.transformUnit(new Vector3f(0.0F, 0.0F, this.speedLevel * this.baseSpeed), new Vector3f()); this.horse.setDeltaMovement(vec37.x, this.horse.getDeltaMovement().y, vec37.z); } @@ -140,7 +137,7 @@ else if (System.currentTimeMillis() < this.lastBoostMillis + (long)this.coolDown } else { - System.out.println("Breaking"); + logger.info("Breaking"); --this.speedLevel; this.lastBoostMillis = System.currentTimeMillis(); return true; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java index 98bb9c39d..680474dfa 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java @@ -1,25 +1,19 @@ package org.vivecraft.client_vr.gameplay.trackers; -import java.util.HashSet; - import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client_vr.VRData; +import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; +import org.vivecraft.client_vr.settings.VRHotkeys; +import org.vivecraft.client_vr.settings.VRSettings; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; -import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.projectile.ProjectileUtil; @@ -34,6 +28,14 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; +import java.util.HashSet; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; +import static org.joml.RoundingMode.FLOOR; + public class InteractTracker extends Tracker { public boolean[] bukkit = new boolean[2]; @@ -48,67 +50,59 @@ public class InteractTracker extends Tracker boolean[] wasactive = new boolean[2]; private HashSet rightClickable = null; - public InteractTracker(Minecraft mc, ClientDataHolderVR dh) + public boolean isActive() { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) - { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (p == null) + else if (mc.player == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (p.isSleeping()) + else if (mc.player.isSleeping()) { return false; } else { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - - if (dataholder.vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (p.isBlocking() && this.hotbar < 0) + else if (mc.player.isBlocking() && this.hotbar < 0) { return false; } else { - return !dataholder.bowTracker.isNotched(); + return !dh.bowTracker.isNotched(); } } } - public void reset(LocalPlayer player) + public void reset() { for (int i = 0; i < 2; ++i) { - this.reset(player, i); + this.reset(i); } } - private void reset(LocalPlayer player, int c) + private void reset(int c) { if (this.inCamera[c] && VRHotkeys.isMovingThirdPersonCam() && VRHotkeys.getMovingThirdPersonCamTriggerer() == VRHotkeys.Triggerer.INTERACTION && VRHotkeys.getMovingThirdPersonCamController() == c) { VRHotkeys.stopMovingThirdPersonCam(); } - if (this.inHandheldCamera[c] && this.dh.cameraTracker.isMoving() && this.dh.cameraTracker.getMovingController() == c && !this.dh.cameraTracker.isQuickMode()) + if (this.inHandheldCamera[c] && dh.cameraTracker.isMoving() && dh.cameraTracker.getMovingController() == c && !dh.cameraTracker.isQuickMode()) { - this.dh.cameraTracker.stopMoving(); + dh.cameraTracker.stopMoving(); } this.inBlockPos[c] = null; @@ -118,10 +112,10 @@ private void reset(LocalPlayer player, int c) this.inCamera[c] = false; this.inHandheldCamera[c] = false; this.active[c] = false; - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyVRInteract).setEnabled(ControllerType.values()[c], false); + dh.vr.getInputAction(VivecraftVRMod.keyVRInteract).setEnabled(ControllerType.values()[c], false); } - public void doProcess(LocalPlayer player) + public void doProcess() { if (this.rightClickable == null) { @@ -144,7 +138,7 @@ public void doProcess(LocalPlayer player) this.rightClickable.add(oclass); } } - catch (Throwable throwable1) + catch (Throwable ignored) { } @@ -162,7 +156,7 @@ public void doProcess(LocalPlayer player) this.rightClickable.add(oclass); } } - catch (Throwable throwable) + catch (Throwable ignored) { } } @@ -176,42 +170,42 @@ public void doProcess(LocalPlayer player) for (int j = 0; j < 2; ++j) { - if (!this.inCamera[j] && !this.inHandheldCamera[j] || !VivecraftVRMod.INSTANCE.keyVRInteract.isDown(ControllerType.values()[j])) + if (!this.inCamera[j] && !this.inHandheldCamera[j] || !VivecraftVRMod.keyVRInteract.isDown(ControllerType.values()[j])) { - this.reset(player, j); + this.reset(j); if (j == 0 && this.hotbar >= 0) { this.active[j] = true; } - Vec3 vec35 = this.dh.vrPlayer.vrdata_world_pre.getHeadPivot(); - Vec3 vec3 = this.dh.vrPlayer.vrdata_world_pre.getController(j).getPosition(); - Vec3 vec31 = this.dh.vrPlayer.vrdata_world_pre.getHand(j).getCustomVector(vec34); - ItemStack itemstack = player.getItemInHand(j == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + Vec3 vec35 = dh.vrPlayer.vrdata_world_pre.getHeadPivot(); + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(j).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getHand(j).getCustomVector(vec34); + ItemStack itemstack = mc.player.getItemInHand(j == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); Item item = null; - if (!this.active[j] && (this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY || this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) && this.dh.vrSettings.mixedRealityRenderCameraModel) + if (!this.active[j] && (dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY || dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) && dh.vrSettings.mixedRealityRenderCameraModel) { - VRData.VRDevicePose vrdata$vrdevicepose = this.dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.THIRD); + VRData.VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.THIRD); Vec3 vec32 = vrdata$vrdevicepose.getPosition(); - vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double)0.15F * this.dh.vrPlayer.vrdata_world_pre.worldScale)); - vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)).scale((double)0.05F * this.dh.vrPlayer.vrdata_world_pre.worldScale)); + vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double)0.15F * dh.vrPlayer.vrdata_world_pre.worldScale)); + vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)).scale((double)0.05F * dh.vrPlayer.vrdata_world_pre.worldScale)); - if (vec3.distanceTo(vec32) < (double)0.15F * this.dh.vrPlayer.vrdata_world_pre.worldScale) + if (vec3.distanceTo(vec32) < (double)0.15F * dh.vrPlayer.vrdata_world_pre.worldScale) { this.inCamera[j] = true; this.active[j] = true; } } - if (!this.active[j] && this.dh.cameraTracker.isVisible() && !this.dh.cameraTracker.isQuickMode()) + if (!this.active[j] && dh.cameraTracker.isVisible() && !dh.cameraTracker.isQuickMode()) { - VRData.VRDevicePose vrdata$vrdevicepose1 = this.dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.CAMERA); + VRData.VRDevicePose vrdata$vrdevicepose1 = dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.CAMERA); Vec3 vec36 = vrdata$vrdevicepose1.getPosition(); - vec36 = vec36.subtract(vrdata$vrdevicepose1.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double)0.08F * this.dh.vrPlayer.vrdata_world_pre.worldScale)); + vec36 = vec36.subtract(vrdata$vrdevicepose1.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double)0.08F * dh.vrPlayer.vrdata_world_pre.worldScale)); - if (vec3.distanceTo(vec36) < (double)0.11F * this.dh.vrPlayer.vrdata_world_pre.worldScale) + if (vec3.distanceTo(vec36) < (double)0.11F * dh.vrPlayer.vrdata_world_pre.worldScale) { this.inHandheldCamera[j] = true; this.active[j] = true; @@ -220,14 +214,14 @@ public void doProcess(LocalPlayer player) if (!this.active[j]) { - int k = Mth.floor(vec3.x); - int l = Mth.floor(vec3.y); - int i = Mth.floor(vec3.z); + int k = roundUsing(vec3.x, FLOOR); + int l = roundUsing(vec3.y, FLOOR); + int i = roundUsing(vec3.z, FLOOR); Vec3 vec33 = new Vec3(vec3.x + vec31.x * -0.1D, vec3.y + vec31.y * -0.1D, vec3.z + vec31.z * -0.1D); AABB aabb = new AABB(vec3, vec33); - this.inEntityHit[j] = ProjectileUtil.getEntityHitResult(this.mc.getCameraEntity(), vec35, vec3, aabb, (e) -> + this.inEntityHit[j] = ProjectileUtil.getEntityHitResult(mc.getCameraEntity(), vec35, vec3, aabb, (e) -> { - return !e.isSpectator() && e.isPickable() && e != this.mc.getCameraEntity().getVehicle(); + return !e.isSpectator() && e.isPickable() && e != mc.getCameraEntity().getVehicle(); }, 0.0D); if (this.inEntityHit[j] != null) @@ -242,8 +236,8 @@ public void doProcess(LocalPlayer player) { BlockPos blockpos = null; blockpos = BlockPos.containing(vec3); - BlockState blockstate = this.mc.level.getBlockState(blockpos); - BlockHitResult blockhitresult = blockstate.getShape(this.mc.level, blockpos).clip(vec35, vec3, blockpos); + BlockState blockstate = mc.level.getBlockState(blockpos); + BlockHitResult blockhitresult = blockstate.getShape(mc.level, blockpos).clip(vec35, vec3, blockpos); this.inBlockPos[j] = blockpos; this.inBlockHit[j] = blockhitresult; this.active[j] = blockhitresult != null && (this.rightClickable.contains(blockstate.getBlock().getClass()) || this.rightClickable.contains(blockstate.getBlock().getClass().getSuperclass())); @@ -259,10 +253,10 @@ public void doProcess(LocalPlayer player) if (!this.wasactive[j] && this.active[j]) { - this.dh.vr.triggerHapticPulse(j, 250); + dh.vr.triggerHapticPulse(j, 250); } - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyVRInteract).setEnabled(ControllerType.values()[j], this.active[j]); + dh.vr.getInputAction(VivecraftVRMod.keyVRInteract).setEnabled(ControllerType.values()[j], this.active[j]); this.wasactive[j] = this.active[j]; } } @@ -287,19 +281,19 @@ public void processBindings() { for (int i = 0; i < 2; ++i) { - if (VivecraftVRMod.INSTANCE.keyVRInteract.consumeClick(ControllerType.values()[i]) && this.active[i]) + if (VivecraftVRMod.keyVRInteract.consumeClick(ControllerType.values()[i]) && this.active[i]) { InteractionHand interactionhand = InteractionHand.values()[i]; boolean flag = false; - if (this.hotbar >= 0 && this.hotbar < 9 && this.mc.player.getInventory().selected != this.hotbar && interactionhand == InteractionHand.MAIN_HAND) + if (this.hotbar >= 0 && this.hotbar < 9 && mc.player.getInventory().selected != this.hotbar && interactionhand == InteractionHand.MAIN_HAND) { - this.mc.player.getInventory().selected = this.hotbar; + mc.player.getInventory().selected = this.hotbar; flag = true; } else if (this.hotbar == 9 && interactionhand == InteractionHand.MAIN_HAND) { - this.mc.player.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); + mc.player.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); flag = true; } else if (this.inCamera[i]) @@ -309,31 +303,31 @@ else if (this.inCamera[i]) } else if (this.inHandheldCamera[i]) { - this.dh.cameraTracker.startMoving(i); + dh.cameraTracker.startMoving(i); flag = true; } else if (this.inEntityHit[i] != null) { flag = true; - if (!this.mc.gameMode.interactAt(this.mc.player, this.inEntity[i], this.inEntityHit[i], interactionhand).consumesAction() && !this.mc.gameMode.interact(this.mc.player, this.inEntity[i], interactionhand).consumesAction()) + if (!mc.gameMode.interactAt(mc.player, this.inEntity[i], this.inEntityHit[i], interactionhand).consumesAction() && !mc.gameMode.interact(mc.player, this.inEntity[i], interactionhand).consumesAction()) { flag = false; } } else if (this.inBlockHit[i] != null) { - flag = this.mc.gameMode.useItemOn(this.mc.player, interactionhand, this.inBlockHit[i]).consumesAction(); + flag = mc.gameMode.useItemOn(mc.player, interactionhand, this.inBlockHit[i]).consumesAction(); } else if (this.bukkit[i]) { - flag = this.mc.gameMode.useItem(this.mc.player, interactionhand).consumesAction(); + flag = mc.gameMode.useItem(mc.player, interactionhand).consumesAction(); } if (flag) { - ((PlayerExtension) this.mc.player).swingArm(interactionhand, VRFirstPersonArmSwing.Interact); - this.dh.vr.triggerHapticPulse(i, 750); + ((PlayerExtension) mc.player).swingArm(interactionhand, VRFirstPersonArmSwing.Interact); + dh.vr.triggerHapticPulse(i, 750); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java index 171ce453b..303788e77 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java @@ -1,20 +1,22 @@ package org.vivecraft.client_vr.gameplay.trackers; -import net.minecraft.network.chat.contents.TranslatableContents; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client_vr.settings.AutoCalibration; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; +import org.joml.Vector3d; + +import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; + public class JumpTracker extends Tracker { public Vec3[] latchStart = new Vec3[] {new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; @@ -23,44 +25,39 @@ public class JumpTracker extends Tracker private boolean c0Latched = false; private boolean c1Latched = false; - public JumpTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - public boolean isClimbeyJump() { - return !this.isActive(Minecraft.getInstance().player) ? false : this.isClimbeyJumpEquipped(); + return !this.isActive() ? false : this.isClimbeyJumpEquipped(); } public boolean isClimbeyJumpEquipped() { - return ClientNetworking.serverAllowsClimbey && ((PlayerExtension) Minecraft.getInstance().player).isClimbeyJumpEquipped(); + return ClientNetworking.serverAllowsClimbey && ((PlayerExtension) mc.player).isClimbeyJumpEquipped(); } - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (ClientDataHolderVR.getInstance().vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!ClientDataHolderVR.getInstance().vrPlayer.getFreeMove() && !ClientDataHolderVR.getInstance().vrSettings.simulateFalling) + else if (!dh.vrPlayer.getFreeMove() && !dh.vrSettings.simulateFalling) { return false; } - else if (!ClientDataHolderVR.getInstance().vrSettings.realisticJumpEnabled) + else if (!dh.vrSettings.realisticJumpEnabled) { return false; } - else if (p != null && p.isAlive()) + else if (mc.player != null && mc.player.isAlive()) { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (!p.isInWater() && !p.isInLava() && p.onGround()) + else if (!mc.player.isInWater() && !mc.player.isInLava() && mc.player.onGround()) { - return !p.isShiftKeyDown() && !p.isPassenger(); + return !mc.player.isShiftKeyDown() && !mc.player.isPassenger(); } else { @@ -78,80 +75,79 @@ public boolean isjumping() return this.c1Latched || this.c0Latched; } - public void idleTick(LocalPlayer player) + public void idleTick() { - this.dh.vr.getInputAction(VivecraftVRMod.INSTANCE.keyClimbeyJump).setEnabled(this.isClimbeyJumpEquipped() && (this.isActive(player) || this.dh.climbTracker.isClimbeyClimbEquipped() && this.dh.climbTracker.isGrabbingLadder())); + dh.vr.getInputAction(VivecraftVRMod.keyClimbeyJump).setEnabled(this.isClimbeyJumpEquipped() && (this.isActive() || dh.climbTracker.isClimbeyClimbEquipped() && dh.climbTracker.isGrabbingLadder())); } - public void reset(LocalPlayer player) + public void reset() { this.c1Latched = false; this.c0Latched = false; } - public void doProcess(LocalPlayer player) + public void doProcess() { if (this.isClimbeyJumpEquipped()) { - VRPlayer vrplayer = this.dh.vrPlayer; boolean[] aboolean = new boolean[2]; for (int i = 0; i < 2; ++i) { - aboolean[i] = VivecraftVRMod.INSTANCE.keyClimbeyJump.isDown(); + aboolean[i] = VivecraftVRMod.keyClimbeyJump.isDown(); } boolean flag = false; if (!aboolean[0] && this.c0Latched) { - this.dh.vr.triggerHapticPulse(0, 200); + dh.vr.triggerHapticPulse(0, 200); flag = true; } - Vec3 vec3 = this.dh.vrPlayer.vrdata_room_pre.getController(0).getPosition(); - Vec3 vec31 = this.dh.vrPlayer.vrdata_room_pre.getController(1).getPosition(); + Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getController(0).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_room_pre.getController(1).getPosition(); Vec3 vec32 = vec3.add(vec31).scale(0.5D); if (aboolean[0] && !this.c0Latched) { this.latchStart[0] = vec32; - this.latchStartOrigin[0] = this.dh.vrPlayer.vrdata_world_pre.origin; - this.latchStartPlayer[0] = this.mc.player.position(); - this.dh.vr.triggerHapticPulse(0, 1000); + this.latchStartOrigin[0] = dh.vrPlayer.vrdata_world_pre.origin; + this.latchStartPlayer[0] = mc.player.position(); + dh.vr.triggerHapticPulse(0, 1000); } if (!aboolean[1] && this.c1Latched) { - this.dh.vr.triggerHapticPulse(1, 200); + dh.vr.triggerHapticPulse(1, 200); flag = true; } if (aboolean[1] && !this.c1Latched) { this.latchStart[1] = vec32; - this.latchStartOrigin[1] = this.dh.vrPlayer.vrdata_world_pre.origin; - this.latchStartPlayer[1] = this.mc.player.position(); - this.dh.vr.triggerHapticPulse(1, 1000); + this.latchStartOrigin[1] = dh.vrPlayer.vrdata_world_pre.origin; + this.latchStartPlayer[1] = mc.player.position(); + dh.vr.triggerHapticPulse(1, 1000); } this.c0Latched = aboolean[0]; this.c1Latched = aboolean[1]; int j = 0; Vec3 vec33 = vec32.subtract(this.latchStart[j]); - vec33 = vec33.yRot(this.dh.vrPlayer.vrdata_world_pre.rotation_radians); + vec33 = vec33.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); if (!flag && this.isjumping()) { - this.dh.vr.triggerHapticPulse(0, 200); - this.dh.vr.triggerHapticPulse(1, 200); + dh.vr.triggerHapticPulse(0, 200); + dh.vr.triggerHapticPulse(1, 200); } if (flag) { - this.dh.climbTracker.forceActivate = true; - Vec3 vec34 = this.dh.vr.controllerHistory[0].netMovement(0.3D).add(this.dh.vr.controllerHistory[1].netMovement(0.3D)); - double d0 = (this.dh.vr.controllerHistory[0].averageSpeed(0.3D) + this.dh.vr.controllerHistory[1].averageSpeed(0.3D)) / 2.0D; + dh.climbTracker.forceActivate = true; + Vec3 vec34 = convertToVec3(dh.vr.controllerHistory[0].netMovement(0.3D, new Vector3d()).add(dh.vr.controllerHistory[1].netMovement(0.3D, new Vector3d()))); + double d0 = (dh.vr.controllerHistory[0].averageSpeed(0.3D) + dh.vr.controllerHistory[1].averageSpeed(0.3D)) / 2.0D; vec34 = vec34.scale((double)0.33F * d0); float f = 0.66F; @@ -160,44 +156,44 @@ public void doProcess(LocalPlayer player) vec34 = vec34.scale((double)f / vec34.length()); } - if (player.hasEffect(MobEffects.JUMP)) + if (mc.player.hasEffect(MobEffects.JUMP)) { - vec34 = vec34.scale((double)player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); + vec34 = vec34.scale((double)mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); } - vec34 = vec34.yRot(this.dh.vrPlayer.vrdata_world_pre.rotation_radians); - Vec3 vec35 = this.mc.player.position().subtract(vec33); + vec34 = vec34.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); + Vec3 vec35 = mc.player.position().subtract(vec33); if (vec33.y < 0.0D && vec34.y < 0.0D) { double d2 = -vec34.x; - double d1 = player.getDeltaMovement().x + d2 * 1.25D; + double d1 = mc.player.getDeltaMovement().x + d2 * 1.25D; d2 = -vec34.y; double d3 = -vec34.z; - player.setDeltaMovement(d1, d2, player.getDeltaMovement().z + d3 * 1.25D); - player.xOld = vec35.x; - player.yOld = vec35.y; - player.zOld = vec35.z; - vec35 = vec35.add(player.getDeltaMovement()); - player.setPos(vec35.x, vec35.y, vec35.z); - this.dh.vrPlayer.snapRoomOriginToPlayerEntity(player, false, true); - this.mc.player.causeFoodExhaustion(0.3F); - this.mc.player.setOnGround(false); + mc.player.setDeltaMovement(d1, d2, mc.player.getDeltaMovement().z + d3 * 1.25D); + mc.player.xOld = vec35.x; + mc.player.yOld = vec35.y; + mc.player.zOld = vec35.z; + vec35 = vec35.add(mc.player.getDeltaMovement()); + mc.player.setPos(vec35.x, vec35.y, vec35.z); + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, true); + mc.player.causeFoodExhaustion(0.3F); + mc.player.setOnGround(false); } else { - this.dh.vrPlayer.snapRoomOriginToPlayerEntity(player, false, true); + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, true); } } else if (this.isjumping()) { - Vec3 vec36 = this.latchStartOrigin[0].subtract(this.latchStartPlayer[0]).add(this.mc.player.position()).subtract(vec33); - this.dh.vrPlayer.setRoomOrigin(vec36.x, vec36.y, vec36.z, false); + Vec3 vec36 = this.latchStartOrigin[0].subtract(this.latchStartPlayer[0]).add(mc.player.position()).subtract(vec33); + dh.vrPlayer.setRoomOrigin(vec36.x, vec36.y, vec36.z, false); } } - else if (this.dh.vr.hmdPivotHistory.netMovement(0.25D).y > 0.1D && this.dh.vr.hmdPivotHistory.latest().y - (double) AutoCalibration.getPlayerHeight() > (double)this.dh.vrSettings.jumpThreshold) + else if (dh.vr.hmdPivotHistory.netMovement(0.25D, new Vector3d()).y > 0.1D && dh.vr.hmdPivotHistory.latest(new Vector3d()).y - (double) AutoCalibration.getPlayerHeight() > (double)dh.vrSettings.jumpThreshold) { - player.jumpFromGround(); + mc.player.jumpFromGround(); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java index 6a8e31edb..b9b289c2f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java @@ -1,16 +1,20 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.common.utils.math.Quaternion; +import org.joml.Quaternionf; +import org.joml.Vector3d; +import org.joml.Vector3f; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.backward; +import static org.vivecraft.common.utils.Utils.convertToVec3; + +import static org.joml.Math.*; + public class RowTracker extends Tracker { Vec3[] lastUWPs = new Vec3[2]; @@ -18,40 +22,35 @@ public class RowTracker extends Tracker double transmissionEfficiency = 0.9D; public float LOar; public float ROar; - public float Foar; - - public RowTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } + public float FOar; - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (ClientDataHolderVR.getInstance().vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!ClientDataHolderVR.getInstance().vrSettings.realisticRowEnabled) + else if (!dh.vrSettings.realisticRowEnabled) { return false; } - else if (p != null && p.isAlive()) + else if (mc.player != null && mc.player.isAlive()) { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (Minecraft.getInstance().options.keyUp.isDown()) + else if (mc.options.keyUp.isDown()) { return false; } - else if (!(p.getVehicle() instanceof Boat)) + else if (!(mc.player.getVehicle() instanceof Boat)) { return false; } else { - return !ClientDataHolderVR.getInstance().bowTracker.isNotched(); + return !dh.bowTracker.isNotched(); } } else @@ -62,29 +61,29 @@ else if (!(p.getVehicle() instanceof Boat)) public boolean isRowing() { - return this.ROar + this.LOar + this.Foar > 0.0F; + return this.ROar + this.LOar + this.FOar > 0.0F; } - public void reset(LocalPlayer player) + public void reset() { this.LOar = 0.0F; this.ROar = 0.0F; - this.Foar = 0.0F; + this.FOar = 0.0F; } - public void doProcess(LocalPlayer player) + public void doProcess() { - double d0 = this.dh.vr.controllerHistory[0].averageSpeed(0.5D); - double d1 = this.dh.vr.controllerHistory[1].averageSpeed(0.5D); + double d0 = dh.vr.controllerHistory[0].averageSpeed(0.5D); + double d1 = dh.vr.controllerHistory[1].averageSpeed(0.5D); float f = 0.5F; float f1 = 2.0F; - this.ROar = (float)Math.max(d0 - (double)f, 0.0D); - this.LOar = (float)Math.max(d1 - (double)f, 0.0D); - this.Foar = this.ROar > 0.0F && this.LOar > 0.0F ? (this.ROar + this.LOar) / 2.0F : 0.0F; + this.ROar = (float) max(d0 - (double) f, 0.0D); + this.LOar = (float) max(d1 - (double) f, 0.0D); + this.FOar = this.ROar > 0.0F && this.LOar > 0.0F ? (this.ROar + this.LOar) / 2.0F : 0.0F; - if (this.Foar > f1) + if (this.FOar > f1) { - this.Foar = f1; + this.FOar = f1; } if (this.ROar > f1) @@ -98,10 +97,20 @@ public void doProcess(LocalPlayer player) } } - public void doProcessFinaltransmithastofixthis(LocalPlayer player) + public void doProcessFinaltransmithastofixthis() { - Boat boat = (Boat)player.getVehicle(); - Quaternion quaternion = (new Quaternion(boat.getXRot(), -(boat.getYRot() % 360.0F), 0.0F)).normalized(); + Boat boat = (Boat)mc.player.getVehicle(); + Quaternionf quaternion = new Quaternionf().setAngleAxis(-(boat.getYRot() % 360.0F), 0.0F, 1.0F, 0.0F) + .mul(new Quaternionf().setAngleAxis(boat.getXRot(), 1.0F, 0.0F, 0.0F)) + .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F)); + if (sqrt(quaternion.lengthSquared()) > 0.0F) + { + quaternion.normalize(); + } + else + { + quaternion.identity(); + } for (int i = 0; i <= 1; ++i) { @@ -120,12 +129,12 @@ public void doProcessFinaltransmithastofixthis(LocalPlayer player) { Vec3 vec33 = this.lastUWPs[i].subtract(vec32); vec33 = vec33.subtract(boat.getDeltaMovement()); - Vec3 vec34 = quaternion.multiply(new Vec3(0.0D, 0.0D, 1.0D)); + Vec3 vec34 = convertToVec3(quaternion.transformUnit(new Vector3f(backward))); double d0 = vec33.dot(vec34) * this.transmissionEfficiency / 5.0D; if ((!(d0 < 0.0D) || !(this.forces[i] > 0.0D)) && (!(d0 > 0.0D) || !(this.forces[i] < 0.0D))) { - this.forces[i] = Math.min(Math.max(d0, -0.1D), 0.1D); + this.forces[i] = min(max(d0, -0.1D), 0.1D); } else { @@ -147,16 +156,30 @@ Vec3 getArmToPaddleVector(int paddle, Boat boat) Vec3 getAttachmentPoint(int paddle, Boat boat) { - Vec3 vec3 = new Vec3((double)((paddle == 0 ? 9.0F : -9.0F) / 16.0F), 0.625D, 0.1875D); - Quaternion quaternion = (new Quaternion(boat.getXRot(), -(boat.getYRot() % 360.0F), 0.0F)).normalized(); - return boat.position().add(quaternion.multiply(vec3)); + Quaternionf quaternion = new Quaternionf().setAngleAxis(-(boat.getYRot() % 360.0F), 0.0F, 1.0F, 0.0F) + .mul(new Quaternionf().setAngleAxis(boat.getXRot(), 1.0F, 0.0F, 0.0F)) + .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F)); + if (sqrt(quaternion.lengthSquared()) > 0.0F) + { + quaternion.normalize(); + } + else + { + quaternion.identity(); + } + return boat.position().add(convertToVec3(quaternion.transformUnit(new Vector3f( + (paddle == 0 ? 9.0F : -9.0F) / 16.0F, 0.625F, 0.1875F) + ))); } Vec3 getAbsArmPos(int side) { - Vec3 vec3 = this.dh.vr.controllerHistory[side].averagePosition(0.1D); - Quaternion quaternion = new Quaternion(0.0F, VRSettings.inst.worldRotation, 0.0F); - return VRPlayer.get().roomOrigin.add(quaternion.multiply(vec3)); + return dh.vrPlayer.roomOrigin.add(convertToVec3( + new Quaternionf().setAngleAxis(toRadians(dh.vrSettings.worldRotation), 0.0F, 1.0F, 0.0F) + .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F)) + .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F)) + .transformUnit(new Vector3f().set(dh.vr.controllerHistory[side].averagePosition(0.1D, new Vector3d()))) + )); } boolean isPaddleUnderWater(int paddle, Boat boat) diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java index f52d394ff..7d24594d5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java @@ -1,46 +1,43 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.FreeMove; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class RunTracker extends Tracker { private double direction = 0.0D; private double speed = 0.0D; private Vec3 movedir; - public RunTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (ClientDataHolderVR.getInstance().vrPlayer.getFreeMove() && !ClientDataHolderVR.getInstance().vrSettings.seated) + if (dh.vrPlayer.getFreeMove() && !dh.vrSettings.seated) { - if (ClientDataHolderVR.getInstance().vrSettings.vrFreeMoveMode != VRSettings.FreeMove.RUN_IN_PLACE) + if (dh.vrSettings.vrFreeMoveMode != FreeMove.RUN_IN_PLACE) { return false; } - else if (p != null && p.isAlive()) + else if (mc.player != null && mc.player.isAlive()) { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (p.onGround() || !p.isInWater() && !p.isInLava()) + else if (mc.player.onGround() || !mc.player.isInWater() && !mc.player.isInLava()) { - if (p.onClimbable()) + if (mc.player.onClimbable()) { return false; } else { - return !ClientDataHolderVR.getInstance().bowTracker.isNotched(); + return !dh.bowTracker.isNotched(); } } else @@ -69,17 +66,17 @@ public double getSpeed() return this.speed; } - public void reset(LocalPlayer player) + public void reset() { this.speed = 0.0D; } - public void doProcess(LocalPlayer player) + public void doProcess() { - Vec3 vec3 = this.dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); - Vec3 vec31 = this.dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); - double d0 = this.dh.vr.controllerHistory[0].averageSpeed(0.33D); - double d1 = this.dh.vr.controllerHistory[1].averageSpeed(0.33D); + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); + double d0 = dh.vr.controllerHistory[0].averageSpeed(0.33D); + double d1 = dh.vr.controllerHistory[1].averageSpeed(0.33D); if (this.speed > 0.0D) { @@ -95,14 +92,14 @@ else if (d0 < 0.6D && d1 < 0.6D) return; } - if (Math.abs(d0 - d1) > 0.5D) + if (abs(d0 - d1) > 0.5D) { this.speed = 0.0D; } else { - Vec3 vec32 = this.dh.vrPlayer.vrdata_world_pre.getController(0).getDirection().add(this.dh.vrPlayer.vrdata_world_pre.getController(1).getDirection()).scale(0.5D); - this.direction = (double)((float)Math.toDegrees(Math.atan2(-vec32.x, vec32.z))); + Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.getController(0).getDirection().add(dh.vrPlayer.vrdata_world_pre.getController(1).getDirection()).scale(0.5D); + this.direction = atan2(-vec32.x, vec32.z); double d2 = (d0 + d1) / 2.0D; this.speed = d2 * 1.0D * 1.3D; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SneakTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SneakTracker.java index fbcf45c4a..b4bba0d28 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SneakTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SneakTracker.java @@ -1,42 +1,39 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.settings.AutoCalibration; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; +import org.joml.Vector3d; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; public class SneakTracker extends Tracker { public boolean sneakOverride = false; public int sneakCounter = 0; - public SneakTracker(Minecraft mc, ClientDataHolderVR dh) + @Override + public boolean isActive() { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) - { - if (ClientDataHolderVR.getInstance().vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!ClientDataHolderVR.getInstance().vrPlayer.getFreeMove() && !ClientDataHolderVR.getInstance().vrSettings.simulateFalling) + else if (!dh.vrPlayer.getFreeMove() && !dh.vrSettings.simulateFalling) { return false; } - else if (!ClientDataHolderVR.getInstance().vrSettings.realisticSneakEnabled) + else if (!dh.vrSettings.realisticSneakEnabled) { return false; } - else if (this.mc.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (p != null && p.isAlive() && p.onGround()) + else if (mc.player != null && mc.player.isAlive() && mc.player.onGround()) { - return !p.isPassenger(); + return !mc.player.isPassenger(); } else { @@ -44,25 +41,20 @@ else if (p != null && p.isAlive() && p.onGround()) } } - public void reset(LocalPlayer player) + @Override + public void reset() { this.sneakOverride = false; } - public void doProcess(LocalPlayer player) + @Override + public void doProcess() { - if (!this.mc.isPaused() && this.dh.sneakTracker.sneakCounter > 0) + if (!mc.isPaused() && dh.sneakTracker.sneakCounter > 0) { - --this.dh.sneakTracker.sneakCounter; + --dh.sneakTracker.sneakCounter; } - if ((double) AutoCalibration.getPlayerHeight() - this.dh.vr.hmdPivotHistory.latest().y > (double)this.dh.vrSettings.sneakThreshold) - { - this.sneakOverride = true; - } - else - { - this.sneakOverride = false; - } + this.sneakOverride = (double)AutoCalibration.getPlayerHeight() - dh.vr.hmdPivotHistory.latest(new Vector3d()).y > (double)dh.vrSettings.sneakThreshold; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java index b0f6a4227..a528b655a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java @@ -1,11 +1,10 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class SwimTracker extends Tracker { Vec3 motion = Vec3.ZERO; @@ -14,42 +13,37 @@ public class SwimTracker extends Tracker final double riseSpeed = (double)0.005F; double swimspeed = (double)1.3F; - public SwimTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { return false; } - else if (!this.dh.vrSettings.realisticSwimEnabled) + else if (!dh.vrSettings.realisticSwimEnabled) { return false; } - else if (this.mc.screen != null) + else if (mc.screen != null) { return false; } - else if (p != null && p.isAlive()) + else if (mc.player != null && mc.player.isAlive()) { - if (this.mc.gameMode == null) + if (mc.gameMode == null) { return false; } - else if (!p.isInWater() && !p.isInLava()) + else if (!mc.player.isInWater() && !mc.player.isInLava()) { return false; } - else if (p.zza > 0.0F) + else if (mc.player.zza > 0.0F) { return false; } else { - return !(p.xxa > 0.0F); + return !(mc.player.xxa > 0.0F); } } else @@ -58,14 +52,14 @@ else if (p.zza > 0.0F) } } - public void doProcess(LocalPlayer player) + public void doProcess() { - Vec3 vec3 = this.dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); - Vec3 vec31 = this.dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); Vec3 vec32 = vec31.subtract(vec3).scale(0.5D).add(vec3); - Vec3 vec33 = this.dh.vrPlayer.vrdata_world_pre.getHeadPivot().subtract(0.0D, 0.3D, 0.0D); - Vec3 vec34 = vec32.subtract(vec33).normalize().add(this.dh.vrPlayer.vrdata_world_pre.hmd.getDirection()).scale(0.5D); - Vec3 vec35 = this.dh.vrPlayer.vrdata_world_pre.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).add(this.dh.vrPlayer.vrdata_world_pre.getController(1).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D))).scale(0.5D); + Vec3 vec33 = dh.vrPlayer.vrdata_world_pre.getHeadPivot().subtract(0.0D, 0.3D, 0.0D); + Vec3 vec34 = vec32.subtract(vec33).normalize().add(dh.vrPlayer.vrdata_world_pre.hmd.getDirection()).scale(0.5D); + Vec3 vec35 = dh.vrPlayer.vrdata_world_pre.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).add(dh.vrPlayer.vrdata_world_pre.getController(1).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D))).scale(0.5D); double d0 = vec35.add(vec34).length() / 2.0D; double d1 = vec33.distanceTo(vec32); double d2 = this.lastDist - d1; @@ -77,9 +71,9 @@ public void doProcess(LocalPlayer player) } this.lastDist = d1; - player.setSwimming(this.motion.length() > (double)0.3F); - player.setSprinting(this.motion.length() > 1.0D); - player.push(this.motion.x, this.motion.y, this.motion.z); + mc.player.setSwimming(this.motion.length() > (double)0.3F); + mc.player.setSprinting(this.motion.length() > 1.0D); + mc.player.push(this.motion.x, this.motion.y, this.motion.z); this.motion = this.motion.scale(this.friction); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java index 02c87885b..3a0555c2e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java @@ -1,19 +1,13 @@ package org.vivecraft.client_vr.gameplay.trackers; -import java.util.List; - -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.block.*; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.BlockTags; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.Vec3History; import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.FreeMove; +import org.vivecraft.client_vr.settings.VRSettings.WeaponCollision; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -21,13 +15,24 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; +import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.Vec3; +import java.util.List; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class SwingTracker extends Tracker { private Vec3[] lastWeaponEndAir = new Vec3[] {new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; @@ -40,70 +45,60 @@ public class SwingTracker extends Tracker Vec3 forward = new Vec3(0.0D, 0.0D, -1.0D); double speedthresh = 3.0D; - public SwingTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) + public boolean isActive() { if (this.disableSwing > 0) { --this.disableSwing; return false; } - else if (this.mc.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (p == null) + else if (mc.player == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } - else if (p.isSleeping()) + else if (mc.player.isSleeping()) { return false; } else { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - - if (minecraft.screen != null) + if (mc.screen != null) { return false; } - else if (dataholder.vrSettings.weaponCollision == VRSettings.WeaponCollision.OFF) + else if (dh.vrSettings.weaponCollision == WeaponCollision.OFF) { return false; } - else if (dataholder.vrSettings.weaponCollision == VRSettings.WeaponCollision.AUTO) + else if (dh.vrSettings.weaponCollision == WeaponCollision.AUTO) { - return !p.isCreative(); + return !mc.player.isCreative(); } - else if (dataholder.vrSettings.seated) + else if (dh.vrSettings.seated) { return false; } else { - VRSettings vrsettings = dataholder.vrSettings; - - if (dataholder.vrSettings.vrFreeMoveMode == VRSettings.FreeMove.RUN_IN_PLACE && p.zza > 0.0F) + if (dh.vrSettings.vrFreeMoveMode == FreeMove.RUN_IN_PLACE && mc.player.zza > 0.0F) { return false; } - else if (p.isBlocking()) + else if (mc.player.isBlocking()) { return false; } else { - return !dataholder.jumpTracker.isjumping(); + return !dh.jumpTracker.isjumping(); } } } @@ -114,24 +109,24 @@ public static boolean isTool(Item item) return item instanceof DiggerItem || item instanceof ArrowItem || item instanceof FishingRodItem || item instanceof FoodOnAStickItem || item instanceof ShearsItem || item == Items.BONE || item == Items.BLAZE_ROD || item == Items.BAMBOO || item == Items.TORCH || item == Items.REDSTONE_TORCH || item == Items.STICK || item == Items.DEBUG_STICK || item instanceof FlintAndSteelItem || item instanceof BrushItem || item.getDefaultInstance().is(ItemTags.VIVECRAFT_TOOLS); } - public void doProcess(LocalPlayer player) + public void doProcess() { this.speedthresh = 3.0D; - if (player.isCreative()) + if (mc.player.isCreative()) { this.speedthresh *= 1.5D; } - this.mc.getProfiler().push("updateSwingAttack"); + mc.getProfiler().push("updateSwingAttack"); for (int i = 0; i < 2; ++i) { - if (!this.dh.climbTracker.isGrabbingLadder(i)) + if (!dh.climbTracker.isGrabbingLadder(i)) { - Vec3 vec3 = this.dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); - Vec3 vec31 = this.dh.vrPlayer.vrdata_world_pre.getHand(i).getCustomVector(this.forward); - ItemStack itemstack = player.getItemInHand(i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getHand(i).getCustomVector(this.forward); + ItemStack itemstack = mc.player.getItemInHand(i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); Item item = itemstack.getItem(); boolean flag = false; boolean flag1 = false; @@ -175,10 +170,13 @@ else if (!itemstack.isEmpty()) f1 = 0.3F; } - f = f * this.dh.vrPlayer.vrdata_world_pre.worldScale; - this.miningPoint[i] = vec3.add(vec31.scale((double)f)); - Vec3 vec32 = this.dh.vrPlayer.vrdata_room_pre.getController(i).getPosition().add(this.dh.vrPlayer.vrdata_room_pre.getHand(i).getCustomVector(this.forward).scale(0.3D)); - this.tipHistory[i].add(vec32); + f *= dh.vrPlayer.vrdata_world_pre.worldScale; + this.miningPoint[i] = vec3.add(vec31.scale(f)); + this.tipHistory[i].add( + dh.vrPlayer.vrdata_room_pre.getController(i).getPosition().add( + dh.vrPlayer.vrdata_room_pre.getHand(i).getCustomVector(this.forward).scale(0.3D) + ) + ); float f2 = (float)this.tipHistory[i].averageSpeed(0.33D); boolean flag2 = false; this.canact[i] = (double)f2 > this.speedthresh && !this.lastWeaponSolid[i]; @@ -186,40 +184,34 @@ else if (!itemstack.isEmpty()) if (flag3) { - BlockHitResult blockhitresult = this.mc.level.clip(new ClipContext(this.dh.vrPlayer.vrdata_world_pre.hmd.getPosition(), vec3, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.mc.player)); + BlockHitResult blockhitresult = mc.level.clip(new ClipContext(dh.vrPlayer.vrdata_world_pre.hmd.getPosition(), vec3, Block.OUTLINE, Fluid.NONE, mc.player)); - if (blockhitresult.getType() != HitResult.Type.MISS) + if (blockhitresult.getType() != Type.MISS) { flag3 = false; } } this.attackingPoint[i] = this.constrain(vec3, this.miningPoint[i]); - Vec3 vec33 = vec3.add(vec31.scale((double)(f + f1))); + Vec3 vec33 = vec3.add(vec31.scale(f + f1)); vec33 = this.constrain(vec3, vec33); AABB aabb = new AABB(vec3, this.attackingPoint[i]); AABB aabb1 = new AABB(vec3, vec33); - List list = this.mc.level.getEntities(this.mc.player, aabb1); - list.removeIf((e) -> - { - return e instanceof Player; - }); - List list1 = this.mc.level.getEntities(this.mc.player, aabb); - list1.removeIf((e) -> - { - return !(e instanceof Player); - }); + List list = mc.level.getEntities(mc.player, aabb1); + list.removeIf((e) -> e instanceof Player); + List list1 = mc.level.getEntities(mc.player, aabb); + list1.removeIf((e) -> !(e instanceof Player)); list.addAll(list1); for (Entity entity : list) { - if (entity.isPickable() && entity != this.mc.getCameraEntity().getVehicle()) + if (entity.isPickable() && entity != mc.getCameraEntity().getVehicle()) { if (flag3) { //Minecraft.getInstance().physicalGuiManager.preClickAction(); - this.mc.gameMode.attack(player, entity); - this.dh.vr.triggerHapticPulse(i, 1000); + mc.gameMode.attack(mc.player, entity); + dh.vr.triggerHapticPulse(i, 1000); this.lastWeaponSolid[i] = true; } @@ -229,19 +221,19 @@ else if (!itemstack.isEmpty()) this.canact[i] = this.canact[i] && !flag1 && !flag2; - if (!this.dh.climbTracker.isClimbeyClimb() || (i != 0 || !VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.RIGHT)) && flag && (i != 1 || !VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.LEFT)) && flag) + if (!dh.climbTracker.isClimbeyClimb() || (i != 0 || !VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT)) && flag && (i != 1 || !VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT)) && flag) { BlockPos blockpos = BlockPos.containing(this.miningPoint[i]); - BlockState blockstate = this.mc.level.getBlockState(blockpos); - BlockHitResult blockhitresult1 = this.mc.level.clip(new ClipContext(this.lastWeaponEndAir[i], this.miningPoint[i], ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.mc.player)); + BlockState blockstate = mc.level.getBlockState(blockpos); + BlockHitResult blockhitresult1 = mc.level.clip(new ClipContext(this.lastWeaponEndAir[i], this.miningPoint[i], Block.OUTLINE, Fluid.NONE, mc.player)); - if (!blockstate.isAir() && blockhitresult1.getType() == HitResult.Type.BLOCK && this.lastWeaponEndAir[i].length() != 0.0D) + if (!blockstate.isAir() && blockhitresult1.getType() == Type.BLOCK && this.lastWeaponEndAir[i].length() != 0.0D) { this.lastWeaponSolid[i] = true; boolean flag4 = blockhitresult1.getBlockPos().equals(blockpos); - boolean flag5 = this.dh.vrSettings.realisticClimbEnabled && (blockstate.getBlock() instanceof LadderBlock || blockstate.getBlock() instanceof VineBlock || blockstate.is(BlockTags.VIVECRAFT_CLIMBABLE)); + boolean flag5 = dh.vrSettings.realisticClimbEnabled && (blockstate.getBlock() instanceof LadderBlock || blockstate.getBlock() instanceof VineBlock || blockstate.is(BlockTags.VIVECRAFT_CLIMBABLE)); - if (blockhitresult1.getType() == HitResult.Type.BLOCK && flag4 && this.canact[i] && !flag5) + if (blockhitresult1.getType() == Type.BLOCK && flag4 && this.canact[i] && !flag5) { int j = 3; @@ -251,39 +243,39 @@ else if (!itemstack.isEmpty()) || blockstate.getBlock() instanceof AttachedStemBlock || blockstate.is(BlockTags.VIVECRAFT_CROPS) // check if the item can use the block - || item.useOn(new UseOnContext(player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1)).shouldSwing())) + || item.useOn(new UseOnContext(mc.player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1)).shouldSwing())) { // don't try to break crops with hoes // actually use the item on the block - boolean useSuccessful = this.mc.gameMode.useItemOn(player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1).shouldSwing(); + boolean useSuccessful = mc.gameMode.useItemOn(mc.player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1).shouldSwing(); if (itemstack.is(ItemTags.VIVECRAFT_SCYTHES) && !useSuccessful) { // some scythes just need to be used - this.mc.gameMode.useItem(player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + mc.gameMode.useItem(mc.player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); } } else if ((item instanceof BrushItem /*|| itemstack.is(ItemTags.VIVECRAFT_BRUSHES*/)) { - ((BrushItem)item).spawnDustParticles(player.level(), blockhitresult1, blockstate, player.getViewVector(0.0F), i == 0 ? player.getMainArm() : player.getMainArm().getOpposite()); - player.level().playSound(player, blockhitresult1.getBlockPos(), blockstate.getBlock() instanceof BrushableBlock ? ((BrushableBlock)blockstate.getBlock()).getBrushSound() : SoundEvents.BRUSH_GENERIC, SoundSource.BLOCKS); - this.mc.gameMode.useItemOn(player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1); + ((BrushItem)item).spawnDustParticles(mc.player.level(), blockhitresult1, blockstate, mc.player.getViewVector(0.0F), i == 0 ? mc.player.getMainArm() : mc.player.getMainArm().getOpposite()); + mc.player.level().playSound(mc.player, blockhitresult1.getBlockPos(), blockstate.getBlock() instanceof BrushableBlock ? ((BrushableBlock)blockstate.getBlock()).getBrushSound() : SoundEvents.BRUSH_GENERIC, SoundSource.BLOCKS); + mc.gameMode.useItemOn(mc.player, i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND, blockhitresult1); } else if (blockstate.getBlock() instanceof NoteBlock || blockstate.is(BlockTags.VIVECRAFT_MUSIC_BLOCKS)) { - this.mc.gameMode.continueDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); + mc.gameMode.continueDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); } else { - j = (int)((double)j + Math.min((double)f2 - this.speedthresh, 4.0D)); - //this.mc.physicalGuiManager.preClickAction(); - this.mc.gameMode.startDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); + j = (int)((double)j + min((double)f2 - this.speedthresh, 4.0D)); + //Minecraft.getInstance().physicalGuiManager.preClickAction(); + mc.gameMode.startDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); if (this.getIsHittingBlock()) { for (int k = 0; k < j; ++k) { - if (this.mc.gameMode.continueDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection())) + if (mc.gameMode.continueDestroyBlock(blockhitresult1.getBlockPos(), blockhitresult1.getDirection())) { - this.mc.particleEngine.crack(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); + mc.particleEngine.crack(blockhitresult1.getBlockPos(), blockhitresult1.getDirection()); } this.clearBlockHitDelay(); @@ -294,13 +286,13 @@ else if (blockstate.getBlock() instanceof NoteBlock || blockstate.is(BlockTags.V } } - Minecraft.getInstance().gameMode.destroyDelay = 0; + mc.gameMode.destroyDelay = 0; } - this.dh.vrPlayer.blockDust(blockhitresult1.getLocation().x, blockhitresult1.getLocation().y, blockhitresult1.getLocation().z, 3 * j, blockpos, blockstate, 0.6F, 1.0F); + dh.vrPlayer.blockDust(blockhitresult1.getLocation().x, blockhitresult1.getLocation().y, blockhitresult1.getLocation().z, 3 * j, blockpos, blockstate, 0.6F, 1.0F); } - this.dh.vr.triggerHapticPulse(i, 250 * j); + dh.vr.triggerHapticPulse(i, 250 * j); } } else @@ -312,12 +304,12 @@ else if (blockstate.getBlock() instanceof NoteBlock || blockstate.is(BlockTags.V } } - this.mc.getProfiler().pop(); + mc.getProfiler().pop(); } private boolean getIsHittingBlock() { - return Minecraft.getInstance().gameMode.isDestroying(); + return mc.gameMode.isDestroying(); } private void clearBlockHitDelay() @@ -328,35 +320,35 @@ private void clearBlockHitDelay() public Vec3 constrain(Vec3 start, Vec3 end) { - BlockHitResult blockhitresult = this.mc.level.clip(new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.mc.player)); - return blockhitresult.getType() == HitResult.Type.BLOCK ? blockhitresult.getLocation() : end; + BlockHitResult blockhitresult = mc.level.clip(new ClipContext(start, end, Block.OUTLINE, Fluid.NONE, mc.player)); + return blockhitresult.getType() == Type.BLOCK ? blockhitresult.getLocation() : end; } - public static float getItemFade(LocalPlayer p, ItemStack is) + public static float getItemFade(ItemStack is) { - float f = p.getAttackStrengthScale(0.0F) * 0.75F + 0.25F; + float f = mc.player.getAttackStrengthScale(0.0F) * 0.75F + 0.25F; - if (p.isShiftKeyDown()) + if (mc.player.isShiftKeyDown()) { f = 0.75F; } - boolean[] aboolean = ClientDataHolderVR.getInstance().swingTracker.lastWeaponSolid; - Minecraft.getInstance().getItemRenderer(); + boolean[] aboolean = dh.swingTracker.lastWeaponSolid; + mc.getItemRenderer(); - if (aboolean[ClientDataHolderVR.ismainhand ? 0 : 1]) + if (aboolean[dh.ismainhand ? 0 : 1]) { f -= 0.25F; } if (is != ItemStack.EMPTY) { - if (p.isBlocking() && p.getUseItem() != is) + if (mc.player.isBlocking() && mc.player.getUseItem() != is) { f -= 0.25F; } - if (is.getItem() == Items.SHIELD && !p.isBlocking()) + if (is.getItem() == Items.SHIELD && !mc.player.isBlocking()) { f -= 0.25F; } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java index cebbd9eb7..fbc6eca0c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java @@ -1,8 +1,18 @@ package org.vivecraft.client_vr.gameplay.trackers; +import org.vivecraft.client.VivecraftVRMod; +import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.client_vr.BlockTags; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.extensions.PlayerExtension; +import org.vivecraft.client_vr.gameplay.VRMovementStyle; + +import org.joml.Matrix4f; +import org.joml.Quaternionf; +import org.joml.Vector3f; + import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.ClipContext; @@ -15,22 +25,15 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.BlockTags; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.extensions.PlayerExtension; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.provider.openvr_lwjgl.OpenVRUtil; -import org.vivecraft.client_vr.gameplay.VRMovementStyle; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Angle; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; import java.util.Random; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.up; + +import static org.joml.Math.*; + public class TeleportTracker extends Tracker { private float teleportEnergy; @@ -41,13 +44,7 @@ public class TeleportTracker extends Tracker private Vec3[] movementTeleportArc = new Vec3[50]; public int movementTeleportArcSteps = 0; public double lastTeleportArcDisplayOffset = 0.0D; - public VRMovementStyle vrMovementStyle; - - public TeleportTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - this.vrMovementStyle = new VRMovementStyle(dh); - } + public final VRMovementStyle vrMovementStyle = new VRMovementStyle(); public float getTeleportEnergy() { @@ -64,34 +61,34 @@ public Vec3 getDestination() return this.movementTeleportDestination; } - public boolean isActive(LocalPlayer p) + public boolean isActive() { - if (p == null) + if (mc.player == null) { return false; } - else if (this.mc.gameMode == null) + else if (mc.gameMode == null) { return false; } - else if (!p.isAlive()) + else if (!mc.player.isAlive()) { return false; } else { - return !p.isSleeping(); + return !mc.player.isSleeping(); } } - public void reset(LocalPlayer player) + public void reset() { this.movementTeleportDestination = new Vec3(0.0D, 0.0D, 0.0D); this.movementTeleportArcSteps = 0; this.movementTeleportProgress = 0.0D; } - public void doProcess(LocalPlayer player) + public void doProcess() { Random random = new Random(); @@ -102,25 +99,25 @@ public void doProcess(LocalPlayer player) boolean flag = false; Vec3 vec3 = null; - boolean flag1 = VivecraftVRMod.INSTANCE.keyTeleport.isDown() && this.dh.vrPlayer.isTeleportEnabled(); - boolean flag2 = this.dh.vrSettings.seated && !this.dh.vrPlayer.getFreeMove() && (player.input.forwardImpulse != 0.0F || player.input.leftImpulse != 0.0F); + boolean flag1 = VivecraftVRMod.keyTeleport.isDown() && dh.vrPlayer.isTeleportEnabled(); + boolean flag2 = dh.vrSettings.seated && !dh.vrPlayer.getFreeMove() && (mc.player.input.forwardImpulse != 0.0F || mc.player.input.leftImpulse != 0.0F); - if ((flag1 || flag2) && !player.isPassenger()) + if ((flag1 || flag2) && !mc.player.isPassenger()) { vec3 = this.movementTeleportDestination; if (this.vrMovementStyle.teleportOnRelease) { - if (((PlayerExtension) player).getMovementTeleportTimer() == 0) + if (((PlayerExtension) mc.player).getMovementTeleportTimer() == 0) { String playCustomTeleportSound = this.vrMovementStyle.startTeleportingSound; } - ((PlayerExtension) player).setMovementTeleportTimer(((PlayerExtension) player).getMovementTeleportTimer() +1); + ((PlayerExtension) mc.player).setMovementTeleportTimer(((PlayerExtension) mc.player).getMovementTeleportTimer() +1); - if (((PlayerExtension) player).getMovementTeleportTimer() > 0) + if (((PlayerExtension) mc.player).getMovementTeleportTimer() > 0) { - this.movementTeleportProgress = (double)((float)((PlayerExtension) player).getMovementTeleportTimer() / 1.0F); + this.movementTeleportProgress = (double)((float)((PlayerExtension) mc.player).getMovementTeleportTimer() / 1.0F); if (this.movementTeleportProgress >= 1.0D) { @@ -129,9 +126,9 @@ public void doProcess(LocalPlayer player) if (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D) { - Vec3 vec38 = this.dh.vrPlayer.vrdata_world_pre.hmd.getPosition(); + Vec3 vec38 = dh.vrPlayer.vrdata_world_pre.hmd.getPosition(); Vec3 vec31 = vec3.add(-vec38.x, -vec38.y, -vec38.z).normalize(); - Vec3 vec32 = player.getLookAngle(); + Vec3 vec32 = mc.player.getLookAngle(); Vec3 vec33 = vec32.cross(new Vec3(0.0D, 1.0D, 0.0D)); Vec3 vec34 = vec33.cross(vec32); @@ -151,18 +148,18 @@ public void doProcess(LocalPlayer player) } } } - else if (((PlayerExtension) player).getMovementTeleportTimer() >= 0 && (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D)) + else if (((PlayerExtension) mc.player).getMovementTeleportTimer() >= 0 && (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D)) { - if (((PlayerExtension) player).getMovementTeleportTimer() == 0) + if (((PlayerExtension) mc.player).getMovementTeleportTimer() == 0) { } - ((PlayerExtension) player).setMovementTeleportTimer(((PlayerExtension) player).getMovementTeleportTimer() + 1); - Vec3 vec39 = player.position(); + ((PlayerExtension) mc.player).setMovementTeleportTimer(((PlayerExtension) mc.player).getMovementTeleportTimer() + 1); + Vec3 vec39 = mc.player.position(); double d6 = vec3.distanceTo(vec39); - double d7 = (double)((PlayerExtension) player).getMovementTeleportTimer() * 1.0D / (d6 + 3.0D); + double d7 = (double)((PlayerExtension) mc.player).getMovementTeleportTimer() * 1.0D / (d6 + 3.0D); - if (((PlayerExtension) player).getMovementTeleportTimer() > 0) + if (((PlayerExtension) mc.player).getMovementTeleportTimer() > 0) { this.movementTeleportProgress = d7; @@ -170,8 +167,8 @@ else if (((PlayerExtension) player).getMovementTeleportTimer() >= 0 && (vec3.x ! { } - Vec3 vec310 = vec3.add(-player.getX(), -player.getY(), -player.getZ()).normalize(); - Vec3 vec311 = player.getLookAngle(); + Vec3 vec310 = vec3.add(-mc.player.getX(), -mc.player.getY(), -mc.player.getZ()).normalize(); + Vec3 vec311 = mc.player.getLookAngle(); Vec3 vec35 = vec311.cross(new Vec3(0.0D, 1.0D, 0.0D)); Vec3 vec312 = vec35.cross(vec311); @@ -182,7 +179,7 @@ else if (((PlayerExtension) player).getMovementTeleportTimer() >= 0 && (vec3.x ! double d8 = random.nextDouble() * 1.0D + 3.5D; double d9 = random.nextDouble() * 2.5D; double d4 = random.nextDouble() * 4.0D - 2.0D; - Vec3 vec37 = new Vec3(player.getX() + vec311.x * d8, player.getY() + vec311.y * d8, player.getZ() + vec311.z * d8); + Vec3 vec37 = new Vec3(mc.player.getX() + vec311.x * d8, mc.player.getY() + vec311.y * d8, mc.player.getZ() + vec311.z * d8); vec37 = vec37.add(vec35.x * d4, vec35.y * d4, vec35.z * d4); vec37.add(vec312.x * d9, vec312.y * d9, vec312.z * d9); double d5 = -0.6D; @@ -208,13 +205,13 @@ else if (((PlayerExtension) player).getMovementTeleportTimer() >= 0 && (vec3.x ! flag = true; } - ((PlayerExtension) player).setMovementTeleportTimer(0); + ((PlayerExtension) mc.player).setMovementTeleportTimer(0); this.movementTeleportProgress = 0.0D; } if (flag && vec3 != null && (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D)) { - this.movementTeleportDistance = vec3.distanceTo(player.position()); + this.movementTeleportDistance = vec3.distanceTo(mc.player.position()); if (this.movementTeleportDistance > 0.0D && this.vrMovementStyle.endTeleportingSound != null) { @@ -227,27 +224,27 @@ else if (((PlayerExtension) player).getMovementTeleportTimer() >= 0 && (vec3.x ! Block block = null; - if (!this.dh.vrPlayer.isTeleportSupported()) + if (!dh.vrPlayer.isTeleportSupported()) { String s1 = "tp " + vec3.x + " " + vec3.y + " " + vec3.z; - this.mc.player.connection.sendCommand(s1); + mc.player.connection.sendCommand(s1); } else { if (ClientNetworking.serverSupportsDirectTeleport) { - ((PlayerExtension) player).setTeleported(true); + ((PlayerExtension) mc.player).setTeleported(true); } - player.moveTo(vec3.x, vec3.y, vec3.z); + mc.player.moveTo(vec3.x, vec3.y, vec3.z); } this.doTeleportCallback(); - ((PlayerExtension) this.mc.player).stepSound(BlockPos.containing(vec3), vec3); + ((PlayerExtension) mc.player).stepSound(BlockPos.containing(vec3), vec3.x(), vec3.y(), vec3.z()); } } - public void updateTeleportDestinations(GameRenderer renderer, Minecraft mc, LocalPlayer player) + public void updateTeleportDestinations() { mc.getProfiler().push("updateTeleportDestinations"); @@ -257,14 +254,14 @@ public void updateTeleportDestinations(GameRenderer renderer, Minecraft mc, Loca if (this.movementTeleportProgress > 0.0D) { - this.updateTeleportArc(mc, player); + this.updateTeleportArc(); } } mc.getProfiler().pop(); } - private void updateTeleportArc(Minecraft mc, LocalPlayer player) + private void updateTeleportArc() { Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getController(1).getPosition(); Vec3 vec31 = dh.vrPlayer.vrdata_world_render.getController(1).getDirection(); @@ -277,20 +274,15 @@ private void updateTeleportArc(Minecraft mc, LocalPlayer player) matrix4f = dh.vr.getAimRotation(0); } - Matrix4f matrix4f1 = Matrix4f.rotationY(dh.vrPlayer.vrdata_world_render.rotation_radians); - matrix4f = Matrix4f.multiply(matrix4f1, matrix4f); - Quaternion quaternion = OpenVRUtil.convertMatrix4ftoRotationQuat(matrix4f); - Angle angle = quaternion.toEuler(); + matrix4f = matrix4f.rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians, new Matrix4f()); + Quaternionf quaternion = new Quaternionf().setFromUnnormalized(matrix4f); int i = 50; this.movementTeleportArc[0] = new Vec3(vec3.x, vec3.y, vec3.z); this.movementTeleportArcSteps = 1; float f = 0.098F; - Matrix4f matrix4f2 = Utils.rotationZMatrix((float)Math.toRadians((double)(-angle.getRoll()))); - Matrix4f matrix4f3 = Utils.rotationXMatrix(-2.5132742F); - Matrix4f matrix4f4 = Matrix4f.multiply(matrix4f, matrix4f2); - Vector3 vector3 = new Vector3(0.0F, 1.0F, 0.0F); - Vector3 vector31 = matrix4f4.transform(vector3); - Vec3 vec32 = vector31.negate().toVector3d(); + Matrix4f matrix4f4 = matrix4f.rotateZ(-atan2((2.0F * (quaternion.x * quaternion.y + quaternion.w * quaternion.z)), (quaternion.w * quaternion.w - quaternion.x * quaternion.x + quaternion.y * quaternion.y - quaternion.z * quaternion.z))); + Vector3f vector31 = new Vector3f(up).mulProject(matrix4f4); + Vec3 vec32 = new Vec3(-vector31.x, -vector31.y, -vector31.z); vec32 = vec32.scale((double)f); float f1 = 0.5F; Vec3 vec33 = new Vec3(vec31.x * (double)f1, vec31.y * (double)f1, vec31.z * (double)f1); @@ -318,11 +310,11 @@ private void updateTeleportArc(Minecraft mc, LocalPlayer player) this.movementTeleportArcSteps = j + 1; Vec3 vec36 = vec34.subtract(vec35).normalize(); Vec3 vec37 = new Vec3(-vec36.x * 0.02D, -vec36.y * 0.02D, -vec36.z * 0.02D); - this.checkAndSetTeleportDestination(mc, player, vec3, blockhitresult, vec37); + this.checkAndSetTeleportDestination(mc, mc.player, vec3, blockhitresult, vec37); Vec3 vec38 = mc.player.position().subtract(this.movementTeleportDestination); double d0 = vec38.y; this.movementTeleportDistance = vec38.length(); - double d1 = Math.sqrt(vec38.x * vec38.x + vec38.z * vec38.z); + double d1 = sqrt(vec38.x * vec38.x + vec38.z * vec38.z); boolean flag1 = true; if (mc.player.isShiftKeyDown() && d0 > 0.2D) @@ -336,11 +328,11 @@ private void updateTeleportArc(Minecraft mc, LocalPlayer player) { flag1 = false; } - else if (ClientNetworking.getTeleportUpLimit() > 0 && -d0 > (double) ClientNetworking.getTeleportUpLimit() * (double)((PlayerExtension) player).getMuhJumpFactor() + 0.2D) + else if (ClientNetworking.getTeleportUpLimit() > 0 && -d0 > (double) ClientNetworking.getTeleportUpLimit() * (double)((PlayerExtension) mc.player).getMuhJumpFactor() + 0.2D) { flag1 = false; } - else if (ClientNetworking.getTeleportHorizLimit() > 0 && d1 > (double) ClientNetworking.getTeleportHorizLimit() * (double)((PlayerExtension) player).getMuhSpeedFactor() + 0.2D) + else if (ClientNetworking.getTeleportHorizLimit() > 0 && d1 > (double) ClientNetworking.getTeleportHorizLimit() * (double)((PlayerExtension) mc.player).getMuhSpeedFactor() + 0.2D) { flag1 = false; } @@ -364,22 +356,20 @@ else if (ClientNetworking.getTeleportHorizLimit() > 0 && d1 > (double) ClientNet private void doTeleportCallback() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - dataholder.swingTracker.disableSwing = 3; + dh.swingTracker.disableSwing = 3; if (ClientNetworking.isLimitedSurvivalTeleport()) { - minecraft.player.causeFoodExhaustion((float)(this.movementTeleportDistance / 16.0D * (double)1.2F)); + mc.player.causeFoodExhaustion((float)(this.movementTeleportDistance / 16.0D * (double)1.2F)); - if (minecraft.gameMode.hasMissTime() && this.vrMovementStyle.arcAiming) + if (mc.gameMode.hasMissTime() && this.vrMovementStyle.arcAiming) { this.teleportEnergy = (float)((double)this.teleportEnergy - this.movementTeleportDistance * 4.0D); } } - minecraft.player.fallDistance = 0.0F; - ((PlayerExtension) minecraft.player).setMovementTeleportTimer(-1); + mc.player.fallDistance = 0.0F; + ((PlayerExtension) mc.player).setMovementTeleportTimer(-1); } private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, Vec3 start, BlockHitResult collision, Vec3 reverseEpsilon) @@ -498,7 +488,7 @@ public Vec3 getInterpolatedArcPosition(float progress) else { float f = progress * (float)(this.movementTeleportArcSteps - 1); - int i = (int)Math.floor((double)f); + int i = (int)floor(f); double d0 = this.movementTeleportArc[i + 1].x - this.movementTeleportArc[i].x; double d1 = this.movementTeleportArc[i + 1].y - this.movementTeleportArc[i].y; double d2 = this.movementTeleportArc[i + 1].z - this.movementTeleportArc[i].z; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java index 2b58719ad..e1368389b 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java @@ -1,18 +1,20 @@ package org.vivecraft.client_vr.gameplay.trackers; -import net.minecraft.network.chat.contents.TranslatableContents; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.VRData; import org.vivecraft.client_vr.render.RenderPass; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class TelescopeTracker extends Tracker { //public static final ResourceLocation scopeResource = new ResourceLocation("vivecraft:trashbin"); @@ -22,20 +24,6 @@ public class TelescopeTracker extends Tracker private static final double lensDotMax = 0.9D; private static final double lensDotMin = 0.75D; - public TelescopeTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer player) - { - return false; - } - - public void doProcess(LocalPlayer player) - { - } - public static boolean isTelescope(ItemStack i) { return i != null && (i.getItem() == Items.SPYGLASS || isLegacyTelescope(i) || i.is(ItemTags.VIVECRAFT_TELESCOPE)); @@ -67,13 +55,13 @@ else if (!i.hasTag() || !i.getTag().getBoolean("Unbreakable")) private static Vec3 getLensOrigin(int controller) { - VRData.VRDevicePose vrdata$vrdevicepose = ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getController(controller); + VRData.VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(controller); return vrdata$vrdevicepose.getPosition().add(getViewVector(controller).scale(-0.2D).add(vrdata$vrdevicepose.getDirection().scale((double)0.05F))); } private static Vec3 getViewVector(int controller) { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getController(controller).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); + return dh.vrPlayer.vrdata_room_pre.getController(controller).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); } public static boolean isViewing(int controller) @@ -83,9 +71,8 @@ public static boolean isViewing(int controller) public static float viewPercent(int controller) { - LocalPlayer p = Minecraft.getInstance().player; - if(p!= null && ClientDataHolderVR.getInstance().vrSettings.seated) { - if(isTelescope(p.getUseItem())) + if(mc.player!= null && dh.vrSettings.seated) { + if(isTelescope(mc.player.getUseItem())) return 1; else return 0; @@ -114,10 +101,10 @@ private static float viewPercent(int controller, int e) } else { - VRData.VRDevicePose eye = ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getEye(RenderPass.values()[e]); + VRData.VRDevicePose eye = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.values()[e]); double dist = eye.getPosition().subtract(getLensOrigin(controller)).length(); Vec3 look = eye.getDirection(); - double dot = Math.abs(look.dot(getViewVector(controller))); + double dot = abs(look.dot(getViewVector(controller))); double dfact = 0.0D; double distfact = 0.0D; @@ -146,7 +133,7 @@ private static float viewPercent(int controller, int e) } } - return (float)Math.min(dfact, distfact); + return (float)min(dfact, distfact); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/Tracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/Tracker.java index e67aed315..7418a984c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/Tracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/Tracker.java @@ -1,30 +1,21 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; - public abstract class Tracker { - public Minecraft mc; - public ClientDataHolderVR dh; - - public Tracker(Minecraft mc, ClientDataHolderVR dh) + public boolean isActive() { - this.mc = mc; - this.dh = dh; + return false; } - public abstract boolean isActive(LocalPlayer var1); - - public abstract void doProcess(LocalPlayer var1); + public void doProcess() + { + } - public void reset(LocalPlayer player) + public void reset() { } - public void idleTick(LocalPlayer player) + public void idleTick() { } @@ -33,9 +24,9 @@ public EntryPoint getEntryPoint() return EntryPoint.LIVING_UPDATE; } - public static enum EntryPoint + public enum EntryPoint { LIVING_UPDATE, - SPECIAL_ITEMS; + SPECIAL_ITEMS } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java index e814cf318..ff0bf1b68 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java @@ -1,11 +1,9 @@ package org.vivecraft.client_vr.gameplay.trackers; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.ItemTags; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.VRData.VRDevicePose; +import org.vivecraft.client_vr.settings.VRSettings.FreeMove; -import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -15,9 +13,13 @@ import net.minecraft.world.item.FoodOnAStickItem; import net.minecraft.world.phys.Vec3; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class VehicleTracker extends Tracker { - private float PreMount_World_Rotation; public Vec3 Premount_Pos_Room = new Vec3(0.0D, 0.0D, 0.0D); public float vehicleInitialRotation = 0.0F; public int rotationCooldown = 0; @@ -25,33 +27,27 @@ public class VehicleTracker extends Tracker private int minecartStupidityCounter; public int dismountCooldown = 0; - public VehicleTracker(Minecraft mc, ClientDataHolderVR dh) - { - super(mc, dh); - } - - public boolean isActive(LocalPlayer p) + public boolean isActive() { - Minecraft minecraft = Minecraft.getInstance(); - if (p == null) + if (mc.player == null) { return false; } - else if (minecraft.gameMode == null) + else if (mc.gameMode == null) { return false; } else { - return p.isAlive(); + return mc.player.isAlive(); } } - public void reset(LocalPlayer player) + public void reset() { this.minecartStupidityCounter = 2; - super.reset(player); + super.reset(); } public double getVehicleFloor(Entity vehicle, double original) @@ -63,8 +59,6 @@ public static Vec3 getSteeringDirection(LocalPlayer player) { Vec3 vec3 = null; Entity entity = player.getVehicle(); - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); if (!(entity instanceof AbstractHorse) && !(entity instanceof Boat)) { @@ -75,29 +69,27 @@ public static Vec3 getSteeringDirection(LocalPlayer player) if (mob.isControlledByLocalInstance()) { int i = (player.getMainHandItem().getItem() instanceof FoodOnAStickItem || player.getMainHandItem().is(ItemTags.VIVECRAFT_FOOD_STICKS)) ? 0 : 1; - VRData.VRDevicePose vrdata$vrdevicepose = dataholder.vrPlayer.vrdata_world_pre.getController(i); + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getController(i); return vrdata$vrdevicepose.getPosition().add(vrdata$vrdevicepose.getDirection().scale(0.3D)).subtract(entity.position()).normalize(); } } } else if (player.zza > 0.0F) { - VRSettings vrsettings = dataholder.vrSettings; - - if (dataholder.vrSettings.vrFreeMoveMode == VRSettings.FreeMove.HMD) + if (dh.vrSettings.vrFreeMoveMode == FreeMove.HMD) { - return dataholder.vrPlayer.vrdata_world_pre.hmd.getDirection(); + return dh.vrPlayer.vrdata_world_pre.hmd.getDirection(); } - return dataholder.vrPlayer.vrdata_world_pre.getController(0).getDirection(); + return dh.vrPlayer.vrdata_world_pre.getController(0).getDirection(); } return vec3; } - public void doProcess(LocalPlayer player) + public void doProcess() { - if (!this.mc.isPaused()) + if (!mc.isPaused()) { if (this.dismountCooldown > 0) { @@ -109,12 +101,12 @@ public void doProcess(LocalPlayer player) --this.rotationCooldown; } - if (this.dh.vrSettings.vehicleRotation && this.mc.player.isPassenger() && this.rotationCooldown == 0) + if (dh.vrSettings.vehicleRotation && mc.player.isPassenger() && this.rotationCooldown == 0) { - Entity entity = this.mc.player.getVehicle(); + Entity entity = mc.player.getVehicle(); this.rotationTarget = (double)entity.getYRot(); - if (entity instanceof AbstractHorse && !this.dh.horseTracker.isActive(this.mc.player)) + if (entity instanceof AbstractHorse && !dh.horseTracker.isActive()) { AbstractHorse abstracthorse = (AbstractHorse)entity; @@ -170,7 +162,9 @@ else if (entity instanceof Mob) } } - float f1 = this.dh.vrPlayer.rotDiff_Degrees((float)this.rotationTarget, this.vehicleInitialRotation); + float f0 = toRadians(this.vehicleInitialRotation); + float f11 = toRadians((float) this.rotationTarget); + float f1 = (float) toDegrees(atan2(sin(f0 - f11), cos(f0 - f11))); if (flag) { @@ -185,9 +179,9 @@ else if (entity instanceof Mob) } } - this.dh.vrSettings.worldRotation += f1; - this.dh.vrSettings.worldRotation %= 360.0F; - this.dh.vr.seatedRot = this.dh.vrSettings.worldRotation; + dh.vrSettings.worldRotation += f1; + dh.vrSettings.worldRotation %= 360.0F; + dh.vr.seatedRot = dh.vrSettings.worldRotation; this.vehicleInitialRotation -= f1; this.vehicleInitialRotation %= 360.0F; } @@ -195,9 +189,9 @@ else if (entity instanceof Mob) { this.minecartStupidityCounter = 3; - if (this.mc.player.isPassenger()) + if (mc.player.isPassenger()) { - this.vehicleInitialRotation = this.mc.player.getVehicle().getYRot(); + this.vehicleInitialRotation = mc.player.getVehicle().getYRot(); } } } @@ -205,18 +199,15 @@ else if (entity instanceof Mob) public void onStartRiding(Entity vehicle, LocalPlayer player) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - this.PreMount_World_Rotation = dataholder.vrPlayer.vrdata_world_pre.rotation_radians; - Vec3 vec3 = dataholder.vrPlayer.vrdata_room_pre.getHeadPivot(); + Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot(); this.Premount_Pos_Room = new Vec3(vec3.x, 0.0D, vec3.z); this.dismountCooldown = 5; - if (dataholder.vrSettings.vehicleRotation) + if (dh.vrSettings.vehicleRotation) { - float f = dataholder.vrPlayer.vrdata_world_pre.hmd.getYaw(); + float f = dh.vrPlayer.vrdata_world_pre.hmd.getYaw(); float f1 = vehicle.getYRot() % 360.0F; - this.vehicleInitialRotation = dataholder.vrSettings.worldRotation; + this.vehicleInitialRotation = dh.vrSettings.worldRotation; this.rotationCooldown = 2; if (vehicle instanceof Minecart) @@ -224,27 +215,34 @@ public void onStartRiding(Entity vehicle, LocalPlayer player) return; } - float f2 = dataholder.vrPlayer.rotDiff_Degrees(f1, f); - dataholder.vrSettings.worldRotation = (float)(Math.toDegrees((double)dataholder.vrPlayer.vrdata_world_pre.rotation_radians) + (double)f2); - dataholder.vrSettings.worldRotation %= 360.0F; - dataholder.vr.seatedRot = dataholder.vrSettings.worldRotation; + float f0 = toRadians(f); + float f11 = toRadians(f1); + float f2 = (float) toDegrees(atan2(sin(f0 - f11), cos(f0 - f11))); + dh.vrSettings.worldRotation = (float)(toDegrees(dh.vrPlayer.vrdata_world_pre.rotation_radians) + f2); + dh.vrSettings.worldRotation %= 360.0F; + dh.vr.seatedRot = dh.vrSettings.worldRotation; } } + // TODO: remove onStopRiding? public void onStopRiding(LocalPlayer player) { - this.dh.swingTracker.disableSwing = 10; - this.dh.sneakTracker.sneakCounter = 0; + dh.swingTracker.disableSwing = 10; + dh.sneakTracker.sneakCounter = 0; - if (this.dh.vrSettings.vehicleRotation) + if (dh.vrSettings.vehicleRotation) { + //I dont wanna do this anymore. + //I think its more confusing to get off the thing and not know where you're looking + // mc.vrSettings.vrWorldRotation = playerRotation_PreMount; + // mc.vr.seatedRot = playerRotation_PreMount; } } private float getMinecartRenderYaw(Minecart entity) { Vec3 vec3 = new Vec3(entity.getX() - entity.xOld, entity.getY() - entity.yOld, entity.getZ() - entity.zOld); - float f = (float)Math.toDegrees(Math.atan2(-vec3.x, vec3.z)); + float f = (float)toDegrees(atan2(-vec3.x, vec3.z)); return this.shouldMinecartTurnView(entity) ? -180.0F + f : this.vehicleInitialRotation; } @@ -260,8 +258,8 @@ private boolean shouldMinecartTurnView(Minecart entity) return vec3.length() > 0.001D; } - public boolean canRoomscaleDismount(LocalPlayer player) + public boolean canRoomscaleDismount() { - return player.zza == 0.0F && player.xxa == 0.0F && player.isPassenger() && player.getVehicle().onGround() && this.dismountCooldown == 0; + return mc.player.zza == 0.0F && mc.player.xxa == 0.0F && mc.player.isPassenger() && mc.player.getVehicle().onGround() && this.dismountCooldown == 0; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java b/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java index bc4146d3a..9f15d8a15 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java @@ -1,12 +1,17 @@ package org.vivecraft.client_vr.gui; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.network.chat.Component; -import org.lwjgl.glfw.GLFW; import org.vivecraft.client.gui.framework.TwoHandedScreen; import org.vivecraft.client_vr.provider.InputSimulator; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; +import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.dh; + +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; public class GuiKeyboard extends TwoHandedScreen { @@ -14,162 +19,153 @@ public class GuiKeyboard extends TwoHandedScreen public void init() { - String s = this.dataholder.vrSettings.keyboardKeys; - String s1 = this.dataholder.vrSettings.keyboardKeysShift; + String arr = dh.vrSettings.keyboardKeys; + String alt = dh.vrSettings.keyboardKeysShift; this.clearWidgets(); if (this.isShift) { - s = s1; + arr = alt; } - int i = 13; - int j = 4; - int k = 32; - int l = 2; - int i1 = 25; - double d0 = (double)s.length() / (double)i; + int cols = 13; + int rows = 4; + int margin = 32; + int spacing = 2; + int bwidth = 25; + double tmp = (double)arr.length() / cols; - if (Math.floor(d0) == d0) + if (floor(tmp) == tmp) { - j = (int)d0; + rows = (int)tmp; } else { - j = (int)(d0 + 1.0D); + rows = (int)(tmp + 1.0D); } - for (int j1 = 0; j1 < j; ++j1) + for (int r = 0; r < rows; ++r) { - for (int k1 = 0; k1 < i; ++k1) + for (int i = 0; i < cols; ++i) { - int l1 = j1 * i + k1; - char c0 = ' '; + int c = (r * cols) + i; + char x = ' '; - if (l1 < s.length()) + if (c < arr.length()) { - c0 = s.charAt(l1); + x = arr.charAt(c); } - String s2 = String.valueOf(c0); - Button button = new Button.Builder( Component.literal(s2), (p) -> - { - InputSimulator.typeChars(s2); - }) - .size( i1, 20) - .pos(k + k1 * (i1 + l), k + j1 * (20 + l)) + final String c1 = String.valueOf(x); + Button button = new Builder(Component.literal(c1), (p) -> InputSimulator.typeChars(c1)) + .size(bwidth, 20) + .pos(margin + i * (bwidth + spacing), margin + r * (20 + spacing)) .build(); this.addRenderableWidget(button); } } - this.addRenderableWidget(new Button.Builder( Component.literal("Shift"), (p) -> - { - this.setShift(!this.isShift); - }) - .size( 30, 20) - .pos(0, k + 3 * (20 + l)) + this.addRenderableWidget(new Builder(Component.literal("Shift"), (p) -> this.setShift(!this.isShift)) + .size(30, 20) + .pos(0, margin + 3 * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal(" "), (p) -> - { - InputSimulator.typeChars(" "); - }) - .size( 5 * (i1 + l), 20) - .pos(k + 4 * (i1 + l), k + j * (20 + l)) + this.addRenderableWidget(new Builder(Component.literal(" "), (p) -> InputSimulator.typeChars(" ")) + .size(5 * (bwidth + spacing), 20) + .pos(margin + 4 * (bwidth + spacing), margin + rows * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("BKSP"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("BKSP"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_BACKSPACE); - InputSimulator.releaseKey(GLFW.GLFW_KEY_BACKSPACE); + InputSimulator.pressKey(GLFW_KEY_BACKSPACE); + InputSimulator.releaseKey(GLFW_KEY_BACKSPACE); }) - .size( 35, 20) - .pos(i * (i1 + l) + k, k) + .size(35, 20) + .pos(cols * (bwidth + spacing) + margin, margin) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("ENTER"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("ENTER"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_ENTER); - InputSimulator.releaseKey(GLFW.GLFW_KEY_ENTER); + InputSimulator.pressKey(GLFW_KEY_ENTER); + InputSimulator.releaseKey(GLFW_KEY_ENTER); }) - .size( 35, 20) - .pos(i * (i1 + l) + k, k + 2 * (20 + l)) + .size(35, 20) + .pos(cols * (bwidth + spacing) + margin, margin + 2 * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("TAB"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("TAB"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_TAB); - InputSimulator.releaseKey(GLFW.GLFW_KEY_TAB); + InputSimulator.pressKey(GLFW_KEY_TAB); + InputSimulator.releaseKey(GLFW_KEY_TAB); }) - .size( 30, 20) - .pos(0, k + 20 + l) + .size(30, 20) + .pos(0, margin + 20 + spacing) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("ESC"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("ESC"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_ESCAPE); - InputSimulator.releaseKey(GLFW.GLFW_KEY_ESCAPE); + InputSimulator.pressKey(GLFW_KEY_ESCAPE); + InputSimulator.releaseKey(GLFW_KEY_ESCAPE); }) - .size( 30, 20) - .pos(0, k) + .size(30, 20) + .pos(0, margin) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("\u2191"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("↑"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_UP); - InputSimulator.releaseKey(GLFW.GLFW_KEY_UP); + InputSimulator.pressKey(GLFW_KEY_UP); + InputSimulator.releaseKey(GLFW_KEY_UP); }) - .size( i1, 20) - .pos((i - 1) * (i1 + l) + k, k + j * (20 + l)) + .size(bwidth, 20) + .pos((cols - 1) * (bwidth + spacing) + margin, margin + rows * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("\u2193"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("↓"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_DOWN); - InputSimulator.releaseKey(GLFW.GLFW_KEY_DOWN); + InputSimulator.pressKey(GLFW_KEY_DOWN); + InputSimulator.releaseKey(GLFW_KEY_DOWN); }) - .size( i1, 20) - .pos((i - 1) * (i1 + l) + k, k + (j + 1) * (20 + l)) + .size(bwidth, 20) + .pos((cols - 1) * (bwidth + spacing) + margin, margin + (rows + 1) * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("\u2190"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("←"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT); + InputSimulator.pressKey(GLFW_KEY_LEFT); + InputSimulator.releaseKey(GLFW_KEY_LEFT); }) - .size( i1, 20) - .pos((i - 2) * (i1 + l) + k, k + (j + 1) * (20 + l)) + .size(bwidth, 20) + .pos((cols - 2) * (bwidth + spacing) + margin, margin + (rows + 1) * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("\u2192"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("→"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_RIGHT); - InputSimulator.releaseKey(GLFW.GLFW_KEY_RIGHT); + InputSimulator.pressKey(GLFW_KEY_RIGHT); + InputSimulator.releaseKey(GLFW_KEY_RIGHT); }) - .size( i1, 20) - .pos(i * (i1 + l) + k, k + (j + 1) * (20 + l)) + .size(bwidth, 20) + .pos(cols * (bwidth + spacing) + margin, margin + (rows + 1) * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("CUT"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("CUT"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_X); - InputSimulator.releaseKey(GLFW.GLFW_KEY_X); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_X); + InputSimulator.releaseKey(GLFW_KEY_X); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); }) - .size( 35, 20) - .pos(k, k + -1 * (20 + l)) + .size(35, 20) + .pos(margin, margin + -1 * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("COPY"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("COPY"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_C); - InputSimulator.releaseKey(GLFW.GLFW_KEY_C); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_C); + InputSimulator.releaseKey(GLFW_KEY_C); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); }) - .size( 35, 20) - .pos(35 + l + k, k + -1 * (20 + l)) + .size(35, 20) + .pos(35 + spacing + margin, margin + -1 * (20 + spacing)) .build()); - this.addRenderableWidget(new Button.Builder( Component.literal("PASTE"), (p) -> + this.addRenderableWidget(new Builder(Component.literal("PASTE"), (p) -> { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_V); - InputSimulator.releaseKey(GLFW.GLFW_KEY_V); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_V); + InputSimulator.releaseKey(GLFW_KEY_V); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); }) - .size( 35, 20) - .pos(2 * (35 + l) + k, k + -1 * (20 + l)) + .size(35, 20) + .pos(2 * (35 + spacing) + margin, margin + -1 * (20 + spacing)) .build()); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java b/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java index 671b99828..db1369602 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java @@ -1,125 +1,124 @@ package org.vivecraft.client_vr.gui; -import net.minecraft.client.gui.GuiGraphics; -import org.vivecraft.client.gui.framework.TwoHandedScreen; -import org.vivecraft.client_vr.provider.MCVR; import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; import net.minecraft.client.KeyMapping; -import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; -public class GuiRadial extends TwoHandedScreen +import static org.vivecraft.client_vr.VRState.dh; + +import static org.joml.Math.*; + +public class GuiRadial extends org.vivecraft.client.gui.framework.TwoHandedScreen { private boolean isShift = false; String[] arr; public void init() { - this.arr = this.dataholder.vrSettings.vrRadialItems; - String[] astring = this.dataholder.vrSettings.vrRadialItemsAlt; + this.arr = dh.vrSettings.vrRadialItems; + String[] alt = dh.vrSettings.vrRadialItemsAlt; this.clearWidgets(); - int i = 8; - int j = 120; - int k = 360 / i; - int l = 48; - int i1 = this.width / 2; - int j1 = this.height / 2; + + int numButts = 8; + int buttonWidthMin = 120; + int degreesPerButt = 360 / numButts; + int dist = 48; + int centerx = this.width / 2; + int centery = this.height / 2; if (this.isShift) { - this.arr = astring; + this.arr = alt; } - for (int k1 = 0; k1 < i; ++k1) + for (int i = 0; i < numButts; ++i) { - KeyMapping keymapping = null; + KeyMapping b = null; - for (KeyMapping keymapping1 : this.minecraft.options.keyMappings) + for (KeyMapping kb : this.minecraft.options.keyMappings) { - if (keymapping1.getName().equalsIgnoreCase(this.arr[k1])) + if (kb.getName().equalsIgnoreCase(this.arr[i])) { - keymapping = keymapping1; + b = kb; } } - String s = "?"; + String str = "?"; - if (keymapping != null) + if (b != null) { - s = I18n.get(keymapping.getName()); + str = I18n.get(b.getName()); } - int i2 = Math.max(j, this.font.width(s)); - int j2 = 0; - int k2 = 0; + int buttonwidth = max(buttonWidthMin, this.font.width(str)); + int x = 0, y = 0; - if (k1 == 0) + if (i == 0) { - j2 = 0; - k2 = -l; + y = -dist; } - else if (k1 == 1) + else if (i == 1) { - j2 = i2 / 2 + 8; - k2 = -l / 2; + x = buttonwidth / 2 + 8; + y = -dist / 2; } - else if (k1 == 2) + else if (i == 2) { - j2 = i2 / 2 + 32; - k2 = 0; + x = buttonwidth / 2 + 32; } - else if (k1 == 3) + else if (i == 3) { - j2 = i2 / 2 + 8; - k2 = l / 2; + x = buttonwidth / 2 + 8; + y = dist / 2; } - else if (k1 == 4) + else if (i == 4) { - j2 = 0; - k2 = l; + y = dist; } - else if (k1 == 5) + else if (i == 5) { - j2 = -i2 / 2 - 8; - k2 = l / 2; + x = -buttonwidth / 2 - 8; + y = dist / 2; } - else if (k1 == 6) + else if (i == 6) { - j2 = -i2 / 2 - 32; - k2 = 0; + x = -buttonwidth / 2 - 32; } - else if (k1 == 7) + else if (i == 7) { - j2 = -i2 / 2 - 8; - k2 = -l / 2; + x = -buttonwidth / 2 - 8; + y = -dist / 2; } - int l1 = k1; + final int idx = i; - if (s != "?") + if (!"?".equals(str)) { - this.addRenderableWidget(new Button.Builder( Component.translatable(s), (p) -> + this.addRenderableWidget(new Builder(Component.translatable(str), (p) -> { - if (l1 < 200) + if (idx < 200) { - VRInputAction vrinputaction = MCVR.get().getInputAction(this.arr[l1]); + VRInputAction vb = dh.vr.getInputAction(this.arr[idx]); - if (vrinputaction != null) + if (vb != null) { - vrinputaction.pressBinding(); - vrinputaction.unpressBinding(2); + vb.pressBinding(); + vb.unpressBinding(2); } } - else if (l1 == 201) + else if (idx == 201) { this.setShift(!this.isShift); } }) - .size( i2, 20) - .pos(i1 + j2 - i2 / 2, j1 + k2 - 10) - .build()); + .size(buttonwidth, 20) + .pos(centerx + x - buttonwidth / 2, centery + y - 10) + .build() + ); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java b/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java index 6ac172a38..186b91571 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java @@ -1,34 +1,18 @@ package org.vivecraft.client_vr.gui; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.stream.Stream; - -import org.lwjgl.glfw.GLFW; -import org.lwjgl.opengl.GL11; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.InputSimulator; -import org.vivecraft.client_vr.provider.MCVR; import org.vivecraft.client_vr.settings.OptionEnum; -import org.vivecraft.client_vr.utils.RGBAColor; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.lwjgl.Matrix4f; -import org.vivecraft.common.utils.lwjgl.Vector3f; +import org.vivecraft.common.utils.color.Color; + +import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.lwjgl.opengl.GL11C; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; @@ -36,26 +20,44 @@ import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat.Mode; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.Font.DisplayMode; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.Tuple; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; + +import static org.joml.Math.*; +import static org.joml.RoundingMode.CEILING; +import static org.lwjgl.glfw.GLFW.*; public class PhysicalKeyboard { - private final Minecraft mc = Minecraft.getInstance(); - private ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); private boolean reinit; private boolean shift; private boolean shiftSticky; - private List keys; + private final List keys = new ArrayList<>(); private static final int ROWS = 4; private static final int COLUMNS = 13; private static final float SPACING = 0.0064F; @@ -69,9 +71,9 @@ public class PhysicalKeyboard private float keyHeight; private float keyWidthSpecial; private float scale = 1.0F; - private KeyButton[] pressedKey = new KeyButton[2]; - private long[] pressTime = new long[2]; - private long[] pressRepeatTime = new long[2]; + private final KeyButton[] pressedKey = new KeyButton[2]; + private final long[] pressTime = new long[2]; + private final long[] pressRepeatTime = new long[2]; private long shiftPressTime; private boolean lastPressedShift; private Supplier easterEggText = () -> { @@ -85,12 +87,7 @@ public class PhysicalKeyboard }; private int easterEggIndex = 0; private boolean easterEggActive; - private Map customTheme = new HashMap<>(); - - public PhysicalKeyboard() - { - this.keys = new ArrayList<>(); - } + private Map customTheme = new HashMap<>(); public void init() { @@ -102,16 +99,12 @@ public void init() this.keyHeight = KEY_HEIGHT * this.scale; this.keyWidthSpecial = KEY_WIDTH_SPECIAL * this.scale; - String chars = this.dh.vrSettings.keyboardKeys; - if (this.shift) - { - chars = this.dh.vrSettings.keyboardKeysShift; - } + String chars = this.shift ? dh.vrSettings.keyboardKeysShift : dh.vrSettings.keyboardKeys; float calcRows = (float)chars.length() / (float)this.columns; - if (Math.abs((float)this.rows - calcRows) > 0.01F) + if (abs((float)this.rows - calcRows) > 0.01F) { - this.rows = Mth.ceil(calcRows); + this.rows = roundUsing(calcRows, CEILING); } for (int i = 0; i < this.rows; ++i) @@ -127,7 +120,7 @@ public void init() } final char c1 = c0; - this.addKey(new KeyButton(k, String.valueOf(c0), this.keyWidthSpecial + this.spacing + (float)j * (this.keyWidth + this.spacing), (float)i * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) + this.addKey(new KeyButton(k, String.valueOf(c0), this.keyWidthSpecial + this.spacing + j * (this.keyWidth + this.spacing), i * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) { @Override public void onPressed() @@ -139,10 +132,10 @@ public void onPressed() PhysicalKeyboard.this.setShift(false, false); } - if (c1 == '/' && PhysicalKeyboard.this.mc.screen == null) + if (c1 == '/' && mc.screen == null) { - InputSimulator.pressKey(GLFW.GLFW_KEY_SLASH); - InputSimulator.releaseKey(GLFW.GLFW_KEY_SLASH); + InputSimulator.pressKey(GLFW_KEY_SLASH); + InputSimulator.releaseKey(GLFW_KEY_SLASH); } } }); @@ -151,12 +144,12 @@ public void onPressed() for (int l = 0; l < 2; ++l) { - this.addKey(new KeyButton(1000 + l, "Shift", l == 1 ? this.keyWidthSpecial + this.spacing + (float)this.columns * (this.keyWidth + this.spacing) : 0.0F, 3.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) + this.addKey(new KeyButton(1000 + l, "Shift", l == 1 ? this.keyWidthSpecial + this.spacing + this.columns * (this.keyWidth + this.spacing) : 0.0F, 3.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) { @Override public void onPressed() { - if (PhysicalKeyboard.this.shift && !PhysicalKeyboard.this.shiftSticky && Utils.milliTime() - PhysicalKeyboard.this.shiftPressTime < 400L) + if (PhysicalKeyboard.this.shift && !PhysicalKeyboard.this.shiftSticky && milliTime() - PhysicalKeyboard.this.shiftPressTime < 400L) { PhysicalKeyboard.this.setShift(true, true); } @@ -165,21 +158,18 @@ public void onPressed() PhysicalKeyboard.this.setShift(!PhysicalKeyboard.this.shift, false); } - PhysicalKeyboard.this.shiftPressTime = Utils.milliTime(); + PhysicalKeyboard.this.shiftPressTime = milliTime(); } @Override - public RGBAColor getRenderColor() { - if (shift) { - RGBAColor color = new RGBAColor(this.pressed ? 1.0F : 0.5F, this.pressed ? 1.0F : 0.5F, 0.0F, 0.5F); - - if (!shiftSticky) - color.r = 0.0F; - - return color; - } - - return super.getRenderColor(); + public Color getRenderColor() { + return (PhysicalKeyboard.this.shift ? + new Color( + (!shiftSticky ? Byte.MIN_VALUE : this.pressed ? Byte.MAX_VALUE : (byte) -1), + this.pressed ? Byte.MAX_VALUE : (byte) -1 + ) : + super.getRenderColor() + ); } }); } @@ -197,8 +187,8 @@ public void onPressed() @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_TAB); - InputSimulator.releaseKey(GLFW.GLFW_KEY_TAB); + InputSimulator.pressKey(GLFW_KEY_TAB); + InputSimulator.releaseKey(GLFW_KEY_TAB); } }); this.addKey(new KeyButton(1004, "Esc", 0.0F, 0.0F, this.keyWidthSpecial, this.keyHeight) @@ -206,73 +196,73 @@ public void onPressed() @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_ESCAPE); - InputSimulator.releaseKey(GLFW.GLFW_KEY_ESCAPE); + InputSimulator.pressKey(GLFW_KEY_ESCAPE); + InputSimulator.releaseKey(GLFW_KEY_ESCAPE); } }); - this.addKey(new KeyButton(1005, "Bksp", this.keyWidthSpecial + this.spacing + (float)this.columns * (this.keyWidth + this.spacing), 0.0F, this.keyWidthSpecial, this.keyHeight) + this.addKey(new KeyButton(1005, "Bksp", this.keyWidthSpecial + this.spacing + this.columns * (this.keyWidth + this.spacing), 0.0F, this.keyWidthSpecial, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_BACKSPACE); - InputSimulator.releaseKey(GLFW.GLFW_KEY_BACKSPACE); + InputSimulator.pressKey(GLFW_KEY_BACKSPACE); + InputSimulator.releaseKey(GLFW_KEY_BACKSPACE); } }); - this.addKey(new KeyButton(1006, "Enter", this.keyWidthSpecial + this.spacing + (float)this.columns * (this.keyWidth + this.spacing), 2.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) + this.addKey(new KeyButton(1006, "Enter", this.keyWidthSpecial + this.spacing + this.columns * (this.keyWidth + this.spacing), 2.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_ENTER); - InputSimulator.releaseKey(GLFW.GLFW_KEY_ENTER); + InputSimulator.pressKey(GLFW_KEY_ENTER); + InputSimulator.releaseKey(GLFW_KEY_ENTER); } }); - this.addKey(new KeyButton(1007, "\u2191", this.keyWidthSpecial + this.spacing + (float)(this.columns + 1) * (this.keyWidth + this.spacing), 4.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) + this.addKey(new KeyButton(1007, "↑", this.keyWidthSpecial + this.spacing + (this.columns + 1) * (this.keyWidth + this.spacing), 4.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_UP); - InputSimulator.releaseKey(GLFW.GLFW_KEY_UP); + InputSimulator.pressKey(GLFW_KEY_UP); + InputSimulator.releaseKey(GLFW_KEY_UP); } }); - this.addKey(new KeyButton(1008, "\u2193", this.keyWidthSpecial + this.spacing + (float)(this.columns + 1) * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) + this.addKey(new KeyButton(1008, "↓", this.keyWidthSpecial + this.spacing + (this.columns + 1) * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_DOWN); - InputSimulator.releaseKey(GLFW.GLFW_KEY_DOWN); + InputSimulator.pressKey(GLFW_KEY_DOWN); + InputSimulator.releaseKey(GLFW_KEY_DOWN); } }); - this.addKey(new KeyButton(1009, "\u2190", this.keyWidthSpecial + this.spacing + (float)this.columns * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) + this.addKey(new KeyButton(1009, "←", this.keyWidthSpecial + this.spacing + this.columns * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT); + InputSimulator.pressKey(GLFW_KEY_LEFT); + InputSimulator.releaseKey(GLFW_KEY_LEFT); } }); - this.addKey(new KeyButton(1010, "\u2192", this.keyWidthSpecial + this.spacing + (float)(this.columns + 2) * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) + this.addKey(new KeyButton(1010, "→", this.keyWidthSpecial + this.spacing + (this.columns + 2) * (this.keyWidth + this.spacing), 5.0F * (this.keyHeight + this.spacing), this.keyWidth, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_RIGHT); - InputSimulator.releaseKey(GLFW.GLFW_KEY_RIGHT); + InputSimulator.pressKey(GLFW_KEY_RIGHT); + InputSimulator.releaseKey(GLFW_KEY_RIGHT); } }); - this.addKey(new KeyButton(1011, "Cut", 1.0F * (this.keyWidthSpecial + this.spacing), -1.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) + this.addKey(new KeyButton(1011, "Cut", (this.keyWidthSpecial + this.spacing), -1.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) { @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_X); - InputSimulator.releaseKey(GLFW.GLFW_KEY_X); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_X); + InputSimulator.releaseKey(GLFW_KEY_X); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); } }); this.addKey(new KeyButton(1012, "Copy", 2.0F * (this.keyWidthSpecial + this.spacing), -1.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) @@ -280,10 +270,10 @@ public void onPressed() @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_C); - InputSimulator.releaseKey(GLFW.GLFW_KEY_C); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_C); + InputSimulator.releaseKey(GLFW_KEY_C); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); } }); this.addKey(new KeyButton(1013, "Paste", 3.0F * (this.keyWidthSpecial + this.spacing), -1.0F * (this.keyHeight + this.spacing), this.keyWidthSpecial, this.keyHeight) @@ -291,10 +281,10 @@ public void onPressed() @Override public void onPressed() { - InputSimulator.pressKey(GLFW.GLFW_KEY_LEFT_CONTROL); - InputSimulator.pressKey(GLFW.GLFW_KEY_V); - InputSimulator.releaseKey(GLFW.GLFW_KEY_V); - InputSimulator.releaseKey(GLFW.GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_LEFT_CONTROL); + InputSimulator.pressKey(GLFW_KEY_V); + InputSimulator.releaseKey(GLFW_KEY_V); + InputSimulator.releaseKey(GLFW_KEY_LEFT_CONTROL); } }); @@ -315,17 +305,17 @@ public void onPressed() } if (dh.vrSettings.physicalKeyboardTheme == KeyboardTheme.CUSTOM) { - customTheme.clear(); + this.customTheme.clear(); File themeFile = new File(mc.gameDirectory, "keyboardtheme.txt"); if (!themeFile.exists()) { // Write template theme file try (PrintWriter pw = new PrintWriter(new FileWriter(themeFile, StandardCharsets.UTF_8))) { - char[] normalChars = this.dh.vrSettings.keyboardKeys.toCharArray(); + char[] normalChars = dh.vrSettings.keyboardKeys.toCharArray(); for (int i = 0; i < normalChars.length; i++) { pw.println("# " + normalChars[i] + " (Normal)"); pw.println(i + "=255,255,255"); } - char[] shiftChars = this.dh.vrSettings.keyboardKeysShift.toCharArray(); + char[] shiftChars = dh.vrSettings.keyboardKeysShift.toCharArray(); for (int i = 0; i < shiftChars.length; i++) { pw.println("# " + shiftChars[i] + " (Shifted)"); pw.println((i + 500) + "=255,255,255"); @@ -348,10 +338,10 @@ public void onPressed() String[] split = line.split("=", 2); int id = Integer.parseInt(split[0]); String[] colorSplit = split[1].split(","); - RGBAColor color = new RGBAColor(Integer.parseInt(colorSplit[0]), Integer.parseInt(colorSplit[1]), Integer.parseInt(colorSplit[2]), 255); - customTheme.put(id, color); + Color color = new Color(Integer.parseInt(colorSplit[0]), Integer.parseInt(colorSplit[1]), Integer.parseInt(colorSplit[2])); + this.customTheme.put(id, color); } catch (Exception ex) { - System.out.println("Bad theme line: " + line); + logger.error("Bad theme line: {}", line); ex.printStackTrace(); } }); @@ -378,7 +368,7 @@ public void process() if (physicalkeyboard$keybutton != null) { - if (physicalkeyboard$keybutton != this.pressedKey[i] && Utils.milliTime() - this.pressTime[i] >= 150L) + if (physicalkeyboard$keybutton != this.pressedKey[i] && milliTime() - this.pressTime[i] >= 150L) { if (this.pressedKey[i] != null) { @@ -388,20 +378,20 @@ public void process() physicalkeyboard$keybutton.press(controllertype, false); this.pressedKey[i] = physicalkeyboard$keybutton; - this.pressTime[i] = Utils.milliTime(); - this.pressRepeatTime[i] = Utils.milliTime(); + this.pressTime[i] = milliTime(); + this.pressRepeatTime[i] = milliTime(); } - else if (physicalkeyboard$keybutton == this.pressedKey[i] && Utils.milliTime() - this.pressTime[i] >= 500L && Utils.milliTime() - this.pressRepeatTime[i] >= 100L) + else if (physicalkeyboard$keybutton == this.pressedKey[i] && milliTime() - this.pressTime[i] >= 500L && milliTime() - this.pressRepeatTime[i] >= 100L) { physicalkeyboard$keybutton.press(controllertype, true); - this.pressRepeatTime[i] = Utils.milliTime(); + this.pressRepeatTime[i] = milliTime(); } } else if (this.pressedKey[i] != null) { this.pressedKey[i].unpress(controllertype); this.pressedKey[i] = null; - this.pressTime[i] = Utils.milliTime(); + this.pressTime[i] = milliTime(); } } } @@ -428,15 +418,15 @@ private Vector3f getCenterPos() private KeyButton findTouchedKey(ControllerType controller) { - Matrix4f matrix4f = new Matrix4f(); - matrix4f.translate(this.getCenterPos()); - Matrix4f.mul(matrix4f, (Matrix4f)Utils.convertOVRMatrix(KeyboardHandler.Rotation_room).invert(), matrix4f); - matrix4f.translate((Vector3f)Utils.convertToVector3f(KeyboardHandler.Pos_room).negate()); - Vec3 vec3 = Utils.convertToVector3d(Utils.transformVector(matrix4f, Utils.convertToVector3f(this.dh.vrPlayer.vrdata_room_pre.getController(controller.ordinal()).getPosition()), true)); + Matrix4f matrix4f = new Matrix4f().translate(this.getCenterPos()) + .mul(KeyboardHandler.Rotation_room.invertAffine(new Matrix4f())) + .translate(convertToVector3f(KeyboardHandler.Pos_room).negate()); + Vector3f vector = convertToVector3f(dh.vrPlayer.vrdata_room_pre.getController(controller.ordinal()).getPosition()); + matrix4f.transformPosition(vector, vector); for (KeyButton physicalkeyboard$keybutton : this.keys) { - if (physicalkeyboard$keybutton.getCollisionBoundingBox().contains(vec3)) + if (physicalkeyboard$keybutton.getCollisionBoundingBox().contains(vector.x(), vector.y(), vector.z())) { return physicalkeyboard$keybutton; } @@ -459,7 +449,7 @@ private void updateEasterEgg(String label) this.easterEggIndex = 0; } } - else if (label.equals("Enter")) + else if ("Enter".equals(label)) { this.easterEggActive = !this.easterEggActive; } @@ -469,61 +459,60 @@ else if (label.equals("Enter")) } } - private void drawBox(BufferBuilder buf, AABB box, RGBAColor color, PoseStack poseStack) + private void drawBox(BufferBuilder buf, AABB box, Color color, PoseStack poseStack) { - org.joml.Matrix4f matrix = poseStack.last().pose(); + Matrix4f matrix = poseStack.last().pose(); float minX = (float)box.minX, minY = (float)box.minY, minZ = (float)box.minZ; float maxX = (float)box.maxX, maxY = (float)box.maxY, maxZ = (float)box.maxZ; - buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, -1.0F).endVertex(); - buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, -1.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, -1.0F).endVertex(); - buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, -1.0F).endVertex(); - buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, -1.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, -1.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, -1.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, -1.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(-1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(-1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(-1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(-1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, 1.0F).endVertex(); - buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, 1.0F).endVertex(); - buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, 1.0F).endVertex(); - buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 0.0F, 1.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 1.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 1.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 1.0F, 0.0F).endVertex(); - buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(0.0F, 1.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(1.0F, 0.0F, 0.0F).endVertex(); - buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(color.r, color.g, color.b, color.a).normal(1.0F, 0.0F, 0.0F).endVertex(); + int r = color.R(); + int g = color.G(); + int b = color.B(); + int a = color.A(); + buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, -1.0F).endVertex(); + buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, -1.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, -1.0F).endVertex(); + buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, -1.0F).endVertex(); + buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, -1.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, -1.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, -1.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, -1.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(-1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(-1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(-1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(-1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, 1.0F).endVertex(); + buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, 1.0F).endVertex(); + buf.vertex(matrix, minX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, 1.0F).endVertex(); + buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 0.0F, 1.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); + buf.vertex(matrix, minX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, maxZ).uv(0, 0).color(r, g, b, a).normal(1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, minY, maxZ).uv(0, 0).color(r, g, b, a).normal(1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, minY, minZ).uv(0, 0).color(r, g, b, a).normal(1.0F, 0.0F, 0.0F).endVertex(); + buf.vertex(matrix, maxX, maxY, minZ).uv(0, 0).color(r, g, b, a).normal(1.0F, 0.0F, 0.0F).endVertex(); } public void render(PoseStack poseStack) { poseStack.pushPose(); Vector3f center = this.getCenterPos(); - poseStack.translate(-center.x, -center.y, -center.z); + poseStack.last().pose().translate(-center.x, -center.y, -center.z); RenderSystem.disableCull(); RenderSystem.enableBlend(); if (this.easterEggActive) { // https://qimg.techjargaming.com/i/UkG1cWAh.png for (KeyButton button : this.keys) { - RGBAColor color = RGBAColor.fromHSB(((float)this.dh.tickCounter + this.mc.getFrameTime()) / 100.0F + (float)(button.boundingBox.minX + (button.boundingBox.maxX - button.boundingBox.minX) / 2.0D) / 2.0F, 1.0F, 1.0F); - button.color.r = color.r; - button.color.g = color.g; - button.color.b = color.b; + button.color.fromHSB(((float)dh.tickCounter + mc.getFrameTime()) / 100.0F + (float)(button.boundingBox.minX + (button.boundingBox.maxX - button.boundingBox.minX) / 2.0D) / 2.0F, 1.0F, 1.0F); } } else { this.keys.forEach(button -> { if (dh.vrSettings.physicalKeyboardTheme == KeyboardTheme.CUSTOM) { - RGBAColor color = customTheme.get(this.shift && button.id < 1000 ? button.id + 500 : button.id); + Color color = this.customTheme.get(this.shift && button.id < 1000 ? button.id + 500 : button.id); if (color != null) { - button.color.r = color.r; - button.color.g = color.g; - button.color.b = color.b; + button.color.set(color.r, color.g, color.b); } } else { dh.vrSettings.physicalKeyboardTheme.assignColor(button); @@ -538,11 +527,10 @@ public void render(PoseStack poseStack) RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); // We need to ignore depth so we can see the back faces and text - RenderSystem.depthFunc(GL11.GL_ALWAYS); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); // Stuff for drawing labels - Font font = this.mc.font; ArrayList> labels = new ArrayList<>(); float textScale = 0.002F * this.scale; @@ -551,41 +539,41 @@ public void render(PoseStack poseStack) BufferBuilder bufferbuilder = tesselator.getBuilder(); bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); - for (KeyButton physicalkeyboard$keybutton1 : this.keys) + for (KeyButton button : this.keys) { - AABB box = physicalkeyboard$keybutton1.getRenderBoundingBox(); - RGBAColor color = physicalkeyboard$keybutton1.getRenderColor(); + AABB box = button.getRenderBoundingBox(); // Draw the key itself - this.drawBox(bufferbuilder, box, color, poseStack); + this.drawBox(bufferbuilder, box, button.getRenderColor(), poseStack); // Calculate text position - float stringWidth = (float)font.width(physicalkeyboard$keybutton1.label) * textScale; - float stringHeight = font.lineHeight * textScale; + float stringWidth = (float)mc.font.width(button.label) * textScale; + float stringHeight = mc.font.lineHeight * textScale; float textX = (float)box.minX + ((float)box.maxX - (float)box.minX) / 2.0F - stringWidth / 2.0F; float textY = (float)box.minY + ((float)box.maxY - (float)box.minY) / 2.0F - stringHeight / 2.0F; float textZ = (float)box.minZ + ((float)box.maxZ - (float)box.minZ) / 2.0F; // Put label in the list - labels.add(new Tuple<>(physicalkeyboard$keybutton1.label, new Vector3f(textX, textY, textZ))); + labels.add(new Tuple<>(button.label, new Vector3f(textX, textY, textZ))); } // Draw all the key boxes tesselator.end(); - RenderSystem.depthFunc(GL11.GL_LEQUAL); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); //GlStateManager._disableLighting(); // Start building vertices for text - MultiBufferSource.BufferSource multibuffersource$buffersource = MultiBufferSource.immediate(tesselator.getBuilder()); + BufferSource multibuffersource$buffersource = MultiBufferSource.immediate(tesselator.getBuilder()); // Build all the text for (Tuple label : labels) { + Vector3f textPos = label.getB(); poseStack.pushPose(); - poseStack.translate((double)(label.getB()).x, (double)(label.getB()).y, (double)(label.getB()).z); + poseStack.last().pose().translate(textPos.x, textPos.y, textPos.z); poseStack.scale(textScale, textScale, 1.0F); - font.drawInBatch(label.getA(), 0.0F, 0.0F, 0xFFFFFFFF, false, poseStack.last().pose(), multibuffersource$buffersource, Font.DisplayMode.NORMAL, 0, 15728880, font.isBidirectional()); + mc.font.drawInBatch(label.getA(), 0.0F, 0.0F, 0xFFFFFFFF, false, poseStack.last().pose(), multibuffersource$buffersource, DisplayMode.NORMAL, 0, 15728880, mc.font.isBidirectional()); poseStack.popPose(); } @@ -607,7 +595,7 @@ public void show() this.shift = false; } - this.scale = this.dh.vrSettings.physicalKeyboardScale; + this.scale = dh.vrSettings.physicalKeyboardScale; this.reinit = true; } @@ -653,14 +641,14 @@ private abstract class KeyButton public final int id; public final String label; public final AABB boundingBox; - public RGBAColor color = new RGBAColor(1.0F, 1.0F, 1.0F, 0.5F); + public Color color = new Color(Color.WHITE, (byte) -1); public boolean pressed; public KeyButton(int id, String label, float x, float y, float width, float height) { this.id = id; this.label = label; - this.boundingBox = new AABB((double)x, (double)y, 0.0D, (double)(x + width), (double)(y + height), 0.028D * (double)PhysicalKeyboard.this.scale); + this.boundingBox = new AABB(x, y, 0.0D, x + width, y + height, 0.028D * PhysicalKeyboard.this.scale); } public AABB getRenderBoundingBox() @@ -673,15 +661,15 @@ public AABB getCollisionBoundingBox() return this.pressed ? this.boundingBox.expandTowards(0.0D, 0.0D, 0.08D) : this.boundingBox; } - public RGBAColor getRenderColor() + public Color getRenderColor() { - RGBAColor color = this.color.copy(); + Color color = new Color(this.color); if (!this.pressed) { - color.r *= 0.5F; - color.g *= 0.5F; - color.b *= 0.5F; + color.r >>= 1; + color.g >>= 1; + color.b >>= 1; } return color; @@ -691,10 +679,10 @@ public final void press(ControllerType controller, boolean isRepeat) { if (!isRepeat) { - PhysicalKeyboard.this.mc.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + mc.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } - MCVR.get().triggerHapticPulse(controller, isRepeat ? 300 : 600); + dh.vr.triggerHapticPulse(controller, isRepeat ? 300 : 600); this.pressed = true; this.onPressed(); PhysicalKeyboard.this.updateEasterEgg(this.label); @@ -712,86 +700,81 @@ public enum KeyboardTheme implements OptionEnum { DEFAULT { @Override public void assignColor(KeyButton button) { - button.color.r = 1.0F; - button.color.g = 1.0F; - button.color.b = 1.0F; + button.color.set(Color.WHITE); } }, RED { @Override public void assignColor(KeyButton button) { - button.color.r = 1.0F; - button.color.g = 0.0F; - button.color.b = 0.0F; + button.color.set(Color.RED); } }, GREEN { @Override public void assignColor(KeyButton button) { - button.color.r = 0.0F; - button.color.g = 1.0F; - button.color.b = 0.0F; + button.color.set(Color.GREEN); } }, BLUE { @Override public void assignColor(KeyButton button) { - button.color.r = 0.0F; - button.color.g = 0.0F; - button.color.b = 1.0F; + button.color.set(Color.BLUE); } }, BLACK { @Override public void assignColor(KeyButton button) { - button.color.r = 0.0F; - button.color.g = 0.0F; - button.color.b = 0.0F; + button.color.set(Color.BLACK); } }, GRASS { @Override public void assignColor(KeyButton button) { if (button.boundingBox.maxY < 0.07D) { - button.color.r = 0.321F; - button.color.g = 0.584F; - button.color.b = 0.184F; + // button.color.set(0.321F, 0.584F, 0.184F); + button.color.set((byte)0xD1, (byte)0x14, (byte)0xAE); } else { - button.color.r = 0.607F; - button.color.g = 0.462F; - button.color.b = 0.325F; + // button.color.set(0.607F, 0.462F, 0.325F); + button.color.set((byte)0x1A, (byte)0xF5, (byte)0xD2); } } }, BEES { @Override public void assignColor(KeyButton button) { - float val = button.boundingBox.maxX % 0.2D < 0.1D ? 1.0F : 0.0F; - button.color.r = val; - button.color.g = val; - button.color.b = 0.0F; + if (button.boundingBox.maxX % 0.2D < 0.1D){ + button.color.r(Byte.MAX_VALUE); + button.color.g(Byte.MAX_VALUE); + } + else + { + button.color.r(Byte.MIN_VALUE); + button.color.g(Byte.MIN_VALUE); + } + button.color.b(Byte.MIN_VALUE); } }, AESTHETIC { @Override public void assignColor(KeyButton button) { if (button.id >= 1000) { - button.color.r = 0.0F; - button.color.g = 1.0F; - button.color.b = 1.0F; + button.color.set(Color.CYAN); } else { - button.color.r = 1.0F; - button.color.g = 0.0F; - button.color.b = 1.0F; + button.color.set(Color.MAGENTA); } } }, DOSE { @Override public void assignColor(KeyButton button) { - button.color.r = button.id % 2 == 0 ? 0.5F : 0.0F; - button.color.g = button.id % 2 == 0 ? 0.0F : 1.0F; - button.color.b = button.id % 2 == 0 ? 1.0F : 0.0F; + if (button.id % 2 == 0) + { + button.color.set((byte) -1, Byte.MIN_VALUE, Byte.MAX_VALUE); + } + else + { + button.color.set(Byte.MIN_VALUE, Byte.MAX_VALUE, Byte.MIN_VALUE); + } } }, CUSTOM { diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java index 2ee7c6517..c072287a6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java @@ -1,17 +1,12 @@ package org.vivecraft.client_vr.menuworlds; -import java.util.Collections; -import java.util.List; -import javax.annotation.Nullable; - -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.DimensionSpecialEffects; import net.minecraft.core.*; -import net.minecraft.util.Mth; +import net.minecraft.core.BlockPos.MutableBlockPos; +import net.minecraft.core.Direction.Axis; import net.minecraft.world.entity.Entity; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.level.ColorResolver; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; @@ -22,13 +17,21 @@ import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.dimension.DimensionType; -import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.Heightmap.Types; import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.shapes.VoxelShape; -public class FakeBlockAccess implements LevelReader { +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; + +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + +public class FakeBlockAccess implements net.minecraft.world.level.LevelReader { private int version; private long seed; private DimensionType dimensionType; @@ -79,7 +82,7 @@ public FakeBlockAccess(int version, long seed, BlockState[] blocks, byte[] skyli // set the ground to the height of the center block BlockPos pos = new BlockPos(0, (int)this.ground, 0); BlockState standing = blocks[encodeCoords(pos)]; - this.ground += Math.max(standing.getCollisionShape(this, pos).max(Direction.Axis.Y), 0.0); + this.ground += max(standing.getCollisionShape(this, pos).max(Axis.Y), 0.0); this.effectiveGround = this.ground; } @@ -175,7 +178,7 @@ public BlockEntity getBlockEntity(BlockPos pos) { @Override public int getBlockTint(BlockPos blockPosIn, ColorResolver colorResolverIn) { - int i = Minecraft.getInstance().options.biomeBlendRadius().get(); + int i = mc.options.biomeBlendRadius().get(); if (i == 0) { @@ -190,7 +193,7 @@ public int getBlockTint(BlockPos blockPosIn, ColorResolver colorResolverIn) { Cursor3D cursor3D = new Cursor3D(blockPosIn.getX() - i, blockPosIn.getY(), blockPosIn.getZ() - i, blockPosIn.getX() + i, blockPosIn.getY(), blockPosIn.getZ() + i); int j1; - for (BlockPos.MutableBlockPos blockpos$mutable = new BlockPos.MutableBlockPos(); cursor3D.advance(); i1 += j1 & 255) + for (MutableBlockPos blockpos$mutable = new MutableBlockPos(); cursor3D.advance(); i1 += j1 & 255) { blockpos$mutable.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ()); j1 = colorResolverIn.getColor(this.getBiome(blockpos$mutable).value(), (double)blockpos$mutable.getX(), (double)blockpos$mutable.getZ()); @@ -243,24 +246,12 @@ public float getShade(Direction face, boolean shade) { return flag ? 0.9F : 1.0F; } else { - switch (face) { - case DOWN: - return flag ? 0.9F : 0.5F; - - case UP: - return flag ? 0.9F : 1.0F; - - case NORTH: - case SOUTH: - return 0.8F; - - case WEST: - case EAST: - return 0.6F; - - default: - return 1.0F; - } + return switch (face) { + case DOWN -> flag ? 0.9F : 0.5F; + case UP -> flag ? 0.9F : 1.0F; + case NORTH, SOUTH -> 0.8F; + case WEST, EAST -> 0.6F; + }; } } @@ -275,8 +266,8 @@ public ChunkAccess getChunk(int x, int z, ChunkStatus requiredStatus, boolean no } @Override - public int getHeight(Heightmap.Types heightmapType, int x, int z) { - if (heightmapType == Heightmap.Types.MOTION_BLOCKING) { + public int getHeight(Types heightmapType, int x, int z) { + if (heightmapType == Types.MOTION_BLOCKING) { return getHeightBlocking(x, z); } return 0; // �\_(?)_/� @@ -287,7 +278,7 @@ public int getHeightBlocking(int x, int z) { } @Override - public BlockPos getHeightmapPos(Heightmap.Types heightmapType, BlockPos pos) { + public BlockPos getHeightmapPos(Types heightmapType, BlockPos pos) { return BlockPos.ZERO; // �\_(?)_/� } @@ -322,9 +313,9 @@ public Holder getNoiseBiome(int x, int y, int z) { int yMoved = y + (int)effectiveGround/4; int zMoved = z + zSize/8; if (!checkCoords(x * 4, y * 4, z * 4)) { - xMoved = Mth.clamp(xMoved, 0, xSize / 4 - 1); - yMoved = Mth.clamp(yMoved, 0, (ySize-(int)effectiveGround) / 4 - 1); - zMoved = Mth.clamp(zMoved, 0, zSize / 4 - 1); + xMoved = clamp(0, xSize / 4 - 1, xMoved); + yMoved = clamp(0, (ySize-(int)effectiveGround) / 4 - 1, yMoved); + zMoved = clamp(0, zSize / 4 - 1, zMoved); } return Holder.direct(biomemap[(yMoved * (zSize / 4) + zMoved) * (xSize / 4) + xMoved]); } diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldDownloader.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldDownloader.java index f96b37261..db5c50558 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldDownloader.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldDownloader.java @@ -1,16 +1,19 @@ package org.vivecraft.client_vr.menuworlds; +import net.minecraft.SharedConstants; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.security.NoSuchAlgorithmException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; -import net.minecraft.SharedConstants; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; +import static org.vivecraft.client.utils.Utils.*; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.common.utils.Utils.logger; public class MenuWorldDownloader { private static final String baseUrl = "https://cache.techjargaming.com/vivecraft/115/"; @@ -31,31 +34,35 @@ public static void downloadWorld(String path) throws IOException, NoSuchAlgorith File file = new File(path); file.getParentFile().mkdirs(); if (file.exists()) { - String localSha1 = Utils.getFileChecksum(file, "SHA-1"); - String remoteSha1 = Utils.httpReadLine(baseUrl + "checksum.php?file=" + path); + String localSha1 = getFileChecksum(file, "SHA-1"); + String remoteSha1 = httpReadLine(baseUrl + "checksum.php?file=" + path); if (localSha1.equals(remoteSha1)) { - VRSettings.logger.info("MenuWorlds: SHA-1 matches for " + path); + logger.info("MenuWorlds: SHA-1 matches for {}", path); return; } } - VRSettings.logger.info("MenuWorlds: Downloading world " + path); - Utils.httpReadToFile(baseUrl + path, file, true); + logger.info("MenuWorlds: Downloading world {}", path); + httpReadToFile(baseUrl + path, file, true); } public static InputStream getRandomWorld() throws IOException, NoSuchAlgorithmException { init(); - VRSettings settings = ClientDataHolderVR.getInstance().vrSettings; - try { List worldList = new ArrayList<>(); - if (settings.menuWorldSelection == VRSettings.MenuWorld.BOTH || settings.menuWorldSelection == VRSettings.MenuWorld.CUSTOM) - worldList.addAll(getCustomWorlds()); - if (settings.menuWorldSelection == VRSettings.MenuWorld.BOTH || settings.menuWorldSelection == VRSettings.MenuWorld.OFFICIAL || worldList.size() == 0) - worldList.addAll(getOfficialWorlds()); - // don't load the same world twice in a row - if (worldList.size() > 1) - worldList.removeIf(world -> lastWorld.equals(world.path) || (world.file != null && lastWorld.equals(world.file.getPath()))); + if ( + switch(dh.vrSettings.menuWorldSelection) + { + case CUSTOM -> worldList.addAll(getCustomWorlds()) || worldList.addAll(getOfficialWorlds()); + case OFFICIAL -> worldList.addAll(getOfficialWorlds()); + case BOTH -> worldList.addAll(getCustomWorlds()) && worldList.addAll(getOfficialWorlds()); + default -> false; + } + ) + { + // don't load the same world twice in a row + worldList.removeIf(world -> lastWorld.equals(world.path) || lastWorld.equals(world.file.getPath())); + } if (worldList.size() == 0) return getRandomWorldFallback(); @@ -73,11 +80,11 @@ public static InputStream getRandomWorld() throws IOException, NoSuchAlgorithmEx private static InputStream getStreamForWorld(MenuWorldItem world) throws IOException, NoSuchAlgorithmException { if (world.file != null) { - VRSettings.logger.info("MenuWorlds: Using world " + world.file.getName()); + logger.info("MenuWorlds: Using world {}", world.file.getName()); return new FileInputStream(world.file); } else if (world.path != null) { downloadWorld(world.path); - VRSettings.logger.info("MenuWorlds: Using official world " + world.path); + logger.info("MenuWorlds: Using official world {}", world.path); return new FileInputStream(world.path); } else { throw new IllegalArgumentException("File or path must be assigned"); @@ -93,14 +100,14 @@ private static List getCustomWorlds() throws IOException { private static List getOfficialWorlds() throws IOException { List list = new ArrayList<>(); - List resultList = Utils.httpReadAllLines(baseUrl + "menuworlds_list.php?minver=" + MenuWorldExporter.MIN_VERSION + "&maxver=" + MenuWorldExporter.VERSION + "&mcver=" + SharedConstants.VERSION_STRING); + List resultList = httpReadAllLines(baseUrl + "menuworlds_list.php?minver=" + MenuWorldExporter.MIN_VERSION + "&maxver=" + MenuWorldExporter.VERSION + "&mcver=" + SharedConstants.VERSION_STRING); for (String str : resultList) list.add(new MenuWorldItem("menuworlds/" + str, null)); return list; } private static InputStream getRandomWorldFallback() throws IOException, NoSuchAlgorithmException { - VRSettings.logger.info("MenuWorlds: Couldn't find a world, trying random file from directory"); + logger.info("MenuWorlds: Couldn't find a world, trying random file from directory"); File dir = new File("menuworlds"); if (dir.exists()) { MenuWorldItem world = getRandomWorldFromList(getWorldsInDirectory(dir)); diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java index 1fa26f25e..4754783b0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java @@ -1,30 +1,13 @@ package org.vivecraft.client_vr.menuworlds; -import com.google.common.io.Files; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.OptionalLong; -import java.util.zip.DataFormatException; -import java.util.zip.Deflater; -import java.util.zip.Inflater; +import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.settings.VRSettings; +import com.google.common.io.Files; import com.mojang.datafixers.DataFixer; import com.mojang.serialization.Dynamic; + import net.minecraft.SharedConstants; -import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; import net.minecraft.core.RegistryAccess; @@ -46,15 +29,26 @@ import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; -import net.minecraft.world.level.biome.AmbientParticleSettings; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeGenerationSettings; -import net.minecraft.world.level.biome.BiomeSpecialEffects; -import net.minecraft.world.level.biome.MobSpawnSettings; +import net.minecraft.world.level.biome.*; +import net.minecraft.world.level.biome.Biome.BiomeBuilder; +import net.minecraft.world.level.biome.Biome.ClimateSettings; +import net.minecraft.world.level.biome.Biome.TemperatureModifier; +import net.minecraft.world.level.biome.BiomeGenerationSettings.PlainBuilder; +import net.minecraft.world.level.biome.BiomeSpecialEffects.Builder; +import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; -import org.vivecraft.client.Xplat; +import net.minecraft.world.level.dimension.DimensionType.MonsterSettings; + +import java.io.*; +import java.util.*; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.Inflater; + +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; public class MenuWorldExporter { public static final int VERSION = 5; @@ -123,15 +117,15 @@ public static byte[] saveArea(Level level, int xMin, int zMin, int xSize, int zS dos.writeInt(level.dimensionType().minY()); dos.writeFloat(level.dimensionType().ambientLight()); - dos.writeFloat(switch (Minecraft.getInstance().player.getDirection()) { - case SOUTH -> 180.0f; - case WEST -> -90.0f; - case EAST -> 90.0f; - default -> 0.0f; // also NORTH + dos.writeFloat(switch (mc.player.getDirection()) { + case SOUTH -> 180.0F; + case WEST -> -90.0F; + case EAST -> 90.0F; + default -> 0.0F; // also NORTH }); - dos.writeBoolean(level.getRainLevel(1.0f) > 0.0f); - dos.writeBoolean(level.getThunderLevel(1.0f) > 0.0f); + dos.writeBoolean(level.getRainLevel(1.0F) > 0.0F); + dos.writeBoolean(level.getThunderLevel(1.0F) > 0.0F); blockStateMapper.writePalette(dos); biomeMapper.writePalette(dos, level.registryAccess()); @@ -211,7 +205,7 @@ public static FakeBlockAccess loadWorld(byte[] data) throws IOException, DataFor boolean isFlat; if (header.version < 4) // old format - isFlat = dis.readUTF().equals("flat"); + isFlat = "flat".equals(dis.readUTF()); else isFlat = dis.readBoolean(); @@ -232,7 +226,7 @@ else if (header.version == 4) dataVersion = dis.readInt(); // v5+ stores the real data version if (dataVersion > SharedConstants.getCurrentVersion().getDataVersion().getVersion()) - VRSettings.logger.warn("Data version is newer than current, this menu world may not load correctly."); + logger.warn("Data version is newer than current, this menu world may not load correctly."); OptionalLong dimFixedTime = OptionalLong.empty(); boolean dimHasCeiling; @@ -244,16 +238,16 @@ else if (header.version == 4) dimFixedTime = OptionalLong.of(18000L); dimHasCeiling = true; dimMinY = 0; - dimAmbientLight = 0.1f; + dimAmbientLight = 0.1F; } else if (BuiltinDimensionTypes.END_EFFECTS.equals(dimName)) { dimFixedTime = OptionalLong.of(6000L); dimHasCeiling = false; dimMinY = 0; - dimAmbientLight = 0.0f; + dimAmbientLight = 0.0F; } else { // overworld/default dimHasCeiling = false; dimMinY = 0; // pre-v5 worlds don't have deeper underground - dimAmbientLight = 0.0f; + dimAmbientLight = 0.0F; } } else { if (dis.readBoolean()) @@ -263,9 +257,9 @@ else if (header.version == 4) dimAmbientLight = dis.readFloat(); } - DimensionType dimensionType = new DimensionType(dimFixedTime, dimHasSkyLight, dimHasCeiling, false, false, 1.0, true, false, dimMinY, ySize, ySize, BlockTags.INFINIBURN_OVERWORLD, dimName, dimAmbientLight, new DimensionType.MonsterSettings(false, false, ConstantInt.of(0), 0)); + DimensionType dimensionType = new DimensionType(dimFixedTime, dimHasSkyLight, dimHasCeiling, false, false, 1.0, true, false, dimMinY, ySize, ySize, BlockTags.INFINIBURN_OVERWORLD, dimName, dimAmbientLight, new MonsterSettings(false, false, ConstantInt.of(0), 0)); - float rotation = 0.0f; + float rotation = 0.0F; boolean rain = false; boolean thunder = false; @@ -355,7 +349,7 @@ public static int readVersion(File file) throws IOException { } private static Optional decodeEnum(Class type, String input) { - return Arrays.stream(type.getEnumConstants()).filter(e -> input.equals(((StringRepresentable)e).getSerializedName())).findFirst(); + return Arrays.stream(type.getEnumConstants()).filter(e -> input.equals(e.getSerializedName())).findFirst(); } public static class Header { @@ -416,7 +410,7 @@ private interface BiomeMapper { Biome getBiome(int id); } - private static final BiomeGenerationSettings dummyGenerationSettings = new BiomeGenerationSettings.PlainBuilder().build(); + private static final BiomeGenerationSettings dummyGenerationSettings = new PlainBuilder().build(); private static final MobSpawnSettings dummyMobSpawnSettings = new MobSpawnSettings.Builder().build(); private static class PaletteBiomeMapper implements BiomeMapper { @@ -441,16 +435,16 @@ void readPalette(DataInputStream dis) throws IOException { int size = dis.readInt(); for (int i = 0; i < size; i++) { - Biome.BiomeBuilder builder = new Biome.BiomeBuilder(); + BiomeBuilder builder = new BiomeBuilder(); dis.readUTF(); // registry key, not actually used though, just for reference builder.hasPrecipitation(dis.readBoolean()); builder.temperature(dis.readFloat()); - decodeEnum(Biome.TemperatureModifier.class, dis.readUTF()).ifPresent(builder::temperatureAdjustment); + decodeEnum(TemperatureModifier.class, dis.readUTF()).ifPresent(builder::temperatureAdjustment); builder.downfall(dis.readFloat()); - BiomeSpecialEffects.Builder effectsBuilder = new BiomeSpecialEffects.Builder(); + Builder effectsBuilder = new Builder(); effectsBuilder.fogColor(dis.readInt()); effectsBuilder.waterColor(dis.readInt()); effectsBuilder.waterFogColor(dis.readInt()); @@ -462,7 +456,7 @@ void readPalette(DataInputStream dis) throws IOException { if (dis.readBoolean()) effectsBuilder.grassColorOverride(dis.readInt()); - decodeEnum(BiomeSpecialEffects.GrassColorModifier.class, dis.readUTF()).ifPresent(effectsBuilder::grassColorModifier); + decodeEnum(GrassColorModifier.class, dis.readUTF()).ifPresent(effectsBuilder::grassColorModifier); if (dis.readBoolean()) { ParticleType particleType = BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation(dis.readUTF())); @@ -484,7 +478,7 @@ void writePalette(DataOutputStream dos, RegistryAccess registryAccess) throws IO dos.writeUTF(registryAccess.registryOrThrow(Registries.BIOME).getKey(biome).toString()); - Biome.ClimateSettings climateSettings = Xplat.getBiomeClimateSettings(biome); + ClimateSettings climateSettings = Xplat.getBiomeClimateSettings(biome); dos.writeBoolean(climateSettings.hasPrecipitation()); dos.writeFloat(climateSettings.temperature()); @@ -526,163 +520,163 @@ private static class LegacyBiomeMapper implements BiomeMapper { //map.put(0, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(1).temperatureAdjustment(Biome.TemperatureModifier.NONE).downfall(1).specialEffects(new BiomeSpecialEffects.Builder().fogColor(1).waterColor(1).waterFogColor(1).skyColor(1).foliageColorOverride(1).grassColorOverride(1).grassColorModifier(BiomeSpecialEffects.GrassColorModifier.NONE).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("")), 0)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // plains - map.put(1, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.800000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(1, new BiomeBuilder().hasPrecipitation(true).temperature(0.800000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // the_void - map.put(127, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(127, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // ocean - map.put(0, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(0, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // desert - map.put(2, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(2, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // mountains - map.put(3, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(3, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // forest - map.put(4, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.700000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(4, new BiomeBuilder().hasPrecipitation(true).temperature(0.700000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // taiga - map.put(5, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.250000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(5, new BiomeBuilder().hasPrecipitation(true).temperature(0.250000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // swamp - map.put(6, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.800000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(6388580).waterFogColor(2302743).skyColor(7907327).foliageColorOverride(6975545).grassColorModifier(BiomeSpecialEffects.GrassColorModifier.SWAMP).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(6, new BiomeBuilder().hasPrecipitation(true).temperature(0.800000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(6388580).waterFogColor(2302743).skyColor(7907327).foliageColorOverride(6975545).grassColorModifier(GrassColorModifier.SWAMP).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // river - map.put(7, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(7, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // nether_wastes - map.put(8, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(3344392).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(8, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(3344392).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // the_end - map.put(9, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(9, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // frozen_ocean - map.put(10, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.000000f).downfall(0.500000f).temperatureAdjustment(Biome.TemperatureModifier.FROZEN).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(10, new BiomeBuilder().hasPrecipitation(true).temperature(0.000000F).downfall(0.500000F).temperatureAdjustment(TemperatureModifier.FROZEN).specialEffects(new Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // frozen_river - map.put(11, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.000000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(11, new BiomeBuilder().hasPrecipitation(true).temperature(0.000000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_tundra - map.put(12, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.000000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(12, new BiomeBuilder().hasPrecipitation(true).temperature(0.000000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_mountains - map.put(13, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.000000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(13, new BiomeBuilder().hasPrecipitation(true).temperature(0.000000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // mushroom_fields - map.put(14, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.900000f).downfall(1.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(14, new BiomeBuilder().hasPrecipitation(true).temperature(0.900000F).downfall(1.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // mushroom_field_shore - map.put(15, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.900000f).downfall(1.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(15, new BiomeBuilder().hasPrecipitation(true).temperature(0.900000F).downfall(1.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // beach - map.put(16, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.800000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(16, new BiomeBuilder().hasPrecipitation(true).temperature(0.800000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // desert_hills - map.put(17, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(17, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // wooded_hills - map.put(18, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.700000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(18, new BiomeBuilder().hasPrecipitation(true).temperature(0.700000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // taiga_hills - map.put(19, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.250000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(19, new BiomeBuilder().hasPrecipitation(true).temperature(0.250000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // mountain_edge - map.put(20, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(20, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // jungle - map.put(21, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(21, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // jungle_hills - map.put(22, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(22, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // jungle_edge - map.put(23, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(23, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // deep_ocean - map.put(24, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(24, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // stone_shore - map.put(25, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(25, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_beach - map.put(26, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.050000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(26, new BiomeBuilder().hasPrecipitation(true).temperature(0.050000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // birch_forest - map.put(27, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.600000f).downfall(0.600000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(27, new BiomeBuilder().hasPrecipitation(true).temperature(0.600000F).downfall(0.600000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // birch_forest_hills - map.put(28, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.600000f).downfall(0.600000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(28, new BiomeBuilder().hasPrecipitation(true).temperature(0.600000F).downfall(0.600000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // dark_forest - map.put(29, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.700000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).grassColorModifier(BiomeSpecialEffects.GrassColorModifier.DARK_FOREST).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(29, new BiomeBuilder().hasPrecipitation(true).temperature(0.700000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).grassColorModifier(GrassColorModifier.DARK_FOREST).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_taiga - map.put(30, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(-0.500000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(30, new BiomeBuilder().hasPrecipitation(true).temperature(-0.500000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_taiga_hills - map.put(31, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(-0.500000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(31, new BiomeBuilder().hasPrecipitation(true).temperature(-0.500000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // giant_tree_taiga - map.put(32, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.300000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8168447).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(32, new BiomeBuilder().hasPrecipitation(true).temperature(0.300000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8168447).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // giant_tree_taiga_hills - map.put(33, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.300000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8168447).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(33, new BiomeBuilder().hasPrecipitation(true).temperature(0.300000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8168447).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // wooded_mountains - map.put(34, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(34, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // savanna - map.put(35, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(1.200000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7711487).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(35, new BiomeBuilder().hasPrecipitation(false).temperature(1.200000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7711487).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // savanna_plateau - map.put(36, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(1.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776511).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(36, new BiomeBuilder().hasPrecipitation(false).temperature(1.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776511).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // badlands - map.put(37, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(37, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // wooded_badlands_plateau - map.put(38, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(38, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // badlands_plateau - map.put(39, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(39, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // small_end_islands - map.put(40, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(40, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // end_midlands - map.put(41, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(41, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // end_highlands - map.put(42, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(42, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // end_barrens - map.put(43, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(43, new BiomeBuilder().hasPrecipitation(false).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(10518688).waterColor(4159204).waterFogColor(329011).skyColor(0).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // warm_ocean - map.put(44, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4445678).waterFogColor(270131).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(44, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4445678).waterFogColor(270131).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // lukewarm_ocean - map.put(45, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4566514).waterFogColor(267827).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(45, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4566514).waterFogColor(267827).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // cold_ocean - map.put(46, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(46, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // deep_warm_ocean - map.put(47, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4445678).waterFogColor(270131).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(47, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4445678).waterFogColor(270131).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // deep_lukewarm_ocean - map.put(48, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4566514).waterFogColor(267827).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(48, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4566514).waterFogColor(267827).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // deep_cold_ocean - map.put(49, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(49, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // deep_frozen_ocean - map.put(50, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.500000f).downfall(0.500000f).temperatureAdjustment(Biome.TemperatureModifier.FROZEN).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(50, new BiomeBuilder().hasPrecipitation(true).temperature(0.500000F).downfall(0.500000F).temperatureAdjustment(TemperatureModifier.FROZEN).specialEffects(new Builder().fogColor(12638463).waterColor(3750089).waterFogColor(329011).skyColor(8103167).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // sunflower_plains - map.put(129, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.800000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(129, new BiomeBuilder().hasPrecipitation(true).temperature(0.800000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7907327).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // desert_lakes - map.put(130, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(130, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // gravelly_mountains - map.put(131, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(131, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // flower_forest - map.put(132, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.700000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(132, new BiomeBuilder().hasPrecipitation(true).temperature(0.700000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // taiga_mountains - map.put(133, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.250000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(133, new BiomeBuilder().hasPrecipitation(true).temperature(0.250000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // swamp_hills - map.put(134, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.800000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(6388580).waterFogColor(2302743).skyColor(7907327).foliageColorOverride(6975545).grassColorModifier(BiomeSpecialEffects.GrassColorModifier.SWAMP).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(134, new BiomeBuilder().hasPrecipitation(true).temperature(0.800000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(6388580).waterFogColor(2302743).skyColor(7907327).foliageColorOverride(6975545).grassColorModifier(GrassColorModifier.SWAMP).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // ice_spikes - map.put(140, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.000000f).downfall(0.500000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(140, new BiomeBuilder().hasPrecipitation(true).temperature(0.000000F).downfall(0.500000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8364543).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // modified_jungle - map.put(149, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(149, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // modified_jungle_edge - map.put(151, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(151, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // tall_birch_forest - map.put(155, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.600000f).downfall(0.600000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(155, new BiomeBuilder().hasPrecipitation(true).temperature(0.600000F).downfall(0.600000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // tall_birch_hills - map.put(156, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.600000f).downfall(0.600000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(156, new BiomeBuilder().hasPrecipitation(true).temperature(0.600000F).downfall(0.600000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8037887).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // dark_forest_hills - map.put(157, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.700000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).grassColorModifier(BiomeSpecialEffects.GrassColorModifier.DARK_FOREST).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(157, new BiomeBuilder().hasPrecipitation(true).temperature(0.700000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7972607).grassColorModifier(GrassColorModifier.DARK_FOREST).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // snowy_taiga_mountains - map.put(158, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(-0.500000f).downfall(0.400000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(158, new BiomeBuilder().hasPrecipitation(true).temperature(-0.500000F).downfall(0.400000F).specialEffects(new Builder().fogColor(12638463).waterColor(4020182).waterFogColor(329011).skyColor(8625919).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // giant_spruce_taiga - map.put(160, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.250000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(160, new BiomeBuilder().hasPrecipitation(true).temperature(0.250000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // giant_spruce_taiga_hills - map.put(161, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.250000f).downfall(0.800000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(161, new BiomeBuilder().hasPrecipitation(true).temperature(0.250000F).downfall(0.800000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233983).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // modified_gravelly_mountains - map.put(162, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.200000f).downfall(0.300000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(162, new BiomeBuilder().hasPrecipitation(true).temperature(0.200000F).downfall(0.300000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(8233727).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // shattered_savanna - map.put(163, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(1.100000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776767).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(163, new BiomeBuilder().hasPrecipitation(false).temperature(1.100000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776767).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // shattered_savanna_plateau - map.put(164, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(1.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776511).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(164, new BiomeBuilder().hasPrecipitation(false).temperature(1.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7776511).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // eroded_badlands - map.put(165, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(165, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // modified_wooded_badlands_plateau - map.put(166, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(166, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // modified_badlands_plateau - map.put(167, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(167, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7254527).foliageColorOverride(10387789).grassColorOverride(9470285).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // bamboo_jungle - map.put(168, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(168, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // bamboo_jungle_hills - map.put(169, new Biome.BiomeBuilder().hasPrecipitation(true).temperature(0.950000f).downfall(0.900000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(169, new BiomeBuilder().hasPrecipitation(true).temperature(0.950000F).downfall(0.900000F).specialEffects(new Builder().fogColor(12638463).waterColor(4159204).waterFogColor(329011).skyColor(7842047).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // soul_sand_valley - map.put(170, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(1787717).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:ash")), 0.006250f)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(170, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(1787717).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:ash")), 0.006250F)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // crimson_forest - map.put(171, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(3343107).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:crimson_spore")), 0.025000f)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(171, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(3343107).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:crimson_spore")), 0.025000F)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // warped_forest - map.put(172, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(1705242).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:warped_spore")), 0.014280f)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(172, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(1705242).waterColor(4159204).waterFogColor(329011).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:warped_spore")), 0.014280F)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); // basalt_deltas - map.put(173, new Biome.BiomeBuilder().hasPrecipitation(false).temperature(2.000000f).downfall(0.000000f).specialEffects(new BiomeSpecialEffects.Builder().fogColor(6840176).waterColor(4159204).waterFogColor(4341314).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:white_ash")), 0.118093f)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); + map.put(173, new BiomeBuilder().hasPrecipitation(false).temperature(2.000000F).downfall(0.000000F).specialEffects(new Builder().fogColor(6840176).waterColor(4159204).waterFogColor(4341314).skyColor(7254527).ambientParticle(new AmbientParticleSettings((ParticleOptions)BuiltInRegistries.PARTICLE_TYPE.get(new ResourceLocation("minecraft:white_ash")), 0.118093F)).build()).generationSettings(dummyGenerationSettings).mobSpawnSettings(dummyMobSpawnSettings).build()); } private LegacyBiomeMapper() { diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java index 79319a4c0..4c5cdc6a7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java @@ -1,31 +1,49 @@ package org.vivecraft.client_vr.menuworlds; -import com.mojang.blaze3d.platform.GlStateManager; +import org.vivecraft.client.Xplat; +import org.vivecraft.client_vr.settings.VRSettings.MenuWorld; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; +import org.vivecraft.mod_compat_vr.sodium.SodiumHelper; + +import org.apache.commons.lang3.tuple.Pair; +import org.joml.Matrix4f; +import org.joml.Vector2f; +import org.joml.Vector3f; +import org.lwjgl.opengl.GL11C; + +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.shaders.FogShape; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import com.mojang.math.Axis; +import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer; +import com.mojang.blaze3d.vertex.VertexBuffer.Usage; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + import net.minecraft.Util; import net.minecraft.client.CloudStatus; import net.minecraft.client.GraphicsStatus; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.DimensionSpecialEffects.SkyType; +import net.minecraft.client.renderer.FogRenderer.FogMode; import net.minecraft.client.renderer.block.BlockRenderDispatcher; -import net.minecraft.client.renderer.texture.*; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; +import net.minecraft.core.BlockPos.MutableBlockPos; import net.minecraft.core.Holder; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; import net.minecraft.tags.FluidTags; import net.minecraft.tags.TagKey; import net.minecraft.util.CubicSampler; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.Precipitation; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; @@ -35,15 +53,6 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.Vec3; -import org.apache.commons.lang3.tuple.Pair; -import org.joml.Matrix4f; -import org.joml.Vector3f; -import org.lwjgl.opengl.GL11; -import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; -import org.vivecraft.mod_compat_vr.sodium.SodiumHelper; import java.io.InputStream; import java.util.*; @@ -51,6 +60,17 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import static java.lang.Math.pow; +import static org.joml.Math.*; +import static org.joml.RoundingMode.FLOOR; +import static org.joml.Vector2i.lengthSquared; + +import static net.minecraft.client.Minecraft.useFancyGraphics; + public class MenuWorldRenderer { private static final ResourceLocation MOON_LOCATION = new ResourceLocation("textures/environment/moon_phases.png"); private static final ResourceLocation SUN_LOCATION = new ResourceLocation("textures/environment/sun.png"); @@ -63,11 +83,10 @@ public class MenuWorldRenderer { private static final ResourceLocation SNOW_LOCATION = new ResourceLocation("textures/environment/snow.png"); - private Minecraft mc; private DimensionSpecialEffects dimensionInfo; private FakeBlockAccess blockAccess; - private final DynamicTexture lightTexture; - private final NativeImage lightPixels; + private final DynamicTexture lightTexture = new DynamicTexture(16, 16, false); + private final NativeImage lightPixels = this.lightTexture.getPixels(); private final ResourceLocation lightTextureLocation; private boolean lightmapUpdateNeeded; private float blockLightRedFlicker; @@ -83,9 +102,9 @@ public class MenuWorldRenderer { private VertexBuffer cloudVBO; private int renderDistance; private int renderDistanceChunks; - public MenuFogRenderer fogRenderer; + public MenuFogRenderer fogRenderer = new MenuFogRenderer(this); public Set visibleTextures = new HashSet<>(); - private Random rand; + private Random rand = new Random(); private boolean ready; private CloudStatus prevCloudsType; private int prevCloudX; @@ -102,41 +121,36 @@ public class MenuWorldRenderer { private final float[] rainSizeX = new float[1024]; private final float[] rainSizeZ = new float[1024]; - private Set animatedSprites = null; + private Set animatedSprites; public MenuWorldRenderer() { - this.mc = Minecraft.getInstance(); - this.lightTexture = new DynamicTexture(16, 16, false); this.lightTextureLocation = mc.getTextureManager().register("vivecraft_light_map", this.lightTexture); - this.lightPixels = this.lightTexture.getPixels(); - this.fogRenderer = new MenuFogRenderer(this); - this.rand = new Random(); this.rand.nextInt(); // toss some bits in the bin } public void init() { - if (ClientDataHolderVR.getInstance().vrSettings.menuWorldSelection == VRSettings.MenuWorld.NONE) { - //VRSettings.logger.info("Main menu worlds disabled."); + if (dh.vrSettings.menuWorldSelection == MenuWorld.NONE) { + //logger.info("Main menu worlds disabled."); return; } try { InputStream inputStream = MenuWorldDownloader.getRandomWorld(); if (inputStream != null) { - VRSettings.logger.info("MenuWorlds: Initializing main menu world renderer..."); + logger.info("MenuWorlds: Initializing main menu world renderer..."); loadRenderers(); - VRSettings.logger.info("MenuWorlds: Loading world data..."); + logger.info("MenuWorlds: Loading world data..."); setWorld(MenuWorldExporter.loadWorld(inputStream)); prepare(); fastTime = new Random().nextInt(10) == 0; } else { - VRSettings.logger.warn("Failed to load any main menu world, falling back to old menu room"); + logger.warn("Failed to load any main menu world, falling back to old menu room"); } } catch (Throwable e) { // Only effective way of preventing crash on poop computers with low heap size if (e instanceof OutOfMemoryError || e.getCause() instanceof OutOfMemoryError) { - VRSettings.logger.error("OutOfMemoryError while loading main menu world. Low heap size or 32-bit Java?"); + logger.error("OutOfMemoryError while loading main menu world. Low heap size or 32-bit Java?"); } else { - VRSettings.logger.error("Exception thrown when loading main menu world, falling back to old menu room. \n {}", e.getMessage()); + logger.error("Exception thrown when loading main menu world, falling back to old menu room. \n {}", e.getMessage()); } e.printStackTrace(); destroy(); @@ -155,25 +169,29 @@ public void render(PoseStack poseStack) { turnOnLightLayer(); - poseStack.pushPose(); - - //rotate World - poseStack.mulPose(Axis.YP.rotationDegrees(worldRotation)); + float worldRotRads = toRadians(worldRotation); - // small offset to center on source block, and add the partial block offset, this shouldn't be too noticable on the fog - poseStack.translate(-0.5,-blockAccess.getGround()+(int)blockAccess.getGround(),-0.5); + poseStack.pushPose(); + poseStack.last().normal() + //rotate World + .rotateY(worldRotRads); + poseStack.last().pose() + //rotate World + .rotateY(worldRotRads) + // small offset to center on source block, and add the partial block offset, this shouldn't be too noticable on the fog + .translate(-0.5F, -blockAccess.getGround()+(int)blockAccess.getGround(), -0.5F); // not sure why this needs to be rotated twice, but it works - Vec3 offset = new Vec3(0.5,-blockAccess.getGround()+(int)blockAccess.getGround(),0.5).yRot(worldRotation*0.0174533f); - Vec3 eyePosition = getEyePos().add(offset).yRot(-worldRotation*0.0174533f); + Vec3 offset = new Vec3(0.5, -blockAccess.getGround()+(int)blockAccess.getGround(), 0.5).yRot(worldRotRads); + Vec3 eyePosition = getEyePos().add(offset).yRot(-worldRotRads); fogRenderer.levelFogColor(); renderSky(poseStack, eyePosition); - fogRenderer.setupFog(FogRenderer.FogMode.FOG_TERRAIN); + fogRenderer.setupFog(FogMode.FOG_TERRAIN); - RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.enableBlend(); Matrix4f modelView = poseStack.last().pose(); @@ -225,7 +243,7 @@ private void renderChunkLayer(RenderType layer, Matrix4f modelView, Matrix4f Pro public void prepare() { if (vertexBuffers == null) { - VRSettings.logger.info("MenuWorlds: Building geometry..."); + logger.info("MenuWorlds: Building geometry..."); boolean ao = mc.options.ambientOcclusion().get(); mc.options.ambientOcclusion().set(true); @@ -250,17 +268,17 @@ public void prepare() { animatedSprites = new HashSet<>(); // disable liquid chunk wrapping - ClientDataHolderVR.getInstance().skipStupidGoddamnChunkBoundaryClipping = true; + dh.skipStupidGoddamnChunkBoundaryClipping = true; if (!SodiumHelper.isLoaded() || !SodiumHelper.hasIssuesWithParallelBlockBuilding()) { // generate the data in parallel - List>> futures = new ArrayList<>(); + List>> futures = new ArrayList<>(); for (RenderType layer : layers) { futures.add(CompletableFuture.supplyAsync(() -> buildGeometryLayer(layer), Util.backgroundExecutor())); } - for (Future> future : futures) { + for (Future> future : futures) { try { - Pair pair = future.get(); + Pair pair = future.get(); uploadGeometry(pair.getLeft(), pair.getRight()); } catch (ExecutionException | InterruptedException e) { throw new RuntimeException(e); @@ -269,7 +287,7 @@ public void prepare() { } else { // generate the data in series for (RenderType layer : layers) { - Pair pair = buildGeometryLayer(layer); + Pair pair = buildGeometryLayer(layer); uploadGeometry(pair.getLeft(), pair.getRight()); } } @@ -281,28 +299,28 @@ public void prepare() { if (OptifineHelper.isOptifineLoaded()) { OptifineHelper.setRenderRegions(optifineRenderRegions); } - ClientDataHolderVR.getInstance().skipStupidGoddamnChunkBoundaryClipping = false; + dh.skipStupidGoddamnChunkBoundaryClipping = false; } } } - private Pair buildGeometryLayer(RenderType layer) { + private Pair buildGeometryLayer(RenderType layer) { PoseStack thisPose = new PoseStack(); int renderDistSquare = (renderDistance + 1) * (renderDistance + 1); BlockRenderDispatcher blockRenderer = mc.getBlockRenderer(); BufferBuilder vertBuffer = new BufferBuilder(20 * 2097152); - vertBuffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + vertBuffer.begin(Mode.QUADS, DefaultVertexFormat.BLOCK); RandomSource randomSource = RandomSource.create(); int c = 0; for (int x = -blockAccess.getXSize() / 2; x < blockAccess.getXSize() / 2; x++) { for (int y = (int) -blockAccess.getGround(); y < blockAccess.getYSize() - (int) blockAccess.getGround(); y++) { // don't build unnecessary blocks in tall worlds - if (Mth.abs(y) > renderDistance + 1) + if (abs(y) > renderDistance + 1) continue; for (int z = -blockAccess.getZSize() / 2; z < blockAccess.getZSize() / 2; z++) { // don't build unnecessary blocks in fog - if (Mth.lengthSquared(x, z) > renderDistSquare) + if (lengthSquared(x, z) > renderDistSquare) continue; BlockPos pos = new BlockPos(x, y, z); @@ -334,15 +352,16 @@ private Pair buildGeometryLayer(Render } } } - VRSettings.logger.info("Built " + c + " blocks."); + logger.info("Built {} blocks.", c); if (layer == RenderType.translucent()) { - vertBuffer.setQuadSorting(VertexSorting.byDistance(0, Mth.frac(blockAccess.getGround()), 0)); + float frac = blockAccess.getGround(); + vertBuffer.setQuadSorting(VertexSorting.byDistance(0.0F, frac - roundUsing(frac, FLOOR), 0.0F)); } return Pair.of(layer, vertBuffer.end()); } - private void uploadGeometry(RenderType layer, BufferBuilder.RenderedBuffer renderedBuffer) { - VertexBuffer buffer = new VertexBuffer(VertexBuffer.Usage.STATIC); + private void uploadGeometry(RenderType layer, RenderedBuffer renderedBuffer) { + VertexBuffer buffer = new VertexBuffer(Usage.STATIC); buffer.bind(); buffer.upload(renderedBuffer); VertexBuffer.unbind(); @@ -377,12 +396,12 @@ public void tick() { if (this.areEyesInFluid(FluidTags.WATER)) { int i = 1; //this.isSpectator() ? 10 : 1; - this.waterVisionTime = Mth.clamp(this.waterVisionTime + i, 0, 600); + this.waterVisionTime = clamp(0, 600, this.waterVisionTime + i); } else if (this.waterVisionTime > 0) { this.areEyesInFluid(FluidTags.WATER); - this.waterVisionTime = Mth.clamp(this.waterVisionTime - 10, 0, 600); + this.waterVisionTime = clamp(0, 600, this.waterVisionTime - 10); } if (SodiumHelper.isLoaded() && animatedSprites != null) { for (TextureAtlasSprite sprite : animatedSprites) { @@ -419,7 +438,7 @@ public void loadRenderers() { for (int j = 0; j < 32; ++j) { float f = j - 16; float g = i - 16; - float h = Mth.sqrt(f * f + g * g); + float h = Vector2f.length(f, g); this.rainSizeX[i << 5 | j] = -g / h; this.rainSizeZ[i << 5 | j] = f / h; } @@ -465,14 +484,14 @@ public void pushVisibleTextures() { public void renderSky(PoseStack poseStack, Vec3 position) { - if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.END) + if (this.dimensionInfo.skyType() == SkyType.END) { this.renderEndSky(poseStack); } - else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) + else if (this.dimensionInfo.skyType() == SkyType.NORMAL) { RenderSystem.setShader(GameRenderer::getPositionShader); - fogRenderer.setupFog(FogRenderer.FogMode.FOG_SKY); + fogRenderer.setupFog(FogMode.FOG_SKY); ShaderInstance skyShader = RenderSystem.getShader(); //RenderSystem.disableTexture(); @@ -497,7 +516,7 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) } RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO); float[] sunriseColor = this.dimensionInfo.getSunriseColor(this.getTimeOfDay(), 0); // calcSunriseSunsetColors @@ -505,25 +524,33 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) { //RenderSystem.disableTexture(); RenderSystem.setShader(GameRenderer::getPositionColorShader); - RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); poseStack.pushPose(); - poseStack.mulPose(Axis.XP.rotationDegrees(90.0f)); - poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.sin(this.getSunAngle()) < 0.0f ? 180.0f : 0.0f)); - poseStack.mulPose(Axis.ZP.rotationDegrees(90.0f)); + float ang0 = toRadians(90.0F); + float ang1 = sin(this.getSunAngle()) < 0.0F ? toRadians(180.0F) : 0.0F; + + poseStack.last().pose() + .rotateX(ang0) + .rotateZ(ang1) + .rotateZ(ang0); + poseStack.last().normal() + .rotateX(ang0) + .rotateZ(ang1) + .rotateZ(ang0); Matrix4f modelView = poseStack.last().pose(); - bufferBuilder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); + bufferBuilder.begin(Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR); bufferBuilder - .vertex(modelView, 0.0f, 100.0f, 0.0f) + .vertex(modelView, 0.0F, 100.0F, 0.0F) .color(sunriseColor[0], sunriseColor[1], sunriseColor[2], sunriseColor[3]) .endVertex(); for (int j = 0; j <= 16; ++j) { - float f6 = (float)j * ((float)Math.PI * 2F) / 16.0F; - float f7 = Mth.sin(f6); - float f8 = Mth.cos(f6); + float f6 = (float)j * ((float)PI * 2F) / 16.0F; + float f7 = sin(f6); + float f8 = cos(f6); bufferBuilder .vertex(modelView, f7 * 120.0F, f8 * 120.0F, -f8 * 40.0F * sunriseColor[3]) .color(sunriseColor[0], sunriseColor[1], sunriseColor[2], 0.0F) @@ -536,27 +563,30 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) //RenderSystem.enableTexture(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO); poseStack.pushPose(); float f10 = 1.0F - getRainLevel(); - RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, f10); - poseStack.mulPose(Axis.YP.rotationDegrees(-90.0f)); - Matrix4f modelView = poseStack.last().pose(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f10); + float ang1 = toRadians(-90.0F); + poseStack.last().normal().rotateY(ang1); + Matrix4f modelView = poseStack.last().pose().rotateY(ang1); //if (OptifineHelper.isOptifineLoaded()) { // needs a full Level //CustomSky.renderSky(this.world, poseStack, Minecraft.getInstance().getFrameTime()); //} - poseStack.mulPose(Axis.XP.rotationDegrees(this.getTimeOfDay() * 360.0f)); + float ang2 = toRadians(this.getTimeOfDay() * 360.0F); + poseStack.last().normal().rotateX(ang2); + modelView.rotateX(ang2); float size = 30.0F; if (!OptifineHelper.isOptifineLoaded() || OptifineHelper.isSunMoonEnabled()) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, SUN_LOCATION); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); bufferBuilder.vertex(modelView, -size, 100.0F, -size).uv(0.0F, 0.0F).endVertex(); bufferBuilder.vertex(modelView, size, 100.0F, -size).uv(1.0F, 0.0F).endVertex(); bufferBuilder.vertex(modelView, size, 100.0F, size).uv(1.0F, 1.0F).endVertex(); @@ -571,15 +601,15 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) int moonPhase = this.getMoonPhase(); int l = moonPhase % 4; int i1 = moonPhase / 4 % 2; - float u0 = (float)(l + 0) / 4.0F; - float v0 = (float)(i1 + 0) / 2.0F; + float u0 = (float)l / 4.0F; + float v0 = (float)i1 / 2.0F; float u1 = (float)(l + 1) / 4.0F; float v1 = (float)(i1 + 1) / 2.0F; - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.vertex(modelView, -size, -100.0f, size).uv(u0, v1).endVertex(); - bufferBuilder.vertex(modelView, size, -100.0f, size).uv(u1, v1).endVertex(); - bufferBuilder.vertex(modelView, size, -100.0f, -size).uv(u1, v0).endVertex(); - bufferBuilder.vertex(modelView, -size, -100.0f, -size).uv(u0, v0).endVertex(); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(modelView, -size, -100.0F, size).uv(u0, v1).endVertex(); + bufferBuilder.vertex(modelView, size, -100.0F, size).uv(u1, v1).endVertex(); + bufferBuilder.vertex(modelView, size, -100.0F, -size).uv(u1, v0).endVertex(); + bufferBuilder.vertex(modelView, -size, -100.0F, -size).uv(u0, v0).endVertex(); BufferUploader.drawWithShader(bufferBuilder.end()); } @@ -594,10 +624,10 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) this.starVBO.bind(); this.starVBO.drawWithShader(poseStack.last().pose(), RenderSystem.getProjectionMatrix(), GameRenderer.getPositionShader()); VertexBuffer.unbind(); - fogRenderer.setupFog(FogRenderer.FogMode.FOG_SKY); + fogRenderer.setupFog(FogMode.FOG_SKY); } - RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); RenderSystem.defaultBlendFunc(); @@ -608,16 +638,16 @@ else if (this.dimensionInfo.skyType() == DimensionSpecialEffects.SkyType.NORMAL) if (horizonDistance < 0.0D) { - RenderSystem.setShaderColor(0.0f, 0.0f, 0.0f, 1.0f); + RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F); poseStack.pushPose(); - poseStack.translate(0.0f, 12.0f, 0.0f); + poseStack.translate(0.0F, 12.0F, 0.0F); this.sky2VBO.bind(); this.sky2VBO.drawWithShader(poseStack.last().pose(), RenderSystem.getProjectionMatrix(), skyShader); VertexBuffer.unbind(); poseStack.popPose(); } - RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.depthMask(true); } } @@ -627,7 +657,7 @@ private void renderEndSky(PoseStack poseStack) if (!OptifineHelper.isOptifineLoaded() || OptifineHelper.isSkyEnabled()) { RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ZERO); RenderSystem.depthMask(false); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderTexture(0, END_SKY_LOCATION); @@ -637,16 +667,44 @@ private void renderEndSky(PoseStack poseStack) for (int i = 0; i < 6; ++i) { poseStack.pushPose(); - switch (i) { - case 1 -> poseStack.mulPose(Axis.XP.rotationDegrees(90.0f)); - case 2 -> poseStack.mulPose(Axis.XP.rotationDegrees(-90.0f)); - case 3 -> poseStack.mulPose(Axis.XP.rotationDegrees(180.0f)); - case 4 -> poseStack.mulPose(Axis.ZP.rotationDegrees(90.0f)); - case 5 -> poseStack.mulPose(Axis.ZP.rotationDegrees(-90.0f)); - } + Matrix4f modelView = switch (i) { + case 1 -> + { + float ang1 = toRadians(90.0F); + poseStack.last().normal().rotateX(ang1); + yield poseStack.last().pose().rotateX(ang1); + } + case 2 -> + { + float ang2 = toRadians(-90.0F); + poseStack.last().normal().rotateX(ang2); + yield poseStack.last().pose().rotateX(ang2); + } + case 3 -> + { + float ang3 = toRadians(180.0F); + poseStack.last().normal().rotateX(ang3); + yield poseStack.last().pose().rotateX(ang3); + } + case 4 -> + { + float ang4 = toRadians(90.0F); + poseStack.last().normal().rotateZ(ang4); + yield poseStack.last().pose().rotateZ(ang4); + } + case 5 -> + { + float ang5 = toRadians(-90.0F); + poseStack.last().normal().rotateZ(ang5); + yield poseStack.last().pose().rotateZ(ang5); + } + default -> + { + yield poseStack.last().pose(); + } + }; - Matrix4f modelView = poseStack.last().pose(); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); int r = 40; int g = 40; @@ -677,18 +735,18 @@ public void renderClouds(PoseStack poseStack, double x, double y, double z) { float cloudHeight = this.dimensionInfo.getCloudHeight(); - if (!Float.isNaN(cloudHeight) && this.mc.options.getCloudsType() != CloudStatus.OFF) { + if (!Float.isNaN(cloudHeight) && mc.options.getCloudsType() != CloudStatus.OFF) { // setup clouds RenderSystem.disableCull(); RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.depthMask(true); - float cloudSizeXZ = 12.0f; - float cloudSizeY = 4.0f; - double cloudOffset = ((float) ticks + mc.getFrameTime()) * 0.03f; + float cloudSizeXZ = 12.0F; + float cloudSizeY = 4.0F; + double cloudOffset = ((float) ticks + mc.getFrameTime()) * 0.03F; double cloudX = (x + cloudOffset) / 12.0; double cloudY = cloudHeight - y + 0.33; if (OptifineHelper.isOptifineLoaded()) { @@ -696,27 +754,27 @@ public void renderClouds(PoseStack poseStack, double x, double y, double z) } double cloudZ = z / 12.0 + 0.33; - cloudX -= Mth.floor(cloudX / 2048.0) * 2048; - cloudZ -= Mth.floor(cloudZ / 2048.0) * 2048; - float cloudXfract = (float) (cloudX - (double) Mth.floor(cloudX)); - float cloudYfract = (float) (cloudY / 4.0 - (double) Mth.floor(cloudY / 4.0)) * 4.0f; - float cloudZfract = (float) (cloudZ - (double) Mth.floor(cloudZ)); + cloudX -= roundUsing(cloudX / 2048.0, FLOOR) * 2048; + cloudZ -= roundUsing(cloudZ / 2048.0, FLOOR) * 2048; + float cloudXfract = (float) (cloudX - (double) roundUsing(cloudX, FLOOR)); + float cloudYfract = (float) (cloudY / 4.0 - (double) roundUsing(cloudY / 4.0, FLOOR)) * 4.0f; + float cloudZfract = (float) (cloudZ - (double) roundUsing(cloudZ, FLOOR)); Vec3 cloudColor = this.getCloudColour(); - int cloudXfloor = (int) Math.floor(cloudX); - int cloudYfloor = (int) Math.floor(cloudY / 4.0); - int cloudZfloor = (int) Math.floor(cloudZ); + int cloudXfloor = roundUsing(cloudX, FLOOR); + int cloudYfloor = roundUsing(cloudY / 4.0, FLOOR); + int cloudZfloor = roundUsing(cloudZ, FLOOR); if (cloudXfloor != this.prevCloudX || cloudYfloor != this.prevCloudY || cloudZfloor != this.prevCloudZ || - this.mc.options.getCloudsType() != this.prevCloudsType || + mc.options.getCloudsType() != this.prevCloudsType || this.prevCloudColor.distanceToSqr(cloudColor) > 2.0E-4) { this.prevCloudX = cloudXfloor; this.prevCloudY = cloudYfloor; this.prevCloudZ = cloudZfloor; this.prevCloudColor = cloudColor; - this.prevCloudsType = this.mc.options.getCloudsType(); + this.prevCloudsType = mc.options.getCloudsType(); this.generateClouds = true; } if (this.generateClouds) { @@ -725,8 +783,8 @@ public void renderClouds(PoseStack poseStack, double x, double y, double z) if (this.cloudVBO != null) { this.cloudVBO.close(); } - this.cloudVBO = new VertexBuffer(VertexBuffer.Usage.STATIC); - BufferBuilder.RenderedBuffer renderedBuffer = this.buildClouds(bufferBuilder, cloudX, cloudY, cloudZ, cloudColor); + this.cloudVBO = new VertexBuffer(Usage.STATIC); + RenderedBuffer renderedBuffer = this.buildClouds(bufferBuilder, cloudX, cloudY, cloudZ, cloudColor); this.cloudVBO.bind(); this.cloudVBO.upload(renderedBuffer); VertexBuffer.unbind(); @@ -737,7 +795,7 @@ public void renderClouds(PoseStack poseStack, double x, double y, double z) RenderSystem.setShaderTexture(0, CLOUDS_LOCATION); fogRenderer.levelFogColor(); poseStack.pushPose(); - poseStack.scale(12.0f, 1.0f, 12.0f); + poseStack.scale(12.0F, 1.0F, 12.0F); poseStack.translate(-cloudXfract, cloudYfract, -cloudZfract); if (this.cloudVBO != null) { this.cloudVBO.bind(); @@ -760,71 +818,71 @@ public void renderClouds(PoseStack poseStack, double x, double y, double z) } private BufferBuilder.RenderedBuffer buildClouds(BufferBuilder bufferBuilder, double cloudX, double cloudY, double cloudZ, Vec3 cloudColor) { - float l = (float)Mth.floor(cloudX) * 0.00390625f; - float m = (float)Mth.floor(cloudZ) * 0.00390625f; + float l = (float)floor(cloudX) * 0.00390625f; + float m = (float)floor(cloudZ) * 0.00390625f; float redTop = (float)cloudColor.x; float greenTop = (float)cloudColor.y; float blueTop = (float)cloudColor.z; - float redX = redTop * 0.9f; - float greenX = greenTop * 0.9f; - float blueX = blueTop * 0.9f; - float redBottom = redTop * 0.7f; - float greenBottom = greenTop * 0.7f; - float blueBottom = blueTop * 0.7f; - float redZ = redTop * 0.8f; - float greenZ = greenTop * 0.8f; - float blueZ = blueTop * 0.8f; + float redX = redTop * 0.9F; + float greenX = greenTop * 0.9F; + float blueX = blueTop * 0.9F; + float redBottom = redTop * 0.7F; + float greenBottom = greenTop * 0.7F; + float blueBottom = blueTop * 0.7F; + float redZ = redTop * 0.8F; + float greenZ = greenTop * 0.8F; + float blueZ = blueTop * 0.8F; RenderSystem.setShader(GameRenderer::getPositionTexColorNormalShader); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); - float z = (float)Math.floor(cloudY / 4.0) * 4.0f; + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); + float z = (float)floor(cloudY / 4.0) * 4.0F; if (this.prevCloudsType == CloudStatus.FANCY) { for (int aa = -3; aa <= 4; ++aa) { for (int ab = -3; ab <= 4; ++ab) { int ae; float ac = aa * 8; float ad = ab * 8; - if (z > -5.0f) { - bufferBuilder.vertex(ac + 0.0f, z + 0.0f, ad + 8.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redBottom, greenBottom, blueBottom, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 0.0f, ad + 8.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redBottom, greenBottom, blueBottom, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 0.0f, ad + 0.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redBottom, greenBottom, blueBottom, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 0.0f, z + 0.0f, ad + 0.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redBottom, greenBottom, blueBottom, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); + if (z > -5.0F) { + bufferBuilder.vertex(ac + 0.0F, z + 0.0F, ad + 8.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redBottom, greenBottom, blueBottom, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 0.0F, ad + 8.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redBottom, greenBottom, blueBottom, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 0.0F, ad + 0.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redBottom, greenBottom, blueBottom, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 0.0F, ad + 0.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redBottom, greenBottom, blueBottom, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); } - if (z <= 5.0f) { - bufferBuilder.vertex(ac + 0.0f, z + 4.0f - 9.765625E-4f, ad + 8.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, 1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 4.0f - 9.765625E-4f, ad + 8.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, 1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 4.0f - 9.765625E-4f, ad + 0.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, 1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + 0.0f, z + 4.0f - 9.765625E-4f, ad + 0.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, 1.0f, 0.0f).endVertex(); + if (z <= 5.0F) { + bufferBuilder.vertex(ac + 0.0F, z + 4.0F - 9.765625E-4f, ad + 8.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 4.0F - 9.765625E-4f, ad + 8.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 4.0F - 9.765625E-4f, ad + 0.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 4.0F - 9.765625E-4f, ad + 0.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); } if (aa > -1) { for (ae = 0; ae < 8; ++ae) { - bufferBuilder.vertex(ac + (float)ae + 0.0f, z + 0.0f, ad + 8.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(-1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 0.0f, z + 4.0f, ad + 8.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(-1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 0.0f, z + 4.0f, ad + 0.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(-1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 0.0f, z + 0.0f, ad + 0.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(-1.0f, 0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 0.0F, z + 0.0F, ad + 8.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 0.0F, z + 4.0F, ad + 8.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 0.0F, z + 4.0F, ad + 0.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 0.0F, z + 0.0F, ad + 0.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); } } if (aa <= 1) { for (ae = 0; ae < 8; ++ae) { - bufferBuilder.vertex(ac + (float)ae + 1.0f - 9.765625E-4f, z + 0.0f, ad + 8.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 1.0f - 9.765625E-4f, z + 4.0f, ad + 8.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 8.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 1.0f - 9.765625E-4f, z + 4.0f, ad + 0.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(1.0f, 0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(ac + (float)ae + 1.0f - 9.765625E-4f, z + 0.0f, ad + 0.0f).uv((ac + (float)ae + 0.5f) * 0.00390625f + l, (ad + 0.0f) * 0.00390625f + m).color(redX, greenX, blueX, 0.8f).normal(1.0f, 0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 1.0F - 9.765625E-4f, z + 0.0F, ad + 8.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 1.0F - 9.765625E-4f, z + 4.0F, ad + 8.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 8.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 1.0F - 9.765625E-4f, z + 4.0F, ad + 0.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(ac + (float)ae + 1.0F - 9.765625E-4f, z + 0.0F, ad + 0.0F).uv((ac + (float)ae + 0.5F) * 0.00390625F + l, (ad + 0.0F) * 0.00390625F + m).color(redX, greenX, blueX, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); } } if (ab > -1) { for (ae = 0; ae < 8; ++ae) { - bufferBuilder.vertex(ac + 0.0f, z + 4.0f, ad + (float)ae + 0.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, -1.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 4.0f, ad + (float)ae + 0.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, -1.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 0.0f, ad + (float)ae + 0.0f).uv((ac + 8.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, -1.0f).endVertex(); - bufferBuilder.vertex(ac + 0.0f, z + 0.0f, ad + (float)ae + 0.0f).uv((ac + 0.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, -1.0f).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 4.0F, ad + (float)ae + 0.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 4.0F, ad + (float)ae + 0.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 0.0F, ad + (float)ae + 0.0F).uv((ac + 8.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 0.0F, ad + (float)ae + 0.0F).uv((ac + 0.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); } } if (ab > 1) continue; for (ae = 0; ae < 8; ++ae) { - bufferBuilder.vertex(ac + 0.0f, z + 4.0f, ad + (float)ae + 1.0f - 9.765625E-4f).uv((ac + 0.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, 1.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 4.0f, ad + (float)ae + 1.0f - 9.765625E-4f).uv((ac + 8.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, 1.0f).endVertex(); - bufferBuilder.vertex(ac + 8.0f, z + 0.0f, ad + (float)ae + 1.0f - 9.765625E-4f).uv((ac + 8.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, 1.0f).endVertex(); - bufferBuilder.vertex(ac + 0.0f, z + 0.0f, ad + (float)ae + 1.0f - 9.765625E-4f).uv((ac + 0.0f) * 0.00390625f + l, (ad + (float)ae + 0.5f) * 0.00390625f + m).color(redZ, greenZ, blueZ, 0.8f).normal(0.0f, 0.0f, 1.0f).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 4.0F, ad + (float)ae + 1.0F - 9.765625E-4f).uv((ac + 0.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 4.0F, ad + (float)ae + 1.0F - 9.765625E-4f).uv((ac + 8.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferBuilder.vertex(ac + 8.0F, z + 0.0F, ad + (float)ae + 1.0F - 9.765625E-4f).uv((ac + 8.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferBuilder.vertex(ac + 0.0F, z + 0.0F, ad + (float)ae + 1.0F - 9.765625E-4f).uv((ac + 0.0F) * 0.00390625F + l, (ad + (float)ae + 0.5F) * 0.00390625F + m).color(redZ, greenZ, blueZ, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); } } } @@ -833,10 +891,10 @@ private BufferBuilder.RenderedBuffer buildClouds(BufferBuilder bufferBuilder, do int ab = 32; for (int af = -32; af < 32; af += 32) { for (int ag = -32; ag < 32; ag += 32) { - bufferBuilder.vertex(af + 0, z, ag + 32).uv((float)(af + 0) * 0.00390625f + l, (float)(ag + 32) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(af + 32, z, ag + 32).uv((float)(af + 32) * 0.00390625f + l, (float)(ag + 32) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(af + 32, z, ag + 0).uv((float)(af + 32) * 0.00390625f + l, (float)(ag + 0) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(af + 0, z, ag + 0).uv((float)(af + 0) * 0.00390625f + l, (float)(ag + 0) * 0.00390625f + m).color(redTop, greenTop, blueTop, 0.8f).normal(0.0f, -1.0f, 0.0f).endVertex(); + bufferBuilder.vertex(af, z, ag + 32).uv((float)(af) * 0.00390625F + l, (float)(ag + 32) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(af + 32, z, ag + 32).uv((float)(af + 32) * 0.00390625F + l, (float)(ag + 32) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(af + 32, z, ag).uv((float)(af + 32) * 0.00390625F + l, (float)(ag) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferBuilder.vertex(af, z, ag).uv((float)(af) * 0.00390625F + l, (float)(ag) * 0.00390625F + m).color(redTop, greenTop, blueTop, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); } } } @@ -844,32 +902,29 @@ private BufferBuilder.RenderedBuffer buildClouds(BufferBuilder bufferBuilder, do } private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, double inZ) { - if (getRainLevel() <= 0.0f) { + if (getRainLevel() <= 0.0F) { return; } RenderSystem.getModelViewStack().pushPose(); - RenderSystem.getModelViewStack().mulPoseMatrix(poseStack.last().pose()); + RenderSystem.getModelViewStack().last().pose().mul(poseStack.last().pose()); RenderSystem.applyModelViewMatrix(); - int xFloor = Mth.floor(inX); - int yFloor = Mth.floor(inY); - int zFloor = Mth.floor(inZ); + int xFloor = roundUsing(inX, FLOOR); + int yFloor = roundUsing(inY, FLOOR); + int zFloor = roundUsing(inZ, FLOOR); Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferBuilder = tesselator.getBuilder(); RenderSystem.disableCull(); RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); - int rainDistance = 5; - if (Minecraft.useFancyGraphics()) { - rainDistance = 10; - } + int rainDistance = useFancyGraphics() ? 10 : 5; RenderSystem.depthMask(true); int count = -1; float rainAnimationTime = this.ticks + mc.getFrameTime(); RenderSystem.setShader(GameRenderer::getParticleShader); turnOnLightLayer(); - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); + MutableBlockPos mutableBlockPos = new MutableBlockPos(); for (int rainZ = zFloor - rainDistance; rainZ <= zFloor + rainDistance; ++rainZ) { for (int rainX = xFloor - rainDistance; rainX <= xFloor + rainDistance; ++rainX) { int q = (rainZ - zFloor + 16) * 32 + rainX - xFloor + 16; @@ -880,19 +935,19 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub if (!biome.hasPrecipitation()) continue; int blockingHeight = blockAccess.getHeightBlocking(rainX, rainZ); - int lower = Math.max(yFloor - rainDistance, blockingHeight); - int upper = Math.max(yFloor + rainDistance, blockingHeight); + int lower = max(yFloor - rainDistance, blockingHeight); + int upper = max(yFloor + rainDistance, blockingHeight); if (lower == upper) { // no rain continue; } - int rainY = Math.max(blockingHeight, yFloor); + int rainY = max(blockingHeight, yFloor); RandomSource randomSource = RandomSource.create(rainX * rainX * 3121L + rainX * 45238971L ^ rainZ * rainZ * 418711L + rainZ * 13761L); mutableBlockPos.setY(lower); - Biome.Precipitation precipitation = biome.getPrecipitationAt(mutableBlockPos); - if (precipitation == Biome.Precipitation.NONE) { + Precipitation precipitation = biome.getPrecipitationAt(mutableBlockPos); + if (precipitation == Precipitation.NONE) { continue; } @@ -900,7 +955,7 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub double localX = rainX + 0.5; double localZ = rainZ + 0.5; - float distance = (float)Math.sqrt(localX * localX + localZ * localZ) / (float)rainDistance; + float distance = (float)sqrt(localX * localX + localZ * localZ) / (float)rainDistance; float blend; float xOffset = 0; float yOffset = 0; @@ -908,30 +963,30 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub int skyLight = blockAccess.getBrightness(LightLayer.SKY, mutableBlockPos) << 4; int blockLight = blockAccess.getBrightness(LightLayer.BLOCK, mutableBlockPos) << 4; - if (precipitation == Biome.Precipitation.RAIN) { + if (precipitation == Precipitation.RAIN) { if (count != 0) { if (count >= 0) { tesselator.end(); } count = 0; RenderSystem.setShaderTexture(0, RAIN_LOCATION); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); } - blend = ((1.0f - distance * distance) * 0.5f + 0.5f); + blend = ((1.0F - distance * distance) * 0.5F + 0.5F); int x = this.ticks + rainX * rainX * 3121 + rainX * 45238971 + rainZ * rainZ * 418711 + rainZ * 13761 & 0x1F; yOffset = -((float)x + mc.getFrameTime()) / 32.0f * (3.0f + randomSource.nextFloat()); - } else if (precipitation == Biome.Precipitation.SNOW) { + } else if (precipitation == Precipitation.SNOW) { if (count != 1) { if (count >= 0) { tesselator.end(); } count = 1; RenderSystem.setShaderTexture(0, SNOW_LOCATION); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.PARTICLE); + bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.PARTICLE); } - blend = ((1.0f - distance * distance) * 0.3f + 0.5f); + blend = ((1.0F - distance * distance) * 0.3F + 0.5F); xOffset = (float)(randomSource.nextDouble() + (double)rainAnimationTime * 0.01 * (double)((float)randomSource.nextGaussian())); float ae = -((float)(this.ticks & 0x1FF) + mc.getFrameTime()) / 512.0f; float af = (float)(randomSource.nextDouble() + (double)(rainAnimationTime * (float)randomSource.nextGaussian()) * 0.001); @@ -946,19 +1001,19 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub bufferBuilder .vertex(localX - r, (double)upper - inY, localZ - s) .uv(0.0f + xOffset, (float)lower * 0.25f + yOffset) - .color(1.0f, 1.0f, 1.0f, blend).uv2(blockLight, skyLight).endVertex(); + .color(1.0F, 1.0F, 1.0F, blend).uv2(blockLight, skyLight).endVertex(); bufferBuilder .vertex(localX + r, (double)upper - inY, localZ + s) .uv(1.0f + xOffset, (float)lower * 0.25f + yOffset) - .color(1.0f, 1.0f, 1.0f, blend).uv2(blockLight, skyLight).endVertex(); + .color(1.0F, 1.0F, 1.0F, blend).uv2(blockLight, skyLight).endVertex(); bufferBuilder .vertex(localX + r, (double)lower - inY, localZ + s) .uv(1.0f + xOffset, (float)upper * 0.25f + yOffset) - .color(1.0f, 1.0f, 1.0f, blend).uv2(blockLight, skyLight).endVertex(); + .color(1.0F, 1.0F, 1.0F, blend).uv2(blockLight, skyLight).endVertex(); bufferBuilder .vertex(localX - r, (double)lower - inY, localZ - s) .uv(0.0f + xOffset, (float)upper * 0.25f + yOffset) - .color(1.0f, 1.0f, 1.0f, blend).uv2(blockLight, skyLight).endVertex(); + .color(1.0F, 1.0F, 1.0F, blend).uv2(blockLight, skyLight).endVertex(); } } if (count >= 0) { @@ -984,8 +1039,7 @@ public float getTimeOfDay() public float getSunAngle() { - float dayTime = this.getTimeOfDay(); - return dayTime * ((float)Math.PI * 2F); + return this.getTimeOfDay() * ((float)PI * 2F); } public int getMoonPhase() @@ -995,12 +1049,12 @@ public int getMoonPhase() public float getSkyDarken() { float dayTime = this.getTimeOfDay(); - float h = 1.0f - (Mth.cos(dayTime * ((float)Math.PI * 2)) * 2.0f + 0.2f); - h = Mth.clamp(h, 0.0f, 1.0f); - h = 1.0f - h; - h *= 1.0f - this.getRainLevel() * 5.0f / 16.0f; - h *= 1.0f - this.getThunderLevel() * 5.0f / 16.0f; - return h * 0.8f + 0.2f; + float h = 1.0f - (cos(dayTime * ((float)PI * 2)) * 2.0f + 0.2f); + h = clamp(0.0f, 1.0f, h); + h = 1.0F - h; + h *= 1.0F - this.getRainLevel() * 5.0F / 16.0F; + h *= 1.0F - this.getThunderLevel() * 5.0F / 16.0F; + return h * 0.8F + 0.2F; } public float getRainLevel() { @@ -1014,8 +1068,8 @@ public float getThunderLevel() { public float getStarBrightness() { float f = this.getTimeOfDay(); - float f1 = 1.0F - (Mth.cos(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); - f1 = Mth.clamp(f1, 0.0F, 1.0F); + float f1 = 1.0F - (cos(f * ((float)PI * 2F)) * 2.0F + 0.25F); + f1 = clamp(0.0F, 1.0F, f1); return f1 * f1 * 0.5F; } @@ -1027,8 +1081,8 @@ public Vec3 getSkyColor(Vec3 position) Vec3 skyColor = CubicSampler.gaussianSampleVec3(samplePosition, (i, j, k) -> Vec3.fromRGB24(blockAccess.getBiomeManager().getNoiseBiomeAtQuart(i, j, k).value().getSkyColor())); - float h = Mth.cos(dayTime * ((float)Math.PI * 2)) * 2.0f + 0.5f; - h = Mth.clamp(h, 0.0f, 1.0f); + float h = cos(dayTime * ((float)PI * 2)) * 2.0f + 0.5f; + h = clamp(0.0f, 1.0f, h); float skyColorR = (float)skyColor.x * h; float skyColorG = (float)skyColor.y * h; float skyColorB = (float)skyColor.z * h; @@ -1063,7 +1117,7 @@ public Vec3 getSkyColor(Vec3 position) public Vec3 getFogColor(Vec3 pos) { - float f = Mth.clamp(Mth.cos(this.getTimeOfDay() * ((float)Math.PI * 2F)) * 2.0F + 0.5F, 0.0F, 1.0F); + float f = clamp(0.0F, 1.0F, cos(this.getTimeOfDay() * ((float)PI * 2F)) * 2.0F + 0.5F); Vec3 scaledPos = pos.subtract(2.0D, 2.0D, 2.0D).scale(0.25D); return CubicSampler.gaussianSampleVec3(scaledPos, (x, y, z) -> this.dimensionInfo.getBrightnessDependentFogColor(Vec3.fromRGB24(this.blockAccess.getBiomeManager().getNoiseBiomeAtQuart(x, y, z).value().getFogColor()), f)); } @@ -1071,8 +1125,8 @@ public Vec3 getFogColor(Vec3 pos) public Vec3 getCloudColour() { float dayTime = this.getTimeOfDay(); - float f1 = Mth.cos(dayTime * ((float)Math.PI * 2F)) * 2.0F + 0.5F; - f1 = Mth.clamp(f1, 0.0F, 1.0F); + float f1 = cos(dayTime * ((float)PI * 2F)) * 2.0F + 0.5F; + f1 = clamp(0.0F, 1.0F, f1); float r = 1.0F; float g = 1.0F; float b = 1.0F; @@ -1111,8 +1165,8 @@ private void generateSky() if (this.skyVBO != null) { this.skyVBO.close(); } - this.skyVBO = new VertexBuffer(VertexBuffer.Usage.STATIC); - BufferBuilder.RenderedBuffer renderedBuffer = buildSkyDisc(bufferBuilder, 16.0f); + this.skyVBO = new VertexBuffer(Usage.STATIC); + RenderedBuffer renderedBuffer = buildSkyDisc(bufferBuilder, 16.0F); this.skyVBO.bind(); this.skyVBO.upload(renderedBuffer); VertexBuffer.unbind(); @@ -1125,21 +1179,21 @@ private void generateSky2() if (this.sky2VBO != null) { this.sky2VBO.close(); } - this.sky2VBO = new VertexBuffer(VertexBuffer.Usage.STATIC); - BufferBuilder.RenderedBuffer renderedBuffer = buildSkyDisc(bufferBuilder, -16.0f); + this.sky2VBO = new VertexBuffer(Usage.STATIC); + RenderedBuffer renderedBuffer = buildSkyDisc(bufferBuilder, -16.0F); this.sky2VBO.bind(); this.sky2VBO.upload(renderedBuffer); VertexBuffer.unbind(); } - private static BufferBuilder.RenderedBuffer buildSkyDisc(BufferBuilder bufferBuilder, float posY) { - float g = Math.signum(posY) * 512.0f; - float h = 512.0f; + private static RenderedBuffer buildSkyDisc(BufferBuilder bufferBuilder, float posY) { + float g = signum(posY) * 512.0F; + float h = 512.0F; RenderSystem.setShader(GameRenderer::getPositionShader); - bufferBuilder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); + bufferBuilder.begin(Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); bufferBuilder.vertex(0.0, posY, 0.0).endVertex(); for (int i = -180; i <= 180; i += 45) { - bufferBuilder.vertex(g * Mth.cos((float)i * ((float)Math.PI / 180)), posY, 512.0f * Mth.sin((float)i * ((float)Math.PI / 180))).endVertex(); + bufferBuilder.vertex(g * cos((float)i * ((float)PI / 180)), posY, 512.0f * sin((float)i * ((float)PI / 180))).endVertex(); } return bufferBuilder.end(); } @@ -1152,17 +1206,17 @@ private void generateStars() if (this.starVBO != null) { this.starVBO.close(); } - this.starVBO = new VertexBuffer(VertexBuffer.Usage.STATIC); - BufferBuilder.RenderedBuffer renderedBuffer = this.buildStars(bufferBuilder); + this.starVBO = new VertexBuffer(Usage.STATIC); + RenderedBuffer renderedBuffer = this.buildStars(bufferBuilder); this.starVBO.bind(); this.starVBO.upload(renderedBuffer); VertexBuffer.unbind(); } - private BufferBuilder.RenderedBuffer buildStars(BufferBuilder bufferBuilderIn) + private RenderedBuffer buildStars(BufferBuilder bufferBuilderIn) { Random random = new Random(10842L); - bufferBuilderIn.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION); + bufferBuilderIn.begin(Mode.QUADS, DefaultVertexFormat.POSITION); for (int i = 0; i < 1500; ++i) { @@ -1174,22 +1228,22 @@ private BufferBuilder.RenderedBuffer buildStars(BufferBuilder bufferBuilderIn) if (d4 < 1.0D && d4 > 0.01D) { - d4 = 1.0D / Math.sqrt(d4); + d4 = 1.0D / sqrt(d4); d0 = d0 * d4; d1 = d1 * d4; d2 = d2 * d4; double d5 = d0 * 100.0D; double d6 = d1 * 100.0D; double d7 = d2 * 100.0D; - double d8 = Math.atan2(d0, d2); - double d9 = Math.sin(d8); - double d10 = Math.cos(d8); - double d11 = Math.atan2(Math.sqrt(d0 * d0 + d2 * d2), d1); - double d12 = Math.sin(d11); - double d13 = Math.cos(d11); - double d14 = random.nextDouble() * Math.PI * 2.0D; - double d15 = Math.sin(d14); - double d16 = Math.cos(d14); + double d8 = atan2(d0, d2); + double d9 = sin(d8); + double d10 = cos(d8); + double d11 = atan2(sqrt(d0 * d0 + d2 * d2), d1); + double d12 = sin(d11); + double d13 = cos(d11); + double d14 = random.nextDouble() * PI * 2.0D; + double d15 = sin(d14); + double d16 = cos(d14); for (int j = 0; j < 4; ++j) { @@ -1217,14 +1271,14 @@ public void turnOffLightLayer() { public void turnOnLightLayer() { RenderSystem.setShaderTexture(2, this.lightTextureLocation); mc.getTextureManager().bindForSetup(this.lightTextureLocation); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D , GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D , GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); } public void updateTorchFlicker() { this.blockLightRedFlicker += (float)((Math.random() - Math.random()) * Math.random() * Math.random() * 0.1); - this.blockLightRedFlicker *= 0.9f; + this.blockLightRedFlicker *= 0.9F; this.lightmapUpdateNeeded = true; } @@ -1247,21 +1301,21 @@ public void updateLightmap() }*/ float skyLight = getSkyDarken(); - float effectiveSkyLight = skyFlashTime > 0 ? 1.0f : skyLight * 0.95F + 0.05F; + float effectiveSkyLight = skyFlashTime > 0 ? 1.0F : skyLight * 0.95F + 0.05F; /* no darkness effect, we don't have an actual player - float darknessScale = this.mc.options.darknessEffectScale().get().floatValue(); + float darknessScale = mc.options.darknessEffectScale().get().floatValue(); float darknessGamma = this.getDarknessGamma(0) * darknessScale; - float effectiveDarknessScale = this.calculateDarknessScale(this.mc.player, darknessGamma, 0) * darknessScale; + float effectiveDarknessScale = this.calculateDarknessScale(mc.player, darknessGamma, 0) * darknessScale; */ float waterVision = getWaterVision(); /* no night vision, we don't have a player - float nightVision = this.mc.player.hasEffect(MobEffects.NIGHT_VISION) - ? GameRenderer.getNightVisionScale(this.mc.player, 0) - : (waterVision > 0.0f && this.mc.player.hasEffect(MobEffects.CONDUIT_POWER) ? waterVision : 0.0f); + float nightVision = mc.player.hasEffect(MobEffects.NIGHT_VISION) + ? GameRenderer.getNightVisionScale(mc.player, 0) + : (waterVision > 0.0f && mc.player.hasEffect(MobEffects.CONDUIT_POWER) ? waterVision : 0.0F); */ - float nightVision = 0.0f; + float nightVision = 0.0F; Vector3f skylightColor = new Vector3f(skyLight, skyLight, 1.0f).lerp(new Vector3f(1.0f, 1.0f, 1.0f), 0.35f); @@ -1271,27 +1325,27 @@ public void updateLightmap() for (int j = 0; j < 16; ++j) { float skyBrightness = LightTexture.getBrightness(this.blockAccess.dimensionType(), i) * effectiveSkyLight; - float blockBrightnessRed = LightTexture.getBrightness(this.blockAccess.dimensionType(), j) * (blockLightRedFlicker + 1.5f); - float blockBrightnessGreen = blockBrightnessRed * ((blockBrightnessRed * 0.6f + 0.4f) * 0.6f + 0.4f); - float blockBrightnessBlue = blockBrightnessRed * (blockBrightnessRed * blockBrightnessRed * 0.6f + 0.4f); + float blockBrightnessRed = LightTexture.getBrightness(this.blockAccess.dimensionType(), j) * (blockLightRedFlicker + 1.5F); + float blockBrightnessGreen = blockBrightnessRed * ((blockBrightnessRed * 0.6F + 0.4F) * 0.6F + 0.4F); + float blockBrightnessBlue = blockBrightnessRed * (blockBrightnessRed * blockBrightnessRed * 0.6F + 0.4F); finalColor.set(blockBrightnessRed, blockBrightnessGreen, blockBrightnessBlue); if (dimensionInfo.forceBrightLightmap()) { finalColor.lerp(new Vector3f(0.99f, 1.12f, 1.0f), 0.25f); - finalColor.set(Mth.clamp(finalColor.x, 0.0f, 1.0f), Mth.clamp(finalColor.y, 0.0f, 1.0f), Mth.clamp(finalColor.z, 0.0f, 1.0f)); + finalColor.set(clamp(0.0f, 1.0f, finalColor.x), clamp(0.0f, 1.0f, finalColor.y), clamp(0.0f, 1.0f, finalColor.z)); } else { finalColor.add(new Vector3f(skylightColor).mul(skyBrightness)); finalColor.lerp(new Vector3f(0.75f, 0.75f, 0.75f), 0.04f); // no darkening from bosses -// if (getDarkenWorldAmount() > 0.0f) { -// finalColor.lerp(new Vector3f(finalColor).mul(0.7f, 0.6f, 0.6f), getDarkenWorldAmount()); +// if (getDarkenWorldAmount() > 0.0F) { +// finalColor.lerp(new Vector3f(finalColor).mul(0.7F, 0.6F, 0.6F), getDarkenWorldAmount()); // } } /* no night vision, no player - if (nightVision > 0.0f && (w = Math.max(finalColor.x(), Math.max(finalColor.y(), finalColor.z()))) < 1.0f) { - v = 1.0f / w; + if (nightVision > 0.0F && (w = max(finalColor.x(), max(finalColor.y(), finalColor.z()))) < 1.0F) { + v = 1.0F / w; vector3f4 = new Vector3f(finalColor).mul(v); finalColor.lerp(vector3f4, nightVision); } @@ -1299,18 +1353,18 @@ public void updateLightmap() if (!dimensionInfo.forceBrightLightmap()) { /* no darkness, no player - if (effectiveDarknessScale > 0.0f) { + if (effectiveDarknessScale > 0.0F) { finalColor.add(-effectiveDarknessScale, -effectiveDarknessScale, -effectiveDarknessScale); } */ - finalColor.set(Mth.clamp(finalColor.x, 0.0f, 1.0f), Mth.clamp(finalColor.y, 0.0f, 1.0f), Mth.clamp(finalColor.z, 0.0f, 1.0f)); + finalColor.set(clamp(0.0f, 1.0f, finalColor.x), clamp(0.0f, 1.0f, finalColor.y), clamp(0.0f, 1.0f, finalColor.z)); } - float gamma = this.mc.options.gamma().get().floatValue(); + float gamma = mc.options.gamma().get().floatValue(); Vector3f vector3f5 = new Vector3f(this.notGamma(finalColor.x), this.notGamma(finalColor.y), this.notGamma(finalColor.z)); - finalColor.lerp(vector3f5, Math.max(0.0f, gamma /*- darknessGamma*/)); + finalColor.lerp(vector3f5, max(0.0f, gamma /*- darknessGamma*/)); finalColor.lerp(new Vector3f(0.75f, 0.75f, 0.75f), 0.04f); - finalColor.set(Mth.clamp(finalColor.x, 0.0f, 1.0f), Mth.clamp(finalColor.y, 0.0f, 1.0f), Mth.clamp(finalColor.z, 0.0f, 1.0f)); + finalColor.set(clamp(0.0f, 1.0f, finalColor.x), clamp(0.0f, 1.0f, finalColor.y), clamp(0.0f, 1.0f, finalColor.z)); finalColor.mul(255.0f); int r = (int)finalColor.x(); @@ -1326,8 +1380,8 @@ public void updateLightmap() } private float notGamma(float f) { - float g = 1.0f - f; - return 1.0f - g * g * g * g; + float g = 1.0F - f; + return 1.0F - g * g * g * g; } public float getWaterVision() @@ -1344,8 +1398,8 @@ public float getWaterVision() } else { - float f2 = Mth.clamp((float)this.waterVisionTime / 100.0F, 0.0F, 1.0F); - float f3 = (float)this.waterVisionTime < 100.0F ? 0.0F : Mth.clamp(((float)this.waterVisionTime - 100.0F) / 500.0F, 0.0F, 1.0F); + float f2 = clamp(0.0F, 1.0F, (float)this.waterVisionTime / 100.0F); + float f3 = (float)this.waterVisionTime < 100.0F ? 0.0F : clamp(0.0F, 1.0F, ((float)this.waterVisionTime - 100.0F) / 500.0F); return f2 * 0.6F + f3 * 0.39999998F; } } @@ -1363,7 +1417,7 @@ public boolean areEyesInFluid(TagKey tagIn) } public Vec3 getEyePos() { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_post.hmd.getPosition(); + return dh.vrPlayer.vrdata_room_post.hmd.getPosition(); } private boolean isFluidTagged(Fluid fluid, TagKey tag) { @@ -1449,7 +1503,7 @@ public void setupFogColor() { if (fogType == FogType.WATER && fogRed != 0.0f && fogGreen != 0.0f && fogBlue != 0.0f) { float f1 = this.menuWorldRenderer.getWaterVision(); - float f3 = Math.min(1.0f / fogRed, Math.min(1.0f / fogGreen, 1.0f / fogBlue)); + float f3 = min(1.0f / fogRed, min(1.0f / fogGreen, 1.0f / fogBlue)); fogRed = fogRed * (1.0F - f1) + fogRed * f3 * f1; fogGreen = fogGreen * (1.0F - f1) + fogGreen * f3 * f1; @@ -1480,7 +1534,7 @@ public void setupFogColor() { private void updateSurfaceFog() { float f = 0.25F + 0.75F * (float) this.menuWorldRenderer.renderDistanceChunks / 32.0F; - f = 1.0F - (float) Math.pow(f, 0.25); + f = 1.0F - (float) pow(f, 0.25); Vec3 eyePos = this.menuWorldRenderer.getEyePos(); Vec3 skyColor = this.menuWorldRenderer.getSkyColor(eyePos); if (OptifineHelper.isOptifineLoaded()) { @@ -1508,9 +1562,9 @@ private void updateSurfaceFog() { fogBlue = (float) fogColor.z; if (this.menuWorldRenderer.renderDistanceChunks >= 4) { - float d0 = Mth.sin(this.menuWorldRenderer.getSunAngle()) > 0.0F ? -1.0F : 1.0F; + float d0 = sin(this.menuWorldRenderer.getSunAngle()) > 0.0F ? -1.0F : 1.0F; Vec3 vec3d2 = new Vec3(d0, 0.0F, 0.0F).yRot(0); - float f5 = (float) ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_post.hmd.getDirection().yRot(menuWorldRenderer.worldRotation).dot(vec3d2); + float f5 = (float) dh.vrPlayer.vrdata_room_post.hmd.getDirection().yRot(menuWorldRenderer.worldRotation).dot(vec3d2); if (f5 < 0.0F) { f5 = 0.0F; @@ -1569,55 +1623,55 @@ private void updateWaterFog(LevelReader levelIn) { int j1 = previousBiomeFog >> 16 & 255; int k1 = previousBiomeFog >> 8 & 255; int l1 = previousBiomeFog & 255; - float f = Mth.clamp((float) (currentTime - this.biomeChangedTime) / 5000.0F, 0.0F, 1.0F); + float f = clamp(0.0F, 1.0F, (float) (currentTime - this.biomeChangedTime) / 5000.0F); - float f1 = Mth.lerp(f, j1, k); - float f2 = Mth.lerp(f, k1, l); - float f3 = Mth.lerp(f, l1, i1); + float f1 = lerp(j1, k, f); + float f2 = lerp(k1, l, f); + float f3 = lerp(l1, i1, f); fogRed = f1 / 255.0F; fogGreen = f2 / 255.0F; fogBlue = f3 / 255.0F; if (targetBiomeFog != waterFogColor) { targetBiomeFog = waterFogColor; - previousBiomeFog = Mth.floor(f1) << 16 | Mth.floor(f2) << 8 | Mth.floor(f3); + previousBiomeFog = roundUsing(f1, FLOOR) << 16 | roundUsing(f2, FLOOR) << 8 | roundUsing(f3, FLOOR); this.biomeChangedTime = currentTime; } } - public void setupFog(FogRenderer.FogMode fogMode) { + public void setupFog(FogMode fogMode) { FogType fogType = getEyeFogType(); float fogStart, fogEnd; FogShape fogShape = FogShape.SPHERE; if (fogType == FogType.LAVA) { - fogStart = 0.25f; - fogEnd = 1.0f; + fogStart = 0.25F; + fogEnd = 1.0F; } else if (fogType == FogType.POWDER_SNOW) { - fogStart = 0.0f; - fogEnd = 2.0f; + fogStart = 0.0F; + fogEnd = 2.0F; } else if (fogType == FogType.WATER) { - fogStart = -8.0f; - fogEnd = 96.0f; + fogStart = -8.0F; + fogEnd = 96.0F; Holder holder = menuWorldRenderer.blockAccess.getBiome(BlockPos.containing(menuWorldRenderer.getEyePos())); if (holder.is(BiomeTags.HAS_CLOSER_WATER_FOG)) { - fogEnd *= 0.85f; + fogEnd *= 0.85F; } if (fogEnd > menuWorldRenderer.renderDistance) { fogEnd = menuWorldRenderer.renderDistance; fogShape = FogShape.CYLINDER; } } else if (menuWorldRenderer.blockAccess.getDimensionReaderInfo().isFoggyAt(0,0)) { - fogStart = menuWorldRenderer.renderDistance * 0.05f; - fogEnd = Math.min(menuWorldRenderer.renderDistance, 192.0f) * 0.5f; - } else if (fogMode == FogRenderer.FogMode.FOG_SKY) { - fogStart = 0.0f; + fogStart = menuWorldRenderer.renderDistance * 0.05F; + fogEnd = min(menuWorldRenderer.renderDistance, 192.0F) * 0.5F; + } else if (fogMode == FogMode.FOG_SKY) { + fogStart = 0.0F; fogEnd = menuWorldRenderer.renderDistance; fogShape = FogShape.CYLINDER; } else { - float h = Mth.clamp(menuWorldRenderer.renderDistance / 10.0f, 4.0f, 64.0f); + float h = clamp(4.0f, 64.0f, menuWorldRenderer.renderDistance / 10.0f); fogStart = menuWorldRenderer.renderDistance - h; fogEnd = menuWorldRenderer.renderDistance; fogShape = FogShape.CYLINDER; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/ControllerType.java b/common/src/main/java/org/vivecraft/client_vr/provider/ControllerType.java index 6d38107a7..1571f05be 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/ControllerType.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/ControllerType.java @@ -3,5 +3,5 @@ public enum ControllerType { RIGHT, - LEFT; + LEFT } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java b/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java index 7d5b5ff80..301ef8fdb 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java @@ -1,16 +1,17 @@ package org.vivecraft.client_vr.provider; -import java.util.Arrays; import net.minecraft.client.KeyMapping; +import java.util.Arrays; + public class HandedKeyBinding extends KeyMapping { private boolean[] pressed = new boolean[ControllerType.values().length]; private int[] pressTime = new int[ControllerType.values().length]; - public HandedKeyBinding(String p_90821_, int p_90822_, String p_90823_) + public HandedKeyBinding(String string, int i, String string2) { - super(p_90821_, p_90822_, p_90823_); + super(string, i, string2); } @Override diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/HardwareType.java b/common/src/main/java/org/vivecraft/client_vr/provider/HardwareType.java index 650bd754a..b27e7c4b6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/HardwareType.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/HardwareType.java @@ -1,6 +1,7 @@ package org.vivecraft.client_vr.provider; import com.google.common.collect.ImmutableList; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -14,9 +15,9 @@ public enum HardwareType public final List manufacturers; public final boolean hasTouchpad; public final boolean hasStick; - private static Map map = new HashMap<>(); + private static final Map map = new HashMap<>(); - private HardwareType(boolean hasTouchpad, boolean hasStick, String... manufacturers) + HardwareType(boolean hasTouchpad, boolean hasStick, String... manufacturers) { this.hasTouchpad = hasTouchpad; this.hasStick = hasStick; @@ -25,7 +26,7 @@ private HardwareType(boolean hasTouchpad, boolean hasStick, String... manufactur public static HardwareType fromManufacturer(String name) { - return map.containsKey(name) ? map.get(name) : VIVE; + return map.getOrDefault(name, VIVE); } static { diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/InputSimulator.java b/common/src/main/java/org/vivecraft/client_vr/provider/InputSimulator.java index 70296132c..6bd7ce9d0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/InputSimulator.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/InputSimulator.java @@ -2,11 +2,12 @@ import java.util.HashSet; import java.util.Set; -import net.minecraft.client.Minecraft; + +import static org.vivecraft.client_vr.VRState.mc; public class InputSimulator { - private static Set pressedKeys = new HashSet<>(); + private static final Set pressedKeys = new HashSet<>(); public static boolean isKeyDown(int key) { @@ -15,7 +16,7 @@ public static boolean isKeyDown(int key) public static void pressKey(int key, int modifiers) { - Minecraft.getInstance().keyboardHandler.keyPress(Minecraft.getInstance().getWindow().getWindow(), key, 0, 1, modifiers); + mc.keyboardHandler.keyPress(mc.getWindow().getWindow(), key, 0, 1, modifiers); pressedKeys.add(key); } @@ -26,7 +27,7 @@ public static void pressKey(int key) public static void releaseKey(int key, int modifiers) { - Minecraft.getInstance().keyboardHandler.keyPress(Minecraft.getInstance().getWindow().getWindow(), key, 0, 0, modifiers); + mc.keyboardHandler.keyPress(mc.getWindow().getWindow(), key, 0, 0, modifiers); pressedKeys.remove(key); } @@ -37,7 +38,7 @@ public static void releaseKey(int key) public static void typeChar(char character, int modifiers) { - Minecraft.getInstance().keyboardHandler.charTyped(Minecraft.getInstance().getWindow().getWindow(), character, modifiers); + mc.keyboardHandler.charTyped(mc.getWindow().getWindow(), character, modifiers); } public static void typeChar(char character) @@ -47,7 +48,7 @@ public static void typeChar(char character) public static void pressMouse(int button, int modifiers) { - Minecraft.getInstance().mouseHandler.onPress(Minecraft.getInstance().getWindow().getWindow(), button, 1, modifiers); + mc.mouseHandler.onPress(mc.getWindow().getWindow(), button, 1, modifiers); } public static void pressMouse(int button) @@ -57,7 +58,7 @@ public static void pressMouse(int button) public static void releaseMouse(int button, int modifiers) { - Minecraft.getInstance().mouseHandler.onPress(Minecraft.getInstance().getWindow().getWindow(), button, 0, modifiers); + mc.mouseHandler.onPress(mc.getWindow().getWindow(), button, 0, modifiers); } public static void releaseMouse(int button) @@ -67,12 +68,12 @@ public static void releaseMouse(int button) public static void setMousePos(double x, double y) { - Minecraft.getInstance().mouseHandler.onMove(Minecraft.getInstance().getWindow().getWindow(), x, y); + mc.mouseHandler.onMove(mc.getWindow().getWindow(), x, y); } public static void scrollMouse(double xOffset, double yOffset) { - Minecraft.getInstance().mouseHandler.onScroll(Minecraft.getInstance().getWindow().getWindow(), xOffset, yOffset); + mc.mouseHandler.onScroll(mc.getWindow().getWindow(), xOffset, yOffset); } public static void typeChars(CharSequence characters) diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index 682961bdb..0cf47bcdc 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -1,26 +1,10 @@ package org.vivecraft.client_vr.provider; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.joml.Vector2f; -import org.lwjgl.glfw.GLFW; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GuiExtension; -import org.vivecraft.client_vr.VRData; +import org.vivecraft.client.utils.Utils; +import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.Vec3History; +import org.vivecraft.client_vr.extensions.GuiExtension; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; @@ -28,48 +12,68 @@ import org.vivecraft.client_vr.provider.openvr_lwjgl.control.VRInputActionSet; import org.vivecraft.client_vr.provider.openvr_lwjgl.control.VivecraftMovementInput; import org.vivecraft.client_vr.render.RenderConfigException; +import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRHotkeys.Triggerer; +import org.vivecraft.client_vr.settings.VRSettings.HUDLock; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; import org.vivecraft.client_xr.render_pass.RenderPassManager; -import org.vivecraft.common.utils.lwjgl.Matrix4f; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.lwjgl.Vector3f; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; +import org.vivecraft.mod_compat_vr.ShadersHelper; + +import org.joml.*; import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ChatScreen; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.WinScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.network.chat.Component; -import net.minecraft.util.Mth; +import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.TorchBlock; import net.minecraft.world.phys.Vec3; -import org.vivecraft.mod_compat_vr.ShadersHelper; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.*; +import java.util.stream.Stream; + +import static org.vivecraft.client.utils.Utils.message; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; + +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; + +@ParametersAreNonnullByDefault public abstract class MCVR { - protected Minecraft mc; - protected ClientDataHolderVR dh; protected static MCVR me; - protected static VivecraftVRMod mod; - protected org.vivecraft.common.utils.math.Matrix4f hmdPose = new org.vivecraft.common.utils.math.Matrix4f(); - public org.vivecraft.common.utils.math.Matrix4f hmdRotation = new org.vivecraft.common.utils.math.Matrix4f(); + protected Matrix4f hmdPose = new Matrix4f(); + public Matrix4f hmdRotation = new Matrix4f(); public HardwareType detectedHardware = HardwareType.VIVE; - protected org.vivecraft.common.utils.math.Matrix4f hmdPoseLeftEye = new org.vivecraft.common.utils.math.Matrix4f(); - protected org.vivecraft.common.utils.math.Matrix4f hmdPoseRightEye = new org.vivecraft.common.utils.math.Matrix4f(); + protected Matrix4f hmdPoseLeftEye = new Matrix4f(); + protected Matrix4f hmdPoseRightEye = new Matrix4f(); public Vec3History hmdHistory = new Vec3History(); public Vec3History hmdPivotHistory = new Vec3History(); protected boolean headIsTracking; - protected org.vivecraft.common.utils.math.Matrix4f[] controllerPose = new org.vivecraft.common.utils.math.Matrix4f[3]; - protected org.vivecraft.common.utils.math.Matrix4f[] controllerRotation = new org.vivecraft.common.utils.math.Matrix4f[3]; - protected boolean[] controllerTracking = new boolean[3]; - protected org.vivecraft.common.utils.math.Matrix4f[] handRotation = new org.vivecraft.common.utils.math.Matrix4f[3]; + protected Matrix4f[] controllerPose = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; + protected Matrix4f[] controllerRotation = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; + protected boolean[] controllerTracking = new boolean[]{false, false}; + protected int[] controllerSkeletalInputTrackingLevel = {0, 0}; + protected ArrayList[] gestureFingerSplay = new ArrayList[]{new ArrayList(), new ArrayList()}; + protected ArrayList[] gestureFingerCurl = new ArrayList[]{new ArrayList(), new ArrayList()}; + protected ArrayList[] gestureFingerTransforms = new ArrayList[]{new ArrayList(), new ArrayList()}; + protected ArrayList[] gestureFingerOrientations = new ArrayList[]{new ArrayList(), new ArrayList()}; + protected Matrix4f[] gesturePose = new Matrix4f[2]; + protected Matrix4f[] gestureRotation = new Matrix4f[2]; + protected Vector3d[] gestureVelocity = new Vector3d[2]; + protected Matrix4f[] handRotation = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; public Vec3History[] controllerHistory = new Vec3History[] {new Vec3History(), new Vec3History()}; public Vec3History[] controllerForwardHistory = new Vec3History[] {new Vec3History(), new Vec3History()}; public Vec3History[] controllerUpHistory = new Vec3History[] {new Vec3History(), new Vec3History()}; @@ -78,11 +82,8 @@ public abstract class MCVR public boolean initialized; public String initStatus; public boolean initSuccess; - protected org.vivecraft.common.utils.math.Matrix4f[] poseMatrices; - protected Vec3[] deviceVelocity; - protected Vec3[] aimSource = new Vec3[3]; - public Vector3 forward = new Vector3(0.0F, 0.0F, -1.0F); - public Vector3 up = new Vector3(0.0F, 1.0F, 0.0F); + protected Matrix4f[] poseMatrices; + protected Vec3[] aimSource = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; public int hmdAvgLength = 90; public LinkedList hmdPosSamples = new LinkedList<>(); public LinkedList hmdYawSamples = new LinkedList<>(); @@ -97,10 +98,6 @@ public abstract class MCVR protected HapticScheduler hapticScheduler; public float seatedRot; public float aimPitch = 0.0F; - protected final org.vivecraft.common.utils.math.Matrix4f Neutral_HMD = new org.vivecraft.common.utils.math.Matrix4f(1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, 1.62F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F, 0.0F, 0.0F, 1.0F); - protected final org.vivecraft.common.utils.math.Matrix4f TPose_Left = new org.vivecraft.common.utils.math.Matrix4f(1.0F, 0.0F, 0.0F, 0.25F, 0.0F, 1.0F, 0.0F, 1.62F, 0.0F, 0.0F, 1.0F, 0.25F, 0.0F, 0.0F, 0.0F, 1.0F); - protected final org.vivecraft.common.utils.math.Matrix4f TPose_Right = new org.vivecraft.common.utils.math.Matrix4f(1.0F, 0.0F, 0.0F, 0.75F, 0.0F, 1.0F, 0.0F, 1.62F, 0.0F, 0.0F, 1.0F, 0.75F, 0.0F, 0.0F, 0.0F, 1.0F); - protected boolean TPose = false; public boolean hudPopup = true; protected int moveModeSwitchCount = 0; public boolean isWalkingAbout; @@ -110,31 +107,9 @@ public abstract class MCVR protected float walkaboutYawStart; protected float hmdForwardYaw = 180; public boolean ignorePressesNextFrame = false; - protected int quickTorchPreviousSlot; protected Map inputActions = new HashMap<>(); protected Map inputActionsByKeyBinding = new HashMap<>(); - public MCVR(Minecraft mc, ClientDataHolderVR dh, VivecraftVRMod vrMod) - { - this.mc = mc; - this.dh = dh; - mod = vrMod; - me = this; - - for (int i = 0; i < 3; ++i) - { - this.aimSource[i] = new Vec3(0.0D, 0.0D, 0.0D); - this.controllerPose[i] = new org.vivecraft.common.utils.math.Matrix4f(); - this.controllerRotation[i] = new org.vivecraft.common.utils.math.Matrix4f(); - this.handRotation[i] = new org.vivecraft.common.utils.math.Matrix4f(); - } - } - - public static MCVR get() - { - return me; - } - public abstract String getName(); public abstract String getID(); @@ -148,7 +123,7 @@ public double getGunAngle() return this.gunAngle; } - public org.vivecraft.common.utils.math.Matrix4f getAimRotation(int controller) + public Matrix4f getAimRotation(int controller) { return this.controllerRotation[controller]; } @@ -157,10 +132,10 @@ public Vec3 getAimSource(int controller) { Vec3 vec3 = new Vec3(this.aimSource[controller].x, this.aimSource[controller].y, this.aimSource[controller].z); - if (!this.dh.vrSettings.seated && this.dh.vrSettings.allowStandingOriginOffset) + if (!dh.vrSettings.seated && dh.vrSettings.allowStandingOriginOffset) { - if(this.dh.vr.isHMDTracking()) - vec3 = vec3.add((double)this.dh.vrSettings.originOffset.getX(), (double)this.dh.vrSettings.originOffset.getY(), (double)this.dh.vrSettings.originOffset.getZ()); + if(dh.vr.isHMDTracking()) + vec3 = vec3.add((double)dh.vrSettings.originOffset.x, (double)dh.vrSettings.originOffset.y, (double)dh.vrSettings.originOffset.z); } return vec3; @@ -168,8 +143,26 @@ public Vec3 getAimSource(int controller) public Vec3 getAimVector(int controller) { - Vector3 vector3 = this.controllerRotation[controller].transform(this.forward); - return vector3.toVector3d(); + return convertToVec3(new Vector3f(forward).mulProject(this.controllerRotation[controller])); + } + + public Vector3f getGesturePosition(int controller) + { + Vector3f vector3_position = this.gesturePose[controller].getTranslation(new Vector3f()); + return new Vector3f(vector3_position.x, vector3_position.y, vector3_position.z); + } + + public Vector3f getGestureVector(int controller) + { + return this.gesturePose[controller].transformPosition(new Vector3f(up)); + } + + public ArrayList getGestureFingerTransforms(int controller){ + return this.gestureFingerTransforms[controller]; + } + + public ArrayList getGestureFingerOrientations(int controller){ + return this.gestureFingerOrientations[controller]; } public void triggerHapticPulse(ControllerType controller, float durationSeconds, float frequency, float amplitude) @@ -179,9 +172,9 @@ public void triggerHapticPulse(ControllerType controller, float durationSeconds, public void triggerHapticPulse(ControllerType controller, float durationSeconds, float frequency, float amplitude, float delaySeconds) { - if (!this.dh.vrSettings.seated) + if (!dh.vrSettings.seated) { - if (this.dh.vrSettings.reverseHands) + if (dh.vrSettings.reverseHands) { if (controller == ControllerType.RIGHT) { @@ -215,35 +208,33 @@ public void triggerHapticPulse(int controller, int strength) } } - public org.vivecraft.common.utils.math.Matrix4f getHandRotation(int controller) + public Matrix4f getHandRotation(int controller) { return this.handRotation[controller]; } public Vec3 getHandVector(int controller) { - Vector3 vector3 = new Vector3(0.0F, 0.0F, -1.0F); - org.vivecraft.common.utils.math.Matrix4f matrix4f = this.handRotation[controller]; - Vector3 vector31 = matrix4f.transform(vector3); - return vector31.toVector3d(); + Vector3f vector31 = new Vector3f().set(forward).mulProject(this.handRotation[controller]); + return convertToVec3(vector31); } public Vec3 getCenterEyePosition() { - Vector3 vector3 = Utils.convertMatrix4ftoTranslationVector(this.hmdPose); + Vector3f vector3 = this.hmdPose.getTranslation(new Vector3f()); - if (this.dh.vrSettings.seated || this.dh.vrSettings.allowStandingOriginOffset) + if (dh.vrSettings.seated || dh.vrSettings.allowStandingOriginOffset) { - if(this.dh.vr.isHMDTracking()) - vector3 = vector3.add(this.dh.vrSettings.originOffset); + if(dh.vr.isHMDTracking()) + vector3 = vector3.add(dh.vrSettings.originOffset, new Vector3f()); } - return vector3.toVector3d(); + return convertToVec3(vector3); } public Vec3 getEyePosition(RenderPass eye) { - org.vivecraft.common.utils.math.Matrix4f matrix4f = this.hmdPoseRightEye; + Matrix4f matrix4f = this.hmdPoseRightEye; if (eye == RenderPass.LEFT) { @@ -260,85 +251,54 @@ else if (eye == RenderPass.RIGHT) if (matrix4f == null) { - org.vivecraft.common.utils.math.Matrix4f matrix4f2 = this.hmdPose; - Vector3 vector31 = Utils.convertMatrix4ftoTranslationVector(matrix4f2); + Vector3f vector31 = this.hmdPose.getTranslation(new Vector3f()); - if (this.dh.vrSettings.seated || this.dh.vrSettings.allowStandingOriginOffset) + if (dh.vrSettings.seated || dh.vrSettings.allowStandingOriginOffset) { - if(this.dh.vr.isHMDTracking()) - vector31 = vector31.add(this.dh.vrSettings.originOffset); + if(dh.vr.isHMDTracking()) + vector31 = vector31.add(dh.vrSettings.originOffset, new Vector3f()); } - return vector31.toVector3d(); + return convertToVec3(vector31); } else { - org.vivecraft.common.utils.math.Matrix4f matrix4f1 = org.vivecraft.common.utils.math.Matrix4f.multiply(this.hmdPose, matrix4f); - Vector3 vector3 = Utils.convertMatrix4ftoTranslationVector(matrix4f1); + Vector3f vector3 = this.hmdPose.mul0(matrix4f, new Matrix4f()).getTranslation(new Vector3f()); - if (this.dh.vrSettings.seated || this.dh.vrSettings.allowStandingOriginOffset) + if (dh.vrSettings.seated || dh.vrSettings.allowStandingOriginOffset) { - if(this.dh.vr.isHMDTracking()) - vector3 = vector3.add(this.dh.vrSettings.originOffset); + if(dh.vr.isHMDTracking()) + vector3 = vector3.add(dh.vrSettings.originOffset, new Vector3f()); } - return vector3.toVector3d(); + return convertToVec3(vector3); } } public HardwareType getHardwareType() { - return this.dh.vrSettings.forceHardwareDetection > 0 ? HardwareType.values()[this.dh.vrSettings.forceHardwareDetection - 1] : this.detectedHardware; + return dh.vrSettings.forceHardwareDetection > 0 ? HardwareType.values()[dh.vrSettings.forceHardwareDetection - 1] : this.detectedHardware; } public Vec3 getHmdVector() { - Vector3 vector3 = this.hmdRotation.transform(this.forward); - return vector3.toVector3d(); + return convertToVec3(new Vector3f(forward).mulProject(this.hmdRotation)); } - public org.vivecraft.common.utils.math.Matrix4f getEyeRotation(RenderPass eye) + public Matrix4f getEyeRotation(RenderPass eye) { - org.vivecraft.common.utils.math.Matrix4f matrix4f; + Matrix4f matrix4f = new Matrix4f(); if (eye == RenderPass.LEFT) { - matrix4f = this.hmdPoseLeftEye; - } - else if (eye == RenderPass.RIGHT) - { - matrix4f = this.hmdPoseRightEye; + matrix4f.set(this.hmdPoseLeftEye); } else { - matrix4f = null; + matrix4f.set(this.hmdPoseRightEye); } - if (matrix4f != null) - { - org.vivecraft.common.utils.math.Matrix4f matrix4f1 = new org.vivecraft.common.utils.math.Matrix4f(); - matrix4f1.M[0][0] = matrix4f.M[0][0]; - matrix4f1.M[0][1] = matrix4f.M[0][1]; - matrix4f1.M[0][2] = matrix4f.M[0][2]; - matrix4f1.M[0][3] = 0.0F; - matrix4f1.M[1][0] = matrix4f.M[1][0]; - matrix4f1.M[1][1] = matrix4f.M[1][1]; - matrix4f1.M[1][2] = matrix4f.M[1][2]; - matrix4f1.M[1][3] = 0.0F; - matrix4f1.M[2][0] = matrix4f.M[2][0]; - matrix4f1.M[2][1] = matrix4f.M[2][1]; - matrix4f1.M[2][2] = matrix4f.M[2][2]; - matrix4f1.M[2][3] = 0.0F; - matrix4f1.M[3][0] = 0.0F; - matrix4f1.M[3][1] = 0.0F; - matrix4f1.M[3][2] = 0.0F; - matrix4f1.M[3][3] = 1.0F; - return org.vivecraft.common.utils.math.Matrix4f.multiply(this.hmdRotation, matrix4f1); - } - else - { - return this.hmdRotation; - } + return this.hmdRotation.mul0(new Matrix4f().set3x3(matrix4f), matrix4f); } public VRInputAction getInputAction(String keyBindingDesc) @@ -363,10 +323,7 @@ public VRInputAction getInputAction(KeyMapping keyBinding) public Collection getInputActionsInSet(VRInputActionSet set) { - return Collections.unmodifiableCollection(this.inputActions.values().stream().filter((action) -> - { - return action.actionSet == set; - }).collect(Collectors.toList())); + return this.inputActions.values().stream().filter((action) -> action.actionSet == set).toList(); } public boolean isControllerTracking(ControllerType controller) @@ -379,15 +336,27 @@ public boolean isControllerTracking(int controller) return this.controllerTracking[controller]; } + public int getControllerSkeletalTrackingLevel(int controller) { + return this.controllerSkeletalInputTrackingLevel[controller]; + } + + public ArrayList[] getGestureFingerSplay(){ + return this.gestureFingerSplay; + } + + public ArrayList[] getGestureFingerCurl(){ + return this.gestureFingerCurl; + } + public void resetPosition() { - Vec3 vec3 = this.getCenterEyePosition().scale(-1.0D).add((double)this.dh.vrSettings.originOffset.getX(), (double)this.dh.vrSettings.originOffset.getY(), (double)this.dh.vrSettings.originOffset.getZ()); - this.dh.vrSettings.originOffset = new Vector3((float)vec3.x, (float)vec3.y + 1.62F, (float)vec3.z); + Vec3 vec3 = this.getCenterEyePosition().scale(-1.0D).add((double)dh.vrSettings.originOffset.x, (double)dh.vrSettings.originOffset.y, (double)dh.vrSettings.originOffset.z); + dh.vrSettings.originOffset = new Vector3f((float)vec3.x, (float)vec3.y + 1.62F, (float)vec3.z); } public void clearOffset() { - this.dh.vrSettings.originOffset = new Vector3(0.0F, 0.0F, 0.0F); + dh.vrSettings.originOffset = new Vector3f(0.0F, 0.0F, 0.0F); } public boolean isHMDTracking() @@ -397,29 +366,26 @@ public boolean isHMDTracking() protected void processHotbar() { - int previousSlot = this.dh.interactTracker.hotbar; - this.dh.interactTracker.hotbar = -1; + int previousSlot = dh.interactTracker.hotbar; + dh.interactTracker.hotbar = -1; if(mc.player == null) return; if(mc.player.getInventory() == null) return; - if(dh.climbTracker.isGrabbingLadder() && - dh.climbTracker.isClaws(mc.player.getMainHandItem())) return; - if(!dh.interactTracker.isActive(mc.player)) return; + if(dh.climbTracker.isGrabbingLadder() && dh.climbTracker.isClaws(mc.player.getMainHandItem())) return; + if(!dh.interactTracker.isActive()) return; Vec3 main = this.getAimSource(0); Vec3 off = this.getAimSource(1); - Vec3 barStartos = null, barEndos = null; - - int i = 1; - if (this.dh.vrSettings.reverseHands) - i = -1; - - if (this.dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.WRIST) { - barStartos = this.getAimRotation(1).transform(new Vector3((float)i * 0.02F, 0.05F, 0.26F)).toVector3d(); - barEndos = this.getAimRotation(1).transform(new Vector3((float)i * 0.02F, 0.05F, 0.01F)).toVector3d(); - } else if (this.dh.vrSettings.vrHudLockMode == VRSettings.HUDLock.HAND) { - barStartos = this.getAimRotation(1).transform(new Vector3((float)i * -0.18F, 0.08F, -0.01F)).toVector3d(); - barEndos = this.getAimRotation(1).transform(new Vector3((float)i * 0.19F, 0.04F, -0.08F)).toVector3d(); + Vec3 barStartos, barEndos; + + int i = dh.vrSettings.reverseHands ? 0 : 1; + + if (dh.vrSettings.vrHudLockMode == HUDLock.WRIST) { + barStartos = convertToVec3(new Vector3f((float)i * 0.02F, 0.05F, 0.26F).mulProject(this.getAimRotation(1))); + barEndos = convertToVec3(new Vector3f((float)i * 0.02F, 0.05F, 0.01F).mulProject(this.getAimRotation(1))); + } else if (dh.vrSettings.vrHudLockMode == HUDLock.HAND) { + barStartos = convertToVec3(new Vector3f((float)i * -0.18F, 0.08F, -0.01F).mulProject(this.getAimRotation(1))); + barEndos = convertToVec3(new Vector3f((float)i * 0.19F, 0.04F, -0.08F).mulProject(this.getAimRotation(1))); } else return; //how did u get here @@ -446,7 +412,7 @@ protected void processHotbar() if(dh.vrSettings.reverseHands) pos = 9 - pos; - int box = (int) Math.floor(pos); + int box = (int) floor(pos); if(box > 8) return; if(box < 0) { @@ -464,10 +430,10 @@ protected void processHotbar() protected KeyMapping findKeyBinding(String name) { - return Stream.concat(Arrays.stream(this.mc.options.keyMappings), mod.getHiddenKeyBindings().stream()).filter((kb) -> + return Stream.concat(Arrays.stream(mc.options.keyMappings), VivecraftVRMod.hiddenKeyBindingSet.stream()).filter((kb) -> { return name.equals(kb.getName()); - }).findFirst().orElse((KeyMapping)null); + }).findFirst().orElse(null); } protected void hmdSampling() @@ -482,7 +448,7 @@ protected void hmdSampling() this.hmdYawSamples.removeFirst(); } - float f = this.dh.vrPlayer.vrdata_room_pre.hmd.getYaw(); + float f = dh.vrPlayer.vrdata_room_pre.hmd.getYaw(); if (f < 0.0F) { @@ -492,13 +458,13 @@ protected void hmdSampling() this.hmdYawTotal += Utils.angleDiff(f, this.hmdYawLast); this.hmdYawLast = f; - if (Math.abs(Utils.angleNormalize(this.hmdYawTotal) - this.hmdYawLast) > 1.0F || this.hmdYawTotal > 100000.0F) + if (abs(Utils.angleNormalize(this.hmdYawTotal) - this.hmdYawLast) > 1.0F || this.hmdYawTotal > 100000.0F) { this.hmdYawTotal = this.hmdYawLast; - System.out.println("HMD yaw desync/overflow corrected"); + logger.warn("HMD yaw desync/overflow corrected"); } - this.hmdPosSamples.add(this.dh.vrPlayer.vrdata_room_pre.hmd.getPosition()); + this.hmdPosSamples.add(dh.vrPlayer.vrdata_room_pre.hmd.getPosition()); float f1 = 0.0F; if (this.hmdYawSamples.size() > 0) @@ -511,12 +477,12 @@ protected void hmdSampling() f1 /= (float)this.hmdYawSamples.size(); } - if (Math.abs(this.hmdYawTotal - f1) > 20.0F) + if (abs(this.hmdYawTotal - f1) > 20.0F) { this.trigger = true; } - if (Math.abs(this.hmdYawTotal - f1) < 1.0F) + if (abs(this.hmdYawTotal - f1) < 1.0F) { this.trigger = false; } @@ -532,322 +498,216 @@ protected void updateAim() RenderPassManager.setGUIRenderPass(); - if (this.mc != null) + this.hmdRotation.identity(); + this.hmdRotation.set3x3(this.hmdPose); + Vec3 vec3 = this.getCenterEyePosition(); + this.hmdHistory.add(vec3); + Vector3f vector3 = new Vector3f(0.0F, -0.1F, 0.1F).mulProject(this.hmdRotation); + this.hmdPivotHistory.add(vector3.x + vec3.x, vector3.y + vec3.y, vector3.z + vec3.z); + + if (dh.vrSettings.seated) { - this.hmdRotation.M[0][0] = this.hmdPose.M[0][0]; - this.hmdRotation.M[0][1] = this.hmdPose.M[0][1]; - this.hmdRotation.M[0][2] = this.hmdPose.M[0][2]; - this.hmdRotation.M[0][3] = 0.0F; - this.hmdRotation.M[1][0] = this.hmdPose.M[1][0]; - this.hmdRotation.M[1][1] = this.hmdPose.M[1][1]; - this.hmdRotation.M[1][2] = this.hmdPose.M[1][2]; - this.hmdRotation.M[1][3] = 0.0F; - this.hmdRotation.M[2][0] = this.hmdPose.M[2][0]; - this.hmdRotation.M[2][1] = this.hmdPose.M[2][1]; - this.hmdRotation.M[2][2] = this.hmdPose.M[2][2]; - this.hmdRotation.M[2][3] = 0.0F; - this.hmdRotation.M[3][0] = 0.0F; - this.hmdRotation.M[3][1] = 0.0F; - this.hmdRotation.M[3][2] = 0.0F; - this.hmdRotation.M[3][3] = 1.0F; - Vec3 vec3 = this.getCenterEyePosition(); - this.hmdHistory.add(vec3); - Vector3 vector3 = this.hmdRotation.transform(new Vector3(0.0F, -0.1F, 0.1F)); - this.hmdPivotHistory.add(new Vec3((double)vector3.getX() + vec3.x, (double)vector3.getY() + vec3.y, (double)vector3.getZ() + vec3.z)); - - if (this.dh.vrSettings.seated) - { - this.controllerPose[0] = this.hmdPose.inverted().inverted(); - this.controllerPose[1] = this.hmdPose.inverted().inverted(); - } + this.controllerPose[0] = this.hmdPose.invert(new Matrix4f()).invert(new Matrix4f()); + this.controllerPose[1] = this.hmdPose.invert(new Matrix4f()).invert(new Matrix4f()); + } - org.vivecraft.common.utils.math.Matrix4f[] amatrix4f = new org.vivecraft.common.utils.math.Matrix4f[] {new org.vivecraft.common.utils.math.Matrix4f(), new org.vivecraft.common.utils.math.Matrix4f()}; - org.vivecraft.common.utils.math.Matrix4f[] amatrix4f1 = new org.vivecraft.common.utils.math.Matrix4f[] {new org.vivecraft.common.utils.math.Matrix4f(), new org.vivecraft.common.utils.math.Matrix4f()}; + Matrix4f[] amatrix4f = new Matrix4f[] {new Matrix4f(), new Matrix4f()}; + Matrix4f[] amatrix4f1 = new Matrix4f[] {new Matrix4f(), new Matrix4f()}; - if (this.dh.vrSettings.seated) - { - amatrix4f1[0] = this.controllerPose[0]; - } - else - { - amatrix4f1[0] = org.vivecraft.common.utils.math.Matrix4f.multiply(this.controllerPose[0], this.getControllerComponentTransform(0, "handgrip")); - } + if (dh.vrSettings.seated) + { + amatrix4f1[0].set(this.controllerPose[0]); + } + else + { + this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "handgrip"), amatrix4f1[0]); + } - this.handRotation[0].M[0][0] = amatrix4f1[0].M[0][0]; - this.handRotation[0].M[0][1] = amatrix4f1[0].M[0][1]; - this.handRotation[0].M[0][2] = amatrix4f1[0].M[0][2]; - this.handRotation[0].M[0][3] = 0.0F; - this.handRotation[0].M[1][0] = amatrix4f1[0].M[1][0]; - this.handRotation[0].M[1][1] = amatrix4f1[0].M[1][1]; - this.handRotation[0].M[1][2] = amatrix4f1[0].M[1][2]; - this.handRotation[0].M[1][3] = 0.0F; - this.handRotation[0].M[2][0] = amatrix4f1[0].M[2][0]; - this.handRotation[0].M[2][1] = amatrix4f1[0].M[2][1]; - this.handRotation[0].M[2][2] = amatrix4f1[0].M[2][2]; - this.handRotation[0].M[2][3] = 0.0F; - this.handRotation[0].M[3][0] = 0.0F; - this.handRotation[0].M[3][1] = 0.0F; - this.handRotation[0].M[3][2] = 0.0F; - this.handRotation[0].M[3][3] = 1.0F; - - if (this.dh.vrSettings.seated) - { - amatrix4f[0] = this.controllerPose[0]; - } - else + this.handRotation[0].identity(); + this.handRotation[0].set3x3(amatrix4f1[0]); + + if (dh.vrSettings.seated) + { + amatrix4f[0].set(this.controllerPose[0]); + } + else + { + this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "tip"), amatrix4f[0]); + } + + Vector3f vector31 = amatrix4f[0].getTranslation(new Vector3f()); + this.aimSource[0] = convertToVec3(vector31); + this.controllerHistory[0].add(this.getAimSource(0)); + this.controllerRotation[0].identity(); + this.controllerRotation[0].set3x3(amatrix4f[0]); + Vec3 vec31 = this.getHmdVector(); + + if (dh.vrSettings.seated && mc.screen == null) + { + Matrix4f matrix4f = new Matrix4f(); + float f = 110.0F; + float f1 = 180.0F; + double d0 = mc.mouseHandler.xpos() / (double)mc.getWindow().getScreenWidth() * (double)f - (double)(f / 2.0F); + int i = mc.getWindow().getScreenHeight(); + + if (i % 2 != 0) { - amatrix4f[0] = org.vivecraft.common.utils.math.Matrix4f.multiply(this.controllerPose[0], this.getControllerComponentTransform(0, "tip")); + --i; } - Vector3 vector31 = Utils.convertMatrix4ftoTranslationVector(amatrix4f[0]); - this.aimSource[0] = vector31.toVector3d(); - this.controllerHistory[0].add(this.getAimSource(0)); - this.controllerRotation[0].M[0][0] = amatrix4f[0].M[0][0]; - this.controllerRotation[0].M[0][1] = amatrix4f[0].M[0][1]; - this.controllerRotation[0].M[0][2] = amatrix4f[0].M[0][2]; - this.controllerRotation[0].M[0][3] = 0.0F; - this.controllerRotation[0].M[1][0] = amatrix4f[0].M[1][0]; - this.controllerRotation[0].M[1][1] = amatrix4f[0].M[1][1]; - this.controllerRotation[0].M[1][2] = amatrix4f[0].M[1][2]; - this.controllerRotation[0].M[1][3] = 0.0F; - this.controllerRotation[0].M[2][0] = amatrix4f[0].M[2][0]; - this.controllerRotation[0].M[2][1] = amatrix4f[0].M[2][1]; - this.controllerRotation[0].M[2][2] = amatrix4f[0].M[2][2]; - this.controllerRotation[0].M[2][3] = 0.0F; - this.controllerRotation[0].M[3][0] = 0.0F; - this.controllerRotation[0].M[3][1] = 0.0F; - this.controllerRotation[0].M[3][2] = 0.0F; - this.controllerRotation[0].M[3][3] = 1.0F; - Vec3 vec31 = this.getHmdVector(); - - if (this.dh.vrSettings.seated && this.mc.screen == null) - { - Matrix4f matrix4f = new Matrix4f(); - float f = 110.0F; - float f1 = 180.0F; - double d0 = this.mc.mouseHandler.xpos() / (double)this.mc.getWindow().getScreenWidth() * (double)f - (double)(f / 2.0F); - int i = this.mc.getWindow().getScreenHeight(); + double d1 = -mc.mouseHandler.ypos() / (double)i * (double)f1 + (double)(f1 / 2.0F); + double d2 = -d1; - if (i % 2 != 0) + if (mc.isWindowActive()) + { + float f2 = dh.vrSettings.keyholeX; + float f3 = 20.0F * dh.vrSettings.xSensitivity; + int j = (int)((double)(-f2 + f / 2.0F) * (double)mc.getWindow().getScreenWidth() / (double)f) + 1; + int k = (int)((double)(f2 + f / 2.0F) * (double)mc.getWindow().getScreenWidth() / (double)f) - 1; + float f4 = ((float)abs(d0) - f2) / (f / 2.0F - f2); + double d3 = mc.mouseHandler.xpos(); + + if (d0 < (double)(-f2)) { - --i; + this.seatedRot += f3 * f4; + this.seatedRot %= 360.0F; + this.hmdForwardYaw = (float)toDegrees(atan2(vec31.x, vec31.z)); + d3 = (double)j; + d0 = (double)(-f2); } - - double d1 = -this.mc.mouseHandler.ypos() / (double)i * (double)f1 + (double)(f1 / 2.0F); - double d2 = -d1; - - if (this.mc.isWindowActive()) + else if (d0 > (double)f2) { - float f2 = this.dh.vrSettings.keyholeX; - float f3 = 20.0F * this.dh.vrSettings.xSensitivity; - int j = (int)((double)(-f2 + f / 2.0F) * (double)this.mc.getWindow().getScreenWidth() / (double)f) + 1; - int k = (int)((double)(f2 + f / 2.0F) * (double)this.mc.getWindow().getScreenWidth() / (double)f) - 1; - float f4 = ((float)Math.abs(d0) - f2) / (f / 2.0F - f2); - double d3 = this.mc.mouseHandler.xpos(); - - if (d0 < (double)(-f2)) - { - this.seatedRot += f3 * f4; - this.seatedRot %= 360.0F; - this.hmdForwardYaw = (float)Math.toDegrees(Math.atan2(vec31.x, vec31.z)); - d3 = (double)j; - d0 = (double)(-f2); - } - else if (d0 > (double)f2) - { - this.seatedRot -= f3 * f4; - this.seatedRot %= 360.0F; - this.hmdForwardYaw = (float)Math.toDegrees(Math.atan2(vec31.x, vec31.z)); - d3 = (double)k; - d0 = (double)f2; - } - - double d4 = 0.5D * (double)this.dh.vrSettings.ySensitivity; - d2 = (double)this.aimPitch + d1 * d4; - d2 = Mth.clamp(d2, -89.9D, 89.9D); - InputSimulator.setMousePos(d3, (double)(i / 2)); - GLFW.glfwSetCursorPos(this.mc.getWindow().getWindow(), d3, (double)(i / 2)); - matrix4f.rotate((float)Math.toRadians(-d2), new Vector3f(1.0F, 0.0F, 0.0F)); - matrix4f.rotate((float)Math.toRadians(-180.0D + d0 - (double)this.hmdForwardYaw), new Vector3f(0.0F, 1.0F, 0.0F)); + this.seatedRot -= f3 * f4; + this.seatedRot %= 360.0F; + this.hmdForwardYaw = (float)toDegrees(atan2(vec31.x, vec31.z)); + d3 = (double)k; + d0 = (double)f2; } - this.controllerRotation[0].M[0][0] = matrix4f.m00; - this.controllerRotation[0].M[0][1] = matrix4f.m01; - this.controllerRotation[0].M[0][2] = matrix4f.m02; - this.controllerRotation[0].M[1][0] = matrix4f.m10; - this.controllerRotation[0].M[1][1] = matrix4f.m11; - this.controllerRotation[0].M[1][2] = matrix4f.m12; - this.controllerRotation[0].M[2][0] = matrix4f.m20; - this.controllerRotation[0].M[2][1] = matrix4f.m21; - this.controllerRotation[0].M[2][2] = matrix4f.m22; - - this.handRotation[0].M[0][0] = matrix4f.m00; - this.handRotation[0].M[0][1] = matrix4f.m01; - this.handRotation[0].M[0][2] = matrix4f.m02; - this.handRotation[0].M[1][0] = matrix4f.m10; - this.handRotation[0].M[1][1] = matrix4f.m11; - this.handRotation[0].M[1][2] = matrix4f.m12; - this.handRotation[0].M[2][0] = matrix4f.m20; - this.handRotation[0].M[2][1] = matrix4f.m21; - this.handRotation[0].M[2][2] = matrix4f.m22; + double d4 = 0.5D * (double)dh.vrSettings.ySensitivity; + d2 = (double)this.aimPitch + d1 * d4; + d2 = clamp(-89.9D, 89.9D, d2); + InputSimulator.setMousePos(d3, (double)(i / 2)); + glfwSetCursorPos(mc.getWindow().getWindow(), d3, (double)(i / 2)); + matrix4f.rotateX((float)toRadians(-d2)); + matrix4f.rotateY((float)toRadians(-180.0D + d0 - (double)this.hmdForwardYaw)); } - Vec3 vec32 = this.getAimVector(0); - this.aimPitch = (float)Math.toDegrees(Math.asin(vec32.y / vec32.length())); - this.controllerForwardHistory[0].add(vec32); - Vec3 vec33 = this.controllerRotation[0].transform(this.up).toVector3d(); - this.controllerUpHistory[0].add(vec33); + this.controllerRotation[0].set3x3(new Matrix4f(matrix4f)); - if (this.dh.vrSettings.seated) - { - amatrix4f1[1] = this.controllerPose[1]; - } - else - { - amatrix4f1[1] = org.vivecraft.common.utils.math.Matrix4f.multiply(this.controllerPose[1], this.getControllerComponentTransform(1, "handgrip")); - } + this.handRotation[0].set3x3(new Matrix4f(matrix4f)); + } - this.handRotation[1].M[0][0] = amatrix4f1[1].M[0][0]; - this.handRotation[1].M[0][1] = amatrix4f1[1].M[0][1]; - this.handRotation[1].M[0][2] = amatrix4f1[1].M[0][2]; - this.handRotation[1].M[0][3] = 0.0F; - this.handRotation[1].M[1][0] = amatrix4f1[1].M[1][0]; - this.handRotation[1].M[1][1] = amatrix4f1[1].M[1][1]; - this.handRotation[1].M[1][2] = amatrix4f1[1].M[1][2]; - this.handRotation[1].M[1][3] = 0.0F; - this.handRotation[1].M[2][0] = amatrix4f1[1].M[2][0]; - this.handRotation[1].M[2][1] = amatrix4f1[1].M[2][1]; - this.handRotation[1].M[2][2] = amatrix4f1[1].M[2][2]; - this.handRotation[1].M[2][3] = 0.0F; - this.handRotation[1].M[3][0] = 0.0F; - this.handRotation[1].M[3][1] = 0.0F; - this.handRotation[1].M[3][2] = 0.0F; - this.handRotation[1].M[3][3] = 1.0F; - - if (this.dh.vrSettings.seated) - { - amatrix4f[1] = this.controllerPose[1]; - } - else - { - amatrix4f[1] = org.vivecraft.common.utils.math.Matrix4f.multiply(this.controllerPose[1], this.getControllerComponentTransform(1, "tip")); - } + Vec3 vec32 = this.getAimVector(0); + this.aimPitch = (float)toDegrees(asin(vec32.y / vec32.length())); + this.controllerForwardHistory[0].add(vec32); + this.controllerUpHistory[0].add(convertToVec3(new Vector3f(up).mulProject(this.controllerRotation[0]))); - vector31 = Utils.convertMatrix4ftoTranslationVector(amatrix4f[1]); - this.aimSource[1] = vector31.toVector3d(); - this.controllerHistory[1].add(this.getAimSource(1)); - this.controllerRotation[1].M[0][0] = amatrix4f[1].M[0][0]; - this.controllerRotation[1].M[0][1] = amatrix4f[1].M[0][1]; - this.controllerRotation[1].M[0][2] = amatrix4f[1].M[0][2]; - this.controllerRotation[1].M[0][3] = 0.0F; - this.controllerRotation[1].M[1][0] = amatrix4f[1].M[1][0]; - this.controllerRotation[1].M[1][1] = amatrix4f[1].M[1][1]; - this.controllerRotation[1].M[1][2] = amatrix4f[1].M[1][2]; - this.controllerRotation[1].M[1][3] = 0.0F; - this.controllerRotation[1].M[2][0] = amatrix4f[1].M[2][0]; - this.controllerRotation[1].M[2][1] = amatrix4f[1].M[2][1]; - this.controllerRotation[1].M[2][2] = amatrix4f[1].M[2][2]; - this.controllerRotation[1].M[2][3] = 0.0F; - this.controllerRotation[1].M[3][0] = 0.0F; - this.controllerRotation[1].M[3][1] = 0.0F; - this.controllerRotation[1].M[3][2] = 0.0F; - this.controllerRotation[1].M[3][3] = 1.0F; - vec31 = this.getAimVector(1); - this.controllerForwardHistory[1].add(vec31); - vec32 = this.controllerRotation[1].transform(this.up).toVector3d(); - this.controllerUpHistory[1].add(vec32); - - if (this.dh.vrSettings.seated) - { - this.aimSource[1] = this.getCenterEyePosition(); - this.aimSource[0] = this.getCenterEyePosition(); - } + if (dh.vrSettings.seated) + { + amatrix4f1[1].set(this.controllerPose[1]); + } + else + { + this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "handgrip"), amatrix4f1[1]); + } - boolean flag = false; + this.handRotation[1].identity(); + this.handRotation[1].set3x3(amatrix4f1[1]); - if (flag) - { - this.controllerPose[2] = this.controllerPose[0]; - } + if (dh.vrSettings.seated) + { + amatrix4f[1].set(this.controllerPose[1]); + } + else + { + this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "tip"), amatrix4f[1]); + } - this.controllerRotation[2].M[0][0] = this.controllerPose[2].M[0][0]; - this.controllerRotation[2].M[0][1] = this.controllerPose[2].M[0][1]; - this.controllerRotation[2].M[0][2] = this.controllerPose[2].M[0][2]; - this.controllerRotation[2].M[0][3] = 0.0F; - this.controllerRotation[2].M[1][0] = this.controllerPose[2].M[1][0]; - this.controllerRotation[2].M[1][1] = this.controllerPose[2].M[1][1]; - this.controllerRotation[2].M[1][2] = this.controllerPose[2].M[1][2]; - this.controllerRotation[2].M[1][3] = 0.0F; - this.controllerRotation[2].M[2][0] = this.controllerPose[2].M[2][0]; - this.controllerRotation[2].M[2][1] = this.controllerPose[2].M[2][1]; - this.controllerRotation[2].M[2][2] = this.controllerPose[2].M[2][2]; - this.controllerRotation[2].M[2][3] = 0.0F; - this.controllerRotation[2].M[3][0] = 0.0F; - this.controllerRotation[2].M[3][1] = 0.0F; - this.controllerRotation[2].M[3][2] = 0.0F; - this.controllerRotation[2].M[3][3] = 1.0F; - - if ((!this.hasThirdController() || this.dh.vrSettings.displayMirrorMode != VRSettings.MirrorMode.MIXED_REALITY && this.dh.vrSettings.displayMirrorMode != VRSettings.MirrorMode.THIRD_PERSON) && !flag) - { - this.mrMovingCamActive = false; - this.aimSource[2] = new Vec3((double)this.dh.vrSettings.vrFixedCamposX, (double)this.dh.vrSettings.vrFixedCamposY, (double)this.dh.vrSettings.vrFixedCamposZ); - } - else - { - this.mrMovingCamActive = true; - Vector3 vector32 = Utils.convertMatrix4ftoTranslationVector(this.controllerPose[2]); - this.aimSource[2] = vector32.toVector3d(); - } + vector31 = amatrix4f[1].getTranslation(new Vector3f()); + this.aimSource[1] = convertToVec3(vector31); + this.controllerHistory[1].add(this.getAimSource(1)); + this.controllerRotation[1].identity(); + this.controllerRotation[1].set3x3(amatrix4f[1]); + this.controllerForwardHistory[1].add(this.getAimVector(1)); + this.controllerUpHistory[1].add(convertToVec3(new Vector3f(up).mulProject(this.controllerRotation[1]))); + + if (dh.vrSettings.seated) + { + this.aimSource[1] = this.getCenterEyePosition(); + this.aimSource[0] = this.getCenterEyePosition(); } + +// boolean flag = false; +// +// if (flag) +// { +// this.controllerPose[2] = this.controllerPose[0]; +// } +// +// this.controllerRotation[2].identity(); +// this.controllerRotation[2].set3x3(this.controllerPose[2]); +// +// if ((!this.hasThirdController() || dh.vrSettings.displayMirrorMode != MirrorMode.MIXED_REALITY && dh.vrSettings.displayMirrorMode != MirrorMode.THIRD_PERSON) && !flag) +// { +// this.mrMovingCamActive = false; +// this.aimSource[2] = new Vec3(dh.vrSettings.vrFixedCamposX, dh.vrSettings.vrFixedCamposY, dh.vrSettings.vrFixedCamposZ); +// } +// else +// { +// this.mrMovingCamActive = true; +// Vector3f vector32 = this.controllerPose[2].getTranslation(new Vector3f()); +// this.aimSource[2] = convertToVec3(vector32); +// } } public void processBindings() { if (!this.inputActions.isEmpty()) { - boolean flag = this.mc.level != null && this.mc.player != null && this.mc.player.isSleeping(); - boolean flag1 = this.mc.screen != null; - boolean flag2 = mod.keyToggleMovement.consumeClick(); + boolean sleeping = mc.level != null && mc.player != null && mc.player.isSleeping(); + boolean gui = mc.screen != null; + boolean toggleMovementPressed = VivecraftVRMod.keyToggleMovement.consumeClick(); - if (!this.mc.options.keyPickItem.isDown() && !flag2) + if (!mc.options.keyPickItem.isDown() && !toggleMovementPressed) { this.moveModeSwitchCount = 0; } - else if (++this.moveModeSwitchCount == 80 || flag2) + else if (++this.moveModeSwitchCount == 80 || toggleMovementPressed) { - if (this.dh.vrSettings.seated) + if (dh.vrSettings.seated) { - this.dh.vrSettings.seatedFreeMove = !this.dh.vrSettings.seatedFreeMove; - this.mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.movementmodeswitch", this.dh.vrSettings.seatedFreeMove ? Component.translatable("vivecraft.options.freemove") : Component.translatable("vivecraft.options.teleport"))); + dh.vrSettings.seatedFreeMove = !dh.vrSettings.seatedFreeMove; + message(Component.translatable("vivecraft.messages.movementmodeswitch", dh.vrSettings.seatedFreeMove ? Component.translatable("vivecraft.options.freemove") : Component.translatable("vivecraft.options.teleport"))); } - else if (this.dh.vrPlayer.isTeleportSupported()) + else if (dh.vrPlayer.isTeleportSupported()) { - this.dh.vrSettings.forceStandingFreeMove = !this.dh.vrSettings.forceStandingFreeMove; - this.mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.movementmodeswitch", this.dh.vrSettings.seatedFreeMove ? Component.translatable("vivecraft.options.freemove") : Component.translatable("vivecraft.options.teleport"))); + dh.vrSettings.forceStandingFreeMove = !dh.vrSettings.forceStandingFreeMove; + message(Component.translatable("vivecraft.messages.movementmodeswitch", dh.vrSettings.seatedFreeMove ? Component.translatable("vivecraft.options.freemove") : Component.translatable("vivecraft.options.teleport"))); } - else if (this.dh.vrPlayer.isTeleportOverridden()) + else if (dh.vrPlayer.isTeleportOverridden()) { - this.dh.vrPlayer.setTeleportOverride(false); - this.mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.teleportdisabled")); + dh.vrPlayer.setTeleportOverride(false); + message(Component.translatable("vivecraft.messages.teleportdisabled")); } else { - this.dh.vrPlayer.setTeleportOverride(true); - this.mc.gui.getChat().addMessage(Component.translatable("vivecraft.messages.teleportenabled")); + dh.vrPlayer.setTeleportOverride(true); + message(Component.translatable("vivecraft.messages.teleportenabled")); } } Vec3 vec3 = this.getAimVector(0); Vec3 vec31 = this.getAimVector(1); - float f = (float)Math.toDegrees(Math.atan2(-vec3.x, vec3.z)); - float f1 = (float)Math.toDegrees(Math.atan2(-vec31.x, vec31.z)); + float f = (float)toDegrees(atan2(-vec3.x, vec3.z)); + float f1 = (float)toDegrees(atan2(-vec31.x, vec31.z)); - if (!flag1) + if (!gui) { - if (mod.keyWalkabout.isDown()) + if (VivecraftVRMod.keyWalkabout.isDown()) { float f2 = f; - ControllerType controllertype = this.findActiveBindingControllerType(mod.keyWalkabout); + ControllerType controllertype = this.findActiveBindingControllerType(VivecraftVRMod.keyWalkabout); if (controllertype != null && controllertype == ControllerType.LEFT) { @@ -857,12 +717,12 @@ else if (this.dh.vrPlayer.isTeleportOverridden()) if (!this.isWalkingAbout) { this.isWalkingAbout = true; - this.walkaboutYawStart = this.dh.vrSettings.worldRotation - f2; + this.walkaboutYawStart = dh.vrSettings.worldRotation - f2; } else { - this.dh.vrSettings.worldRotation = this.walkaboutYawStart + f2; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation = this.walkaboutYawStart + f2; + dh.vrSettings.worldRotation %= 360.0F; } } else @@ -870,12 +730,13 @@ else if (this.dh.vrPlayer.isTeleportOverridden()) this.isWalkingAbout = false; } - if (mod.keyRotateFree.isDown()) + if (VivecraftVRMod.keyRotateFree.isDown()) { float f3 = f; - ControllerType controllertype5 = this.findActiveBindingControllerType(mod.keyRotateFree); + //oh this is ugly. TODO: cache which hand when binding button. + ControllerType controller = this.findActiveBindingControllerType(VivecraftVRMod.keyRotateFree); - if (controllertype5 != null && controllertype5 == ControllerType.LEFT) + if (controller == ControllerType.LEFT) { f3 = f1; } @@ -883,11 +744,11 @@ else if (this.dh.vrPlayer.isTeleportOverridden()) if (!this.isFreeRotate) { this.isFreeRotate = true; - this.walkaboutYawStart = this.dh.vrSettings.worldRotation + f3; + this.walkaboutYawStart = dh.vrSettings.worldRotation + f3; } else { - this.dh.vrSettings.worldRotation = this.walkaboutYawStart - f3; + dh.vrSettings.worldRotation = this.walkaboutYawStart - f3; } } else @@ -896,86 +757,87 @@ else if (this.dh.vrPlayer.isTeleportOverridden()) } } - if (mod.keyHotbarNext.consumeClick()) + if (VivecraftVRMod.keyHotbarNext.consumeClick()) { this.changeHotbar(-1); - this.triggerBindingHapticPulse(mod.keyHotbarNext, 250); + this.triggerBindingHapticPulse(VivecraftVRMod.keyHotbarNext, 250); } - if (mod.keyHotbarPrev.consumeClick()) + if (VivecraftVRMod.keyHotbarPrev.consumeClick()) { this.changeHotbar(1); - this.triggerBindingHapticPulse(mod.keyHotbarPrev, 250); + this.triggerBindingHapticPulse(VivecraftVRMod.keyHotbarPrev, 250); } - if (mod.keyQuickTorch.consumeClick() && this.mc.player != null) + if (VivecraftVRMod.keyQuickTorch.consumeClick() && mc.player != null && mc.screen == null) { - for (int j = 0; j < 9; ++j) + Inventory inv = mc.player.getInventory(); + for (byte torchSlot = 0; torchSlot < 9; ++torchSlot) { - ItemStack itemstack = this.mc.player.getInventory().getItem(j); + ItemStack itemstack = inv.getItem(torchSlot); - if (itemstack.getItem() instanceof BlockItem && ((BlockItem)itemstack.getItem()).getBlock() instanceof TorchBlock && this.mc.screen == null) + if (itemstack.getItem() instanceof BlockItem && ((BlockItem)itemstack.getItem()).getBlock() instanceof TorchBlock) { - this.quickTorchPreviousSlot = this.mc.player.getInventory().selected; - this.mc.player.getInventory().selected = j; - this.mc.startUseItem(); - this.mc.player.getInventory().selected = this.quickTorchPreviousSlot; - this.quickTorchPreviousSlot = -1; - break; + int previous = inv.selected; + inv.selected = torchSlot; + mc.startUseItem(); + // switch back immediately + inv.selected = previous; + torchSlot = Byte.MAX_VALUE - 1; } } } - if (flag1 && !flag && this.mc.options.keyUp.isDown() && !(this.mc.screen instanceof WinScreen) && this.mc.player != null) + if (gui && !sleeping && mc.options.keyUp.isDown() && !(mc.screen instanceof WinScreen) && mc.player != null) { - this.mc.player.closeContainer(); + mc.player.closeContainer(); } - if (this.mc.screen instanceof AbstractContainerScreen && this.mc.options.keyInventory.consumeClick() && this.mc.player != null) + if (mc.screen instanceof AbstractContainerScreen && mc.options.keyInventory.consumeClick() && mc.player != null) { - this.mc.player.closeContainer(); + mc.player.closeContainer(); } - if (this.mc.screen instanceof ChatScreen && this.mc.options.keyChat.consumeClick()) + if (mc.screen instanceof ChatScreen && mc.options.keyChat.consumeClick()) { - this.mc.setScreen((Screen)null); + mc.setScreen(null); } - if (this.dh.vrSettings.worldRotationIncrement == 0.0F) + if (dh.vrSettings.worldRotationIncrement == 0.0F) { - float f4 = this.getInputAction(mod.keyRotateAxis).getAxis2DUseTracked().getX(); + float f4 = this.getInputAction(VivecraftVRMod.keyRotateAxis).getAxis2DUseTracked().x(); if (f4 == 0.0F) { - f4 = this.getInputAction(mod.keyFreeMoveRotate).getAxis2DUseTracked().getX(); + f4 = this.getInputAction(VivecraftVRMod.keyFreeMoveRotate).getAxis2DUseTracked().x(); } if (f4 != 0.0F) { float f8 = 10.0F * f4; - this.dh.vrSettings.worldRotation -= f8; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation -= f8; + dh.vrSettings.worldRotation %= 360.0F; } } - else if (mod.keyRotateAxis.consumeClick() || mod.keyFreeMoveRotate.consumeClick()) + else if (VivecraftVRMod.keyRotateAxis.consumeClick() || VivecraftVRMod.keyFreeMoveRotate.consumeClick()) { - float f5 = this.getInputAction(mod.keyRotateAxis).getAxis2D(false).getX(); + float f5 = this.getInputAction(VivecraftVRMod.keyRotateAxis).getAxis2D(false).x(); if (f5 == 0.0F) { - f5 = this.getInputAction(mod.keyFreeMoveRotate).getAxis2D(false).getX(); + f5 = this.getInputAction(VivecraftVRMod.keyFreeMoveRotate).getAxis2D(false).x(); } - if (Math.abs(f5) > 0.5F) + if (abs(f5) > 0.5F) { - this.dh.vrSettings.worldRotation -= this.dh.vrSettings.worldRotationIncrement * Math.signum(f5); - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation -= dh.vrSettings.worldRotationIncrement * signum(f5); + dh.vrSettings.worldRotation %= 360.0F; } } - if (this.dh.vrSettings.worldRotationIncrement == 0.0F) + if (dh.vrSettings.worldRotationIncrement == 0.0F) { - float f6 = VivecraftMovementInput.getMovementAxisValue(mod.keyRotateLeft); + float f6 = VivecraftMovementInput.getMovementAxisValue(VivecraftVRMod.keyRotateLeft); if (f6 > 0.0F) { @@ -986,19 +848,19 @@ else if (mod.keyRotateAxis.consumeClick() || mod.keyFreeMoveRotate.consumeClick( f9 = 10.0F * f6; } - this.dh.vrSettings.worldRotation += f9; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation += f9; + dh.vrSettings.worldRotation %= 360.0F; } } - else if (mod.keyRotateLeft.consumeClick()) + else if (VivecraftVRMod.keyRotateLeft.consumeClick()) { - this.dh.vrSettings.worldRotation += this.dh.vrSettings.worldRotationIncrement; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation += dh.vrSettings.worldRotationIncrement; + dh.vrSettings.worldRotation %= 360.0F; } - if (this.dh.vrSettings.worldRotationIncrement == 0.0F) + if (dh.vrSettings.worldRotationIncrement == 0.0F) { - float f7 = VivecraftMovementInput.getMovementAxisValue(mod.keyRotateRight); + float f7 = VivecraftMovementInput.getMovementAxisValue(VivecraftVRMod.keyRotateRight); if (f7 > 0.0F) { @@ -1009,55 +871,55 @@ else if (mod.keyRotateLeft.consumeClick()) f10 = 10.0F * f7; } - this.dh.vrSettings.worldRotation -= f10; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation -= f10; + dh.vrSettings.worldRotation %= 360.0F; } } - else if (mod.keyRotateRight.consumeClick()) + else if (VivecraftVRMod.keyRotateRight.consumeClick()) { - this.dh.vrSettings.worldRotation -= this.dh.vrSettings.worldRotationIncrement; - this.dh.vrSettings.worldRotation %= 360.0F; + dh.vrSettings.worldRotation -= dh.vrSettings.worldRotationIncrement; + dh.vrSettings.worldRotation %= 360.0F; } - this.seatedRot = this.dh.vrSettings.worldRotation; + this.seatedRot = dh.vrSettings.worldRotation; - if (mod.keyRadialMenu.consumeClick() && !flag1) + if (VivecraftVRMod.keyRadialMenu.consumeClick() && !gui) { - ControllerType controllertype1 = this.findActiveBindingControllerType(mod.keyRadialMenu); + ControllerType controller = this.findActiveBindingControllerType(VivecraftVRMod.keyRadialMenu); - if (controllertype1 != null) + if (controller != null) { - RadialHandler.setOverlayShowing(!RadialHandler.isShowing(), controllertype1); + RadialHandler.setOverlayShowing(!RadialHandler.isShowing(), controller); } } - if (mod.keySwapMirrorView.consumeClick()) + if (VivecraftVRMod.keySwapMirrorView.consumeClick()) { - if (this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) + if (dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON) { - this.dh.vrSettings.displayMirrorMode = VRSettings.MirrorMode.FIRST_PERSON; + dh.vrSettings.displayMirrorMode = MirrorMode.FIRST_PERSON; } - else if (this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PERSON) + else if (dh.vrSettings.displayMirrorMode == MirrorMode.FIRST_PERSON) { - this.dh.vrSettings.displayMirrorMode = VRSettings.MirrorMode.THIRD_PERSON; + dh.vrSettings.displayMirrorMode = MirrorMode.THIRD_PERSON; } if (!ShadersHelper.isShaderActive()) { - this.dh.vrRenderer.reinitFrameBuffers("Mirror Setting Changed"); + dh.vrRenderer.reinitFrameBuffers("Mirror Setting Changed"); } else { // in case if the last third person mirror was mixed reality - this.dh.vrRenderer.resizeFrameBuffers("Mirror Setting Changed"); + dh.vrRenderer.resizeFrameBuffers("Mirror Setting Changed"); } } - if (mod.keyToggleKeyboard.consumeClick()) + if (VivecraftVRMod.keyToggleKeyboard.consumeClick()) { - KeyboardHandler.setOverlayShowing(!KeyboardHandler.Showing); + KeyboardHandler.setOverlayShowing(!KeyboardHandler.isShowing()); } - if (mod.keyMoveThirdPersonCam.consumeClick() && !ClientDataHolderVR.kiosk && !this.dh.vrSettings.seated && (this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY || this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON)) + if (VivecraftVRMod.keyMoveThirdPersonCam.consumeClick() && !dh.kiosk && !dh.vrSettings.seated && (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY || dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON)) { - ControllerType controllertype2 = this.findActiveBindingControllerType(mod.keyMoveThirdPersonCam); + ControllerType controllertype2 = this.findActiveBindingControllerType(VivecraftVRMod.keyMoveThirdPersonCam); if (controllertype2 != null) { @@ -1065,123 +927,123 @@ else if (this.dh.vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PER } } - if (!mod.keyMoveThirdPersonCam.isDown() && VRHotkeys.isMovingThirdPersonCam() && VRHotkeys.getMovingThirdPersonCamTriggerer() == VRHotkeys.Triggerer.BINDING) + if (!VivecraftVRMod.keyMoveThirdPersonCam.isDown() && VRHotkeys.isMovingThirdPersonCam() && VRHotkeys.getMovingThirdPersonCamTriggerer() == Triggerer.BINDING) { VRHotkeys.stopMovingThirdPersonCam(); - this.dh.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } - if (VRHotkeys.isMovingThirdPersonCam() && VRHotkeys.getMovingThirdPersonCamTriggerer() == VRHotkeys.Triggerer.MENUBUTTON && mod.keyMenuButton.consumeClick()) + if (VRHotkeys.isMovingThirdPersonCam() && VRHotkeys.getMovingThirdPersonCamTriggerer() == VRHotkeys.Triggerer.MENUBUTTON && VivecraftVRMod.keyMenuButton.consumeClick()) { VRHotkeys.stopMovingThirdPersonCam(); - this.dh.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } - if (KeyboardHandler.Showing && this.mc.screen == null && mod.keyMenuButton.consumeClick()) + if (KeyboardHandler.isShowing() && mc.screen == null && VivecraftVRMod.keyMenuButton.consumeClick()) { KeyboardHandler.setOverlayShowing(false); } - if (RadialHandler.isShowing() && mod.keyMenuButton.consumeClick()) + if (RadialHandler.isShowing() && VivecraftVRMod.keyMenuButton.consumeClick()) { RadialHandler.setOverlayShowing(false, (ControllerType)null); } - if (mod.keyMenuButton.consumeClick()) + if (VivecraftVRMod.keyMenuButton.consumeClick()) { - if (!flag1) + if (!gui) { - if (!ClientDataHolderVR.kiosk) + if (!dh.kiosk) { - this.mc.pauseGame(false); + mc.pauseGame(false); } } else { - InputSimulator.pressKey(256); - InputSimulator.releaseKey(256); + InputSimulator.pressKey(GLFW_KEY_ESCAPE); + InputSimulator.releaseKey(GLFW_KEY_ESCAPE); } KeyboardHandler.setOverlayShowing(false); } - if (mod.keyTogglePlayerList.consumeClick()) + if (VivecraftVRMod.keyTogglePlayerList.consumeClick()) { - ((GuiExtension) this.mc.gui).setShowPlayerList(!((GuiExtension) this.mc.gui).getShowPlayerList()); + ((GuiExtension) mc.gui).setShowPlayerList(!((GuiExtension) mc.gui).getShowPlayerList()); } - if (mod.keyToggleHandheldCam.consumeClick() && this.mc.player != null) + if (VivecraftVRMod.keyToggleHandheldCam.consumeClick() && mc.player != null) { - this.dh.cameraTracker.toggleVisibility(); + dh.cameraTracker.toggleVisibility(); - if (this.dh.cameraTracker.isVisible()) + if (dh.cameraTracker.isVisible()) { - ControllerType controllertype3 = this.findActiveBindingControllerType(mod.keyToggleHandheldCam); + ControllerType hand = this.findActiveBindingControllerType(VivecraftVRMod.keyToggleHandheldCam); - if (controllertype3 == null) + if (hand == null) { - controllertype3 = ControllerType.RIGHT; + hand = ControllerType.RIGHT; } - VRData.VRDevicePose vrdata$vrdevicepose = this.dh.vrPlayer.vrdata_world_pre.getController(controllertype3.ordinal()); - this.dh.cameraTracker.setPosition(vrdata$vrdevicepose.getPosition()); - this.dh.cameraTracker.setRotation(new Quaternion(vrdata$vrdevicepose.getMatrix().transposed())); + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getController(hand.ordinal()); + dh.cameraTracker.setPosition(vrdata$vrdevicepose.getPosition()); + dh.cameraTracker.setRotation(new Quaternionf().setFromNormalized(vrdata$vrdevicepose.getMatrix())); } } - if (mod.keyQuickHandheldCam.consumeClick() && this.mc.player != null) + if (VivecraftVRMod.keyQuickHandheldCam.consumeClick() && mc.player != null) { - if (!this.dh.cameraTracker.isVisible()) + if (!dh.cameraTracker.isVisible()) { - this.dh.cameraTracker.toggleVisibility(); + dh.cameraTracker.toggleVisibility(); } - ControllerType controllertype4 = this.findActiveBindingControllerType(mod.keyQuickHandheldCam); + ControllerType hand = this.findActiveBindingControllerType(VivecraftVRMod.keyQuickHandheldCam); - if (controllertype4 == null) + if (hand == null) { - controllertype4 = ControllerType.RIGHT; + hand = ControllerType.RIGHT; } - VRData.VRDevicePose vrdata$vrdevicepose1 = this.dh.vrPlayer.vrdata_world_pre.getController(controllertype4.ordinal()); - this.dh.cameraTracker.setPosition(vrdata$vrdevicepose1.getPosition()); - this.dh.cameraTracker.setRotation(new Quaternion(vrdata$vrdevicepose1.getMatrix().transposed())); - this.dh.cameraTracker.startMoving(controllertype4.ordinal(), true); + VRDevicePose vrdata$vrdevicepose1 = dh.vrPlayer.vrdata_world_pre.getController(hand.ordinal()); + dh.cameraTracker.setPosition(vrdata$vrdevicepose1.getPosition()); + dh.cameraTracker.setRotation(new Quaternionf().setFromNormalized(vrdata$vrdevicepose1.getMatrix())); + dh.cameraTracker.startMoving(hand.ordinal(), true); } - if (!mod.keyQuickHandheldCam.isDown() && this.dh.cameraTracker.isMoving() && this.dh.cameraTracker.isQuickMode() && this.mc.player != null) + if (!VivecraftVRMod.keyQuickHandheldCam.isDown() && dh.cameraTracker.isMoving() && dh.cameraTracker.isQuickMode() && mc.player != null) { - this.dh.cameraTracker.stopMoving(); - this.dh.grabScreenShot = true; + dh.cameraTracker.stopMoving(); + dh.grabScreenShot = true; } GuiHandler.processBindingsGui(); RadialHandler.processBindings(); KeyboardHandler.processBindings(); - this.dh.interactTracker.processBindings(); + dh.interactTracker.processBindings(); } } public void populateInputActions() { - Map map = this.getSpecialActionParams(); + Map actionParams = this.getSpecialActionParams(); // iterate over all minecraft keys, and our hidden keys - for (KeyMapping keymapping : Stream.concat(Arrays.stream(this.mc.options.keyMappings), mod.getHiddenKeyBindings().stream()).toList()) + for (KeyMapping keymapping : Stream.concat(Arrays.stream(mc.options.keyMappings), VivecraftVRMod.hiddenKeyBindingSet.stream()).toList()) { - ActionParams actionparams = map.getOrDefault(keymapping.getName(), new ActionParams("optional", "boolean", (VRInputActionSet)null)); - VRInputAction vrinputaction = new VRInputAction(keymapping, actionparams.requirement, actionparams.type, actionparams.actionSetOverride); - this.inputActions.put(vrinputaction.name, vrinputaction); + ActionParams params = actionParams.getOrDefault(keymapping.getName(), new ActionParams("optional", "boolean", null)); + VRInputAction action = new VRInputAction(keymapping, params.requirement, params.type, params.actionSetOverride); + this.inputActions.put(action.name, action); } - for (VRInputAction vrinputaction1 : this.inputActions.values()) + for (VRInputAction action : this.inputActions.values()) { - this.inputActionsByKeyBinding.put(vrinputaction1.keyBinding.getName(), vrinputaction1); + this.inputActionsByKeyBinding.put(action.keyBinding.getName(), action); } - this.getInputAction(mod.keyVRInteract).setPriority(5).setEnabled(false); - this.getInputAction(mod.keyClimbeyGrab).setPriority(10).setEnabled(false); - this.getInputAction(mod.keyClimbeyJump).setEnabled(false); + this.getInputAction(VivecraftVRMod.keyVRInteract).setPriority(5).setEnabled(false); + this.getInputAction(VivecraftVRMod.keyClimbeyGrab).setPriority(10).setEnabled(false); + this.getInputAction(VivecraftVRMod.keyClimbeyJump).setEnabled(false); this.getInputAction(GuiHandler.keyKeyboardClick).setPriority(50); this.getInputAction(GuiHandler.keyKeyboardShift).setPriority(50); } @@ -1189,103 +1051,93 @@ public void populateInputActions() public Map getSpecialActionParams() { Map map = new HashMap<>(); - this.addActionParams(map, this.mc.options.keyUp, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyDown, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyLeft, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyRight, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyInventory, "suggested", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, this.mc.options.keyAttack, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyUse, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, this.mc.options.keyChat, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyHotbarScroll, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyHotbarSwipeX, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyHotbarSwipeY, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyMenuButton, "suggested", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyTeleportFallback, "suggested", "vector1", (VRInputActionSet)null); - this.addActionParams(map, mod.keyFreeMoveRotate, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyFreeMoveStrafe, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyRotateLeft, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, mod.keyRotateRight, "optional", "vector1", (VRInputActionSet)null); - this.addActionParams(map, mod.keyRotateAxis, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, mod.keyRadialMenu, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, mod.keySwapMirrorView, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyToggleKeyboard, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyMoveThirdPersonCam, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyToggleHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyQuickHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); - this.addActionParams(map, mod.keyTrackpadTouch, "optional", "boolean", VRInputActionSet.TECHNICAL); - this.addActionParams(map, mod.keyVRInteract, "suggested", "boolean", VRInputActionSet.CONTEXTUAL); - this.addActionParams(map, mod.keyClimbeyGrab, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, mod.keyClimbeyJump, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyLeftClick, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyScrollAxis, "optional", "vector2", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyRightClick, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyShift, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyKeyboardClick, "suggested", "boolean", (VRInputActionSet)null); - this.addActionParams(map, GuiHandler.keyKeyboardShift, "suggested", "boolean", (VRInputActionSet)null); - File file1 = new File("customactionsets.txt"); - - if (file1.exists()) + this.addActionParams(map, mc.options.keyUp, "optional", "vector1", null); + this.addActionParams(map, mc.options.keyDown, "optional", "vector1", null); + this.addActionParams(map, mc.options.keyLeft, "optional", "vector1", null); + this.addActionParams(map, mc.options.keyRight, "optional", "vector1", null); + this.addActionParams(map, mc.options.keyInventory, "suggested", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, mc.options.keyAttack, "suggested", "boolean", null); + this.addActionParams(map, mc.options.keyUse, "suggested", "boolean", null); + this.addActionParams(map, mc.options.keyChat, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyHotbarScroll, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyHotbarSwipeX, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyHotbarSwipeY, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyMenuButton, "suggested", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyTeleportFallback, "suggested", "vector1", null); + this.addActionParams(map, VivecraftVRMod.keyFreeMoveRotate, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyFreeMoveStrafe, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyRotateLeft, "optional", "vector1", null); + this.addActionParams(map, VivecraftVRMod.keyRotateRight, "optional", "vector1", null); + this.addActionParams(map, VivecraftVRMod.keyRotateAxis, "optional", "vector2", null); + this.addActionParams(map, VivecraftVRMod.keyRadialMenu, "suggested", "boolean", null); + this.addActionParams(map, VivecraftVRMod.keySwapMirrorView, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyToggleKeyboard, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyMoveThirdPersonCam, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyToggleHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyQuickHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); + this.addActionParams(map, VivecraftVRMod.keyTrackpadTouch, "optional", "boolean", VRInputActionSet.TECHNICAL); + this.addActionParams(map, VivecraftVRMod.keyVRInteract, "suggested", "boolean", VRInputActionSet.CONTEXTUAL); + this.addActionParams(map, VivecraftVRMod.keyClimbeyGrab, "suggested", "boolean", null); + this.addActionParams(map, VivecraftVRMod.keyClimbeyJump, "suggested", "boolean", null); + this.addActionParams(map, GuiHandler.keyLeftClick, "suggested", "boolean", null); + this.addActionParams(map, GuiHandler.keyScrollAxis, "optional", "vector2", null); + this.addActionParams(map, GuiHandler.keyRightClick, "suggested", "boolean", null); + this.addActionParams(map, GuiHandler.keyShift, "suggested", "boolean", null); + this.addActionParams(map, GuiHandler.keyKeyboardClick, "suggested", "boolean", null); + this.addActionParams(map, GuiHandler.keyKeyboardShift, "suggested", "boolean", null); + File file = new File("customactionsets.txt"); + + if (file.exists()) { - System.out.println("Loading custom action set definitions..."); - String s; + logger.info("Loading custom action set definitions..."); + String line; - try (BufferedReader bufferedreader = new BufferedReader(new FileReader(file1))) + try (BufferedReader br = new BufferedReader(new FileReader(file))) { - while ((s = bufferedreader.readLine()) != null) + while ((line = br.readLine()) != null) { - String[] astring = s.split(":", 2); + String[] tokens = line.split(":", 2); - if (astring.length < 2) + if (tokens.length < 2) { - System.out.println("Invalid tokens: " + s); + logger.warn("Invalid tokens: {}", line); } else { - KeyMapping keymapping = this.findKeyBinding(astring[0]); + KeyMapping keymapping = this.findKeyBinding(tokens[0]); if (keymapping == null) { - System.out.println("Unknown key binding: " + astring[0]); + logger.warn("Unknown key binding: {}", tokens[0]); } - else if (mod.getAllKeyBindings().contains(keymapping)) + else if (VivecraftVRMod.allKeyBindingSet.contains(keymapping)) { - System.out.println("NO! Don't touch Vivecraft bindings!"); + logger.warn("NO! Don't touch Vivecraft bindings!"); } else { - VRInputActionSet vrinputactionset = null; - String s1 = astring[1].toLowerCase(); - - switch (s1) - { - case "ingame": - vrinputactionset = VRInputActionSet.INGAME; - break; - - case "gui": - vrinputactionset = VRInputActionSet.GUI; - break; - - case "global": - vrinputactionset = VRInputActionSet.GLOBAL; - } - - if (vrinputactionset == null) + VRInputActionSet actionSet = switch (tokens[1].toLowerCase()) { + case "ingame" -> VRInputActionSet.INGAME; + case "gui" -> VRInputActionSet.GUI; + case "global" -> VRInputActionSet.GLOBAL; + default -> null; + }; + + if (actionSet == null) { - System.out.println("Unknown action set: " + astring[1]); + logger.warn("Unknown action set: {}", tokens[1]); } else { - this.addActionParams(map, keymapping, "optional", "boolean", vrinputactionset); + this.addActionParams(map, keymapping, "optional", "boolean", actionSet); } } } } } - catch (IOException ioexception) + catch (IOException e) { - ioexception.printStackTrace(); + e.printStackTrace(); } } @@ -1294,30 +1146,30 @@ else if (mod.getAllKeyBindings().contains(keymapping)) protected void changeHotbar(int dir) { - if (this.mc.player != null && (!this.dh.climbTracker.isGrabbingLadder() || !this.dh.climbTracker.isClaws(this.mc.player.getMainHandItem()))) + if (mc.player != null && (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getMainHandItem()))) { - if (this.mc.screen == null) + if (mc.screen == null) { InputSimulator.scrollMouse(0.0D, (double)(dir * 4)); } else { - this.mc.player.getInventory().swapPaint((double)dir); + mc.player.getInventory().swapPaint((double)dir); } } } - private void addActionParams(Map map, KeyMapping keyBinding, String requirement, String type, VRInputActionSet actionSetOverride) + private void addActionParams(Map map, KeyMapping keymapping, String requirement, String type, @Nullable VRInputActionSet actionSetOverride) { ActionParams actionparams = new ActionParams(requirement, type, actionSetOverride); - map.put(keyBinding.getName(), actionparams); + map.put(keymapping.getName(), actionparams); } - protected abstract void triggerBindingHapticPulse(KeyMapping var1, int var2); + protected abstract void triggerBindingHapticPulse(KeyMapping binding, int duration); - protected abstract ControllerType findActiveBindingControllerType(KeyMapping var1); + protected abstract ControllerType findActiveBindingControllerType(KeyMapping binding); - public abstract void poll(long var1); + public abstract void poll(long frameIndex); public abstract Vector2f getPlayAreaSize(); @@ -1325,11 +1177,13 @@ private void addActionParams(Map map, KeyMapping keyBindin public abstract boolean postinit() throws RenderConfigException; - public abstract org.vivecraft.common.utils.math.Matrix4f getControllerComponentTransform(int var1, String var2); + public abstract Matrix4f getControllerComponentTransform(int controllerIndex, String componentName); + + public abstract ControllerType getOriginControllerType(long inputValueHandle); public abstract boolean hasThirdController(); - public abstract List getOrigins(VRInputAction var1); + public abstract List getOrigins(VRInputAction action); public abstract String getOriginName(long l); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java index 71d42f8d0..921db4462 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java @@ -1,12 +1,36 @@ package org.vivecraft.client_vr.provider; +import org.vivecraft.client.extensions.RenderTargetExtension; +import org.vivecraft.client_vr.VRTextureTarget; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; +import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; +import org.vivecraft.client_vr.render.RenderConfigException; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.render.ShaderHelper; +import org.vivecraft.client_vr.render.VRShaders; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; +import org.vivecraft.client_xr.render_pass.WorldRenderPass; +import org.vivecraft.mod_compat_vr.ShadersHelper; +import org.vivecraft.mod_compat_vr.resolutioncontrol.ResolutionControlHelper; + +import org.joml.Matrix4f; +import org.joml.RoundingMode; +import org.lwjgl.opengl.GL11C; +import org.lwjgl.opengl.GL13C; +import org.lwjgl.opengl.GL20C; +import org.lwjgl.system.MemoryUtil; + import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlUtil; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + import net.minecraft.client.GraphicsStatus; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; @@ -14,38 +38,26 @@ import net.minecraft.util.Tuple; import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL43; -import org.lwjgl.system.MemoryUtil; -import org.vivecraft.client.extensions.RenderTargetExtension; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.mod_compat_vr.ShadersHelper; -import org.vivecraft.client_vr.VRTextureTarget; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; -import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; -import org.vivecraft.client_xr.render_pass.WorldRenderPass; -import org.vivecraft.client_vr.render.RenderConfigException; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.render.ShaderHelper; -import org.vivecraft.client_vr.render.VRShaders; -import org.vivecraft.mod_compat_vr.resolutioncontrol.ResolutionControlHelper; import java.nio.FloatBuffer; import java.util.ArrayList; import java.util.List; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; + +import static net.minecraft.client.Minecraft.ON_OSX; + public abstract class VRRenderer { public static final String RENDER_SETUP_FAILURE_MESSAGE = "Failed to initialise stereo rendering plugin: "; public RenderTarget cameraFramebuffer; public RenderTarget cameraRenderFramebuffer; protected int dispLastWidth; protected int dispLastHeight; - public Matrix4f[] eyeproj = new Matrix4f[2]; + public Matrix4f[] eyeproj = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; public RenderTarget framebufferEye0; public RenderTarget framebufferEye1; public RenderTarget framebufferMR; @@ -60,9 +72,9 @@ public abstract class VRRenderer { public boolean lastEnableVsync = true; public boolean lastFogFancy = true; public boolean lastFogFast = false; - private GraphicsStatus previousGraphics = null; + private GraphicsStatus previousGraphics; public int lastGuiScale = 0; - protected VRSettings.MirrorMode lastMirror; + protected MirrorMode lastMirror; public int lastRenderDistanceChunks = -1; public long lastWindow = 0L; public float lastWorldScale = 0.0F; @@ -94,11 +106,13 @@ protected void checkGLError(String message) { public abstract void createRenderTexture(int var1, int var2); - public abstract Matrix4f getProjectionMatrix(int var1, float var2, float var3); + public abstract Matrix4f getProjectionMatrix(int eyeType, double nearClip, double farClip, Matrix4f dest); public abstract void endFrame() throws RenderConfigException; - public abstract boolean providesStencilMask(); + public boolean providesStencilMask(){ + return false; + }; public void deleteRenderTextures() { if (this.LeftEyeTextureId > 0) { @@ -113,12 +127,10 @@ public void deleteRenderTextures() { } public void doStencil(boolean inverse) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); //setup stencil for writing - GL11.glEnable(GL11.GL_STENCIL_TEST); - RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); + GL11C.glEnable(GL11C.GL_STENCIL_TEST); + RenderSystem.stencilOp(GL11C.GL_KEEP, GL11C.GL_KEEP, GL11C.GL_REPLACE); RenderSystem.stencilMask(0xFF); // Write to stencil buffer if (inverse) { @@ -126,7 +138,7 @@ public void doStencil(boolean inverse) { RenderSystem.clearStencil(0xFF); RenderSystem.clearDepth(0); - RenderSystem.stencilFunc(GL11.GL_ALWAYS, 0, 0xFF); // Set any stencil to 0 + RenderSystem.stencilFunc(GL11C.GL_ALWAYS, 0, 0xFF); // Set any stencil to 0 RenderSystem.colorMask(false, false, false, true); } else { @@ -134,36 +146,36 @@ public void doStencil(boolean inverse) { RenderSystem.clearStencil(0); RenderSystem.clearDepth(1); - RenderSystem.stencilFunc(GL11.GL_ALWAYS, 0xFF, 0xFF); // Set any stencil to 1 + RenderSystem.stencilFunc(GL11C.GL_ALWAYS, 0xFF, 0xFF); // Set any stencil to 1 RenderSystem.colorMask(true, true, true, true); } - RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT, false); + RenderSystem.clear(GL11C.GL_DEPTH_BUFFER_BIT | GL11C.GL_STENCIL_BUFFER_BIT, false); RenderSystem.clearStencil(0); RenderSystem.clearDepth(1); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); - RenderSystem.depthFunc(GL11.GL_ALWAYS); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); RenderSystem.disableCull(); - RenderSystem.setShaderColor(0F, 0F, 0F, 1.0F); + RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F); - RenderTarget fb = minecraft.getMainRenderTarget(); + RenderTarget fb = mc.getMainRenderTarget(); RenderSystem.backupProjectionMatrix(); RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho(0.0F, fb.viewWidth, 0.0F, fb.viewHeight, 0.0F, 20.0F), VertexSorting.ORTHOGRAPHIC_Z); RenderSystem.getModelViewStack().pushPose(); RenderSystem.getModelViewStack().setIdentity(); if (inverse) //draw on far clip - RenderSystem.getModelViewStack().translate(0, 0, -20); + RenderSystem.getModelViewStack().last().pose().translate(0.0F, 0.0F, -20.0F); RenderSystem.applyModelViewMatrix(); - int s = GlStateManager._getInteger(GL43.GL_CURRENT_PROGRAM); + int s = GlStateManager._getInteger(GL20C.GL_CURRENT_PROGRAM); - if (dataholder.currentPass == RenderPass.SCOPEL || dataholder.currentPass == RenderPass.SCOPER) { + if (dh.currentPass == RenderPass.SCOPEL || dh.currentPass == RenderPass.SCOPER) { drawCircle(fb.viewWidth, fb.viewHeight); - } else if (dataholder.currentPass == RenderPass.LEFT || dataholder.currentPass == RenderPass.RIGHT) { + } else if (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT) { drawMask(); } @@ -177,10 +189,10 @@ public void doStencil(boolean inverse) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.enableCull(); GlStateManager._glUseProgram(s); - RenderSystem.stencilFunc(GL11.GL_NOTEQUAL, 255, 1); - RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); + RenderSystem.stencilFunc(GL11C.GL_NOTEQUAL, 255, 1); + RenderSystem.stencilOp(GL11C.GL_KEEP, GL11C.GL_KEEP, GL11C.GL_KEEP); RenderSystem.stencilMask(0); // Dont Write to stencil buffer - RenderSystem.depthFunc(GL11.GL_LEQUAL); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } FloatBuffer buffer = MemoryUtil.memAllocFloat(16); @@ -192,7 +204,7 @@ public void doFSAA(boolean hasShaders) { } else { RenderSystem.disableBlend(); // set to always, so that we can skip the clear - RenderSystem.depthFunc(GL43.GL_ALWAYS); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); // first pass this.fsaaFirstPassResultFBO.bindWrite(true); @@ -200,11 +212,11 @@ public void doFSAA(boolean hasShaders) { RenderSystem.setShaderTexture(0, framebufferVrRender.getColorTextureId()); RenderSystem.setShaderTexture(1, framebufferVrRender.getDepthTextureId()); - RenderSystem.activeTexture(GL43.GL_TEXTURE1); + RenderSystem.activeTexture(GL13C.GL_TEXTURE1); this.framebufferVrRender.bindRead(); - RenderSystem.activeTexture(GL43.GL_TEXTURE2); + RenderSystem.activeTexture(GL13C.GL_TEXTURE2); RenderSystem.bindTexture(framebufferVrRender.getDepthTextureId()); - RenderSystem.activeTexture(GL43.GL_TEXTURE0); + RenderSystem.activeTexture(GL13C.GL_TEXTURE0); VRShaders.lanczosShader.setSampler("Sampler0", RenderSystem.getShaderTexture(0)); VRShaders.lanczosShader.setSampler("Sampler1", RenderSystem.getShaderTexture(1)); @@ -219,11 +231,11 @@ public void doFSAA(boolean hasShaders) { RenderSystem.setShaderTexture(0, this.fsaaFirstPassResultFBO.getColorTextureId()); RenderSystem.setShaderTexture(1, this.fsaaFirstPassResultFBO.getDepthTextureId()); - RenderSystem.activeTexture(GL43.GL_TEXTURE1); + RenderSystem.activeTexture(GL13C.GL_TEXTURE1); this.fsaaFirstPassResultFBO.bindRead(); - RenderSystem.activeTexture(GL43.GL_TEXTURE2); + RenderSystem.activeTexture(GL13C.GL_TEXTURE2); RenderSystem.bindTexture(fsaaFirstPassResultFBO.getDepthTextureId()); - RenderSystem.activeTexture(GL43.GL_TEXTURE0); + RenderSystem.activeTexture(GL13C.GL_TEXTURE0); VRShaders.lanczosShader.setSampler("Sampler0", RenderSystem.getShaderTexture(0)); VRShaders.lanczosShader.setSampler("Sampler1", RenderSystem.getShaderTexture(1)); @@ -235,34 +247,32 @@ public void doFSAA(boolean hasShaders) { // Clean up time VRShaders.lanczosShader.clear(); - Minecraft.getInstance().getMainRenderTarget().bindWrite(true); - RenderSystem.depthFunc(GL43.GL_LEQUAL); + mc.getMainRenderTarget().bindWrite(true); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } } private void drawCircle(float width, float height) { BufferBuilder builder = Tesselator.getInstance().getBuilder(); - builder.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); + builder.begin(Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION); int i = 32; - float f = (float) (width / 2); - builder.vertex((float) (width / 2), (float) (width / 2), 0.0F).endVertex(); + float f = width / 2; + builder.vertex(f, f, 0.0D).endVertex(); for (int j = 0; j < i + 1; ++j) { - float f1 = (float) j / (float) i * (float) Math.PI * 2.0F; - float f2 = (float) ((double) (width / 2) + Math.cos((double) f1) * (double) f); - float f3 = (float) ((double) (width / 2) + Math.sin((double) f1) * (double) f); - builder.vertex(f2, f3, 0.0F).endVertex(); + double f1 = (double) j / i * PI * 2.0D; + double f2 = f + cos(f1) * f; + double f3 = f + sin(f1) * f; + builder.vertex(f2, f3, 0.0D).endVertex(); } BufferUploader.drawWithShader(builder.end()); } private void drawMask() { - Minecraft mc = Minecraft.getInstance(); - ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); float[] verts = getStencilMask(dh.currentPass); if (verts == null) return; BufferBuilder builder = Tesselator.getInstance().getBuilder(); - builder.begin(VertexFormat.Mode.TRIANGLES, DefaultVertexFormat.POSITION); + builder.begin(Mode.TRIANGLES, DefaultVertexFormat.POSITION); mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/black.png")); @@ -277,7 +287,7 @@ private void drawMask() { private void drawQuad() { //RenderSystem.setShader(GameRenderer::getPositionTexShader); BufferBuilder builder = Tesselator.getInstance().getBuilder(); - builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + builder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); builder.vertex(-1.0F, -1.0F, 0.0F).uv(0.0F, 0.0F).endVertex(); builder.vertex(1.0F, -1.0F, 0.0F).uv(1.0F, 0.0F).endVertex(); builder.vertex(1.0F, 1.0F, 0.0F).uv(1.0F, 1.0F).endVertex(); @@ -286,7 +296,7 @@ private void drawQuad() { } public double getCurrentTimeSecs() { - return (double) System.nanoTime() / 1.0E9D; + return System.nanoTime() / 1.0E9D; } public double getFrameTiming() { @@ -302,41 +312,39 @@ public String getLastError() { } public String getName() { - return "OpenVR"; + return "Default Renderer Name"; } public List getRenderPasses() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); List list = new ArrayList<>(); list.add(RenderPass.LEFT); list.add(RenderPass.RIGHT); // only do these, if the window is not minimized - if (minecraft.getWindow().getScreenWidth() > 0 && minecraft.getWindow().getScreenHeight() > 0) { - if (dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PERSON) { + if (mc.getWindow().getScreenWidth() > 0 && mc.getWindow().getScreenHeight() > 0) { + if (dh.vrSettings.displayMirrorMode == MirrorMode.FIRST_PERSON) { list.add(RenderPass.CENTER); - } else if (dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { - if (dataholder.vrSettings.mixedRealityUndistorted && dataholder.vrSettings.mixedRealityUnityLike) { + } else if (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY) { + if (dh.vrSettings.mixedRealityUndistorted && dh.vrSettings.mixedRealityUnityLike) { list.add(RenderPass.CENTER); } list.add(RenderPass.THIRD); - } else if (dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) { + } else if (dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON) { list.add(RenderPass.THIRD); } } - if (minecraft.player != null) { - if (TelescopeTracker.isTelescope(minecraft.player.getMainHandItem()) && TelescopeTracker.isViewing(0)) { + if (mc.player != null) { + if (TelescopeTracker.isTelescope(mc.player.getMainHandItem()) && TelescopeTracker.isViewing(0)) { list.add(RenderPass.SCOPER); } - if (TelescopeTracker.isTelescope(minecraft.player.getOffhandItem()) && TelescopeTracker.isViewing(1)) { + if (TelescopeTracker.isTelescope(mc.player.getOffhandItem()) && TelescopeTracker.isViewing(1)) { list.add(RenderPass.SCOPEL); } - if (dataholder.cameraTracker.isVisible()) { + if (dh.cameraTracker.isVisible()) { list.add(RenderPass.CAMERA); } } @@ -347,13 +355,13 @@ public List getRenderPasses() { public abstract Tuple getRenderTextureSizes(); public Tuple getMirrorTextureSize(int eyeFBWidth, int eyeFBHeight, float resolutionScale) { - mirrorFBWidth = (int) Math.ceil(Minecraft.getInstance().getWindow().getScreenWidth() * resolutionScale); - mirrorFBHeight = (int) Math.ceil(Minecraft.getInstance().getWindow().getScreenHeight() * resolutionScale); + mirrorFBWidth = roundUsing(mc.getWindow().getScreenWidth() * resolutionScale, RoundingMode.CEILING); + mirrorFBHeight = roundUsing(mc.getWindow().getScreenHeight() * resolutionScale, RoundingMode.CEILING); - if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { + if (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY) { mirrorFBWidth = mirrorFBWidth / 2; - if (ClientDataHolderVR.getInstance().vrSettings.mixedRealityUnityLike) { + if (dh.vrSettings.mixedRealityUnityLike) { mirrorFBHeight = mirrorFBHeight / 2; } } @@ -379,8 +387,8 @@ public Tuple getTelescopeTextureSize(int eyeFBWidth, int eyeFB } public Tuple getCameraTextureSize(int eyeFBWidth, int eyeFBHeight) { - int cameraFBwidth = Math.round(1920.0F * ClientDataHolderVR.getInstance().vrSettings.handCameraResScale); - int cameraFBheight = Math.round(1080.0F * ClientDataHolderVR.getInstance().vrSettings.handCameraResScale); + int cameraFBwidth = round(1920.0F * dh.vrSettings.handCameraResScale); + int cameraFBheight = round(1080.0F * dh.vrSettings.handCameraResScale); if (ShadersHelper.needsSameSizeBuffers()) { @@ -389,11 +397,11 @@ public Tuple getCameraTextureSize(int eyeFBWidth, int eyeFBHei if (aspect > (float)(eyeFBWidth / eyeFBHeight)) { cameraFBwidth = eyeFBWidth; - cameraFBheight = Math.round((float)eyeFBWidth / aspect); + cameraFBheight = round((float)eyeFBWidth / aspect); } else { - cameraFBwidth = Math.round((float)eyeFBHeight * aspect); + cameraFBwidth = round((float)eyeFBHeight * aspect); cameraFBheight = eyeFBHeight; } } @@ -416,7 +424,7 @@ public void reinitFrameBuffers(String cause) { if (acceptReinits) { if (!reinitFramebuffers) { // only print the first cause - System.out.println("Reinit Render: " + cause); + logger.info("Reinit Render: {}", cause); } this.reinitFramebuffers = true; } @@ -430,39 +438,37 @@ public void resizeFrameBuffers(String cause) { } public void setupRenderConfiguration() throws Exception { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (minecraft.getWindow().getWindow() != this.lastWindow) { - this.lastWindow = minecraft.getWindow().getWindow(); + if (mc.getWindow().getWindow() != this.lastWindow) { + this.lastWindow = mc.getWindow().getWindow(); this.reinitFrameBuffers("Window Handle Changed"); } - if (this.lastEnableVsync != minecraft.options.enableVsync().get()) { + if (this.lastEnableVsync != mc.options.enableVsync().get()) { this.reinitFrameBuffers("VSync Changed"); - this.lastEnableVsync = minecraft.options.enableVsync().get(); + this.lastEnableVsync = mc.options.enableVsync().get(); } - if (this.lastMirror != dataholder.vrSettings.displayMirrorMode) { + if (this.lastMirror != dh.vrSettings.displayMirrorMode) { if (!ShadersHelper.isShaderActive()) { // don't reinit with shaders, not needed this.reinitFrameBuffers("Mirror Changed"); } else { // mixed reality is half size, so a resize is needed - if (lastMirror == VRSettings.MirrorMode.MIXED_REALITY - || dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { + if (lastMirror == MirrorMode.MIXED_REALITY + || dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY) { this.resizeFrameBuffers("Mirror Changed"); } } - this.lastMirror = dataholder.vrSettings.displayMirrorMode; + this.lastMirror = dh.vrSettings.displayMirrorMode; } if ((framebufferMR == null || framebufferUndistorted == null) && ShadersHelper.isShaderActive()) { this.reinitFrameBuffers("Shaders on, but some buffers not initialized"); } - if (Minecraft.getInstance().options.graphicsMode().get() != previousGraphics) { - previousGraphics = Minecraft.getInstance().options.graphicsMode().get(); - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("gfx setting change"); + if (mc.options.graphicsMode().get() != previousGraphics) { + previousGraphics = mc.options.graphicsMode().get(); + dh.vrRenderer.reinitFrameBuffers("gfx setting change"); } if (this.resizeFrameBuffers && !this.reinitFramebuffers) { @@ -473,19 +479,19 @@ public void setupRenderConfiguration() throws Exception { float resolutionScale = ResolutionControlHelper.isLoaded() ? ResolutionControlHelper.getCurrentScaleFactor() : 1.0F; - this.renderScale = (float) Math.sqrt(dataholder.vrSettings.renderScaleFactor) * resolutionScale; - int eyeFBWidth = (int) Math.ceil(eyew * this.renderScale); - int eyeFBHeight = (int) Math.ceil(eyeh * this.renderScale); + this.renderScale = sqrt(dh.vrSettings.renderScaleFactor) * resolutionScale; + int eyeFBWidth = roundUsing(eyew * this.renderScale, RoundingMode.CEILING); + int eyeFBHeight = roundUsing(eyeh * this.renderScale, RoundingMode.CEILING); Tuple mirrorSize = getMirrorTextureSize(eyeFBWidth, eyeFBHeight, resolutionScale); Tuple telescopeSize = getTelescopeTextureSize(eyeFBWidth, eyeFBHeight); Tuple cameraSize = getCameraTextureSize(eyeFBWidth, eyeFBHeight); // main render target - ((RenderTargetExtension) WorldRenderPass.stereoXR.target).setUseStencil(dataholder.vrSettings.vrUseStencil); + ((RenderTargetExtension) WorldRenderPass.stereoXR.target).setUseStencil(dh.vrSettings.vrUseStencil); WorldRenderPass.stereoXR.resize(eyeFBWidth, eyeFBHeight); - if (dataholder.vrSettings.useFsaa) { - this.fsaaFirstPassResultFBO.resize(eyew, eyeFBHeight, Minecraft.ON_OSX); + if (dh.vrSettings.useFsaa) { + this.fsaaFirstPassResultFBO.resize(eyew, eyeFBHeight, ON_OSX); } // mirror @@ -501,7 +507,7 @@ public void setupRenderConfiguration() throws Exception { WorldRenderPass.rightTelescope.resize(telescopeSize.getA(), telescopeSize.getB()); // camera - cameraFramebuffer.resize(cameraSize.getA(), cameraSize.getB(), Minecraft.ON_OSX); + cameraFramebuffer.resize(cameraSize.getA(), cameraSize.getB(), ON_OSX); if (ShadersHelper.needsSameSizeBuffers()) { WorldRenderPass.camera.resize(eyeFBWidth, eyeFBHeight); } else { @@ -535,33 +541,33 @@ public void setupRenderConfiguration() throws Exception { throw new RenderConfigException("Failed to initialise stereo rendering plugin: " + this.getName(), Component.literal(this.getLastError())); } - dataholder.print("Provider supplied render texture IDs: " + this.LeftEyeTextureId + " " + this.RightEyeTextureId); - dataholder.print("Provider supplied texture resolution: " + eyew + " x " + eyeh); + logger.info("Provider supplied render texture IDs: {} {}", this.LeftEyeTextureId, this.RightEyeTextureId); + logger.info("Provider supplied texture resolution: {} x {}", eyew, eyeh); } this.checkGLError("Render Texture setup"); if (this.framebufferEye0 == null) { this.framebufferEye0 = new VRTextureTarget("L Eye", eyew, eyeh, false, false, this.LeftEyeTextureId, false, true, false); - dataholder.print(this.framebufferEye0.toString()); + logger.info(this.framebufferEye0.toString()); this.checkGLError("Left Eye framebuffer setup"); } if (this.framebufferEye1 == null) { this.framebufferEye1 = new VRTextureTarget("R Eye", eyew, eyeh, false, false, this.RightEyeTextureId, false, true, false); - dataholder.print(this.framebufferEye1.toString()); + logger.info(this.framebufferEye1.toString()); this.checkGLError("Right Eye framebuffer setup"); } float resolutionScale = ResolutionControlHelper.isLoaded() ? ResolutionControlHelper.getCurrentScaleFactor() : 1.0F; - this.renderScale = (float) Math.sqrt(dataholder.vrSettings.renderScaleFactor) * resolutionScale; - int eyeFBWidth = (int) Math.ceil(eyew * this.renderScale); - int eyeFBHeight = (int) Math.ceil(eyeh * this.renderScale); + this.renderScale = (float) sqrt(dh.vrSettings.renderScaleFactor) * resolutionScale; + int eyeFBWidth = roundUsing(eyew * this.renderScale, RoundingMode.CEILING); + int eyeFBHeight = roundUsing(eyeh * this.renderScale, RoundingMode.CEILING); - this.framebufferVrRender = new VRTextureTarget("3D Render", eyeFBWidth, eyeFBHeight, true, false, -1, true, true, dataholder.vrSettings.vrUseStencil); + this.framebufferVrRender = new VRTextureTarget("3D Render", eyeFBWidth, eyeFBHeight, true, false, -1, true, true, dh.vrSettings.vrUseStencil); WorldRenderPass.stereoXR = new WorldRenderPass((VRTextureTarget) this.framebufferVrRender); - dataholder.print(this.framebufferVrRender.toString()); + logger.info(this.framebufferVrRender.toString()); this.checkGLError("3D framebuffer setup"); getMirrorTextureSize(eyeFBWidth, eyeFBHeight, resolutionScale); @@ -569,7 +575,7 @@ public void setupRenderConfiguration() throws Exception { List list = this.getRenderPasses(); for (RenderPass renderpass : list) { - System.out.println("Passes: " + renderpass.toString()); + logger.info("Passes: {}", renderpass.toString()); } // only do these, if the window is not minimized @@ -577,42 +583,42 @@ public void setupRenderConfiguration() throws Exception { if (list.contains(RenderPass.THIRD) || ShadersHelper.isShaderActive()) { this.framebufferMR = new VRTextureTarget("Mixed Reality Render", this.mirrorFBWidth, this.mirrorFBHeight, true, false, -1, true, false, false); WorldRenderPass.mixedReality = new WorldRenderPass((VRTextureTarget) this.framebufferMR); - dataholder.print(this.framebufferMR.toString()); + logger.info(this.framebufferMR.toString()); this.checkGLError("Mixed reality framebuffer setup"); } if (list.contains(RenderPass.CENTER) || ShadersHelper.isShaderActive()) { this.framebufferUndistorted = new VRTextureTarget("Undistorted View Render", this.mirrorFBWidth, this.mirrorFBHeight, true, false, -1, false, false, false); WorldRenderPass.center = new WorldRenderPass((VRTextureTarget) this.framebufferUndistorted); - dataholder.print(this.framebufferUndistorted.toString()); + logger.info(this.framebufferUndistorted.toString()); this.checkGLError("Undistorted view framebuffer setup"); } } GuiHandler.guiFramebuffer = new VRTextureTarget("GUI", GuiHandler.guiWidth, GuiHandler.guiHeight, true, false, -1, false, true, false); - dataholder.print(GuiHandler.guiFramebuffer.toString()); + logger.info(GuiHandler.guiFramebuffer.toString()); this.checkGLError("GUI framebuffer setup"); KeyboardHandler.Framebuffer = new VRTextureTarget("Keyboard", GuiHandler.guiWidth, GuiHandler.guiHeight, true, false, -1, false, true, false); - dataholder.print(KeyboardHandler.Framebuffer.toString()); + logger.info(KeyboardHandler.Framebuffer.toString()); this.checkGLError("Keyboard framebuffer setup"); RadialHandler.Framebuffer = new VRTextureTarget("Radial Menu", GuiHandler.guiWidth, GuiHandler.guiHeight, true, false, -1, false, true, false); - dataholder.print(RadialHandler.Framebuffer.toString()); + logger.info(RadialHandler.Framebuffer.toString()); this.checkGLError("Radial framebuffer setup"); Tuple telescopeSize = getTelescopeTextureSize(eyeFBWidth, eyeFBHeight); this.telescopeFramebufferR = new VRTextureTarget("TelescopeR", telescopeSize.getA(), telescopeSize.getB(), true, false, -1, true, false, false); WorldRenderPass.rightTelescope = new WorldRenderPass((VRTextureTarget) this.telescopeFramebufferR); - dataholder.print(this.telescopeFramebufferR.toString()); - this.telescopeFramebufferR.setClearColor(0.0f, 0.0f, 0.0f, 1.0f); - this.telescopeFramebufferR.clear(Minecraft.ON_OSX); + logger.info(this.telescopeFramebufferR.toString()); + this.telescopeFramebufferR.setClearColor(0.0F, 0.0F, 0.0F, 1.0F); + this.telescopeFramebufferR.clear(ON_OSX); this.checkGLError("TelescopeR framebuffer setup"); this.telescopeFramebufferL = new VRTextureTarget("TelescopeL", telescopeSize.getA(), telescopeSize.getB(), true, false, -1, true, false, false); WorldRenderPass.leftTelescope = new WorldRenderPass((VRTextureTarget) this.telescopeFramebufferL); - dataholder.print(this.telescopeFramebufferL.toString()); - this.telescopeFramebufferL.setClearColor(0.0f, 0.0f, 0.0f, 1.0f); - this.telescopeFramebufferL.clear(Minecraft.ON_OSX); + logger.info(this.telescopeFramebufferL.toString()); + this.telescopeFramebufferL.setClearColor(0.0F, 0.0F, 0.0F, 1.0F); + this.telescopeFramebufferL.clear(ON_OSX); this.checkGLError("TelescopeL framebuffer setup"); @@ -626,58 +632,59 @@ public void setupRenderConfiguration() throws Exception { } this.cameraFramebuffer = new VRTextureTarget("Handheld Camera", cameraSize.getA(), cameraSize.getB(), true, false, -1, true, false, false); - dataholder.print(this.cameraFramebuffer.toString()); + logger.info(this.cameraFramebuffer.toString()); this.checkGLError("Camera framebuffer setup"); this.cameraRenderFramebuffer = new VRTextureTarget("Handheld Camera Render", cameraRenderFBwidth, cameraRenderFBheight, true, false, -1, true, true, false); WorldRenderPass.camera = new WorldRenderPass((VRTextureTarget) this.cameraRenderFramebuffer); - dataholder.print(this.cameraRenderFramebuffer.toString()); + logger.info(this.cameraRenderFramebuffer.toString()); this.checkGLError("Camera render framebuffer setup"); - ((GameRendererExtension) minecraft.gameRenderer).setupClipPlanes(); - this.eyeproj[0] = this.getProjectionMatrix(0, ((GameRendererExtension) minecraft.gameRenderer).getMinClipDistance(), ((GameRendererExtension) minecraft.gameRenderer).getClipDistance()); - this.eyeproj[1] = this.getProjectionMatrix(1, ((GameRendererExtension) minecraft.gameRenderer).getMinClipDistance(), ((GameRendererExtension) minecraft.gameRenderer).getClipDistance()); + GameRendererExtension GRE = (GameRendererExtension) mc.gameRenderer; + GRE.setupClipPlanes(); + this.getProjectionMatrix(0, GRE.getMinClipDistance(), GRE.getClipDistance(), this.eyeproj[0]); + this.getProjectionMatrix(1, GRE.getMinClipDistance(), GRE.getClipDistance(), this.eyeproj[1]); - if (dataholder.vrSettings.useFsaa) { + if (dh.vrSettings.useFsaa) { try { this.checkGLError("pre FSAA FBO creation"); this.fsaaFirstPassResultFBO = new VRTextureTarget("FSAA Pass1 FBO", eyew, eyeFBHeight, true, false, -1, false, false, false); this.fsaaLastPassResultFBO = new VRTextureTarget("FSAA Pass2 FBO", eyew, eyeh, true, false, -1, false, false, false); - dataholder.print(this.fsaaFirstPassResultFBO.toString()); - dataholder.print(this.fsaaLastPassResultFBO.toString()); + logger.info(this.fsaaFirstPassResultFBO.toString()); + logger.info(this.fsaaLastPassResultFBO.toString()); this.checkGLError("FSAA FBO creation"); VRShaders.setupFSAA(); ShaderHelper.checkGLError("FBO init fsaa shader"); } catch (Exception exception) { - dataholder.vrSettings.useFsaa = false; - dataholder.vrSettings.saveOptions(); - System.out.println(exception.getMessage()); + dh.vrSettings.useFsaa = false; + dh.vrSettings.saveOptions(); + logger.error(exception.getMessage()); this.reinitFramebuffers = true; return; } } try { - minecraft.mainRenderTarget = this.framebufferVrRender; + mc.mainRenderTarget = this.framebufferVrRender; VRShaders.setupDepthMask(); ShaderHelper.checkGLError("init depth shader"); VRShaders.setupFOVReduction(); ShaderHelper.checkGLError("init FOV shader"); VRShaders.setupPortalShaders(); ShaderHelper.checkGLError("init portal shader"); - minecraft.gameRenderer.checkEntityPostEffect(minecraft.getCameraEntity()); + mc.gameRenderer.checkEntityPostEffect(mc.getCameraEntity()); } catch (Exception exception1) { - System.out.println(exception1.getMessage()); + logger.error(exception1.getMessage()); System.exit(-1); } - if (minecraft.screen != null) { - int l2 = minecraft.getWindow().getGuiScaledWidth(); - int j3 = minecraft.getWindow().getGuiScaledHeight(); - minecraft.screen.init(minecraft, l2, j3); + if (mc.screen != null) { + int l2 = mc.getWindow().getGuiScaledWidth(); + int j3 = mc.getWindow().getGuiScaledHeight(); + mc.screen.init(mc, l2, j3); } - long windowPixels = (long)minecraft.getWindow().getScreenWidth() * minecraft.getWindow().getScreenHeight(); + long windowPixels = (long)mc.getWindow().getScreenWidth() * mc.getWindow().getScreenHeight(); long vrPixels = eyeFBWidth * eyeFBHeight * 2L; if (list.contains(RenderPass.CENTER)) { @@ -688,10 +695,10 @@ public void setupRenderConfiguration() throws Exception { vrPixels += windowPixels; } - System.out.println("[Minecrift] New render config:" + + logger.info("New render config:" + "\nOpenVR target width: " + eyew + ", height: " + eyeh + " [" + String.format("%.1f", (float) (eyew * eyeh) / 1000000.0F) + " MP]" + - "\nRender target width: " + eyeFBWidth + ", height: " + eyeFBHeight + " [Render scale: " + Math.round(dataholder.vrSettings.renderScaleFactor * 100.0F) + "%, " + String.format("%.1f", (float) (eyeFBWidth * eyeFBHeight) / 1000000.0F) + " MP]" + - "\nMain window width: " + minecraft.getWindow().getScreenWidth() + ", height: " + minecraft.getWindow().getScreenHeight() + " [" + String.format("%.1f", (float) windowPixels / 1000000.0F) + " MP]" + + "\nRender target width: " + eyeFBWidth + ", height: " + eyeFBHeight + " [Render scale: " + round(dh.vrSettings.renderScaleFactor * 100.0F) + "%, " + String.format("%.1f", (float) (eyeFBWidth * eyeFBHeight) / 1000000.0F) + " MP]" + + "\nMain window width: " + mc.getWindow().getScreenWidth() + ", height: " + mc.getWindow().getScreenHeight() + " [" + String.format("%.1f", (float) windowPixels / 1000000.0F) + " MP]" + "\nTotal shaded pixels per frame: " + String.format("%.1f", (float) vrPixels / 1000000.0F) + " MP (eye stencil not accounted for)"); this.lastDisplayFBWidth = eyeFBWidth; this.lastDisplayFBHeight = eyeFBHeight; @@ -705,9 +712,8 @@ public void setupRenderConfiguration() throws Exception { } public boolean wasDisplayResized() { - Minecraft minecraft = Minecraft.getInstance(); - int i = minecraft.getWindow().getScreenHeight(); - int j = minecraft.getWindow().getScreenWidth(); + int i = mc.getWindow().getScreenHeight(); + int j = mc.getWindow().getScreenWidth(); boolean flag = this.dispLastHeight != i || this.dispLastWidth != j; this.dispLastHeight = i; this.dispLastWidth = j; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java index 46181f935..a5252652e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java @@ -1,21 +1,24 @@ package org.vivecraft.client_vr.provider.nullvr; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; -import org.joml.Vector2f; -import org.lwjgl.glfw.GLFW; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.MethodHolder; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.MCVR; import org.vivecraft.client_vr.provider.VRRenderer; import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Matrix4f; +import org.vivecraft.client_vr.settings.VRHotkeys; + +import org.joml.Matrix4f; +import org.joml.Vector2f; + +import net.minecraft.client.KeyMapping; + +import java.util.List; -import java.util.*; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.lwjgl.glfw.GLFW.*; public class NullVR extends MCVR { @@ -24,9 +27,9 @@ public class NullVR extends MCVR private boolean vrActive = true; private boolean vrActiveChangedLastFrame = false; - public NullVR(Minecraft mc, ClientDataHolderVR dh) + public NullVR() { - super(mc, dh, VivecraftVRMod.INSTANCE); + super(); ome = this; this.hapticScheduler = new NullVRHapticScheduler(); } @@ -66,19 +69,17 @@ public boolean init() { if (!this.initialized) { - this.mc = Minecraft.getInstance(); - // only supports seated mode - System.out.println("NullDriver. Forcing seated mode."); - this.dh.vrSettings.seated = true; + logger.info("NullDriver. Forcing seated mode."); + dh.vrSettings.seated = true; this.headIsTracking = false; - Utils.Matrix4fSetIdentity(this.hmdPose); - this.hmdPose.M[1][3] = 1.62F; + this.hmdPose.identity(); + this.hmdPose.m13(1.62F); // eye offset, 10cm total distance - this.hmdPoseLeftEye.M[0][3] = -0.05F; - this.hmdPoseRightEye.M[0][3] = 0.05F; + this.hmdPoseLeftEye.m03(-0.05F); + this.hmdPoseRightEye.m03(0.05F); this.initialized = true; this.initSuccess = true; @@ -93,50 +94,33 @@ public void poll(long frameIndex) if (this.initialized) { - this.mc.getProfiler().push("updatePose"); + mc.getProfiler().push("updatePose"); if (mc.screen == null) { // don't permanently change the sensitivity - float xSens = this.dh.vrSettings.xSensitivity; - float xKey = this.dh.vrSettings.keyholeX; + float xSens = dh.vrSettings.xSensitivity; + float xKey = dh.vrSettings.keyholeX; - this.dh.vrSettings.xSensitivity = this.dh.vrSettings.ySensitivity * 1.636F * ((float)mc.getWindow().getScreenWidth() / (float)mc.getWindow().getScreenHeight()); - this.dh.vrSettings.keyholeX = 1; + dh.vrSettings.xSensitivity = dh.vrSettings.ySensitivity * 1.636F * ((float)mc.getWindow().getScreenWidth() / (float)mc.getWindow().getScreenHeight()); + dh.vrSettings.keyholeX = 1; this.updateAim(); - this.dh.vrSettings.xSensitivity = xSens; - this.dh.vrSettings.keyholeX = xKey; + dh.vrSettings.xSensitivity = xSens; + dh.vrSettings.keyholeX = xKey; // point head in cursor direction - hmdRotation.M[0][0] = handRotation[0].M[0][0]; - hmdRotation.M[0][1] = handRotation[0].M[0][1]; - hmdRotation.M[0][2] = handRotation[0].M[0][2]; - hmdRotation.M[1][0] = handRotation[0].M[1][0]; - hmdRotation.M[1][1] = handRotation[0].M[1][1]; - hmdRotation.M[1][2] = handRotation[0].M[1][2]; - hmdRotation.M[2][0] = handRotation[0].M[2][0]; - hmdRotation.M[2][1] = handRotation[0].M[2][1]; - hmdRotation.M[2][2] = handRotation[0].M[2][2]; + hmdRotation.set3x3(handRotation[0]); } else if(GuiHandler.guiRotation_room != null){ // look at screen, so that it's centered - hmdRotation.M[0][0] = GuiHandler.guiRotation_room.M[0][0]; - hmdRotation.M[0][1] = GuiHandler.guiRotation_room.M[0][1]; - hmdRotation.M[0][2] = GuiHandler.guiRotation_room.M[0][2]; - hmdRotation.M[1][0] = GuiHandler.guiRotation_room.M[1][0]; - hmdRotation.M[1][1] = GuiHandler.guiRotation_room.M[1][1]; - hmdRotation.M[1][2] = GuiHandler.guiRotation_room.M[1][2]; - hmdRotation.M[2][0] = GuiHandler.guiRotation_room.M[2][0]; - hmdRotation.M[2][1] = GuiHandler.guiRotation_room.M[2][1]; - hmdRotation.M[2][2] = GuiHandler.guiRotation_room.M[2][2]; - + hmdRotation.set3x3(GuiHandler.guiRotation_room); } - this.mc.getProfiler().popPush("hmdSampling"); + mc.getProfiler().popPush("hmdSampling"); this.hmdSampling(); - this.mc.getProfiler().pop(); + mc.getProfiler().pop(); } } @@ -158,7 +142,7 @@ protected ControllerType findActiveBindingControllerType(KeyMapping binding) } @Override - public Matrix4f getControllerComponentTransform(int controllerIndex, String componenetName) + public Matrix4f getControllerComponentTransform(int controllerIndex, String componentName) { return new Matrix4f(); } @@ -169,6 +153,11 @@ public String getOriginName(long handle) return "NullDriver"; } + @Override + public ControllerType getOriginControllerType(long inputValueHandle) { + return null; + } + @Override public boolean postinit() { @@ -183,7 +172,7 @@ public boolean hasThirdController() } @Override - public List getOrigins(VRInputAction var1) { + public List getOrigins(VRInputAction action) { return null; } @@ -194,7 +183,7 @@ public VRRenderer createVRRenderer() { @Override public boolean isActive() { - if (MethodHolder.isKeyDown(GLFW.GLFW_KEY_RIGHT_CONTROL) && MethodHolder.isKeyDown(GLFW.GLFW_KEY_F6)) { + if (VRHotkeys.isKeyDown(GLFW_KEY_RIGHT_CONTROL) && VRHotkeys.isKeyDown(GLFW_KEY_F6)) { if (!vrActiveChangedLastFrame) { vrActive = !vrActive; vrActiveChangedLastFrame = true; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVRStereoRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVRStereoRenderer.java index b8503192e..d978c6f00 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVRStereoRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVRStereoRenderer.java @@ -1,16 +1,20 @@ package org.vivecraft.client_vr.provider.nullvr; +import org.vivecraft.client_vr.provider.MCVR; +import org.vivecraft.client_vr.render.RenderPass; + +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11C; + import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.TextureUtil; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.util.Tuple; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; -import org.vivecraft.client_vr.provider.MCVR; -import org.vivecraft.client_vr.provider.VRRenderer; -import org.vivecraft.client_vr.render.RenderPass; -public class NullVRStereoRenderer extends VRRenderer +import static org.vivecraft.common.utils.Utils.logger; + +public class NullVRStereoRenderer extends org.vivecraft.client_vr.provider.VRRenderer { public NullVRStereoRenderer(MCVR vr) { @@ -20,50 +24,37 @@ public NullVRStereoRenderer(MCVR vr) @Override public Tuple getRenderTextureSizes() { - if (this.resolution != null) - { - return this.resolution; - } - else - { + if (this.resolution == null) { this.resolution = new Tuple<>(2048, 2048); - System.out.println("NullVR Render Res " + this.resolution.getA() + " x " + this.resolution.getB()); + logger.info("NullVR Render Res {} x {}", this.resolution.getA(), this.resolution.getB()); this.ss = -1.0F; - System.out.println("NullVR Supersampling: " + this.ss); - - return this.resolution; + logger.info("NullVR Supersampling: {}", this.ss); } + return this.resolution; } - @Override - public Matrix4f getProjectionMatrix(int eyeType, float nearClip, float farClip) + public Matrix4f getProjectionMatrix(int eyeType, double nearClip, double farClip, Matrix4f dest) { - return new Matrix4f().setPerspective(90.0F, 1.0F, nearClip, farClip); - } - - @Override - public String getLastError() - { - return ""; + return dest.setPerspective(90.0F, 1.0F, (float) nearClip, (float) farClip); } @Override public void createRenderTexture(int lwidth, int lheight) { this.LeftEyeTextureId = GlStateManager._genTexture(); - int i = GlStateManager._getInteger(GL11.GL_TEXTURE_BINDING_2D); + int i = GlStateManager._getInteger(GL11C.GL_TEXTURE_BINDING_2D); RenderSystem.bindTexture(this.LeftEyeTextureId); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - GlStateManager._texImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, lwidth, lheight, 0, GL11.GL_RGBA, GL11.GL_INT, null); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); + GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA8, lwidth, lheight, 0, GL11C.GL_RGBA, GL11C.GL_INT, null); RenderSystem.bindTexture(i); this.RightEyeTextureId = GlStateManager._genTexture(); - i = GlStateManager._getInteger(GL11.GL_TEXTURE_BINDING_2D); + i = GlStateManager._getInteger(GL11C.GL_TEXTURE_BINDING_2D); RenderSystem.bindTexture(this.RightEyeTextureId); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - GlStateManager._texImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, lwidth, lheight, 0, GL11.GL_RGBA, GL11.GL_INT, null); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); + GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA8, lwidth, lheight, 0, GL11C.GL_RGBA, GL11C.GL_INT, null); RenderSystem.bindTexture(i); } @@ -72,12 +63,6 @@ public void endFrame() { } - @Override - public boolean providesStencilMask() - { - return false; - } - @Override public float[] getStencilMask(RenderPass eye) @@ -91,18 +76,6 @@ public String getName() return "NullVR"; } - @Override - public boolean isInitialized() - { - return this.vr.initSuccess; - } - - @Override - public String getinitError() - { - return this.vr.initStatus; - } - @Override public void destroy() { super.destroy(); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index 00f7f43da..154195a33 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -1,23 +1,7 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.blaze3d.platform.InputConstants; -import com.sun.jna.NativeLibrary; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.phys.Vec3; -import org.joml.Vector2f; -import org.lwjgl.openvr.*; -import org.lwjgl.system.MemoryStack; -import org.lwjgl.system.MemoryUtil; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; @@ -26,49 +10,71 @@ import org.vivecraft.client_vr.provider.openvr_lwjgl.control.VRInputActionSet; import org.vivecraft.client_vr.render.RenderConfigException; import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.HUDLock; import org.vivecraft.client_vr.utils.external.jinfinadeck; import org.vivecraft.client_vr.utils.external.jkatvr; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Vector3; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.sun.jna.NativeLibrary; +import org.joml.*; +import org.lwjgl.openvr.*; +import org.lwjgl.openvr.VRBoneTransform.Buffer; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; + +import com.mojang.blaze3d.platform.InputConstants.Type; + +import net.minecraft.client.KeyMapping; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.OutputStreamWriter; import java.lang.management.ManagementFactory; +import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.LongBuffer; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.stream.Collectors; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; +import static org.joml.Math.*; import static org.lwjgl.openvr.VR.*; import static org.lwjgl.openvr.VRApplications.*; import static org.lwjgl.openvr.VRCompositor.*; import static org.lwjgl.openvr.VRInput.*; -import static org.lwjgl.openvr.VRRenderModels.*; +import static org.lwjgl.openvr.VRRenderModels.VRRenderModels_GetComponentButtonMask; +import static org.lwjgl.openvr.VRRenderModels.VRRenderModels_GetComponentStateForDevicePath; import static org.lwjgl.openvr.VRSettings.VRSettings_GetFloat; import static org.lwjgl.openvr.VRSystem.*; public class MCOpenVR extends MCVR { - public static final int LEFT_CONTROLLER = 1; - public static final int RIGHT_CONTROLLER = 0; - public static final int THIRD_CONTROLLER = 2; protected static MCOpenVR ome; private final String ACTION_EXTERNAL_CAMERA = "/actions/mixedreality/in/externalcamera"; private final String ACTION_LEFT_HAND = "/actions/global/in/lefthand"; + private final String ACTION_LEFT_HAND_GESTURE = "/actions/global/in/lefthandbones"; private final String ACTION_LEFT_HAPTIC = "/actions/global/out/lefthaptic"; private final String ACTION_RIGHT_HAND = "/actions/global/in/righthand"; + private final String ACTION_RIGHT_HAND_GESTURE = "/actions/global/in/righthandbones"; private final String ACTION_RIGHT_HAPTIC = "/actions/global/out/righthaptic"; - private Map actionSetHandles = new EnumMap<>(VRInputActionSet.class); + private final Map actionSetHandles = new EnumMap<>(VRInputActionSet.class); private VRActiveActionSet.Buffer activeActionSetsBuffer; private Map controllerComponentNames; private Map controllerComponentTransforms; - private boolean dbg = true; + private boolean getDeviceProperties = true; private long externalCameraPoseHandle; - private int[] controllerDeviceIndex = new int[3]; + private final int[] controllerDeviceIndex = new int[2]; private boolean getXforms = true; private final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create(); private final IntBuffer hmdErrorStore = MemoryUtil.memCallocInt(1); @@ -78,31 +84,35 @@ public class MCOpenVR extends MCVR { private long leftControllerHandle; private long leftHapticHandle; private long leftPoseHandle; - private InputOriginInfo originInfo; + private long leftGestureHandle; + private final InputOriginInfo originInfo; private boolean paused = false; - private InputPoseActionData poseData; + private final InputPoseActionData poseData; + private final InputPoseActionData gestureData; private long rightControllerHandle; private long rightHapticHandle; private long rightPoseHandle; + private long rightGestureHandle; private final VRTextureBounds texBounds = VRTextureBounds.calloc(); - private Map trackpadSwipeSamplers = new HashMap<>(); + private final Map trackpadSwipeSamplers = new HashMap<>(); private boolean tried; - private Queue vrEvents = new LinkedList<>(); + private final Queue vrEvents = new LinkedList<>(); final Texture texType0 = Texture.calloc(); final Texture texType1 = Texture.calloc(); InputDigitalActionData digital = InputDigitalActionData.calloc(); InputAnalogActionData analog = InputAnalogActionData.calloc(); - public MCOpenVR(Minecraft mc, ClientDataHolderVR dh) { - super(mc, dh, VivecraftVRMod.INSTANCE); + public MCOpenVR() { + super(); ome = this; this.hapticScheduler = new OpenVRHapticScheduler(); - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < controllerDeviceIndex.length; ++i) { this.controllerDeviceIndex[i] = -1; } this.poseData = InputPoseActionData.calloc(); + this.gestureData = InputPoseActionData.calloc(); this.originInfo = InputOriginInfo.calloc(); } @@ -111,64 +121,30 @@ public static MCOpenVR get() { } static String getInputErrorName(int code) { - switch (code) { - case 0: - return "wat"; - - case 1: - return "NameNotFound"; - - case 2: - return "WrongType"; - - case 3: - return "InvalidHandle"; - - case 4: - return "InvalidParam"; - - case 5: - return "NoSteam"; - - case 6: - return "MaxCapacityReached"; - - case 7: - return "IPCError"; - - case 8: - return "NoActiveActionSet"; - - case 9: - return "InvalidDevice"; - - case 10: - return "InvalidSkeleton"; - - case 11: - return "InvalidBoneCount"; - - case 12: - return "InvalidCompressedData"; - - case 13: - return "NoData"; - - case 14: - return "BufferTooSmall"; - - case 15: - return "MismatchedActionManifest"; - - case 16: - return "MissingSkeletonData"; - - case 17: - return "InvalidBoneIndex"; - - default: - return "Unknown"; - } + return switch (code) { + case EVRInputError_VRInputError_None -> "None"; + case EVRInputError_VRInputError_NameNotFound -> "NameNotFound"; + case EVRInputError_VRInputError_WrongType -> "WrongType"; + case EVRInputError_VRInputError_InvalidHandle -> "InvalidHandle"; + case EVRInputError_VRInputError_InvalidParam -> "InvalidParam"; + case EVRInputError_VRInputError_NoSteam -> "NoSteam"; + case EVRInputError_VRInputError_MaxCapacityReached -> "MaxCapacityReached"; + case EVRInputError_VRInputError_IPCError -> "IPCError"; + case EVRInputError_VRInputError_NoActiveActionSet -> "NoActiveActionSet"; + case EVRInputError_VRInputError_InvalidDevice -> "InvalidDevice"; + case EVRInputError_VRInputError_InvalidSkeleton -> "InvalidSkeleton"; + case EVRInputError_VRInputError_InvalidBoneCount -> "InvalidBoneCount"; + case EVRInputError_VRInputError_InvalidCompressedData -> "InvalidCompressedData"; + case EVRInputError_VRInputError_NoData -> "NoData"; + case EVRInputError_VRInputError_BufferTooSmall -> "BufferTooSmall"; + case EVRInputError_VRInputError_MismatchedActionManifest -> "MismatchedActionManifest"; + case EVRInputError_VRInputError_MissingSkeletonData -> "MissingSkeletonData"; + case EVRInputError_VRInputError_InvalidBoneIndex -> "InvalidBoneIndex"; + case EVRInputError_VRInputError_InvalidPriority -> "InvalidPriority"; + case EVRInputError_VRInputError_PermissionDenied -> "PermissionDenied"; + case EVRInputError_VRInputError_InvalidRenderModel -> "InvalidRenderModel"; + default -> "Unknown"; + }; } public void destroy() { @@ -177,11 +153,11 @@ public void destroy() { VR_ShutdownInternal(); this.initialized = false; - if (ClientDataHolderVR.katvr) { + if (dh.katvr) { jkatvr.Halt(); } - if (ClientDataHolderVR.infinadeck) { + if (dh.infinadeck) { jinfinadeck.Destroy(); } } catch (Throwable throwable) { @@ -204,7 +180,7 @@ public Vector2f getPlayAreaSize() { FloatBuffer pSizeZ = stack.callocFloat(1); FloatBuffer pSizeX = stack.callocFloat(1); boolean b0 = VRChaperone.VRChaperone_GetPlayAreaSize(pSizeX, pSizeZ); - return b0 ? new Vector2f(pSizeX.get(0) * this.dh.vrSettings.walkMultiplier, pSizeZ.get(0) * this.dh.vrSettings.walkMultiplier) : null; + return b0 ? new Vector2f(pSizeX.get(0) * dh.vrSettings.walkMultiplier, pSizeZ.get(0) * dh.vrSettings.walkMultiplier) : null; } else { return null; } @@ -218,7 +194,6 @@ public boolean init() { return this.initialized; } else { this.tried = true; - this.mc = Minecraft.getInstance(); try { this.initializeOpenVR(); this.initOpenVRCompositor(); @@ -236,52 +211,50 @@ public boolean init() { } if (OpenVR.VRInput == null) { - System.out.println("Controller input not available. Forcing seated mode."); - this.dh.vrSettings.seated = true; + logger.info("Controller input not available. Forcing seated mode."); + dh.vrSettings.seated = true; } - System.out.println("OpenVR initialized & VR connected."); - this.deviceVelocity = new Vec3[64]; + logger.info("OpenVR initialized & VR connected."); for (int i = 0; i < this.poseMatrices.length; ++i) { this.poseMatrices[i] = new Matrix4f(); - this.deviceVelocity[i] = new Vec3(0.0D, 0.0D, 0.0D); } this.initialized = true; - if (ClientDataHolderVR.katvr) { + if (dh.katvr) { try { - System.out.println("Waiting for KATVR...."); + logger.info("Waiting for KATVR...."); Utils.unpackNatives("katvr"); - NativeLibrary.addSearchPath("WalkerBase.dll", (new File("openvr/katvr")).getAbsolutePath()); + NativeLibrary.addSearchPath("WalkerBase.dll", new File("openvr/katvr").getAbsolutePath()); jkatvr.Init(1); jkatvr.Launch(); if (jkatvr.CheckForLaunch()) { - System.out.println("KATVR Loaded"); + logger.info("KATVR Loaded"); } else { - System.out.println("KATVR Failed to load"); + logger.info("KATVR Failed to load"); } } catch (Exception exception1) { - System.out.println("KATVR crashed: " + exception1.getMessage()); + logger.error("KATVR crashed: {}", exception1.getMessage()); } } - if (ClientDataHolderVR.infinadeck) { + if (dh.infinadeck) { try { - System.out.println("Waiting for Infinadeck...."); + logger.info("Waiting for Infinadeck...."); Utils.unpackNatives("infinadeck"); NativeLibrary.addSearchPath("InfinadeckAPI.dll", (new File("openvr/infinadeck")).getAbsolutePath()); if (jinfinadeck.InitConnection()) { jinfinadeck.CheckConnection(); - System.out.println("Infinadeck Loaded"); + logger.info("Infinadeck Loaded"); } else { - System.out.println("Infinadeck Failed to load"); + logger.warn("Infinadeck Failed to load"); } } catch (Exception exception) { - System.out.println("Infinadeck crashed: " + exception.getMessage()); + logger.error("Infinadeck crashed: {}", exception.getMessage()); } } @@ -292,38 +265,36 @@ public boolean init() { public void poll(long frameIndex) { if (this.initialized) { this.paused = VRSystem_ShouldApplicationPause(); - this.mc.getProfiler().push("events"); + mc.getProfiler().push("events"); this.pollVREvents(); - if (!this.dh.vrSettings.seated) { - this.mc.getProfiler().popPush("controllers"); - this.mc.getProfiler().push("gui"); + if (!dh.vrSettings.seated) { + mc.getProfiler().popPush("controllers"); + mc.getProfiler().push("gui"); - if (this.mc.screen == null && this.dh.vrSettings.vrTouchHotbar) { - VRSettings vrsettings = this.dh.vrSettings; - - if (this.dh.vrSettings.vrHudLockMode != VRSettings.HUDLock.HEAD && this.hudPopup) { + if (mc.screen == null && dh.vrSettings.vrTouchHotbar) { + if (dh.vrSettings.vrHudLockMode != HUDLock.HEAD && this.hudPopup) { this.processHotbar(); } } - this.mc.getProfiler().pop(); + mc.getProfiler().pop(); } - this.mc.getProfiler().popPush("processEvents"); + mc.getProfiler().popPush("processEvents"); this.processVREvents(); - this.mc.getProfiler().popPush("updatePose/Vsync"); + mc.getProfiler().popPush("updatePose/Vsync"); this.updatePose(); - this.mc.getProfiler().popPush("processInputs"); + mc.getProfiler().popPush("processInputs"); this.processInputs(); - this.mc.getProfiler().popPush("hmdSampling"); + mc.getProfiler().popPush("hmdSampling"); this.hmdSampling(); - this.mc.getProfiler().pop(); + mc.getProfiler().pop(); } } public void processInputs() { - if (!this.dh.vrSettings.seated && !ClientDataHolderVR.viewonly && this.inputInitialized) { + if (!dh.vrSettings.seated && !dh.viewonly && this.inputInitialized) { for (VRInputAction vrinputaction : this.inputActions.values()) { if (vrinputaction.isHanded()) { for (ControllerType controllertype : ControllerType.values()) { @@ -335,34 +306,30 @@ public void processInputs() { } } - this.processScrollInput(GuiHandler.keyScrollAxis, () -> - { - InputSimulator.scrollMouse(0.0D, 1.0D); - }, () -> - { - InputSimulator.scrollMouse(0.0D, -1.0D); - }); - this.processScrollInput(VivecraftVRMod.INSTANCE.keyHotbarScroll, () -> - { - this.changeHotbar(-1); - }, () -> - { - this.changeHotbar(1); - }); - this.processSwipeInput(VivecraftVRMod.INSTANCE.keyHotbarSwipeX, () -> - { - this.changeHotbar(1); - }, () -> - { - this.changeHotbar(-1); - }, (Runnable) null, (Runnable) null); - this.processSwipeInput(VivecraftVRMod.INSTANCE.keyHotbarSwipeY, (Runnable) null, (Runnable) null, () -> - { - this.changeHotbar(-1); - }, () -> - { - this.changeHotbar(1); - }); + this.processScrollInput( + GuiHandler.keyScrollAxis, + () -> InputSimulator.scrollMouse(0.0D, 1.0D), + () -> InputSimulator.scrollMouse(0.0D, -1.0D) + ); + this.processScrollInput( + VivecraftVRMod.keyHotbarScroll, + () -> this.changeHotbar(-1), + () -> this.changeHotbar(1) + ); + this.processSwipeInput( + VivecraftVRMod.keyHotbarSwipeX, + () -> this.changeHotbar(1), + () -> this.changeHotbar(-1), + null, + null + ); + this.processSwipeInput( + VivecraftVRMod.keyHotbarSwipeY, + null, + null, + () -> this.changeHotbar(-1), + () -> this.changeHotbar(1) + ); this.ignorePressesNextFrame = false; } } @@ -381,39 +348,35 @@ private boolean isError() { } private void debugOut(int deviceindex) { -// System.out.println("******************* VR DEVICE: " + deviceindex + " *************************"); -// -// for (Field field : VR.ETrackedDeviceProperty.class.getDeclaredFields()) { -// try { -// String[] astring = field.getName().split("_"); -// String s = astring[astring.length - 1]; -// String s1 = ""; -// -// VRSystem_ShouldApplicationPause() -// -// if (s.equals("Float")) { -// s1 = s1 + field.getName() + " " + this.vrsystem.GetFloatTrackedDeviceProperty.apply(deviceindex, field.getInt((Object) null), this.hmdErrorStore); -// } else if (s.equals("String")) { -// Pointer pointer = new Memory(32768L); -// this.vrsystem.GetStringTrackedDeviceProperty.apply(deviceindex, field.getInt((Object) null), pointer, 32767, this.hmdErrorStore); -// s1 = s1 + field.getName() + " " + pointer.getString(0L); -// } else if (s.equals("Bool")) { -// s1 = s1 + field.getName() + " " + this.vrsystem.GetBoolTrackedDeviceProperty.apply(deviceindex, field.getInt((Object) null), this.hmdErrorStore); -// } else if (s.equals("Int32")) { -// s1 = s1 + field.getName() + " " + this.vrsystem.GetInt32TrackedDeviceProperty.apply(deviceindex, field.getInt((Object) null), this.hmdErrorStore); -// } else if (s.equals("Uint64")) { -// s1 = s1 + field.getName() + " " + this.vrsystem.GetUint64TrackedDeviceProperty.apply(deviceindex, field.getInt((Object) null), this.hmdErrorStore); -// } else { -// s1 = s1 + field.getName() + " (skipped)"; -// } -// -// System.out.println(s1.replace("ETrackedDeviceProperty_Prop_", "")); -// } catch (IllegalAccessException illegalaccessexception) { -// illegalaccessexception.printStackTrace(); -// } -// } -// -// System.out.println("******************* END VR DEVICE: " + deviceindex + " *************************"); + try { + StringBuilder VRDeviceProps = new StringBuilder(5653); // 5653 is the count of guaranteed characters to print + for (Field field : VR.class.getDeclaredFields()) { + String[] field_words = field.getName().split("_"); + + if (Arrays.asList(field_words).contains("ETrackedDeviceProperty")) + { + VRDeviceProps.append(field.getName().replace("ETrackedDeviceProperty_Prop_", "\n")).append(" ").append( + switch (field_words[field_words.length - 1]) + { + case "Float" -> + VRSystem_GetFloatTrackedDeviceProperty(deviceindex, field.getInt(null), this.hmdErrorStore); + case "String" -> + VRSystem_GetStringTrackedDeviceProperty(deviceindex, field.getInt(null), this.hmdErrorStore); + case "Bool" -> + VRSystem_GetBoolTrackedDeviceProperty(deviceindex, field.getInt(null), this.hmdErrorStore); + case "Int32" -> + VRSystem_GetInt32TrackedDeviceProperty(deviceindex, field.getInt(null), this.hmdErrorStore); + case "Uint64" -> + VRSystem_GetUint64TrackedDeviceProperty(deviceindex, field.getInt(null), this.hmdErrorStore); + default -> "(skipped)"; + } + ); + } + } + logger.info("VR DEVICE {}:{}", deviceindex, VRDeviceProps); + } catch (IllegalAccessException illegalaccessexception) { + illegalaccessexception.printStackTrace(); + } } protected ControllerType findActiveBindingControllerType(KeyMapping binding) { @@ -421,7 +384,7 @@ protected ControllerType findActiveBindingControllerType(KeyMapping binding) { return null; } else { long i = this.getInputAction(binding).getLastOrigin(); - return i != 0L ? this.getOriginControllerType(i) : null; + return i != k_ulInvalidInputValueHandle ? this.getOriginControllerType(i) : null; } } @@ -432,7 +395,7 @@ private void generateActionManifest() { for (VRInputActionSet vrinputactionset : VRInputActionSet.values()) { String s = vrinputactionset.usage; - if (vrinputactionset.advanced && !this.dh.vrSettings.allowAdvancedBindings) { + if (vrinputactionset.advanced && !dh.vrSettings.allowAdvancedBindings) { s = "hidden"; } @@ -451,11 +414,13 @@ private void generateActionManifest() { list2.add(ImmutableMap.builder().put("name", vrinputaction.name).put("requirement", vrinputaction.requirement).put("type", vrinputaction.type).build()); } - list2.add(ImmutableMap.builder().put("name", ACTION_LEFT_HAND).put("requirement", "suggested").put("type", "pose").build()); - list2.add(ImmutableMap.builder().put("name", ACTION_RIGHT_HAND).put("requirement", "suggested").put("type", "pose").build()); - list2.add(ImmutableMap.builder().put("name", ACTION_EXTERNAL_CAMERA).put("requirement", "optional").put("type", "pose").build()); - list2.add(ImmutableMap.builder().put("name", ACTION_LEFT_HAPTIC).put("requirement", "suggested").put("type", "vibration").build()); - list2.add(ImmutableMap.builder().put("name", ACTION_RIGHT_HAPTIC).put("requirement", "suggested").put("type", "vibration").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_LEFT_HAND).put("requirement", "suggested").put("type", "pose").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_LEFT_HAND_GESTURE).put("requirement", "optional").put("type", "skeleton").put("skeleton", "/skeleton/hand/left").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_LEFT_HAPTIC).put("requirement", "suggested").put("type", "vibration").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_RIGHT_HAND).put("requirement", "suggested").put("type", "pose").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_RIGHT_HAND_GESTURE).put("requirement", "optional").put("type", "skeleton").put("skeleton", "/skeleton/hand/right").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_RIGHT_HAPTIC).put("requirement", "suggested").put("type", "vibration").build()); + list2.add(ImmutableMap.builder().put("name", this.ACTION_EXTERNAL_CAMERA).put("requirement", "optional").put("type", "pose").build()); map.put("actions", list2); Map map1 = new HashMap<>(); @@ -469,11 +434,13 @@ private void generateActionManifest() { map1.put(vrinputactionset1.name, component.getString()); } - map1.put(ACTION_LEFT_HAND, "Left Hand Pose"); - map1.put(ACTION_RIGHT_HAND, "Right Hand Pose"); - map1.put(ACTION_EXTERNAL_CAMERA, "External Camera"); - map1.put(ACTION_LEFT_HAPTIC, "Left Hand Haptic"); - map1.put(ACTION_RIGHT_HAPTIC, "Right Hand Haptic"); + map1.put(this.ACTION_LEFT_HAND, "Left Hand Pose"); + map1.put(this.ACTION_LEFT_HAND_GESTURE, "Left Hand Gestures"); + map1.put(this.ACTION_LEFT_HAPTIC, "Left Hand Haptic"); + map1.put(this.ACTION_RIGHT_HAND, "Right Hand Pose"); + map1.put(this.ACTION_RIGHT_HAND_GESTURE, "Right Hand Gestures"); + map1.put(this.ACTION_RIGHT_HAPTIC, "Right Hand Haptic"); + map1.put(this.ACTION_EXTERNAL_CAMERA, "External Camera"); map1.put("language_tag", "en_US"); map.put("localization", ImmutableList.>builder().add(map1).build()); List> list3 = new ArrayList<>(); @@ -495,7 +462,7 @@ private void generateActionManifest() { throw new RuntimeException("Failed to write action manifest", exception); } - String s1 = this.dh.vrSettings.reverseHands ? "_reversed" : ""; + String s1 = dh.vrSettings.reverseHands ? "_reversed" : ""; Utils.loadAssetToFile("input/vive_defaults" + s1 + ".json", new File("openvr/input/vive_defaults.json"), false); Utils.loadAssetToFile("input/oculus_defaults" + s1 + ".json", new File("openvr/input/oculus_defaults.json"), false); Utils.loadAssetToFile("input/wmr_defaults" + s1 + ".json", new File("openvr/input/wmr_defaults.json"), false); @@ -507,9 +474,9 @@ private void generateActionManifest() { private long getActionHandle(String name) { try (MemoryStack stack = MemoryStack.stackPush()) { LongBuffer longbyreference = stack.callocLong(1); - int i = VRInput.VRInput_GetActionHandle(name, longbyreference); + int i = VRInput_GetActionHandle(name, longbyreference); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting action handle for '" + name + "': " + getInputErrorName(i)); } else { return longbyreference.get(0); @@ -527,17 +494,17 @@ private boolean updateActiveActionSets() { arraylist.add(VRInputActionSet.MIXED_REALITY); arraylist.add(VRInputActionSet.TECHNICAL); - if (this.mc.screen == null) { + if (mc.screen == null) { arraylist.add(VRInputActionSet.INGAME); arraylist.add(VRInputActionSet.CONTEXTUAL); } else { arraylist.add(VRInputActionSet.GUI); - if (ClientDataHolderVR.getInstance().vrSettings.ingameBindingsInGui) { + if (dh.vrSettings.ingameBindingsInGui) { arraylist.add(VRInputActionSet.INGAME); } } - if (KeyboardHandler.Showing || RadialHandler.isShowing()) { + if (KeyboardHandler.isShowing() || RadialHandler.isShowing()) { arraylist.add(VRInputActionSet.KEYBOARD); } @@ -550,14 +517,14 @@ private boolean updateActiveActionSets() { for (int i = 0; i < arraylist.size(); ++i) { VRInputActionSet vrinputactionset = arraylist.get(i); - activeActionSetsBuffer.get(i).set(this.getActionSetHandle(vrinputactionset), 0L, 0, 0); + activeActionSetsBuffer.get(i).set(this.getActionSetHandle(vrinputactionset), k_ulInvalidInputValueHandle, k_ulInvalidInputValueHandle, 0 /*k_nActionSetPriorityReservedMin*/); } return !arraylist.isEmpty(); } - public Matrix4f getControllerComponentTransform(int controllerIndex, String componenetName) { - return this.controllerComponentTransforms != null && this.controllerComponentTransforms.containsKey(componenetName) && ((Matrix4f[]) this.controllerComponentTransforms.get(componenetName))[controllerIndex] != null ? (this.controllerComponentTransforms.get(componenetName))[controllerIndex] : Utils.Matrix4fSetIdentity(new Matrix4f()); + public Matrix4f getControllerComponentTransform(int controllerIndex, String componentName) { + return this.controllerComponentTransforms != null && this.controllerComponentTransforms.containsKey(componentName) && this.controllerComponentTransforms.get(componentName)[controllerIndex] != null ? (this.controllerComponentTransforms.get(componentName))[controllerIndex] : new Matrix4f(); } private Matrix4f getControllerComponentTransformFromButton(int controllerIndex, long button) { @@ -578,11 +545,11 @@ public String memUTF8NullTerminated(ByteBuffer buf) { public String getOriginName(long handle) { try (MemoryStack stack = MemoryStack.stackPush()) { - ByteBuffer str = stack.calloc(32768); + ByteBuffer str = stack.calloc(k_unMaxPropertyStringSize); // omit controller type - int i = VRInput_GetOriginLocalizedName(handle, str, 5); + int i = VRInput_GetOriginLocalizedName(handle, str, EVRInputStringBits_VRInputString_Hand | EVRInputStringBits_VRInputString_InputSource); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting origin name: " + getInputErrorName(i)); } else { return memUTF8NullTerminated(str); @@ -605,73 +572,69 @@ private void getTransforms() { this.controllerComponentNames = new HashMap<>(); } - int i = VRRenderModels_GetRenderModelCount(); - List list = new ArrayList<>(); - list.add("tip"); - list.add("handgrip"); - boolean flag = false; + List componentNames = new ArrayList<>(); //TODO: get the controller-specific list + componentNames.add("tip"); + componentNames.add("handgrip"); + boolean failed = false; - for (String s : list) { - this.controllerComponentTransforms.put(s, new Matrix4f[2]); + for (String comp : componentNames) { + this.controllerComponentTransforms.put(comp, new Matrix4f[]{new Matrix4f(), new Matrix4f()}); - for (int j = 0; j < 2; ++j) { - if (this.controllerDeviceIndex[j] == -1) { - flag = true; + for (int i = 0; i < 2; ++i) { + if (this.controllerDeviceIndex[i] == -1) { + failed = true; } else { try (MemoryStack stack = MemoryStack.stackPush()) { - var stringBuffer = stack.calloc(32768); - VRSystem_GetStringTrackedDeviceProperty(this.controllerDeviceIndex[j], VR.ETrackedDeviceProperty_Prop_RenderModelName_String, stringBuffer, this.hmdErrorStore); - String renderModelName = memUTF8NullTerminated(stringBuffer); - VRSystem_GetStringTrackedDeviceProperty(controllerDeviceIndex[j], VR.ETrackedDeviceProperty_Prop_InputProfilePath_String, stringBuffer, this.hmdErrorStore); - String inputProfilePath = memUTF8NullTerminated(stringBuffer); - boolean flag1 = inputProfilePath.contains("holographic"); - boolean flag2 = inputProfilePath.contains("rifts"); - - var componentName = s; - if (flag1 && s.equals("handgrip")) { - componentName = "body"; - } + ByteBuffer stringBuffer = stack.calloc(k_unMaxPropertyStringSize); + VRSystem_GetStringTrackedDeviceProperty(this.controllerDeviceIndex[i], ETrackedDeviceProperty_Prop_RenderModelName_String, stringBuffer, this.hmdErrorStore); + String renderModelName = this.memUTF8NullTerminated(stringBuffer); + VRSystem_GetStringTrackedDeviceProperty(this.controllerDeviceIndex[i], ETrackedDeviceProperty_Prop_InputProfilePath_String, stringBuffer, this.hmdErrorStore); + String inputProfilePath = this.memUTF8NullTerminated(stringBuffer); + boolean isWMR = inputProfilePath.contains("holographic"); + boolean isRiftS = inputProfilePath.contains("rifts"); + + String componentName = isWMR && "handgrip".equals(comp) ? "body" : comp; long k = VRRenderModels_GetComponentButtonMask(renderModelName, componentName); - if (k > 0L) { - this.controllerComponentNames.put(k, s); + if (k > k_ulInvalidInputValueHandle) { + this.controllerComponentNames.put(k, comp); } - long l = j == 0 ? this.rightControllerHandle : this.leftControllerHandle; + long sourceHandle = i == 0 ? this.rightControllerHandle : this.leftControllerHandle; - if (l == 0L) { - flag = true; + if (sourceHandle == k_ulInvalidInputValueHandle) { + // print("Failed getting transform: " + comp + " controller " + i); + failed = true; } else { - var renderModelComponentState = RenderModelComponentState.calloc(stack); - boolean b0 = VRRenderModels_GetComponentStateForDevicePath(renderModelName, componentName, l, RenderModelControllerModeState.calloc(stack), renderModelComponentState); + RenderModelComponentState renderModelComponentState = RenderModelComponentState.calloc(stack); + boolean b0 = VRRenderModels_GetComponentStateForDevicePath(renderModelName, componentName, sourceHandle, RenderModelControllerModeState.calloc(stack), renderModelComponentState); if (!b0) { - flag = true; + failed = true; } else { - Matrix4f matrix4f = new Matrix4f(); - OpenVRUtil.convertSteamVRMatrix3ToMatrix4f(renderModelComponentState.mTrackingToComponentLocal(), matrix4f); - (this.controllerComponentTransforms.get(s))[j] = matrix4f; + convertRM34ToCM44( + renderModelComponentState.mTrackingToComponentLocal().m(), + this.controllerComponentTransforms.get(comp)[i] + ); - if (j == 1 && flag2 && s.equals("handgrip")) { - (this.controllerComponentTransforms.get(s))[1] = (this.controllerComponentTransforms.get(s))[0]; + if (i == 1 && isRiftS && "handgrip".equals(comp)) { + this.controllerComponentTransforms.get(comp)[1] = this.controllerComponentTransforms.get(comp)[0]; } - if (!flag && j == 0) { + if (!failed && i == 0) { try { - Matrix4f matrix4f1 = this.getControllerComponentTransform(0, "tip"); - Matrix4f matrix4f2 = this.getControllerComponentTransform(0, "handgrip"); - Vector3 vector3 = matrix4f1.transform(this.forward); - Vector3 vector31 = matrix4f2.transform(this.forward); - double d0 = (double) Math.abs(vector3.normalized().dot(vector31.normalized())); - double d1 = Math.acos(d0); - double d2 = Math.toDegrees(d1); - double d3 = Math.acos((double) vector3.normalized().dot(this.forward.normalized())); - double d4 = Math.toDegrees(d3); + Vector3f vector3 = new Vector3f(forward).mulProject(this.getControllerComponentTransform(0, "tip")); + Vector3f vector31 = new Vector3f(forward).mulProject(this.getControllerComponentTransform(0, "handgrip")); + double d0 = (double) abs(vector3.normalize(new Vector3f()).dot(vector31.normalize(new Vector3f()))); + double d1 = acos(d0); + double d2 = toDegrees(d1); + double d3 = acos((double) vector3.normalize(new Vector3f()).dot(forward.normalize(new Vector3f()))); + double d4 = toDegrees(d3); this.gunStyle = d2 > 10.0D; this.gunAngle = d2; } catch (Exception exception) { - flag = true; + failed = true; } } } @@ -680,23 +643,23 @@ private void getTransforms() { } } - this.getXforms = flag; + this.getXforms = failed; } } } private void initializeOpenVR() { this.hmdErrorStoreBuf = MemoryUtil.memCallocInt(1); - int token = VR.VR_InitInternal(this.hmdErrorStoreBuf, 1); + int token = VR_InitInternal(this.hmdErrorStoreBuf, EVRApplicationType_VRApplication_Scene); if (!this.isError()) { OpenVR.create(token); } if (OpenVR.VRSystem != null && !this.isError()) { - System.out.println("OpenVR System Initialized OK."); - this.hmdTrackedDevicePoses = TrackedDevicePose.calloc(64); - this.poseMatrices = new Matrix4f[64]; + logger.info("OpenVR System Initialized OK."); + this.hmdTrackedDevicePoses = TrackedDevicePose.calloc(k_unMaxTrackedDeviceCount); + this.poseMatrices = new Matrix4f[k_unMaxTrackedDeviceCount]; for (int i = 0; i < this.poseMatrices.length; ++i) { this.poseMatrices[i] = new Matrix4f(); @@ -704,7 +667,7 @@ private void initializeOpenVR() { this.initSuccess = true; } else { - throw new RuntimeException(VR.VR_GetVRInitErrorAsEnglishDescription(this.getError())); + throw new RuntimeException(VR_GetVRInitErrorAsEnglishDescription(this.getError())); } } @@ -731,43 +694,57 @@ private void initInputAndApplication() throws RenderConfigException { // if (!this.isError()) { // this.vrOpenComposite.setAutoSynch(false); // this.vrOpenComposite.read(); -// System.out.println("OpenComposite initialized."); +// logger.info("OpenComposite initialized."); // } else { -// System.out.println("OpenComposite not found: " + VR.VR_GetVRInitErrorAsEnglishDescription(this.getError()).getString(0L)); +// logger.error("OpenComposite not found: {}", VR.VR_GetVRInitErrorAsEnglishDescription(this.getError()).getString(0L)); // this.vrOpenComposite = null; // } // } private void initOpenVRCompositor() { if (OpenVR.VRSystem != null) { - VRCompositor_SetTrackingSpace(1); + VRCompositor_SetTrackingSpace(ETrackingUniverseOrigin_TrackingUniverseStanding); try (MemoryStack stack = MemoryStack.stackPush()) { - var pointer = stack.calloc(20); - System.out.println("TrackingSpace: " + VRCompositor_GetTrackingSpace()); - VRSystem_GetStringTrackedDeviceProperty(0, 1005, pointer, this.hmdErrorStore); - String s = memUTF8NullTerminated(pointer); - System.out.println("Device manufacturer is: " + s); + ByteBuffer pointer = stack.calloc(k_unMaxPropertyStringSize); + int trackingSpace = VRCompositor_GetTrackingSpace(); + logger.info( + "TrackingSpace: {} {}", + trackingSpace, + Arrays.stream(VR.class.getDeclaredFields()).filter( + field -> field.getName().contains("ETrackingUniverseOrigin_TrackingUniverse") + ).map(field -> { + try { + return (field.getInt(null) == trackingSpace ? + field.getName().replace("ETrackingUniverseOrigin_TrackingUniverse", "") : + "" + ); + } catch (Exception ignored){ return ""; } + }).collect(Collectors.joining()) + ); + VRSystem_GetStringTrackedDeviceProperty(k_unTrackedDeviceIndex_Hmd, ETrackedDeviceProperty_Prop_ManufacturerName_String, pointer, this.hmdErrorStore); + String s = this.memUTF8NullTerminated(pointer); + logger.info("Device manufacturer is: {}", s); this.detectedHardware = HardwareType.fromManufacturer(s); } - this.dh.vrSettings.loadOptions(); + dh.vrSettings.loadOptions(); VRHotkeys.loadExternalCameraConfig(); } if (OpenVR.VRCompositor == null) { - System.out.println("Skipping VR Compositor..."); + logger.info("Skipping VR Compositor..."); } this.texBounds.uMax(1.0F); this.texBounds.uMin(0.0F); this.texBounds.vMax(1.0F); this.texBounds.vMin(0.0F); - this.texType0.eColorSpace(VR.EColorSpace_ColorSpace_Gamma); - this.texType0.eType(VR.ETextureType_TextureType_OpenGL); - this.texType0.handle(-1); - this.texType1.eColorSpace(VR.EColorSpace_ColorSpace_Gamma); - this.texType1.eType(VR.ETextureType_TextureType_OpenGL); - this.texType1.handle(-1); - System.out.println("OpenVR Compositor initialized OK."); + this.texType0.eColorSpace(EColorSpace_ColorSpace_Gamma); + this.texType0.eType(ETextureType_TextureType_OpenGL); + this.texType0.handle(ETextureType_TextureType_Invalid); + this.texType1.eColorSpace(EColorSpace_ColorSpace_Gamma); + this.texType1.eType(ETextureType_TextureType_OpenGL); + this.texType1.handle(ETextureType_TextureType_Invalid); + logger.info("OpenVR Compositor initialized OK."); } private void installApplicationManifest(boolean force) throws RenderConfigException { @@ -786,19 +763,19 @@ private void installApplicationManifest(boolean force) throws RenderConfigExcept Map map = (new Gson()).fromJson(new FileReader(file1), Map.class); s = ((Map) ((List) map.get("applications")).get(0)).get("app_key").toString(); } catch (Exception exception1) { - System.out.println("Error reading appkey from manifest"); + logger.error("Error reading appkey from manifest"); exception1.printStackTrace(); return; } - System.out.println("Appkey: " + s); + logger.info("Appkey: " + s); if (!force && VRApplications_IsApplicationInstalled(s)) { - System.out.println("Application manifest already installed"); + logger.warn("Application manifest already installed"); } else { int i = VRApplications_AddApplicationManifest(file1.getAbsolutePath(), true); - if (i != 0) { + if (i != EVRApplicationError_VRApplicationError_None) { // application needs to be installed, so abort String pathFormatted = ""; boolean hasInvalidChars = false; @@ -812,12 +789,12 @@ private void installApplicationManifest(boolean force) throws RenderConfigExcept } String error = VRApplications_GetApplicationsErrorNameFromEnum(i) + (hasInvalidChars ? "\nInvalid characters in path: \n" : "\n"); - System.out.println("Failed to install application manifest: " + error + file1.getAbsolutePath()); + logger.error("Failed to install application manifest: {}{}", error, file1.getAbsolutePath()); throw new RenderConfigException("Failed to install application manifest", Component.empty().append(error).append(pathFormatted)); } - System.out.println("Application manifest installed successfully"); + logger.info("Application manifest installed successfully"); } int j; @@ -826,17 +803,17 @@ private void installApplicationManifest(boolean force) throws RenderConfigExcept String s1 = ManagementFactory.getRuntimeMXBean().getName(); j = Integer.parseInt(s1.split("@")[0]); } catch (Exception exception) { - System.out.println("Error getting process id"); + logger.error("Error getting process id"); exception.printStackTrace(); return; } int k = VRApplications_IdentifyApplication(j, s); - if (k != 0) { - System.out.println("Failed to identify application: " + VRApplications_GetApplicationsErrorNameFromEnum(k)); + if (k != EVRApplicationError_VRApplicationError_None) { + logger.error("Failed to identify application: {}", VRApplications_GetApplicationsErrorNameFromEnum(k)); } else { - System.out.println("Application identified successfully"); + logger.info("Application identified successfully"); } } } @@ -848,23 +825,25 @@ private void loadActionHandles() { for (VRInputAction vrinputaction : this.inputActions.values()) { int i = VRInput_GetActionHandle(vrinputaction.name, longbyreference); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting action handle for '" + vrinputaction.name + "': " + getInputErrorName(i)); } vrinputaction.setHandle(longbyreference.get(0)); } - this.leftPoseHandle = this.getActionHandle(ACTION_LEFT_HAND); - this.rightPoseHandle = this.getActionHandle(ACTION_RIGHT_HAND); - this.leftHapticHandle = this.getActionHandle(ACTION_LEFT_HAPTIC); - this.rightHapticHandle = this.getActionHandle(ACTION_RIGHT_HAPTIC); - this.externalCameraPoseHandle = this.getActionHandle(ACTION_EXTERNAL_CAMERA); + this.leftPoseHandle = this.getActionHandle(this.ACTION_LEFT_HAND); + this.leftGestureHandle = this.getActionHandle(this.ACTION_LEFT_HAND_GESTURE); + this.leftHapticHandle = this.getActionHandle(this.ACTION_LEFT_HAPTIC); + this.rightPoseHandle = this.getActionHandle(this.ACTION_RIGHT_HAND); + this.rightGestureHandle = this.getActionHandle(this.ACTION_RIGHT_HAND_GESTURE); + this.rightHapticHandle = this.getActionHandle(this.ACTION_RIGHT_HAPTIC); + this.externalCameraPoseHandle = this.getActionHandle(this.ACTION_EXTERNAL_CAMERA); for (VRInputActionSet vrinputactionset : VRInputActionSet.values()) { int j = VRInput_GetActionSetHandle(vrinputactionset.name, longbyreference); - if (j != 0) { + if (j != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting action set handle for '" + vrinputactionset.name + "': " + getInputErrorName(j)); } @@ -879,7 +858,7 @@ private void loadActionHandles() { private void loadActionManifest() { int i = VRInput_SetActionManifestPath((new File("openvr/input/action_manifest.json")).getAbsolutePath()); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Failed to load action manifest: " + getInputErrorName(i)); } } @@ -895,8 +874,8 @@ private void pollVREvents() { private void processInputAction(VRInputAction action) { if (action.isActive() && action.isEnabledRaw() // try to prevent double left clicks - && (!ClientDataHolderVR.getInstance().vrSettings.ingameBindingsInGui - || !(action.actionSet == VRInputActionSet.INGAME && action.keyBinding.key.getType() == InputConstants.Type.MOUSE && action.keyBinding.key.getValue() == 0 && mc.screen != null))) { + && (!dh.vrSettings.ingameBindingsInGui + || !(action.actionSet == VRInputActionSet.INGAME && action.keyBinding.key.getType() == Type.MOUSE && action.keyBinding.key.getValue() == 0 && mc.screen != null))) { if (action.isButtonChanged()) { if (action.isButtonPressed() && action.isEnabled()) { if (!this.ignorePressesNextFrame) { @@ -914,8 +893,8 @@ private void processInputAction(VRInputAction action) { private void processScrollInput(KeyMapping keyBinding, Runnable upCallback, Runnable downCallback) { VRInputAction vrinputaction = this.getInputAction(keyBinding); - if (vrinputaction.isEnabled() && vrinputaction.getLastOrigin() != 0L && vrinputaction.getAxis2D(true).getY() != 0.0F) { - float f = vrinputaction.getAxis2D(false).getY(); + if (vrinputaction.isEnabled() && vrinputaction.getLastOrigin() != k_ulInvalidInputValueHandle && vrinputaction.getAxis2D(true).y() != 0.0F) { + float f = vrinputaction.getAxis2D(false).y(); if (f > 0.0F) { upCallback.run(); @@ -928,7 +907,7 @@ private void processScrollInput(KeyMapping keyBinding, Runnable upCallback, Runn private void processSwipeInput(KeyMapping keyBinding, Runnable leftCallback, Runnable rightCallback, Runnable upCallback, Runnable downCallback) { VRInputAction vrinputaction = this.getInputAction(keyBinding); - if (vrinputaction.isEnabled() && vrinputaction.getLastOrigin() != 0L) { + if (vrinputaction.isEnabled() && vrinputaction.getLastOrigin() != k_ulInvalidInputValueHandle) { ControllerType controllertype = this.findActiveBindingControllerType(keyBinding); if (controllertype != null) { @@ -967,16 +946,13 @@ private void processVREvents() { VREvent vrevent = this.vrEvents.poll(); switch (vrevent.eventType()) { - case 100: - case 101: - case 102: - case 108: - case 853: - this.getXforms = true; - break; - - case 700: - this.mc.stop(); + case EVREventType_VREvent_TrackedDeviceActivated, + EVREventType_VREvent_TrackedDeviceDeactivated, + EVREventType_VREvent_TrackedDeviceUpdated, + EVREventType_VREvent_TrackedDeviceRoleChanged, + EVREventType_VREvent_ModelSkinSettingsHaveChanged + -> this.getXforms = true; + case EVREventType_VREvent_Quit -> mc.stop(); } } } @@ -984,153 +960,207 @@ private void processVREvents() { private void readOriginInfo(long inputValueHandle) { int i = VRInput_GetOriginTrackedDeviceInfo(inputValueHandle, this.originInfo, InputOriginInfo.SIZEOF); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error reading origin info: " + getInputErrorName(i)); } } - private void readPoseData(long actionHandle) { - int i = VRInput_GetPoseActionDataForNextFrame(actionHandle, 1, this.poseData, InputPoseActionData.SIZEOF, 0L); + private void readPoseData(long actionHandle, InputPoseActionData holder) { + int i = VRInput_GetPoseActionDataForNextFrame(actionHandle, ETrackingUniverseOrigin_TrackingUniverseStanding, holder, InputPoseActionData.SIZEOF, k_ulInvalidActionHandle); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error reading pose data: " + getInputErrorName(i)); } } private void updateControllerPose(int controller, long actionHandle) { - if (this.TPose) { - if (controller == 0) { - Utils.Matrix4fCopy(this.TPose_Right, this.controllerPose[controller]); - } else if (controller == 1) { - Utils.Matrix4fCopy(this.TPose_Left, this.controllerPose[controller]); - } - - this.controllerTracking[controller] = true; - } else { - this.readPoseData(actionHandle); + this.readPoseData(actionHandle, this.poseData); - if (this.poseData.activeOrigin() != 0L) { - this.readOriginInfo(this.poseData.activeOrigin()); - int i = this.originInfo.trackedDeviceIndex(); + if (this.poseData.activeOrigin() != k_ulInvalidActionHandle) { + this.readOriginInfo(this.poseData.activeOrigin()); + int i = this.originInfo.trackedDeviceIndex(); - if (i != this.controllerDeviceIndex[controller]) { - this.getXforms = true; - } + if (i != this.controllerDeviceIndex[controller]) { + this.getXforms = true; + } - this.controllerDeviceIndex[controller] = i; + this.controllerDeviceIndex[controller] = i; - if (i != -1) { - TrackedDevicePose trackeddevicepose = this.poseData.pose(); + if (i != k_unTrackedDeviceIndexInvalid) { + TrackedDevicePose trackeddevicepose = this.poseData.pose(); - if (trackeddevicepose.bPoseIsValid()) { - OpenVRUtil.convertSteamVRMatrix3ToMatrix4f(trackeddevicepose.mDeviceToAbsoluteTracking(), this.poseMatrices[i]); - this.deviceVelocity[i] = new Vec3((double) trackeddevicepose.vVelocity().v(0), (double) trackeddevicepose.vVelocity().v(1), (double) trackeddevicepose.vVelocity().v(2)); - Utils.Matrix4fCopy(this.poseMatrices[i], this.controllerPose[controller]); - this.controllerTracking[controller] = true; - return; - } + if (trackeddevicepose.bPoseIsValid()) { + convertRM34ToCM44(trackeddevicepose.mDeviceToAbsoluteTracking().m(), this.poseMatrices[i]); + this.controllerPose[controller].set(this.poseMatrices[i]); + this.controllerTracking[controller] = true; + return; } - } else { - this.controllerDeviceIndex[controller] = -1; } + } else { + this.controllerDeviceIndex[controller] = -1; + } + + this.controllerTracking[controller] = false; + } - this.controllerTracking[controller] = false; + private void updateControllerGesture(int controller, long gestureHandle) { + IntBuffer controllerStatics = MemoryUtil.memCallocInt(2); + VRInput_GetBoneCount(gestureHandle, controllerStatics); + int BoneCount = controllerStatics.get(0); + // print("Bone Count: " + BoneCount); + controllerStatics.position(1); + VRInput_GetSkeletalTrackingLevel(gestureHandle, controllerStatics); + int TrackingLevel = controllerStatics.get(1); + // print("Skeletal Tracking Level: " + TrackingLevel); + this.controllerSkeletalInputTrackingLevel[controller] = TrackingLevel; + try ( + // InputSkeletalActionData BoneActDat = InputSkeletalActionData.calloc(); + Buffer BoneTransDat = VRBoneTransform.calloc(BoneCount); + VRSkeletalSummaryData DevBoneSum = VRSkeletalSummaryData.calloc() + ) { + // VRInput.VRInput_GetSkeletalActionData(gestureHandle, BoneActDat); + // print("Skeletal Action Data: " + BoneActDat.bActive() + " " + BoneActDat.activeOrigin()); + VRInput_GetSkeletalBoneData(gestureHandle, EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Model, EVRSkeletalMotionRange_VRSkeletalMotionRange_WithController, BoneTransDat); + // print("Skeletal Bone Data: " + BoneTransDat); + this.gestureFingerTransforms[controller].clear(); + this.gestureFingerTransforms[controller].ensureCapacity(BoneCount); + this.gestureFingerOrientations[controller].clear(); + this.gestureFingerOrientations[controller].ensureCapacity(BoneCount); + for (VRBoneTransform BoneTrans : BoneTransDat) { + HmdVector4 pos = BoneTrans.position$(); + // print("Skeletal Bone Position: " + pos); + this.gestureFingerTransforms[controller].add(new Vector4f(pos.v(0), pos.v(1), pos.v(2), pos.v(3))); + HmdQuaternionf dir = BoneTrans.orientation(); + // print("Skeletal Bone Orientation: " + BoneTrans.orientation()); + this.gestureFingerOrientations[controller].add(new Quaternionf(dir.w(), dir.x(), dir.y(), dir.z())); + } + VRInput_GetSkeletalSummaryData(gestureHandle, EVRSummaryType_VRSummaryType_FromDevice, DevBoneSum); + this.gestureFingerSplay[controller].clear(); + this.gestureFingerSplay[controller].ensureCapacity(EVRFingerSplay_VRFingerSplay_Count); + for (int i = 0; i < EVRFingerSplay_VRFingerSplay_Count; i++) { + this.gestureFingerSplay[controller].add(i, DevBoneSum.flFingerSplay(i)); +// print(switch (i){ +// case EVRFingerSplay_VRFingerSplay_Thumb_Index -> "Thumb Index Splay: "; +// case EVRFingerSplay_VRFingerSplay_Index_Middle -> "Index Middle Splay: "; +// case EVRFingerSplay_VRFingerSplay_Middle_Ring -> "Middle Ring Splay: "; +// case EVRFingerSplay_VRFingerSplay_Ring_Pinky -> "Ring Pinky Splay: "; +// default -> "Unknown Splay: "; +// } + DevBoneSum.flFingerSplay(i)); + } + this.gestureFingerCurl[controller].clear(); + this.gestureFingerCurl[controller].ensureCapacity(EVRFinger_VRFinger_Count); + for (int i = 0; i < EVRFinger_VRFinger_Count; i++) { + this.gestureFingerCurl[controller].add(i, DevBoneSum.flFingerCurl(i)); +// print(switch(i) { +// case EVRFinger_VRFinger_Thumb -> "Thumb Curl: "; +// case EVRFinger_VRFinger_Index -> "Index Curl: "; +// case EVRFinger_VRFinger_Middle -> "Middle Curl: "; +// case EVRFinger_VRFinger_Ring -> "Ring Curl: "; +// case EVRFinger_VRFinger_Pinky -> "Pinky Curl: "; +// default -> "Unknown Curl: "; +// } + DevBoneSum.flFingerCurl(i)); + } +// if (this.TPose) { +// try ( +// VRBoneTransform.Buffer ReferenceTransDat = VRBoneTransform.calloc(BoneCount); +// ) { +// VRInput_GetSkeletalReferenceTransforms(gestureHandle, EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Model, EVRSkeletalReferencePose_VRSkeletalReferencePose_BindPose, ReferenceTransDat); +// HmdVector4 hold = ReferenceTransDat.position$(); +// new Vector3f(hold.v(0), hold.v(1), hold.v(2)); +// Utils.Matrix4fCopy(, this.gesturePose[controller]); +// } +// this.controllerTracking[controller] = true; +// } else { + this.readPoseData(gestureHandle, this.gestureData); + TrackedDevicePose trackeddevicepose = this.gestureData.pose(); + if (trackeddevicepose.bPoseIsValid()) { + convertRM34ToCM44(trackeddevicepose.mDeviceToAbsoluteTracking().m(), this.gesturePose[controller]); + this.gestureVelocity[controller] = new Vector3d(trackeddevicepose.vVelocity().v(0), trackeddevicepose.vVelocity().v(1), trackeddevicepose.vVelocity().v(2)); + } +// } } + + MemoryUtil.memFree(controllerStatics); } private void updatePose() { - if (OpenVR.VRSystem != null && OpenVR.VRSystem != null) { - int i = VRCompositor_WaitGetPoses(this.hmdTrackedDevicePoses, null); + if (OpenVR.VRSystem != null && OpenVR.VRCompositor != null) { + int ret = VRCompositor_WaitGetPoses(this.hmdTrackedDevicePoses, null); - if (i > 0) { - System.out.println("Compositor Error: GetPoseError " + OpenVRStereoRenderer.getCompostiorError(i)); + if (ret != EVRCompositorError_VRCompositorError_None) { + logger.error("Compositor Error: GetPoseError {}", OpenVRStereoRenderer.getCompositorError(ret)); } - if (i == 101) { + if (ret == EVRCompositorError_VRCompositorError_DoNotHaveFocus) { //this is so dumb but it works. this.triggerHapticPulse(0, 500); this.triggerHapticPulse(1, 500); } - if (this.getXforms) { - this.getTransforms(); - } else if (this.dbg) { - this.dbg = false; + if (this.getXforms) { //set null by events. + this.getTransforms(); //do we want the dynamic info? I don't think so... + //findControllerDevices(); + } else if (this.getDeviceProperties) { + this.getDeviceProperties = false; this.debugOut(0); this.debugOut(this.controllerDeviceIndex[0]); this.debugOut(this.controllerDeviceIndex[1]); } try (MemoryStack stack = MemoryStack.stackPush()) { - var hmdmatrix34 = HmdMatrix34.calloc(stack); - OpenVRUtil.convertSteamVRMatrix3ToMatrix4f(VRSystem_GetEyeToHeadTransform(0, hmdmatrix34), this.hmdPoseLeftEye); - OpenVRUtil.convertSteamVRMatrix3ToMatrix4f(VRSystem_GetEyeToHeadTransform(1, hmdmatrix34), this.hmdPoseRightEye); + HmdMatrix34 hmdmatrix34 = HmdMatrix34.calloc(stack); + convertRM34ToCM44(VRSystem_GetEyeToHeadTransform(EVREye_Eye_Left, hmdmatrix34).m(), this.hmdPoseLeftEye); + convertRM34ToCM44(VRSystem_GetEyeToHeadTransform(EVREye_Eye_Right, hmdmatrix34).m(), this.hmdPoseRightEye); } - for (int j = 0; j < 64; ++j) { + for (int j = 0; j < this.poseMatrices.length; ++j) { if (this.hmdTrackedDevicePoses.get(j).bPoseIsValid()) { - OpenVRUtil.convertSteamVRMatrix3ToMatrix4f(this.hmdTrackedDevicePoses.get(j).mDeviceToAbsoluteTracking(), this.poseMatrices[j]); - this.deviceVelocity[j] = new Vec3((double) this.hmdTrackedDevicePoses.get(j).vVelocity().v(0), (double) this.hmdTrackedDevicePoses.get(j).vVelocity().v(1), (double) this.hmdTrackedDevicePoses.get(j).vVelocity().v(2)); + convertRM34ToCM44(this.hmdTrackedDevicePoses.get(j).mDeviceToAbsoluteTracking().m(), this.poseMatrices[j]); } } if (this.hmdTrackedDevicePoses.get(0).bPoseIsValid()) { - Utils.Matrix4fCopy(this.poseMatrices[0], this.hmdPose); + this.hmdPose.set(this.poseMatrices[0]); this.headIsTracking = true; } else { this.headIsTracking = false; - Utils.Matrix4fSetIdentity(this.hmdPose); - this.hmdPose.M[1][3] = 1.62F; - } - - this.TPose = false; - - if (this.TPose) { - this.TPose_Right.M[0][3] = 0.0F; - this.TPose_Right.M[1][3] = 0.0F; - this.TPose_Right.M[2][3] = 0.0F; - Matrix4f matrix4f = this.TPose_Right; - Utils.Matrix4fCopy(Matrix4f.rotationY(-120.0F), this.TPose_Right); - this.TPose_Right.M[0][3] = 0.5F; - this.TPose_Right.M[1][3] = 1.0F; - this.TPose_Right.M[2][3] = -0.5F; - this.TPose_Left.M[0][3] = 0.0F; - this.TPose_Left.M[1][3] = 0.0F; - this.TPose_Left.M[2][3] = 0.0F; - matrix4f = this.TPose_Left; - Utils.Matrix4fCopy(Matrix4f.rotationY(120.0F), this.TPose_Left); - this.TPose_Left.M[0][3] = -0.5F; - this.TPose_Left.M[1][3] = 1.0F; - this.TPose_Left.M[2][3] = -0.5F; - this.Neutral_HMD.M[0][3] = 0.0F; - this.Neutral_HMD.M[1][3] = 1.8F; - Utils.Matrix4fCopy(this.Neutral_HMD, this.hmdPose); - this.headIsTracking = true; + this.hmdPose.identity(); + this.hmdPose.m13(1.62F); } if (this.inputInitialized) { - this.mc.getProfiler().push("updateActionState"); + mc.getProfiler().push("updateActionState"); if (this.updateActiveActionSets()) { - int k = VRInput.VRInput_UpdateActionState(activeActionSetsBuffer, VRActiveActionSet.SIZEOF); + int k = VRInput_UpdateActionState(this.activeActionSetsBuffer, VRActiveActionSet.SIZEOF); - if (k != 0) { + if (k != EVRInputError_VRInputError_None) { throw new RuntimeException("Error updating action state: code " + getInputErrorName(k)); } } this.inputActions.values().forEach(this::readNewData); - this.mc.getProfiler().pop(); + mc.getProfiler().pop(); - if (this.dh.vrSettings.reverseHands) { + if (dh.vrSettings.reverseHands) { this.updateControllerPose(0, this.leftPoseHandle); this.updateControllerPose(1, this.rightPoseHandle); + if (dh.vrSettings.skeletalInput){ + this.updateControllerGesture(0, this.leftGestureHandle); + this.updateControllerGesture(1, this.rightGestureHandle); + } } else { this.updateControllerPose(0, this.rightPoseHandle); this.updateControllerPose(1, this.leftPoseHandle); + if (dh.vrSettings.skeletalInput){ + this.updateControllerGesture(0, this.rightGestureHandle); + this.updateControllerGesture(1, this.leftGestureHandle); + } } - this.updateControllerPose(2, this.externalCameraPoseHandle); + // this.updateControllerPose(2, this.externalCameraPoseHandle); + + //mc.getProfiler().pop(); } this.updateAim(); @@ -1142,19 +1172,26 @@ long getActionSetHandle(VRInputActionSet actionSet) { } long getControllerHandle(ControllerType hand) { - if (this.dh.vrSettings.reverseHands) { + if (dh.vrSettings.reverseHands) { return hand == ControllerType.RIGHT ? this.leftControllerHandle : this.rightControllerHandle; } else { return hand == ControllerType.RIGHT ? this.rightControllerHandle : this.leftControllerHandle; } } + long getGestureHandle(ControllerType hand) { + return (dh.vrSettings.reverseHands ? + (hand == ControllerType.RIGHT ? this.leftGestureHandle : this.rightGestureHandle) : + (hand == ControllerType.RIGHT ? this.rightGestureHandle : this.leftGestureHandle) + ); + } + long getInputSourceHandle(String path) { try (MemoryStack stack = MemoryStack.stackPush()) { LongBuffer longbyreference = stack.callocLong(1); int i = VRInput_GetInputSourceHandle(path, longbyreference); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting input source handle for '" + path + "': " + getInputErrorName(i)); } else { return longbyreference.get(0); @@ -1162,13 +1199,11 @@ long getInputSourceHandle(String path) { } } - ControllerType getOriginControllerType(long inputValueHandle) { - if (inputValueHandle == 0L) { - return null; - } else { + public ControllerType getOriginControllerType(long inputValueHandle) { + if (inputValueHandle != k_ulInvalidInputValueHandle) { this.readOriginInfo(inputValueHandle); - if (this.originInfo.trackedDeviceIndex() != -1) { + if (this.originInfo.trackedDeviceIndex() != k_unTrackedDeviceIndexInvalid) { if (this.originInfo.trackedDeviceIndex() == this.controllerDeviceIndex[0]) { return ControllerType.RIGHT; } @@ -1178,35 +1213,30 @@ ControllerType getOriginControllerType(long inputValueHandle) { } } - return null; } + return null; } public void readNewData(VRInputAction action) { - String s = action.type; - - switch (s) { - case "boolean": + switch (action.type) { + case "boolean" -> { if (action.isHanded()) { for (ControllerType controllertype1 : ControllerType.values()) { this.readDigitalData(action, controllertype1); } } else { - this.readDigitalData(action, (ControllerType) null); + this.readDigitalData(action, null); } - - break; - - case "vector1": - case "vector2": - case "vector3": + } + case "vector1", "vector2", "vector3" -> { if (action.isHanded()) { for (ControllerType controllertype : ControllerType.values()) { this.readAnalogData(action, controllertype); } } else { - this.readAnalogData(action, (ControllerType) null); + this.readAnalogData(action, null); } + } } } @@ -1258,17 +1288,17 @@ public boolean hasThirdController() { public List getOrigins(VRInputAction action) { try (MemoryStack stack = MemoryStack.stackPush()) { - var longbyreference = stack.callocLong(16); + LongBuffer longbyreference = stack.callocLong(k_unMaxActionOriginCount); int i = VRInput_GetActionOrigins(this.getActionSetHandle(action.actionSet), action.handle, longbyreference); - if (i != 0) { + if (i != EVRInputError_VRInputError_None) { throw new RuntimeException("Error getting action origins for '" + action.name + "': " + getInputErrorName(i)); } else { List list = new ArrayList<>(); while (longbyreference.remaining() > 0) { long j = longbyreference.get(); - if (j != 0L) { + if (j != k_ulInvalidActionHandle) { list.add(j); } } @@ -1285,7 +1315,10 @@ public VRRenderer createVRRenderer() { @Override public boolean isActive() { - int activityLevel = VRSystem_GetTrackedDeviceActivityLevel(0); - return activityLevel == EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction || activityLevel == EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction_Timeout; + return switch (VRSystem_GetTrackedDeviceActivityLevel(k_unTrackedDeviceIndex_Hmd)){ + case EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction, + EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction_Timeout -> true; + default -> false; + }; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java index a13dbcaae..7a4ae5fac 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java @@ -1,24 +1,28 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl; -import java.util.concurrent.TimeUnit; - -import org.lwjgl.openvr.VRInput; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.HapticScheduler; +import java.util.concurrent.TimeUnit; + +import static org.vivecraft.common.utils.Utils.logger; + +import static org.lwjgl.openvr.VRInput.VRInput_TriggerHapticVibrationAction; + public class OpenVRHapticScheduler extends HapticScheduler { private void triggerHapticPulse(ControllerType controller, float durationSeconds, float frequency, float amplitude) { - int i = VRInput.VRInput_TriggerHapticVibrationAction(MCOpenVR.get().getHapticHandle(controller), 0.0F, durationSeconds, frequency, amplitude, 0L); + int i = VRInput_TriggerHapticVibrationAction(MCOpenVR.get().getHapticHandle(controller), 0.0F, durationSeconds, frequency, amplitude, 0L); if (i != 0) { - System.out.println("Error triggering haptic: " + MCOpenVR.getInputErrorName(i)); + logger.error("Error triggering haptic: {}", MCOpenVR.getInputErrorName(i)); } } public void queueHapticPulse(ControllerType controller, float durationSeconds, float frequency, float amplitude, float delaySeconds) { - this.executor.schedule(() -> - { - this.triggerHapticPulse(controller, durationSeconds, frequency, amplitude); - }, (long) (delaySeconds * 1000000.0F), TimeUnit.MICROSECONDS); + this.executor.schedule( + () -> this.triggerHapticPulse(controller, durationSeconds, frequency, amplitude), + (long) (delaySeconds * 1000000.0F), + TimeUnit.MICROSECONDS + ); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java index 940182771..a41afbac4 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java @@ -1,47 +1,54 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl; +import org.vivecraft.client_vr.provider.VRRenderer; +import org.vivecraft.client_vr.render.RenderConfigException; + +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11C; +import org.lwjgl.openvr.HiddenAreaMesh; +import org.lwjgl.openvr.HmdMatrix44; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; + import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.TextureUtil; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.network.chat.Component; import net.minecraft.util.Tuple; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; -import org.lwjgl.openvr.*; -import org.lwjgl.system.MemoryStack; -import org.lwjgl.system.MemoryUtil; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.provider.MCVR; -import org.vivecraft.client_vr.provider.VRRenderer; -import org.vivecraft.client_vr.render.RenderConfigException; -import org.vivecraft.client_vr.render.RenderPass; -import static org.lwjgl.openvr.VRCompositor.*; +import java.nio.IntBuffer; + +import static org.vivecraft.common.utils.Utils.logger; + +import static org.lwjgl.openvr.OpenVR.VRCompositor; +import static org.lwjgl.openvr.VR.*; +import static org.lwjgl.openvr.VRCompositor.VRCompositor_PostPresentHandoff; +import static org.lwjgl.openvr.VRCompositor.VRCompositor_Submit; import static org.lwjgl.openvr.VRSystem.*; public class OpenVRStereoRenderer extends VRRenderer { private HiddenAreaMesh[] hiddenMeshes = new HiddenAreaMesh[2]; private final MCOpenVR openvr; - public OpenVRStereoRenderer(MCVR vr) { + public OpenVRStereoRenderer(MCOpenVR vr) { super(vr); - this.openvr = (MCOpenVR) vr; + this.openvr = vr; hiddenMeshes[0] = HiddenAreaMesh.calloc(); hiddenMeshes[1] = HiddenAreaMesh.calloc(); } + @Override public Tuple getRenderTextureSizes() { - if (this.resolution != null) { - return this.resolution; - } else { + if (this.resolution == null) { try (MemoryStack stack = MemoryStack.stackPush()) { - var intbyreference = stack.callocInt(1); - var intbyreference1 = stack.callocInt(1); + IntBuffer intbyreference = stack.callocInt(1); + IntBuffer intbyreference1 = stack.callocInt(1); VRSystem_GetRecommendedRenderTargetSize(intbyreference, intbyreference1); this.resolution = new Tuple<>(intbyreference.get(0), intbyreference1.get(0)); - System.out.println("OpenVR Render Res " + this.resolution.getA() + " x " + this.resolution.getB()); + logger.info("OpenVR Render Res {} x {}", this.resolution.getA(), this.resolution.getB()); this.ss = this.openvr.getSuperSampling(); - System.out.println("OpenVR Supersampling: " + this.ss); + logger.info("OpenVR Supersampling: {}", this.ss); } for (int i = 0; i < 2; ++i) { @@ -49,7 +56,7 @@ public Tuple getRenderTextureSizes() { int j = this.hiddenMeshes[i].unTriangleCount(); if (j <= 0) { - System.out.println("No stencil mesh found for eye " + i); + logger.warn("No stencil mesh found for eye {}", i); } else { this.hiddenMesheVertecies[i] = new float[this.hiddenMeshes[i].unTriangleCount() * 3 * 2]; MemoryUtil.memFloatBuffer(MemoryUtil.memAddress(this.hiddenMeshes[i].pVertexData()), this.hiddenMesheVertecies[i].length).get(this.hiddenMesheVertecies[i]); @@ -59,132 +66,94 @@ public Tuple getRenderTextureSizes() { this.hiddenMesheVertecies[i][k + 1] *= (float) this.resolution.getB(); } - System.out.println("Stencil mesh loaded for eye " + i); + logger.info("Stencil mesh loaded for eye {}", i); } } - - return this.resolution; } + return this.resolution; } - public Matrix4f getProjectionMatrix(int eyeType, float nearClip, float farClip) { + @Override + public Matrix4f getProjectionMatrix(int eyeType, double nearClip, double farClip, Matrix4f dest) { try (MemoryStack stack = MemoryStack.stackPush()) { - if (eyeType == 0) { - return Utils.Matrix4fFromOpenVR(VRSystem_GetProjectionMatrix(0, nearClip, farClip, HmdMatrix44.calloc(stack))); - } else { - return Utils.Matrix4fFromOpenVR(VRSystem_GetProjectionMatrix(1, nearClip, farClip, HmdMatrix44.calloc(stack))); - } + return dest.setTransposed( + VRSystem_GetProjectionMatrix( + eyeType == 0 ? EVREye_Eye_Left : EVREye_Eye_Right, + (float) nearClip, + (float) farClip, + HmdMatrix44.calloc(stack) + ).m() + ); } } - public String getLastError() { - return ""; - } - + @Override public void createRenderTexture(int lwidth, int lheight) { this.LeftEyeTextureId = GlStateManager._genTexture(); - int i = GlStateManager._getInteger(GL11.GL_TEXTURE_BINDING_2D); + int i = GlStateManager._getInteger(GL11C.GL_TEXTURE_BINDING_2D); RenderSystem.bindTexture(this.LeftEyeTextureId); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - GlStateManager._texImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, lwidth, lheight, 0, GL11.GL_RGBA, GL11.GL_INT, null); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); + GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA8, lwidth, lheight, 0, GL11C.GL_RGBA, GL11C.GL_INT, null); RenderSystem.bindTexture(i); this.openvr.texType0.handle(this.LeftEyeTextureId); - this.openvr.texType0.eColorSpace(VR.EColorSpace_ColorSpace_Gamma); - this.openvr.texType0.eType(VR.ETextureType_TextureType_OpenGL); + this.openvr.texType0.eColorSpace(EColorSpace_ColorSpace_Gamma); + this.openvr.texType0.eType(ETextureType_TextureType_OpenGL); this.RightEyeTextureId = GlStateManager._genTexture(); - i = GlStateManager._getInteger(GL11.GL_TEXTURE_BINDING_2D); + i = GlStateManager._getInteger(GL11C.GL_TEXTURE_BINDING_2D); RenderSystem.bindTexture(this.RightEyeTextureId); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); - RenderSystem.texParameter(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - GlStateManager._texImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, lwidth, lheight, 0, GL11.GL_RGBA, GL11.GL_INT, null); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, GL11C.GL_LINEAR); + RenderSystem.texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, GL11C.GL_LINEAR); + GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA8, lwidth, lheight, 0, GL11C.GL_RGBA, GL11C.GL_INT, null); RenderSystem.bindTexture(i); this.openvr.texType1.handle(this.RightEyeTextureId); - this.openvr.texType1.eColorSpace(VR.EColorSpace_ColorSpace_Gamma); - this.openvr.texType1.eType(VR.ETextureType_TextureType_OpenGL); - } - - public boolean endFrame(RenderPass eye) { - return true; + this.openvr.texType1.eColorSpace(EColorSpace_ColorSpace_Gamma); + this.openvr.texType1.eType(ETextureType_TextureType_OpenGL); } + @Override public void endFrame() throws RenderConfigException { - if (OpenVR.VRCompositor.Submit != 0) { + if (VRCompositor.Submit != 0) { int i = VRCompositor_Submit(0, this.openvr.texType0, null, 0); int j = VRCompositor_Submit(1, this.openvr.texType1, null, 0); VRCompositor_PostPresentHandoff(); if (i + j > 0) { - throw new RenderConfigException("Compositor Error", Component.literal("Texture submission error: Left/Right " + getCompostiorError(i) + "/" + getCompostiorError(j))); + throw new RenderConfigException("Compositor Error", Component.literal("Texture submission error: Left/Right " + getCompositorError(i) + "/" + getCompositorError(j))); } } } - public static String getCompostiorError(int code) { - switch (code) { - case 0: - return "None:"; - - case 1: - return "RequestFailed"; - - case 100: - return "IncompatibleVersion"; - - case 101: - return "DoesNotHaveFocus"; - - case 102: - return "InvalidTexture"; - - case 103: - return "IsNotSceneApplication"; - - case 104: - return "TextureIsOnWrongDevice"; - - case 105: - return "TextureUsesUnsupportedFormat:"; - - case 106: - return "SharedTexturesNotSupported"; - - case 107: - return "IndexOutOfRange"; - - case 108: - return "AlreadySubmitted:"; - - default: - return "Unknown"; - } + public static String getCompositorError(int code) { + return switch (code) { + case EVRCompositorError_VRCompositorError_None -> "None"; + case EVRCompositorError_VRCompositorError_RequestFailed -> "RequestFailed"; + case EVRCompositorError_VRCompositorError_IncompatibleVersion -> "IncompatibleVersion"; + case EVRCompositorError_VRCompositorError_DoNotHaveFocus -> "DoesNotHaveFocus"; + case EVRCompositorError_VRCompositorError_InvalidTexture -> "InvalidTexture"; + case EVRCompositorError_VRCompositorError_IsNotSceneApplication -> "IsNotSceneApplication"; + case EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice -> "TextureIsOnWrongDevice"; + case EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat -> "TextureUsesUnsupportedFormat"; + case EVRCompositorError_VRCompositorError_SharedTexturesNotSupported -> "SharedTexturesNotSupported"; + case EVRCompositorError_VRCompositorError_IndexOutOfRange -> "IndexOutOfRange"; + case EVRCompositorError_VRCompositorError_AlreadySubmitted -> "AlreadySubmitted"; + case EVRCompositorError_VRCompositorError_InvalidBounds -> "InvalidBounds"; + case EVRCompositorError_VRCompositorError_AlreadySet -> "AlreadySet"; + default -> "Unknown"; + }; } + @Override public boolean providesStencilMask() { return true; } - public float[] getStencilMask(RenderPass eye) { - if (this.hiddenMesheVertecies != null && (eye == RenderPass.LEFT || eye == RenderPass.RIGHT)) { - return eye == RenderPass.LEFT ? this.hiddenMesheVertecies[0] : this.hiddenMesheVertecies[1]; - } else { - return null; - } - } - + @Override public String getName() { return "OpenVR"; } - public boolean isInitialized() { - return this.vr.initSuccess; - } - - public String getinitError() { - return this.vr.initStatus; - } - @Override public void destroy() { super.destroy(); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRUtil.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRUtil.java deleted file mode 100644 index 0af186693..000000000 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRUtil.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.vivecraft.client_vr.provider.openvr_lwjgl; - -import org.lwjgl.openvr.HmdMatrix34; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; - -public class OpenVRUtil -{ - public static Matrix4f convertSteamVRMatrix3ToMatrix4f(HmdMatrix34 hmdMatrix, Matrix4f mat) - { - Utils.Matrix4fSet(mat, hmdMatrix.m(0), hmdMatrix.m(1), hmdMatrix.m(2), hmdMatrix.m(3), hmdMatrix.m(4), hmdMatrix.m(5), hmdMatrix.m(6), hmdMatrix.m(7), hmdMatrix.m(8), hmdMatrix.m(9), hmdMatrix.m(10), hmdMatrix.m(11), 0.0F, 0.0F, 0.0F, 1.0F); - return mat; - } - -// public static Matrix4f convertSteamVRMatrix4ToMatrix4f(HmdMatrix44_t hmdMatrix, Matrix4f mat) -// { -// Utils.Matrix4fSet(mat, hmdMatrix.m[0], hmdMatrix.m[1], hmdMatrix.m[2], hmdMatrix.m[3], hmdMatrix.m[4], hmdMatrix.m[5], hmdMatrix.m[6], hmdMatrix.m[7], hmdMatrix.m[8], hmdMatrix.m[9], hmdMatrix.m[10], hmdMatrix.m[11], hmdMatrix.m[12], hmdMatrix.m[13], hmdMatrix.m[14], hmdMatrix.m[15]); -// return mat; -// } - - public static Quaternion convertMatrix4ftoRotationQuat(Matrix4f mat) - { - return Utils.convertMatrix4ftoRotationQuat(mat.M[0][0], mat.M[0][1], mat.M[0][2], mat.M[1][0], mat.M[1][1], mat.M[1][2], mat.M[2][0], mat.M[2][1], mat.M[2][2]); - } - -// public static HmdMatrix34_t convertToMatrix34(org.joml.Matrix4f matrix) -// { -// HmdMatrix34_t hmdmatrix34_t = new HmdMatrix34_t(); -// hmdmatrix34_t.m[0] = matrix.m00(); -// hmdmatrix34_t.m[1] = matrix.m10(); -// hmdmatrix34_t.m[2] = matrix.m20(); -// hmdmatrix34_t.m[3] = matrix.m30(); -// hmdmatrix34_t.m[4] = matrix.m01(); -// hmdmatrix34_t.m[5] = matrix.m11(); -// hmdmatrix34_t.m[6] = matrix.m21(); -// hmdmatrix34_t.m[7] = matrix.m31(); -// hmdmatrix34_t.m[8] = matrix.m02(); -// hmdmatrix34_t.m[9] = matrix.m12(); -// hmdmatrix34_t.m[10] = matrix.m22(); -// hmdmatrix34_t.m[11] = matrix.m32(); -// return hmdmatrix34_t; -// } -} diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java index eea5ae825..de48ac2d0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java @@ -1,25 +1,30 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; - -import javax.annotation.Nullable; - import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.HandedKeyBinding; import org.vivecraft.client_vr.provider.InputSimulator; -import org.vivecraft.client_vr.provider.MCVR; import org.vivecraft.client_vr.provider.openvr_lwjgl.control.VRInputActionSet; -import org.vivecraft.common.utils.math.Vector2; -import org.vivecraft.common.utils.math.Vector3; -import com.mojang.blaze3d.platform.InputConstants; +import org.joml.Vector2f; +import org.joml.Vector3f; import net.minecraft.client.KeyMapping; +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import static org.vivecraft.client_vr.VRState.dh; + +import static org.joml.Math.*; +import static org.lwjgl.openvr.VR.k_ulInvalidInputValueHandle; + +import static com.mojang.blaze3d.platform.InputConstants.Key; +import static com.mojang.blaze3d.platform.InputConstants.Type; + public class VRInputAction { public final KeyMapping keyBinding; @@ -28,12 +33,12 @@ public class VRInputAction public final String type; public final VRInputActionSet actionSet; private int priority = 0; - private boolean[] enabled = new boolean[ControllerType.values().length]; - private List listeners = new ArrayList<>(); + private final boolean[] enabled = new boolean[ControllerType.values().length]; + private final List listeners = new ArrayList<>(); private ControllerType currentHand = ControllerType.RIGHT; private boolean currentlyInUse; public long handle; - private boolean[] pressed = new boolean[ControllerType.values().length]; + private final boolean[] pressed = new boolean[ControllerType.values().length]; protected int[] unpressInTicks = new int[ControllerType.values().length]; public DigitalData[] digitalData = new DigitalData[ControllerType.values().length]; public AnalogData[] analogData = new AnalogData[ControllerType.values().length]; @@ -56,92 +61,67 @@ public VRInputAction(KeyMapping keyBinding, String requirement, String type, VRI public boolean isButtonPressed() { - if (this.type.equals("boolean")) + if ("boolean".equals(this.type)) { return this.digitalData().state; } else { - Vector3 vector3 = this.getAxis3D(false); - return Math.abs(vector3.getX()) > 0.5F || Math.abs(vector3.getY()) > 0.5F || Math.abs(vector3.getZ()) > 0.5F; + Vector3f vector3 = this.getAxis3D(false); + return abs(vector3.x()) > 0.5F || abs(vector3.y()) > 0.5F || abs(vector3.z()) > 0.5F; } } public boolean isButtonChanged() { - if (this.type.equals("boolean")) + if ("boolean".equals(this.type)) { return this.digitalData().isChanged; } else { - Vector3 vector3 = this.getAxis3D(false); - Vector3 vector31 = this.getAxis3D(true); - return Math.abs(vector3.getX() - vector31.getX()) > 0.5F != Math.abs(vector3.getX()) > 0.5F || Math.abs(vector3.getY() - vector31.getY()) > 0.5F != Math.abs(vector3.getY()) > 0.5F || Math.abs(vector3.getZ() - vector31.getZ()) > 0.5F != Math.abs(vector3.getZ()) > 0.5F; + Vector3f vector3 = this.getAxis3D(false); + Vector3f vector31 = this.getAxis3D(true); + return abs(vector3.x() - vector31.x()) > 0.5F != abs(vector3.x()) > 0.5F || abs(vector3.y() - vector31.y()) > 0.5F != abs(vector3.y()) > 0.5F || abs(vector3.z() - vector31.z()) > 0.5F != abs(vector3.z()) > 0.5F; } } public float getAxis1D(boolean delta) { - String s = this.type; - switch (s) - { - case "boolean": - return this.digitalToAnalog(delta); - - case "vector1": - case "vector2": - case "vector3": - return delta ? this.analogData().deltaX : this.analogData().x; - - default: - return 0.0F; - } + return switch (this.type) { + case "boolean" -> this.digitalToAnalog(delta); + case "vector1", "vector2", "vector3" -> delta ? this.analogData().deltaX : this.analogData().x; + default -> 0.0F; + }; } - public Vector2 getAxis2D(boolean delta) + public Vector2f getAxis2D(boolean delta) { - String s = this.type; - switch (s) - { - case "boolean": - return new Vector2(this.digitalToAnalog(delta), 0.0F); - - case "vector1": - return delta ? new Vector2(this.analogData().deltaX, 0.0F) : new Vector2(this.analogData().x, 0.0F); - - case "vector2": - case "vector3": - return delta ? new Vector2(this.analogData().deltaX, this.analogData().deltaY) : new Vector2(this.analogData().x, this.analogData().y); - - default: - return new Vector2(); - } + return switch (this.type) { + case "boolean" -> new Vector2f(this.digitalToAnalog(delta), 0.0F); + case "vector1" -> + delta ? new Vector2f(this.analogData().deltaX, 0.0F) : new Vector2f(this.analogData().x, 0.0F); + case "vector2", "vector3" -> + delta ? new Vector2f(this.analogData().deltaX, this.analogData().deltaY) : new Vector2f(this.analogData().x, this.analogData().y); + default -> new Vector2f(); + }; } - public Vector3 getAxis3D(boolean delta) + public Vector3f getAxis3D(boolean delta) { - String s = this.type; - - switch (s) - { - case "boolean": - return new Vector3(this.digitalToAnalog(delta), 0.0F, 0.0F); - - case "vector1": - return delta ? new Vector3(this.analogData().deltaX, 0.0F, 0.0F) : new Vector3(this.analogData().x, 0.0F, 0.0F); - - case "vector2": - return delta ? new Vector3(this.analogData().deltaX, this.analogData().deltaY, 0.0F) : new Vector3(this.analogData().x, this.analogData().y, 0.0F); - - case "vector3": - return delta ? new Vector3(this.analogData().deltaX, this.analogData().deltaY, this.analogData().deltaZ) : new Vector3(this.analogData().x, this.analogData().y, this.analogData().z); - default: - return new Vector3(); - } + return switch (this.type) { + case "boolean" -> new Vector3f(this.digitalToAnalog(delta), 0.0F, 0.0F); + case "vector1" -> + delta ? new Vector3f(this.analogData().deltaX, 0.0F, 0.0F) : new Vector3f(this.analogData().x, 0.0F, 0.0F); + case "vector2" -> + delta ? new Vector3f(this.analogData().deltaX, this.analogData().deltaY, 0.0F) : new Vector3f(this.analogData().x, this.analogData().y, 0.0F); + case "vector3" -> + delta ? new Vector3f(this.analogData().deltaX, this.analogData().deltaY, this.analogData().deltaZ) : new Vector3f(this.analogData().x, this.analogData().y, this.analogData().z); + default -> new Vector3f(); + }; } public float getAxis1DUseTracked() @@ -158,30 +138,30 @@ public float getAxis1DUseTracked() } } - public Vector2 getAxis2DUseTracked() + public Vector2f getAxis2DUseTracked() { if (!this.currentlyInUse && !this.isEnabled()) { - return new Vector2(); + return new Vector2f(); } else { - Vector2 vector2 = this.getAxis2D(false); - this.currentlyInUse = vector2.getX() != 0.0F || vector2.getY() != 0.0F; + Vector2f vector2 = this.getAxis2D(false); + this.currentlyInUse = vector2.x() != 0.0F || vector2.y() != 0.0F; return vector2; } } - Vector3 getAxis3DUseTracked() + Vector3f getAxis3DUseTracked() { if (!this.currentlyInUse && !this.isEnabled()) { - return new Vector3(); + return new Vector3f(); } else { - Vector3 vector3 = this.getAxis3D(false); - this.currentlyInUse = vector3.getX() != 0.0F || vector3.getY() != 0.0F || vector3.getZ() != 0.0F; + Vector3f vector3 = this.getAxis3D(false); + this.currentlyInUse = vector3.x() != 0.0F || vector3.y() != 0.0F || vector3.z() != 0.0F; return vector3; } } @@ -207,21 +187,12 @@ private float digitalToAnalog(boolean delta) public long getLastOrigin() { - String s = this.type; - - switch (s) - { - case "boolean": - return this.digitalData().activeOrigin; - case "vector1": - case "vector2": - case "vector3": - return this.analogData().activeOrigin; - - default: - return 0L; - } + return switch (this.type) { + case "boolean" -> this.digitalData().activeOrigin; + case "vector1", "vector2", "vector3" -> this.analogData().activeOrigin; + default -> k_ulInvalidInputValueHandle; + }; } public ControllerType getCurrentHand() @@ -273,14 +244,14 @@ public boolean isEnabled() { return false; } - else if (MCOpenVR.get() == null) + else if (dh.vr == null) { return false; } else { long i = this.getLastOrigin(); - ControllerType controllertype = MCOpenVR.get().getOriginControllerType(i); + ControllerType controllertype = dh.vr.getOriginControllerType(i); if (controllertype == null && this.isHanded()) { @@ -288,16 +259,12 @@ else if (MCOpenVR.get() == null) } else { - for (VRInputAction vrinputaction : MCOpenVR.get().getInputActions()) + for (VRInputAction vrinputaction : dh.vr.getInputActions()) { - if (vrinputaction != this && vrinputaction.isEnabledRaw(controllertype) && vrinputaction.isActive() && vrinputaction.getPriority() > this.getPriority() && MCVR.get().getOrigins(vrinputaction).contains(i)) + if (vrinputaction != this && vrinputaction.isEnabledRaw(controllertype) && vrinputaction.isActive() && vrinputaction.getPriority() > this.getPriority() && dh.vr.getOrigins(vrinputaction).contains(i)) { - if (vrinputaction.isHanded()) - { - return !((HandedKeyBinding)vrinputaction.keyBinding).isPriorityOnController(controllertype); - } + return vrinputaction.isHanded() && !((HandedKeyBinding) vrinputaction.keyBinding).isPriorityOnController(controllertype); - return false; } } @@ -355,21 +322,12 @@ public VRInputAction setEnabled(boolean enabled) public boolean isActive() { - String s = this.type; - switch (s) - { - case "boolean": - return this.digitalData().isActive; - - case "vector1": - case "vector2": - case "vector3": - return this.analogData().isActive; - - default: - return false; - } + return switch (this.type) { + case "boolean" -> this.digitalData().isActive; + case "vector1", "vector2", "vector3" -> this.analogData().isActive; + default -> false; + }; } public boolean isHanded() @@ -422,7 +380,7 @@ public void tick() } else if (this.unpressInTicks[0] > 0 && --this.unpressInTicks[0] == 0) { - this.unpressBindingImmediately((ControllerType)null); + this.unpressBindingImmediately(null); } } @@ -453,7 +411,7 @@ private void pressBinding(ControllerType hand) this.pressed[0] = true; - if (this.notifyListeners(true, (ControllerType)null)) + if (this.notifyListeners(true, null)) { return; } @@ -526,7 +484,7 @@ public void unpressBindingImmediately(ControllerType hand) this.pressed[0] = false; - if (this.notifyListeners(false, (ControllerType)null)) + if (this.notifyListeners(false, null)) { return; } @@ -546,17 +504,17 @@ public static void setKeyBindState(KeyMapping kb, boolean pressed) private void pressKey() { - InputConstants.Key inputconstants$key = this.keyBinding.key; + Key inputconstants$key = this.keyBinding.key; - if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.INSTANCE.isSafeBinding(this.keyBinding)) //&& (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) + if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.isSafeBinding(this.keyBinding)) //&& (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) { - if (inputconstants$key.getType() == InputConstants.Type.KEYSYM) + if (inputconstants$key.getType() == Type.KEYSYM) { InputSimulator.pressKey(inputconstants$key.getValue()); return; } - if (inputconstants$key.getType() == InputConstants.Type.MOUSE) + if (inputconstants$key.getType() == Type.MOUSE) { InputSimulator.pressMouse(inputconstants$key.getValue()); return; @@ -568,17 +526,17 @@ private void pressKey() public void unpressKey() { - InputConstants.Key inputconstants$key = this.keyBinding.key; + Key inputconstants$key = this.keyBinding.key; - if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.INSTANCE.isSafeBinding(this.keyBinding)) // && (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) + if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.isSafeBinding(this.keyBinding)) // && (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) { - if (inputconstants$key.getType() == InputConstants.Type.KEYSYM) + if (inputconstants$key.getType() == Type.KEYSYM) { InputSimulator.releaseKey(inputconstants$key.getValue()); return; } - if (inputconstants$key.getType() == InputConstants.Type.MOUSE) + if (inputconstants$key.getType() == Type.MOUSE) { InputSimulator.releaseMouse(inputconstants$key.getValue()); return; @@ -588,7 +546,7 @@ public void unpressKey() this.keyBinding.release(); } - public class AnalogData + public static class AnalogData { public float x; public float y; @@ -601,7 +559,7 @@ public class AnalogData public long activeOrigin; } - public class DigitalData + public static class DigitalData { public boolean state; public boolean isChanged; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java index 8728b3c95..808478f51 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java @@ -1,21 +1,17 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl.control; +import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR; + +import javax.annotation.Nullable; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; - -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR; public class HapticMusicPlayer { - private static Map map = new HashMap<>(); - - private HapticMusicPlayer() - { - } + private static final Map map = new HashMap<>(); public static Music newMusic(String name) { @@ -72,9 +68,8 @@ public void play() for (Object object : this.data) { - if (object instanceof Note) + if (object instanceof Note hapticmusicplayer$music$note) { - Note hapticmusicplayer$music$note = (Note)object; if (hapticmusicplayer$music$note.controller != null) { @@ -86,15 +81,14 @@ public void play() MCOpenVR.get().triggerHapticPulse(ControllerType.LEFT, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); } } - else if (object instanceof Delay) + else if (object instanceof Delay hapticmusicplayer$music$delay) { - Delay hapticmusicplayer$music$delay = (Delay)object; f += hapticmusicplayer$music$delay.durationSeconds; } } } - private class Delay + private static class Delay { final float durationSeconds; @@ -104,7 +98,7 @@ private Delay(float durationSeconds) } } - private class Note + private static class Note { final ControllerType controller; final float durationSeconds; @@ -121,7 +115,7 @@ private Note(ControllerType controller, float durationSeconds, float frequency, } } - public class MusicBuilder + public static class MusicBuilder { private Music music; private float tempo; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java index a5e382511..1d60501c8 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java @@ -3,8 +3,8 @@ import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR; -import org.vivecraft.common.utils.lwjgl.Vector2f; -import org.vivecraft.common.utils.math.Vector2; + +import org.joml.Vector2f; public class TrackpadSwipeSampler { @@ -12,11 +12,11 @@ public class TrackpadSwipeSampler private static final int RIGHT = 1; private static final int DOWN = 2; private static final int LEFT = 3; - private Vector2f[] buffer = new Vector2f[5]; + private final Vector2f[] buffer = new Vector2f[5]; private int index; private long count; - private Vector2f accumulator = new Vector2f(); - private int[] swiped = new int[4]; + private final Vector2f accumulator = new Vector2f(); + private final int[] swiped = new int[4]; public float threshold = 0.5F; public TrackpadSwipeSampler() @@ -27,13 +27,13 @@ public TrackpadSwipeSampler() } } - public void update(ControllerType hand, Vector2 position) + public void update(ControllerType hand, Vector2f position) { - MCOpenVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTrackpadTouch).setCurrentHand(hand); + MCOpenVR.get().getInputAction(VivecraftVRMod.keyTrackpadTouch).setCurrentHand(hand); - if (MCOpenVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTrackpadTouch).isButtonPressed()) + if (MCOpenVR.get().getInputAction(VivecraftVRMod.keyTrackpadTouch).isButtonPressed()) { - this.buffer[this.index].set(position.getX(), position.getY()); + this.buffer[this.index].set(position.x(), position.y()); if (++this.index >= this.buffer.length) { @@ -52,7 +52,7 @@ public void update(ControllerType hand, Vector2 position) this.count = 0L; } - if (this.count >= (long)this.buffer.length) + if (this.count >= this.buffer.length) { int i = (this.index + 1) % this.buffer.length; this.accumulator.x += this.buffer[i].x - this.buffer[this.index].x; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java index 7eadb69f1..0c9ad3651 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java @@ -1,8 +1,9 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl.control; -import net.minecraft.client.KeyMapping; import org.vivecraft.client.VivecraftVRMod; +import net.minecraft.client.KeyMapping; + public enum VRInputActionSet { INGAME("/actions/ingame", "vivecraft.actionset.ingame", "leftright", false), @@ -19,7 +20,7 @@ public enum VRInputActionSet public final String usage; public final boolean advanced; - private VRInputActionSet(String name, String localizedName, String usage, boolean advanced) + VRInputActionSet(String name, String localizedName, String usage, boolean advanced) { this.name = name; this.localizedName = localizedName; @@ -27,23 +28,13 @@ private VRInputActionSet(String name, String localizedName, String usage, boolea this.advanced = advanced; } - public static VRInputActionSet fromKeyBinding(KeyMapping keyBinding) + public static VRInputActionSet fromKeyBinding(KeyMapping keyMapping) { - String s = keyBinding.getCategory(); - - switch (s) - { - case "vivecraft.key.category.gui": - return GUI; - - case "vivecraft.key.category.climbey": - return CONTEXTUAL; - - case "vivecraft.key.category.keyboard": - return KEYBOARD; - - default: - return VivecraftVRMod.INSTANCE.isModBinding(keyBinding) ? MOD : INGAME; - } + return switch (keyMapping.getCategory()) { + case "vivecraft.key.category.gui" -> GUI; + case "vivecraft.key.category.climbey" -> CONTEXTUAL; + case "vivecraft.key.category.keyboard" -> KEYBOARD; + default -> VivecraftVRMod.isModBinding(keyMapping) ? MOD : INGAME; + }; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VivecraftMovementInput.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VivecraftMovementInput.java index 9c6cc201d..55213127e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VivecraftMovementInput.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VivecraftMovementInput.java @@ -1,14 +1,18 @@ package org.vivecraft.client_vr.provider.openvr_lwjgl.control; -import net.minecraft.client.KeyMapping; -import org.vivecraft.client_vr.provider.MCVR; import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; +import net.minecraft.client.KeyMapping; + +import static org.vivecraft.client_vr.VRState.dh; + +import static org.joml.Math.*; + public class VivecraftMovementInput { public static float getMovementAxisValue(KeyMapping keyBinding) { - VRInputAction vrinputaction = MCVR.get().getInputAction(keyBinding); - return Math.abs(vrinputaction.getAxis1DUseTracked()); + VRInputAction vrinputaction = dh.vr.getInputAction(keyBinding); + return abs(vrinputaction.getAxis1DUseTracked()); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/MC_OVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/MC_OVR.java index 69263cbbf..c82b576fb 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/MC_OVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/MC_OVR.java @@ -149,7 +149,7 @@ // } // else // { -// this.hmdPose.SetIdentity(); +// this.hmdPose.identity(); // this.hmdPose.M[1][3] = 1.62F; // } // diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/OVR_StereoRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/OVR_StereoRenderer.java index a85b8ae57..95a5b692c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/OVR_StereoRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/ovr_lwjgl/OVR_StereoRenderer.java @@ -94,12 +94,12 @@ // if (eyeType == 0) // { // OVRUtil.ovrMatrix4f_Projection(this.mcovr.hmdDesc.DefaultEyeFov(0), nearClip, farClip, 0, this.projL); -// return OVRUtils.ovrMatrix4ToMatrix4f(this.projL).toMCMatrix(); +// return OVRUtils.ovrMatrix4ToMatrix4f(this.projL).transpose(); // } // else // { // OVRUtil.ovrMatrix4f_Projection(this.mcovr.hmdDesc.DefaultEyeFov(1), nearClip, farClip, 0, this.projR); -// return OVRUtils.ovrMatrix4ToMatrix4f(this.projR).toMCMatrix(); +// return OVRUtils.ovrMatrix4ToMatrix4f(this.projR).transpose(); // } // } // diff --git a/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java b/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java index 97b05eb26..70f0295f6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java @@ -9,5 +9,6 @@ public enum RenderPass GUI, SCOPER, SCOPEL, - CAMERA; + CAMERA, + VANILLA } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java index 113d7934f..857f83818 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java @@ -1,10 +1,14 @@ package org.vivecraft.client_vr.render; -import com.mojang.blaze3d.platform.GlStateManager; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.GL11C; +import org.lwjgl.opengl.GL20C; import java.util.List; +import static org.vivecraft.common.utils.Utils.logger; + +import static com.mojang.blaze3d.platform.GlStateManager.*; + public class ShaderHelper { private static int createShader(String shaderGLSL, int shaderType) throws Exception @@ -13,7 +17,7 @@ private static int createShader(String shaderGLSL, int shaderType) throws Except try { - i = GlStateManager.glCreateShader(shaderType); + i = glCreateShader(shaderType); if (i == 0) { @@ -21,8 +25,8 @@ private static int createShader(String shaderGLSL, int shaderType) throws Except } else { - GlStateManager.glShaderSource(i, List.of(shaderGLSL)); - GlStateManager.glCompileShader(i); + glShaderSource(i, List.of(shaderGLSL)); + glCompileShader(i); String log = GL20C.glGetShaderInfoLog(i); if (!log.isEmpty()) { @@ -36,21 +40,21 @@ private static int createShader(String shaderGLSL, int shaderType) throws Except } catch (Exception exception) { - GlStateManager.glDeleteShader(i); + glDeleteShader(i); throw exception; } } public static int checkGLError(String par1Str) { - int i = GL11.glGetError(); + int i = GL11C.glGetError(); if (i != 0) { String s = ""; - System.out.println("########## GL ERROR ##########"); - System.out.println("@ " + par1Str); - System.out.println(i + ": " + s); + logger.error("########## GL ERROR ##########"); + logger.error("@ " + par1Str); + logger.error(i + ": " + s); } return i; @@ -60,7 +64,7 @@ public static int initShaders(String vertexShaderGLSL, String fragmentShaderGLSL { int i = 0; int j = 0; - int k = 0; + int k; label98: { byte b0; @@ -80,50 +84,48 @@ public static int initShaders(String vertexShaderGLSL, String fragmentShaderGLSL { if (i == 0 || j == 0) { - return 0; + b0 = 0; } } return b0; } - k = GlStateManager.glCreateProgram(); + k = glCreateProgram(); - if (k == 0) + if (k != 0) { - return 0; - } - else - { - GlStateManager.glAttachShader(k, i); - GlStateManager.glAttachShader(k, j); + glAttachShader(k, i); + glAttachShader(k, j); if (doAttribs) { - GlStateManager._glBindAttribLocation(k, 0, "in_Position"); + _glBindAttribLocation(k, 0, "in_Position"); checkGLError("@2"); - GlStateManager._glBindAttribLocation(k, 1, "in_Color"); + _glBindAttribLocation(k, 1, "in_Color"); checkGLError("@2a"); - GlStateManager._glBindAttribLocation(k, 2, "in_TextureCoord"); + _glBindAttribLocation(k, 2, "in_TextureCoord"); checkGLError("@3"); } - GL43C.glLinkProgram(k); + GL20C.glLinkProgram(k); checkGLError("Link"); String log = GL20C.glGetShaderInfoLog(i); - if (!log.isEmpty()) { - System.out.println("Shader compilation log: " + log); - return 0; - } - String log2 = GL20C.glGetShaderInfoLog(j); - if (!log2.isEmpty()) { - System.out.println("Shader compilation log: " + log2); - return 0; + if (!log.isEmpty()) + { + logger.info("Shader compilation log: " + log); + k = 0; } else + { + String log2 = GL20C.glGetShaderInfoLog(j); + if (!log2.isEmpty()) { - return k; + logger.info("Shader compilation log: " + log2); + k = 0; } } } + return k; + } } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java b/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java index d78f5f85f..a147aecaf 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java @@ -1,26 +1,27 @@ package org.vivecraft.client_vr.render; -import org.vivecraft.client_vr.gameplay.trackers.SwingTracker; import org.vivecraft.client_vr.provider.ControllerType; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.world.item.ItemStack; +import static org.vivecraft.client_vr.VRState.dh; + public class VRArmRenderer extends PlayerRenderer { - public VRArmRenderer(EntityRendererProvider.Context p_117733_, boolean p_117734_) + public VRArmRenderer(Context p_117733_, boolean p_117734_) { super(p_117733_, p_117734_); } @@ -41,14 +42,14 @@ private void renderItem(ControllerType side, PoseStack matrixStackIn, MultiBuffe this.setModelProperties(playerIn); RenderSystem.enableBlend(); RenderSystem.enableCull(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); playermodel.attackTime = 0.0F; playermodel.crouching = false; playermodel.swimAmount = 0.0F; rendererArmIn.xRot = 0.0F; playermodel.leftSleeve.copyFrom(playermodel.leftArm); playermodel.rightSleeve.copyFrom(playermodel.rightArm); - float f = SwingTracker.getItemFade((LocalPlayer)playerIn, ItemStack.EMPTY); + float f = dh.swingTracker.getItemFade(ItemStack.EMPTY); rendererArmIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkinTextureLocation())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); rendererArmwearIn.xRot = 0.0F; rendererArmwearIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkinTextureLocation())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRFirstPersonArmSwing.java b/common/src/main/java/org/vivecraft/client_vr/render/VRFirstPersonArmSwing.java index 77a88e4bb..9531f0a1f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRFirstPersonArmSwing.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRFirstPersonArmSwing.java @@ -4,5 +4,5 @@ public enum VRFirstPersonArmSwing { Attack, Use, - Interact; + Interact } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java b/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java index 93e4f75b0..5f3a9e0b5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java @@ -2,9 +2,11 @@ import com.mojang.blaze3d.shaders.AbstractUniform; import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import net.minecraft.client.Minecraft; + import net.minecraft.client.renderer.ShaderInstance; +import static org.vivecraft.client_vr.VRState.mc; + public class VRShaders { public static ShaderInstance lanczosShader; @@ -49,13 +51,9 @@ public static ShaderInstance getRendertypeEndGatewayShaderVR(){ return rendertypeEndGatewayShaderVR; } - private VRShaders() - { - } - public static void setupDepthMask() throws Exception { - depthMaskShader = new ShaderInstance(Minecraft.getInstance().getResourceManager(), "mixedreality", DefaultVertexFormat.POSITION_TEX); + depthMaskShader = new ShaderInstance(mc.getResourceManager(), "mixedreality", DefaultVertexFormat.POSITION_TEX); _DepthMask_resolutionUniform = depthMaskShader.safeGetUniform( "resolution"); @@ -71,7 +69,7 @@ public static void setupDepthMask() throws Exception public static void setupFSAA() throws Exception { - lanczosShader = new ShaderInstance(Minecraft.getInstance().getResourceManager(), "lanczos", DefaultVertexFormat.POSITION_TEX); + lanczosShader = new ShaderInstance(mc.getResourceManager(), "lanczos", DefaultVertexFormat.POSITION_TEX); _Lanczos_texelWidthOffsetUniform = lanczosShader.safeGetUniform( "texelWidthOffset"); @@ -84,7 +82,7 @@ public static void setupFSAA() throws Exception public static void setupFOVReduction() throws Exception { - fovReductionShader = new ShaderInstance(Minecraft.getInstance().getResourceManager(), "fovreduction", DefaultVertexFormat.POSITION_TEX); + fovReductionShader = new ShaderInstance(mc.getResourceManager(), "fovreduction", DefaultVertexFormat.POSITION_TEX); _FOVReduction_RadiusUniform = fovReductionShader.safeGetUniform("circle_radius"); @@ -102,7 +100,7 @@ public static void setupFOVReduction() throws Exception public static void setupPortalShaders() throws Exception { - rendertypeEndPortalShaderVR = new ShaderInstance(Minecraft.getInstance().getResourceManager(), "rendertype_end_portal_vr", DefaultVertexFormat.POSITION); - rendertypeEndGatewayShaderVR = new ShaderInstance(Minecraft.getInstance().getResourceManager(), "rendertype_end_gateway_vr", DefaultVertexFormat.POSITION); + rendertypeEndPortalShaderVR = new ShaderInstance(mc.getResourceManager(), "rendertype_end_portal_vr", DefaultVertexFormat.POSITION); + rendertypeEndGatewayShaderVR = new ShaderInstance(mc.getResourceManager(), "rendertype_end_gateway_vr", DefaultVertexFormat.POSITION); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRWidgetHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/VRWidgetHelper.java index 49db2cec6..fa792b1c0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRWidgetHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRWidgetHelper.java @@ -1,12 +1,18 @@ package org.vivecraft.client_vr.render; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; +import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; +import org.vivecraft.client_vr.settings.VRHotkeys; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; + import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat.Mode; -import net.minecraft.client.Minecraft; + import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -17,19 +23,16 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.inventory.InventoryMenu; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.MethodHolder; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; -import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; -import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client.utils.Utils; import java.util.function.Function; +import static org.vivecraft.client.utils.Utils.getCombinedLightWithMin; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class VRWidgetHelper { private static final RandomSource random = RandomSource.create(); @@ -37,24 +40,21 @@ public class VRWidgetHelper public static void renderVRThirdPersonCamWidget() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - - if (dataholder.vrSettings.mixedRealityRenderCameraModel) + if (dh.vrSettings.mixedRealityRenderCameraModel) { - if ((dataholder.currentPass == RenderPass.LEFT || dataholder.currentPass == RenderPass.RIGHT) && (dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY || dataholder.vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON)) + if ((dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT) && (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY || dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON)) { float f = 0.35F; - if (dataholder.interactTracker.isInCamera() && !VRHotkeys.isMovingThirdPersonCam()) + if (dh.interactTracker.isInCamera() && !VRHotkeys.isMovingThirdPersonCam()) { f *= 1.03F; } - renderVRCameraWidget(-0.748F, -0.438F, -0.06F, f, RenderPass.THIRD, ClientDataHolderVR.thirdPersonCameraModel, ClientDataHolderVR.thirdPersonCameraDisplayModel, () -> + renderVRCameraWidget(-0.748F, -0.438F, -0.06F, f, RenderPass.THIRD, dh.thirdPersonCameraModel, dh.thirdPersonCameraDisplayModel, () -> { - dataholder.vrRenderer.framebufferMR.bindRead(); - RenderSystem.setShaderTexture(0, dataholder.vrRenderer.framebufferMR.getColorTextureId()); + dh.vrRenderer.framebufferMR.bindRead(); + RenderSystem.setShaderTexture(0, dh.vrRenderer.framebufferMR.getColorTextureId()); }, (face) -> { if (face == Direction.NORTH) @@ -71,24 +71,22 @@ public static void renderVRThirdPersonCamWidget() public static void renderVRHandheldCameraWidget() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.currentPass != RenderPass.CAMERA && dataholder.cameraTracker.isVisible()) + if (dh.currentPass != RenderPass.CAMERA && dh.cameraTracker.isVisible()) { float f = 0.25F; - if (dataholder.interactTracker.isInHandheldCamera() && !dataholder.cameraTracker.isMoving()) + if (dh.interactTracker.isInHandheldCamera() && !dh.cameraTracker.isMoving()) { f *= 1.03F; } renderVRCameraWidget(-0.5F, -0.25F, -0.22F, f, RenderPass.CAMERA, CameraTracker.cameraModel, CameraTracker.cameraDisplayModel, () -> { - if (((ItemInHandRendererExtension) minecraft.getEntityRenderDispatcher().getItemInHandRenderer()).getNearOpaqueBlock(dataholder.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(), (double)((GameRendererExtension) minecraft.gameRenderer).getMinClipDistance()) == null) + if (((ItemInHandRendererExtension) mc.getEntityRenderDispatcher().getItemInHandRenderer()).getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(), (double)((GameRendererExtension) mc.gameRenderer).getMinClipDistance()) == null) { - dataholder.vrRenderer.cameraFramebuffer.bindRead(); - RenderSystem.setShaderTexture(0, dataholder.vrRenderer.cameraFramebuffer.getColorTextureId()); + dh.vrRenderer.cameraFramebuffer.bindRead(); + RenderSystem.setShaderTexture(0, dh.vrRenderer.cameraFramebuffer.getColorTextureId()); } else { RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/black.png")); @@ -102,48 +100,50 @@ public static void renderVRHandheldCameraWidget() public static void renderVRCameraWidget(float offsetX, float offsetY, float offsetZ, float scale, RenderPass renderPass, ModelResourceLocation model, ModelResourceLocation displayModel, Runnable displayBindFunc, Function displayFaceFunc) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); PoseStack poseStack = RenderSystem.getModelViewStack(); poseStack.pushPose(); poseStack.setIdentity(); - ((GameRendererExtension) minecraft.gameRenderer).applyVRModelView(dataholder.currentPass, poseStack); + ((GameRendererExtension) mc.gameRenderer).applyVRModelView(dh.currentPass, poseStack); - Vec3 vec3 = dataholder.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition(); - Vec3 vec31 = dataholder.vrPlayer.vrdata_world_render.getEye(dataholder.currentPass).getPosition(); + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition(); + Vec3 vec31 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); Vec3 vec32 = vec3.subtract(vec31); - poseStack.translate(vec32.x, vec32.y, vec32.z); - poseStack.mulPoseMatrix(dataholder.vrPlayer.vrdata_world_render.getEye(renderPass).getMatrix().toMCMatrix()); - scale = scale * dataholder.vrPlayer.vrdata_world_render.worldScale; + poseStack.last().pose() + .translate((float) vec32.x, (float) vec32.y, (float) vec32.z) + .mul(dh.vrPlayer.vrdata_world_render.getEye(renderPass).getMatrix()); + scale *= dh.vrPlayer.vrdata_world_render.worldScale; poseStack.scale(scale, scale, scale); if (debug) { - MethodHolder.rotateDeg(poseStack, 180.0F, 0.0F, 1.0F, 0.0F); - ((GameRendererExtension) minecraft.gameRenderer).renderDebugAxes(0, 0, 0, 0.08F); - MethodHolder.rotateDeg(poseStack, 180.0F, 0.0F, 1.0F, 0.0F); + float ang = toRadians(180.0F); + poseStack.last().pose().rotateY(ang); + poseStack.last().normal().rotateY(ang); + ((GameRendererExtension) mc.gameRenderer).renderDebugAxes(0, 0, 0, 0.08F); + poseStack.last().pose().rotateY(ang); + poseStack.last().normal().rotateY(ang); } - poseStack.translate(offsetX, offsetY, offsetZ); + poseStack.last().pose().translate(offsetX, offsetY, offsetZ); RenderSystem.applyModelViewMatrix(); - BlockPos blockpos = BlockPos.containing(dataholder.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition()); - int i = Utils.getCombinedLightWithMin(minecraft.level, blockpos, 0); + BlockPos blockpos = BlockPos.containing(dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition()); + int i = getCombinedLightWithMin(mc.level, blockpos, 0); RenderSystem.enableDepthTest(); RenderSystem.defaultBlendFunc(); RenderSystem.setShaderTexture(0, InventoryMenu.BLOCK_ATLAS); - if (minecraft.level != null) + if (mc.level != null) RenderSystem.setShader(GameRenderer::getRendertypeEntityCutoutNoCullShader); else RenderSystem.setShader(GameRenderer::getPositionTexColorNormalShader); - minecraft.gameRenderer.lightTexture().turnOnLightLayer(); + mc.gameRenderer.lightTexture().turnOnLightLayer(); Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tesselator.getBuilder(); bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.NEW_ENTITY); - minecraft.getBlockRenderer().getModelRenderer().renderModel((new PoseStack()).last(), bufferbuilder, (BlockState)null, minecraft.getModelManager().getModel(model), 1.0F, 1.0F, 1.0F, i, OverlayTexture.NO_OVERLAY); + mc.getBlockRenderer().getModelRenderer().renderModel((new PoseStack()).last(), bufferbuilder, null, mc.getModelManager().getModel(model), 1.0F, 1.0F, 1.0F, i, OverlayTexture.NO_OVERLAY); tesselator.end(); RenderSystem.disableBlend(); @@ -153,7 +153,7 @@ public static void renderVRCameraWidget(float offsetX, float offsetY, float offs BufferBuilder bufferbuilder1 = tesselator.getBuilder(); bufferbuilder1.begin(Mode.QUADS, DefaultVertexFormat.NEW_ENTITY); - for (BakedQuad bakedquad : minecraft.getModelManager().getModel(displayModel).getQuads((BlockState)null, (Direction)null, random)) + for (BakedQuad bakedquad : mc.getModelManager().getModel(displayModel).getQuads(null, null, random)) { if (displayFaceFunc.apply(bakedquad.getDirection()) != DisplayFace.NONE && bakedquad.getSprite().contents().name().equals(new ResourceLocation("vivecraft:transparent"))) { @@ -202,16 +202,16 @@ public static void renderVRCameraWidget(float offsetX, float offsetY, float offs } tesselator.end(); - minecraft.gameRenderer.lightTexture().turnOffLightLayer(); + mc.gameRenderer.lightTexture().turnOffLightLayer(); RenderSystem.enableBlend(); poseStack.popPose(); RenderSystem.applyModelViewMatrix(); } - public static enum DisplayFace + public enum DisplayFace { NONE, NORMAL, - MIRROR; + MIRROR } } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java index 7187ed503..f492feeaf 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java @@ -1,49 +1,38 @@ package org.vivecraft.client_vr.render; -import com.mojang.math.Axis; import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.gameplay.trackers.SwingTracker; import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; import org.vivecraft.client_vr.provider.ControllerType; -import com.mojang.blaze3d.vertex.PoseStack; import org.joml.Quaternionf; +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.Util; -import net.minecraft.client.Minecraft; import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.world.InteractionHand; -import net.minecraft.world.item.ArrowItem; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CompassItem; -import net.minecraft.world.item.CrossbowItem; -import net.minecraft.world.item.FishingRodItem; -import net.minecraft.world.item.FoodOnAStickItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.MapItem; -import net.minecraft.world.item.ShieldItem; -import net.minecraft.world.item.SwordItem; -import net.minecraft.world.item.TridentItem; -import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.*; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.TorchBlock; import net.minecraft.world.phys.Vec3; +import javax.annotation.Nonnull; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + public class VivecraftItemRendering { - private static ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); - public static VivecraftItemTransformType getTransformType(ItemStack pStack, AbstractClientPlayer pPlayer, ItemRenderer itemRenderer) { - VivecraftItemTransformType rendertype = VivecraftItemTransformType.Item; - Item item = pStack.getItem(); - Minecraft minecraft = Minecraft.getInstance(); + public static VivecraftItemTransformType getTransformType(ItemStack pStack, AbstractClientPlayer pPlayer, ItemRenderer itemRenderer) { + VivecraftItemTransformType rendertype = VivecraftItemTransformType.Item; + Item item = pStack.getItem(); if (pStack.getUseAnimation() != UseAnim.EAT && pStack.getUseAnimation() != UseAnim.DRINK) { @@ -57,7 +46,7 @@ public static VivecraftItemTransformType getTransformType(ItemStack pStack, Abst } else { - BakedModel bakedmodel = itemRenderer.getModel(pStack, minecraft.level, minecraft.player, 0); + BakedModel bakedmodel = itemRenderer.getModel(pStack, mc.level, mc.player, 0); if (bakedmodel.isGui3d()) { @@ -77,7 +66,7 @@ else if (pStack.getUseAnimation() == UseAnim.BOW) { rendertype = VivecraftItemTransformType.Bow_Seated; - if (dh.bowTracker.isActive((LocalPlayer)pPlayer)) + if (dh.bowTracker.isActive()) { if (dh.bowTracker.isDrawing) { @@ -134,74 +123,67 @@ else if (TelescopeTracker.isTelescope(pStack)) rendertype = VivecraftItemTransformType.Noms; } return rendertype; - } - - public static void applyThirdPersonItemTransforms(PoseStack pMatrixStack, VivecraftItemTransformType rendertype, boolean mainHand, AbstractClientPlayer pPlayer, float pEquippedProgress, float pPartialTicks, ItemStack pStack, InteractionHand pHand) { - //all TODO - int k = mainHand ? 1 : -1; - Minecraft minecraft = Minecraft.getInstance(); - double scale = 0.525D; - double translateX = 0; - double translateY = 0.05; - double translateZ = 0; - boolean useLeftHandModelinLeftHand = false; - -// pMatrixStack.mulPose(preRotation); - pMatrixStack.translate(translateX, translateY, translateZ); -// pMatrixStack.mulPose(rotation); - pMatrixStack.scale((float)scale, (float)scale, (float)scale); - } - - - public static void applyFirstPersonItemTransforms(PoseStack pMatrixStack, VivecraftItemTransformType rendertype, boolean mainHand, AbstractClientPlayer pPlayer, float pEquippedProgress, float pPartialTicks, ItemStack pStack, InteractionHand pHand) { - int k = mainHand ? 1 : -1; - Minecraft minecraft = Minecraft.getInstance(); - double scale = 0.7D; - double translateX = -0.05D; - double translateY = 0.005D; - double translateZ = 0.0D; - boolean useLeftHandModelinLeftHand = false; - + } + + public static void applyThirdPersonItemTransforms(@Nonnull PoseStack pMatrixStack, VivecraftItemTransformType rendertype, boolean mainHand, AbstractClientPlayer pPlayer, float pEquippedProgress, float pPartialTicks, ItemStack pStack, InteractionHand pHand) { + //all TODO + float scale = 0.525F; + float translateX = 0.0F; + float translateY = 0.05F; + float translateZ = 0.0F; + boolean useLeftHandModelinLeftHand = false; + + // pMatrixStack.last().pose().rotate(preRotation); + // pMatrixStack.last().normal().rotate(preRotation); + pMatrixStack.last().pose().translate(translateX, translateY, translateZ); + // pMatrixStack.last().pose().rotate(rotation); + // pMatrixStack.last().normal().rotate(rotation); + pMatrixStack.scale(scale, scale, scale); + } + + + public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStack, VivecraftItemTransformType rendertype, boolean mainHand, AbstractClientPlayer pPlayer, float pEquippedProgress, float pPartialTicks, ItemStack pStack, InteractionHand pHand) { + int k = mainHand ? 1 : -1; + float scale = 0.7F; + float translateX = -0.05F; + float translateY = 0.005F; + float translateZ = 0.0F; + boolean useLeftHandModelinLeftHand = false; + double gunAngle = dh.vr.getGunAngle(); - Quaternionf rotation = Axis.YP.rotationDegrees(0.0F); - Quaternionf preRotation = Axis.YP.rotationDegrees(0.0F); - rotation.mul(Axis.XP.rotationDegrees((float)(-110.0D + gunAngle))); + Quaternionf rotation = new Quaternionf().rotationY(0.0F).rotateX(toRadians((float)(-110.0D + gunAngle))); + Quaternionf preRotation = new Quaternionf().rotationY(0.0F); if (rendertype == VivecraftItemTransformType.Bow_Seated) { - translateY += -0.1D; + translateY -= 0.1D; translateZ += 0.1D; - rotation.mul(Axis.XP.rotationDegrees((float)(90.0D - gunAngle))); - scale = (double)0.7F; + rotation.rotateX(toRadians((float)(90.0D - gunAngle))); } else if (rendertype == VivecraftItemTransformType.Bow_Roomscale) { - rotation = Axis.XP.rotationDegrees(0.0F); - pMatrixStack.mulPose(Axis.XP.rotationDegrees((float)(-110.0D + gunAngle))); + rotation.rotationX(0.0F); + float ang = (float)toRadians((-110.0D + gunAngle)); + pMatrixStack.last().pose().rotateX(ang); + pMatrixStack.last().normal().rotateX(ang); translateY -= 0.25D; translateZ += (double)0.025F + 0.03D * gunAngle / 40.0D; - translateX += -0.0225D; - scale = 1.0D; + translateX -= 0.0225D; + scale = 1.0F; } else if (rendertype == VivecraftItemTransformType.Bow_Roomscale_Drawing) { - rotation = Axis.YP.rotationDegrees(0.0F); - scale = 1.0D; - int i = 0; - - if (dh.vrSettings.reverseShootingEye) - { - i = 1; - } + rotation.rotationY(0.0F); + scale = 1.0F; + int i = dh.vrSettings.reverseShootingEye ? 1 : 0; Vec3 vec3 = dh.bowTracker.getAimVector(); Vec3 vec31 = new Vec3(vec3.x, vec3.y, vec3.z); Vec3 vec32 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); Vec3 vec33 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)); vec31.cross(vec32); - double d4 = (180D / Math.PI) * Math.acos(vec31.dot(vec32)); - float f = (float)Math.toDegrees(Math.asin(vec31.y / vec31.length())); - float f1 = (float)Math.toDegrees(Math.atan2(vec31.x, vec31.z)); + float f = (float)toDegrees(asin(vec31.y / vec31.length())); + float f1 = (float)toDegrees(atan2(vec31.x, vec31.z)); Vec3 vec34 = new Vec3(0.0D, 1.0D, 0.0D); Vec3 vec35 = new Vec3(vec31.x, 0.0D, vec31.z); Vec3 vec36 = Vec3.ZERO; @@ -212,164 +194,158 @@ else if (rendertype == VivecraftItemTransformType.Bow_Roomscale_Drawing) vec36 = vec35.scale(d5); } - double d6 = 0.0D; Vec3 vec37 = vec33.subtract(vec36).normalize(); - d6 = vec37.dot(vec34); + double d6 = vec37.dot(vec34); double d7 = vec35.dot(vec37.cross(vec34)); float f2; if (d7 < 0.0D) { - f2 = -((float)Math.acos(d6)); + f2 = -((float)acos(d6)); } else { - f2 = (float)Math.acos(d6); + f2 = (float)acos(d6); } - float f3 = (float)((180D / Math.PI) * (double)f2); + float f3 = (float)((180D / PI) * (double)f2); if (dh.bowTracker.isCharged()) { long j = Util.getMillis() - dh.bowTracker.startDrawTime; - translateX += 0.003D * Math.sin((double)j); + translateX += 0.003D * sin(j); } - pMatrixStack.translate(0.0D, 0.0D, 0.1D); - pMatrixStack.last().pose().mul(dh.vrPlayer.vrdata_world_render.getController(1).getMatrix().transposed().toMCMatrix()); - rotation.mul(Axis.YP.rotationDegrees(f1)); - rotation.mul(Axis.XP.rotationDegrees(-f)); - rotation.mul(Axis.ZP.rotationDegrees(-f3)); - rotation.mul(Axis.ZP.rotationDegrees(180.0F)); + pMatrixStack.last().pose() + .translate(0.0F, 0.0F, 0.1F) + .mul(dh.vrPlayer.vrdata_world_render.getController(1).getMatrix()); + rotation.rotateY(toRadians(f1)); + rotation.rotateX(toRadians(-f)); + rotation.rotateZ(toRadians(-f3)); + rotation.rotateZ(toRadians(180.0F)); pMatrixStack.last().pose().rotate(rotation); - rotation = Axis.YP.rotationDegrees(0.0F); - rotation.mul(Axis.YP.rotationDegrees(180.0F)); - rotation.mul(Axis.XP.rotationDegrees(160.0F)); + rotation.rotationY(0.0F); + rotation.rotateY(toRadians(180.0F)); + rotation.rotateX(toRadians(160.0F)); translateY += 0.1225D; translateX += 0.125D; translateZ += 0.16D; } else if (rendertype == VivecraftItemTransformType.Crossbow) { - translateX += (double)0.01F; - translateZ += (double) - 0.02F; - translateY += (double) - 0.02F; - scale = 0.5D; - rotation = Axis.XP.rotationDegrees(0.0F); - rotation.mul(Axis.YP.rotationDegrees(10.0F)); + translateX += 0.01F; + translateZ -= 0.02F; + translateY -= 0.02F; + scale = 0.5F; + rotation.rotationX(0.0F); + rotation.rotateY(toRadians(10.0F)); } else if (rendertype == VivecraftItemTransformType.Map) { - rotation = Axis.XP.rotationDegrees(-45.0F); - translateX = 0.0D; - translateY = 0.16D; - translateZ = -0.075D; - scale = 0.75D; + rotation.rotationX(toRadians(-45.0F)); + translateX = 0.0F; + translateY = 0.16F; + translateZ = -0.075F; + scale = 0.75F; } else if (rendertype == VivecraftItemTransformType.Noms) { - long l = (long)minecraft.player.getUseItemRemainingTicks(); - rotation = Axis.ZP.rotationDegrees(180.0F); - rotation.mul(Axis.XP.rotationDegrees(-135.0F)); - translateZ = translateZ + 0.006D * Math.sin((double)l); - translateZ = translateZ + (double)0.02F; - translateX += (double)0.08F; - scale = (double)0.4F; + long l = mc.player.getUseItemRemainingTicks(); + rotation.rotationZ(toRadians(180.0F)); + rotation.rotateX(toRadians(-135.0F)); + translateZ += 0.006F * sin(l); + translateZ += 0.02F; + translateX += 0.08F; + scale = 0.4F; } else if (rendertype != VivecraftItemTransformType.Item && rendertype != VivecraftItemTransformType.Block_Item) { if (rendertype == VivecraftItemTransformType.Compass) { - rotation = Axis.YP.rotationDegrees(90.0F); - rotation.mul(Axis.XP.rotationDegrees(25.0F)); - scale = (double)0.4F; + rotation.rotationY(toRadians(90.0F)); + rotation.rotateX(toRadians(25.0F)); + scale = 0.4F; } else if (rendertype == VivecraftItemTransformType.Block_3D) { - scale = (double)0.3F; - translateZ += (double) - 0.1F; - translateX += (double)0.05F; + scale = 0.3F; + translateZ -= 0.1F; + translateX += 0.05F; } else if (rendertype == VivecraftItemTransformType.Block_Stick) { - rotation = Axis.XP.rotationDegrees(0.0F); + rotation.rotationX(0.0F); translateY += -0.105D + 0.06D * gunAngle / 40.0D; - translateZ += (double) - 0.1F; - rotation.mul(Axis.XP.rotationDegrees(-45.0F)); - rotation.mul(Axis.XP.rotationDegrees((float)gunAngle)); + translateZ -= 0.1F; + rotation.rotateX(toRadians(-45.0F)); + rotation.rotateX(toRadians((float)gunAngle)); } else if (rendertype == VivecraftItemTransformType.Horn) { - scale = (double)0.3F; - rotation = Axis.XP.rotationDegrees(0.0F); - translateY += -0.105D + 0.06D * gunAngle / 40.0D; - translateZ += (double) - 0.1F; - rotation.mul(Axis.XP.rotationDegrees(-45.0F)); - rotation.mul(Axis.XP.rotationDegrees((float)gunAngle)); + scale = 0.3F; + rotation = new Quaternionf().rotationX(0.0F); + translateY += -0.105F + 0.06F * gunAngle / 40.0F; + translateZ -= 0.1F; + rotation.rotateX(toRadians(-45.0F)); + rotation.rotateX(toRadians((float)gunAngle)); } else if (rendertype == VivecraftItemTransformType.Shield) { - boolean reverse = dh.vrSettings.reverseHands && !dh.vrSettings.seated; - if(reverse)k*=-1; - scale = (double)0.4F; + boolean reverse = dh.vrSettings.reverseHands && !dh.vrSettings.seated; + if(reverse)k*=-1; + scale = 0.4F; - translateY += (double)0.18F; - // - if (k==1) + translateY += 0.18F; + if (k==1) { - rotation.mul(Axis.XP.rotationDegrees((float)(105.0D - gunAngle))); - translateX += (double)0.11F; + rotation.rotateX(toRadians((float)(105.0D - gunAngle))); + translateX += 0.11F; } else { - rotation.mul(Axis.XP.rotationDegrees((float)(115.0D - gunAngle))); - translateX += -0.015D; + rotation.rotateX(toRadians((float)(115.0D - gunAngle))); + translateX -= 0.015F; } - //// - translateZ += 0.1F; + translateZ += 0.1F; if (pPlayer.isUsingItem() && pPlayer.getUseItemRemainingTicks() > 0 && pPlayer.getUsedItemHand() == pHand) { - rotation.mul(Axis.XP.rotationDegrees(k*5F)); - rotation.mul(Axis.ZP.rotationDegrees(-5F)); - - if (k==1) - { - translateY += (double) -0.12F; - translateZ += -.1F; - translateX += .04F; - } - else - { - translateY += -0.12F; - translateZ += -.11F; - translateX += 0.19F; - } - - - //// + rotation.rotateX(toRadians(k*5F)); + rotation.rotateZ(toRadians(-5F)); + + translateY -= 0.12F; + if (k==1) + { + translateZ -= .1F; + translateX += .04F; + } + else + { + translateZ -= .11F; + translateX += 0.19F; + } + + if (pPlayer.isBlocking()) { - rotation.mul(Axis.YP.rotationDegrees((float)k * 90.0F)); + rotation.rotateY(toRadians((float)k * 90.0F)); } else { - rotation.mul(Axis.YP.rotationDegrees((1.0F - pEquippedProgress) * (float)k * 90.0F)); + rotation.rotateY(toRadians((1.0F - pEquippedProgress)) * (float)k * 90.0F); } - //// } - //// - rotation.mul(Axis.YP.rotationDegrees((float)k * -90.0F)); + rotation.rotateY(toRadians((float)k * -90.0F)); } else if (rendertype == VivecraftItemTransformType.Spear) { - rotation = Axis.XP.rotationDegrees(0.0F); - translateX += (double) - 0.135F; - translateZ = translateZ + (double)0.575F; - scale = (double)0.6F; + rotation.rotationX(0.0F); + translateX -= 0.135F; + translateZ += 0.575F; + scale = 0.6F; float f4 = 0.0F; boolean flag5 = false; - int i1 = 0; + int i1; if (pPlayer.isUsingItem() && pPlayer.getUseItemRemainingTicks() > 0 && pPlayer.getUsedItemHand() == pHand) { @@ -378,7 +354,7 @@ else if (rendertype == VivecraftItemTransformType.Spear) if (i1 <= 0 || i1 > 0 && pPlayer.isInWaterOrRain()) { - f4 = (float)pStack.getUseDuration() - ((float)minecraft.player.getUseItemRemainingTicks() - pPartialTicks + 1.0F); + f4 = (float)pStack.getUseDuration() - ((float)mc.player.getUseItemRemainingTicks() - pPartialTicks + 1.0F); if (f4 > 10.0F) { @@ -386,16 +362,18 @@ else if (rendertype == VivecraftItemTransformType.Spear) if (i1 > 0 && pPlayer.isInWaterOrRain()) { - pMatrixStack.mulPose(Axis.ZP.rotationDegrees((float)(-dh.tickCounter * 10 * i1 % 360) - pPartialTicks * 10.0F * (float)i1)); + float ang = toRadians((float)(-dh.tickCounter * 10 * i1 % 360) - pPartialTicks * 10.0F * (float)i1); + pMatrixStack.last().pose().rotateZ(ang); + pMatrixStack.last().normal().rotateZ(ang); } if (dh.frameIndex % 4L == 0L) { - dh.vr.triggerHapticPulse(mainHand ? 0 : 1, 200); + dh.vr.triggerHapticPulse(mainHand ? 0 : 1, 200); } long j1 = Util.getMillis() - dh.bowTracker.startDrawTime; - translateX += 0.003D * Math.sin((double)j1); + translateX += 0.003D * sin(j1); } } } @@ -403,29 +381,31 @@ else if (rendertype == VivecraftItemTransformType.Spear) if (pPlayer.isAutoSpinAttack()) { i1 = 5; - translateZ += (double) - 0.15F; - pMatrixStack.mulPose(Axis.ZP.rotationDegrees((float)(-dh.tickCounter * 10 * i1 % 360) - pPartialTicks * 10.0F * (float)i1)); + translateZ -= 0.15F; + float ang = toRadians((float)(-dh.tickCounter * 10 * i1 % 360) - pPartialTicks * 10.0F * (float)i1); + pMatrixStack.last().pose().rotateZ(ang); + pMatrixStack.last().normal().rotateZ(ang); flag5 = true; } if (!flag5) { - translateY += 0.0D + 0.2D * gunAngle / 40.0D; - rotation.mul(Axis.XP.rotationDegrees((float)gunAngle)); + translateY += 0.0F + 0.2F * gunAngle / 40.0F; + rotation.rotateX(toRadians((float)gunAngle)); } - rotation.mul(Axis.XP.rotationDegrees(-65.0F)); - translateZ = translateZ + (double)(-0.75F + f4 / 10.0F * 0.25F); + rotation.rotateX(toRadians(-65.0F)); + translateZ += (-0.75F + f4 / 10.0F * 0.25F); } else if (rendertype != VivecraftItemTransformType.Sword) { if (rendertype == VivecraftItemTransformType.Tool_Rod) { - translateZ += (double) - 0.15F; + translateZ -= 0.15F; translateY += -0.02D + gunAngle / 40.0D * 0.1D; - translateX += (double)0.05F; - rotation.mul(Axis.XP.rotationDegrees(40.0F)); - scale = (double)0.8F; + translateX += 0.05F; + rotation.rotateX(toRadians(40.0F)); + scale = 0.8F; } else if (rendertype == VivecraftItemTransformType.Tool) { @@ -433,69 +413,74 @@ else if (rendertype == VivecraftItemTransformType.Tool) if (isClaws) { - rotation.mul(Axis.XP.rotationDegrees((float)(-gunAngle))); - scale = (double)0.3F; - translateZ += (double)0.075F; - translateY += (double)0.02F; - translateX += (double)0.03F; + rotation.rotateX(toRadians((float)(-gunAngle))); + scale = 0.3F; + translateZ += 0.075F; + translateY += 0.02F; + translateX += 0.03F; - if (VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.RIGHT) && mainHand || VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.LEFT) && !mainHand) + if (VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT) && mainHand || VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT) && !mainHand) { - translateZ += (double) - 0.2F; + translateZ -= 0.2F; } } if (pStack.getItem() instanceof ArrowItem || pStack.is(ItemTags.VIVECRAFT_ARROWS)) { - preRotation = Axis.ZP.rotationDegrees(-180.0F); - rotation.mul(Axis.XP.rotationDegrees((float)(-gunAngle))); + preRotation.rotationZ(toRadians(-180.0F)); + rotation.rotateX(toRadians((float)(-gunAngle))); } } else if (rendertype == VivecraftItemTransformType.Telescope) { - preRotation = Axis.XP.rotationDegrees(0.0F); - rotation = Axis.XP.rotationDegrees(0.0F); - translateZ = 0.0D; - translateY = 0.0D; - translateX = 0.0D; + preRotation.rotationX(0.0F); + rotation.rotationX(0.0F); + translateZ = 0.0F; + translateY = 0.0F; + translateX = 0.0F; } } } else { - rotation = Axis.ZP.rotationDegrees(180.0F); - rotation.mul(Axis.XP.rotationDegrees(-135.0F)); - scale = (double)0.4F; - translateX += (double)0.08F; - translateZ += (double) - 0.08F; + rotation.rotationZ(toRadians(180.0F)); + rotation.rotateX(toRadians(-135.0F)); + scale = 0.4F; + translateX += 0.08F; + translateZ -= 0.08F; } - pMatrixStack.mulPose(preRotation); - pMatrixStack.translate(translateX, translateY, translateZ); - pMatrixStack.mulPose(rotation); - pMatrixStack.scale((float)scale, (float)scale, (float)scale); - } - - public enum VivecraftItemTransformType -{ - Item, - Block_3D, - Block_Stick, - Block_Item, - Shield, - Sword, - Tool, - Tool_Rod, - Bow_Seated, - Bow_Roomscale, - Bow_Roomscale_Drawing, - Spear, - Map, - Noms, - Crossbow, - Telescope, - Compass, - Horn -} - + pMatrixStack.last().pose() + .rotate(preRotation) + .translate(translateX, translateY, translateZ) + .rotate(rotation); + + pMatrixStack.last().normal() + .rotate(preRotation) + .rotate(rotation); + + pMatrixStack.scale(scale, scale, scale); + } + + public enum VivecraftItemTransformType + { + Item, + Block_3D, + Block_Stick, + Block_Item, + Shield, + Sword, + Tool, + Tool_Rod, + Bow_Seated, + Bow_Roomscale, + Bow_Roomscale_Drawing, + Spear, + Map, + Noms, + Crossbow, + Telescope, + Compass, + Horn + } } \ No newline at end of file diff --git a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java index 98738cb96..c201c4779 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java @@ -1,19 +1,22 @@ package org.vivecraft.client_vr.render; -import com.mojang.math.Axis; -import net.minecraft.world.level.material.FogType; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRData; +import org.vivecraft.client_vr.VRData.VRDevicePose; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; +import org.vivecraft.client_xr.render_pass.RenderPassType; + +import org.joml.Quaternionf; -import net.minecraft.client.Camera; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client_xr.render_pass.RenderPassType; +import static org.vivecraft.client_vr.VRState.dh; -public class XRCamera extends Camera { +import static org.joml.Math.*; + + +public class XRCamera extends net.minecraft.client.Camera { public void setup(BlockGetter pLevel, Entity pRenderViewEntity, boolean pThirdPerson, boolean pThirdPersonReverse, float pPartialTicks) { if (RenderPassType.isVanilla()) { super.setup(pLevel, pRenderViewEntity, pThirdPerson, pThirdPersonReverse, pPartialTicks); @@ -22,10 +25,7 @@ public void setup(BlockGetter pLevel, Entity pRenderViewEntity, boolean pThirdPe this.initialized = true; this.level = pLevel; this.entity = pRenderViewEntity; - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - RenderPass renderpass = dataholder.currentPass; - - VRData.VRDevicePose eye = dataholder.vrPlayer.vrdata_world_render.getEye(renderpass); + VRDevicePose eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass); this.setPosition(eye.getPosition()); this.xRot = -eye.getPitch(); this.yRot = eye.getYaw(); @@ -35,8 +35,8 @@ public void setup(BlockGetter pLevel, Entity pRenderViewEntity, boolean pThirdPe eye.getCustomVector(new Vec3(1.0D, 0.0D, 0.0D)); this.getLeftVector().set((float) vec3.x, (float) vec3.y, (float) vec3.z); this.rotation().set(0.0F, 0.0F, 0.0F, 1.0F); - this.rotation().mul(Axis.YP.rotationDegrees(-this.yRot)); - this.rotation().mul(Axis.XP.rotationDegrees(this.xRot)); + this.rotation().mul(new Quaternionf().rotationY(toRadians(-this.yRot))); + this.rotation().mul(new Quaternionf().rotationX(toRadians(this.xRot))); } public void tick() { @@ -47,11 +47,14 @@ public void tick() { @Override public boolean isDetached() { - if (RenderPassType.isVanilla()) { - return super.isDetached(); - } - boolean renderSelf = ClientDataHolderVR.getInstance().currentPass == RenderPass.THIRD && ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON || ClientDataHolderVR.getInstance().currentPass == RenderPass.CAMERA; - return renderSelf || ClientDataHolderVR.getInstance().vrSettings.shouldRenderSelf; + return (RenderPassType.isVanilla() ? + super.isDetached() : + switch (dh.currentPass){ + case THIRD -> dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON; + case CAMERA -> true; + default -> dh.vrSettings.shouldRenderSelf; + } + ); } // some mods call this, when querying the sunrise color in the menu world diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/AutoCalibration.java b/common/src/main/java/org/vivecraft/client_vr/settings/AutoCalibration.java index 245dd19bf..736592a13 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/AutoCalibration.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/AutoCalibration.java @@ -1,43 +1,31 @@ package org.vivecraft.client_vr.settings; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client.utils.LangHelper; -import net.minecraft.client.Minecraft; +import org.joml.Vector3d; + import net.minecraft.network.chat.Component; +import static org.vivecraft.client.utils.Utils.message; +import static org.vivecraft.client_vr.VRState.dh; + +import static org.joml.Math.*; + public class AutoCalibration { public static final float defaultHeight = 1.52F; public static void calibrateManual() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - dataholder.vrSettings.manualCalibration = (float)dataholder.vr.hmdPivotHistory.averagePosition(0.5D).y; - int i = (int)((float)((double)Math.round(100.0D * (double)getPlayerHeight() / (double)1.52F))); - minecraft.gui.getChat().addMessage(Component.literal(LangHelper.get("vivecraft.messages.heightset", i))); - dataholder.vrSettings.saveOptions(); + + dh.vrSettings.manualCalibration = (float)dh.vr.hmdPivotHistory.averagePosition(0.5D, new Vector3d()).y; + message(Component.literal(LangHelper.get("vivecraft.messages.heightset", round(100.0F * getPlayerHeight() / defaultHeight)))); + dh.vrSettings.saveOptions(); } public static float getPlayerHeight() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - float f = 1.52F; - - if (dataholder.vrSettings.seated) - { - return f; - } - else - { - if (dataholder.vrSettings.manualCalibration != -1.0F) - { - f = dataholder.vrSettings.manualCalibration; - } - - return f; - } + return !dh.vrSettings.seated && dh.vrSettings.manualCalibration != -1.0F ? + dh.vrSettings.manualCalibration : defaultHeight; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java b/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java index b82614eeb..09aee5a5a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java @@ -1,20 +1,21 @@ package org.vivecraft.client_vr.settings; -import java.lang.reflect.Method; - import org.vivecraft.client.utils.LangHelper; +import java.lang.reflect.Method; + public interface OptionEnum> { default String getLangKey() { - switch (name().toLowerCase()) { - case "yes": return LangHelper.YES_KEY; - case "no": return LangHelper.NO_KEY; - case "on": return LangHelper.ON_KEY; - case "off": return LangHelper.OFF_KEY; - } - - Class cls = getClass(); - return "vivecraft.options." + (cls.isAnonymousClass() ? cls.getSuperclass() : cls).getSimpleName().toLowerCase() + "." + name().toLowerCase().replace("_", ""); + return switch (name().toLowerCase()) { + case "yes" -> LangHelper.YES_KEY; + case "no" -> LangHelper.NO_KEY; + case "on" -> LangHelper.ON_KEY; + case "off" -> LangHelper.OFF_KEY; + default -> { + Class cls = getClass(); + yield "vivecraft.options." + (cls.isAnonymousClass() ? cls.getSuperclass() : cls).getSimpleName().toLowerCase() + "." + name().toLowerCase().replace("_", ""); + } + }; } default T getNext() { diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/SettingField.java b/common/src/main/java/org/vivecraft/client_vr/settings/SettingField.java index f56a3f841..6ec195772 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/SettingField.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/SettingField.java @@ -1,5 +1,7 @@ package org.vivecraft.client_vr.settings; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -9,12 +11,12 @@ @Target(ElementType.FIELD) public @interface SettingField { /** - * The {@link VRSettings.VrOptions} that this field is associated with. + * The {@link VrOptions} that this field is associated with. * If left as the default DUMMY, it will function as a hidden setting. * * @return option enum */ - VRSettings.VrOptions value() default VRSettings.VrOptions.DUMMY; + VrOptions value() default VrOptions.DUMMY; /** * String to save the option as in the config file, or empty to use the field name. diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java b/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java index 009a77af8..7f1fdb4d8 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java @@ -1,41 +1,44 @@ package org.vivecraft.client_vr.settings; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; - -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.MethodHolder; -import org.vivecraft.client_vr.extensions.MinecraftExtension; -import org.vivecraft.client_vr.VRData; import org.vivecraft.client.utils.LangHelper; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.common.utils.math.Angle; -import org.vivecraft.common.utils.math.Axis; -import org.vivecraft.common.utils.math.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; +import org.vivecraft.client_vr.VRData.VRDevicePose; +import org.vivecraft.client_vr.extensions.MinecraftExtension; +import org.vivecraft.client_vr.provider.InputSimulator; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; import com.google.common.util.concurrent.Runnables; +import org.joml.Matrix4f; +import org.joml.Quaternionf; +import org.joml.Vector3f; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.WinScreen; import net.minecraft.network.chat.Component; import net.minecraft.world.phys.Vec3; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +import static org.vivecraft.client.utils.Utils.message; +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; + public class VRHotkeys { static long nextRead = 0L; static final long COOLOFF_PERIOD_MILLIS = 500L; static boolean debug = false; private static int startController; - private static VRData.VRDevicePose startControllerPose; + private static VRDevicePose startControllerPose; private static float startCamposX; private static float startCamposY; private static float startCamposZ; - private static Quaternion startCamrotQuat; + private static Quaternionf startCamrotQuat; private static Triggerer camTriggerer; public static boolean handleKeyboardInputs(int key, int scanCode, int action, int modifiers) @@ -46,69 +49,68 @@ public static boolean handleKeyboardInputs(int key, int scanCode, int action, in } else { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); + boolean flag = false; - if (action == 1 && key == 344 && MethodHolder.isKeyDown(345)) + if (action == GLFW_PRESS && key == GLFW_KEY_RIGHT_SHIFT && isKeyDown(GLFW_KEY_RIGHT_CONTROL)) { - dataholder.vrSettings.storeDebugAim = true; - minecraft.gui.getChat().addMessage(Component.translatable("vivecraft.messages.showaim")); + dh.vrSettings.storeDebugAim = true; + message(Component.translatable("vivecraft.messages.showaim")); flag = true; } - if (action == 1 && key == 66 && MethodHolder.isKeyDown(345)) + if (action == GLFW_PRESS && key == GLFW_KEY_B && isKeyDown(GLFW_KEY_RIGHT_CONTROL)) { - dataholder.vrSettings.walkUpBlocks = !dataholder.vrSettings.walkUpBlocks; - minecraft.gui.getChat().addMessage(Component.translatable("vivecraft.messages.walkupblocks", dataholder.vrSettings.walkUpBlocks ? LangHelper.getYes() : LangHelper.getNo())); + dh.vrSettings.walkUpBlocks = !dh.vrSettings.walkUpBlocks; + message(Component.translatable("vivecraft.messages.walkupblocks", dh.vrSettings.walkUpBlocks ? LangHelper.getYes() : LangHelper.getNo())); flag = true; } - if (action == 1 && key == 73 && MethodHolder.isKeyDown(345)) + if (action == GLFW_PRESS && key == GLFW_KEY_I && isKeyDown(GLFW_KEY_RIGHT_CONTROL)) { - dataholder.vrSettings.inertiaFactor = dataholder.vrSettings.inertiaFactor.getNext(); - minecraft.gui.getChat().addMessage(Component.translatable("vivecraft.messages.playerinertia", Component.translatable(dataholder.vrSettings.inertiaFactor.getLangKey()))); + dh.vrSettings.inertiaFactor = dh.vrSettings.inertiaFactor.getNext(); + message(Component.translatable("vivecraft.messages.playerinertia", Component.translatable(dh.vrSettings.inertiaFactor.getLangKey()))); flag = true; } - if (action == 1 && key == 82 && MethodHolder.isKeyDown(345)) + if (action == GLFW_PRESS && key == GLFW_KEY_R && isKeyDown(GLFW_KEY_RIGHT_CONTROL)) { - if (dataholder.vrPlayer.isTeleportOverridden()) + if (dh.vrPlayer.isTeleportOverridden()) { - dataholder.vrPlayer.setTeleportOverride(false); - minecraft.gui.getChat().addMessage(Component.translatable("vivecraft.messages.teleportdisabled")); + dh.vrPlayer.setTeleportOverride(false); + message(Component.translatable("vivecraft.messages.teleportdisabled")); } else { - dataholder.vrPlayer.setTeleportOverride(true); - minecraft.gui.getChat().addMessage(Component.translatable("vivecraft.messages.teleportenabled")); + dh.vrPlayer.setTeleportOverride(true); + message(Component.translatable("vivecraft.messages.teleportenabled")); } flag = true; } - if (action == 1 && key == 268 && MethodHolder.isKeyDown(345)) + if (action == GLFW_PRESS && key == GLFW_KEY_HOME && isKeyDown(GLFW_KEY_RIGHT_CONTROL)) { snapMRCam(0); flag = true; } - if (action == 1 && key == 301 && debug) + if (action == GLFW_PRESS && key == GLFW_KEY_F12 && debug) { - minecraft.setScreen(new WinScreen(false, Runnables.doNothing())); + mc.setScreen(new WinScreen(false, Runnables.doNothing())); flag = true; } - if ((minecraft.level == null || minecraft.screen != null) && action == 1 && key == 294) + if ((mc.level == null || mc.screen != null) && action == GLFW_PRESS && key == GLFW_KEY_F5) { - dataholder.vrSettings.setOptionValue(VRSettings.VrOptions.MIRROR_DISPLAY); - ((MinecraftExtension) minecraft).notifyMirror(dataholder.vrSettings.getButtonDisplayString(VRSettings.VrOptions.MIRROR_DISPLAY), false, 3000); + dh.vrSettings.setOptionValue(VrOptions.MIRROR_DISPLAY); + ((MinecraftExtension) mc).notifyMirror(dh.vrSettings.getButtonDisplayString(VrOptions.MIRROR_DISPLAY), false, 3000); } if (flag) { - dataholder.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } return flag; @@ -117,203 +119,208 @@ public static boolean handleKeyboardInputs(int key, int scanCode, int action, in public static void handleMRKeys() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); + boolean flag = false; - if (MethodHolder.isKeyDown(263) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_LEFT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(-0.01F, 0.0F, 0.0F)); + adjustCamPos(new Vector3f(-0.01F, 0.0F, 0.0F)); flag = true; } - if (MethodHolder.isKeyDown(262) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_RIGHT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(0.01F, 0.0F, 0.0F)); + adjustCamPos(new Vector3f(0.01F, 0.0F, 0.0F)); flag = true; } - if (MethodHolder.isKeyDown(265) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_UP) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(0.0F, 0.0F, -0.01F)); + adjustCamPos(new Vector3f(0.0F, 0.0F, -0.01F)); flag = true; } - if (MethodHolder.isKeyDown(264) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_DOWN) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(0.0F, 0.0F, 0.01F)); + adjustCamPos(new Vector3f(0.0F, 0.0F, 0.01F)); flag = true; } - if (MethodHolder.isKeyDown(266) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_PAGE_UP) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(0.0F, 0.01F, 0.0F)); + adjustCamPos(new Vector3f(0.0F, 0.01F, 0.0F)); flag = true; } - if (MethodHolder.isKeyDown(267) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_PAGE_DOWN) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamPos(new Vector3(0.0F, -0.01F, 0.0F)); + adjustCamPos(new Vector3f(0.0F, -0.01F, 0.0F)); flag = true; } - if (MethodHolder.isKeyDown(265) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_UP) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.PITCH, 0.5F); + adjustCamRot(1.0F, 0.0F, 0.0F, 0.5F); flag = true; } - if (MethodHolder.isKeyDown(264) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_DOWN) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.PITCH, -0.5F); + adjustCamRot(1.0F, 0.0F, 0.0F, -0.5F); flag = true; } - if (MethodHolder.isKeyDown(263) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_LEFT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.YAW, 0.5F); + adjustCamRot(0.0F, 1.0F, 0.0F, 0.5F); flag = true; } - if (MethodHolder.isKeyDown(262) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_RIGHT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.YAW, -0.5F); + adjustCamRot(0.0F, 1.0F, 0.0F, -0.5F); flag = true; } - if (MethodHolder.isKeyDown(266) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_PAGE_UP) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.ROLL, 0.5F); + adjustCamRot(0.0F, 0.0F, 1.0F, 0.5F); flag = true; } - if (MethodHolder.isKeyDown(267) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_PAGE_DOWN) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - adjustCamRot(Axis.ROLL, -0.5F); + adjustCamRot(0.0F, 0.0F, 1.0F, -0.5F); flag = true; } - if (MethodHolder.isKeyDown(260) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_INSERT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - minecraft.options.fov().set(minecraft.options.fov().get() + 1); + mc.options.fov().set(mc.options.fov().get() + 1); flag = true; } - if (MethodHolder.isKeyDown(261) && MethodHolder.isKeyDown(345) && !MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_DELETE) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && !isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - minecraft.options.fov().set(minecraft.options.fov().get() - 1); + mc.options.fov().set(mc.options.fov().get() - 1); flag = true; } - if (MethodHolder.isKeyDown(260) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_INSERT) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - ++dataholder.vrSettings.mixedRealityFov; + ++dh.vrSettings.mixedRealityFov; flag = true; } - if (MethodHolder.isKeyDown(261) && MethodHolder.isKeyDown(345) && MethodHolder.isKeyDown(344)) + if (isKeyDown(GLFW_KEY_DELETE) && isKeyDown(GLFW_KEY_RIGHT_CONTROL) && isKeyDown(GLFW_KEY_RIGHT_SHIFT)) { - --dataholder.vrSettings.mixedRealityFov; + --dh.vrSettings.mixedRealityFov; flag = true; } if (flag) { - dataholder.vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); - if (dataholder.vr.mrMovingCamActive) + if (dh.vr.mrMovingCamActive) { - Minecraft.getInstance().gui.getChat().addMessage(Component.literal(LangHelper.get("vivecraft.messages.coords", dataholder.vrSettings.mrMovingCamOffsetX, dataholder.vrSettings.mrMovingCamOffsetY, dataholder.vrSettings.mrMovingCamOffsetZ))); - Angle angle = dataholder.vrSettings.mrMovingCamOffsetRotQuat.toEuler(); - Minecraft.getInstance().gui.getChat().addMessage(Component.literal(LangHelper.get("vivecraft.messages.angles", angle.getPitch(), angle.getYaw(), angle.getRoll()))); + message(Component.literal(LangHelper.get("vivecraft.messages.coords", dh.vrSettings.mrMovingCamOffsetX, dh.vrSettings.mrMovingCamOffsetY, dh.vrSettings.mrMovingCamOffsetZ))); + message(Component.literal(LangHelper.get( + "vivecraft.messages.angles", + (float)toDegrees(asin((-2.0F * (dh.vrSettings.mrMovingCamOffsetRotQuat.y * dh.vrSettings.mrMovingCamOffsetRotQuat.z - dh.vrSettings.mrMovingCamOffsetRotQuat.w * dh.vrSettings.mrMovingCamOffsetRotQuat.x)))), + (float)toDegrees(atan2((2.0F * (dh.vrSettings.mrMovingCamOffsetRotQuat.x * dh.vrSettings.mrMovingCamOffsetRotQuat.z + dh.vrSettings.mrMovingCamOffsetRotQuat.w * dh.vrSettings.mrMovingCamOffsetRotQuat.y)), (dh.vrSettings.mrMovingCamOffsetRotQuat.w * dh.vrSettings.mrMovingCamOffsetRotQuat.w - dh.vrSettings.mrMovingCamOffsetRotQuat.x * dh.vrSettings.mrMovingCamOffsetRotQuat.x - dh.vrSettings.mrMovingCamOffsetRotQuat.y * dh.vrSettings.mrMovingCamOffsetRotQuat.y + dh.vrSettings.mrMovingCamOffsetRotQuat.z * dh.vrSettings.mrMovingCamOffsetRotQuat.z))), + (float)toDegrees(atan2((2.0F * (dh.vrSettings.mrMovingCamOffsetRotQuat.x * dh.vrSettings.mrMovingCamOffsetRotQuat.y + dh.vrSettings.mrMovingCamOffsetRotQuat.w * dh.vrSettings.mrMovingCamOffsetRotQuat.z)), (dh.vrSettings.mrMovingCamOffsetRotQuat.w * dh.vrSettings.mrMovingCamOffsetRotQuat.w - dh.vrSettings.mrMovingCamOffsetRotQuat.x * dh.vrSettings.mrMovingCamOffsetRotQuat.x + dh.vrSettings.mrMovingCamOffsetRotQuat.y * dh.vrSettings.mrMovingCamOffsetRotQuat.y - dh.vrSettings.mrMovingCamOffsetRotQuat.z * dh.vrSettings.mrMovingCamOffsetRotQuat.z))) + ))); } else { - Minecraft.getInstance().gui.getChat().addMessage(Component.literal(LangHelper.get("vivecraft.messages.coords", dataholder.vrSettings.vrFixedCamposX, dataholder.vrSettings.vrFixedCamposY, dataholder.vrSettings.vrFixedCamposZ))); - Angle angle1 = dataholder.vrSettings.vrFixedCamrotQuat.toEuler(); - Minecraft.getInstance().gui.getChat().addMessage(Component.literal(LangHelper.get("vivecraft.messages.angles", angle1.getPitch(), angle1.getYaw(), angle1.getRoll()))); + message(Component.literal(LangHelper.get("vivecraft.messages.coords", dh.vrSettings.vrFixedCamposX, dh.vrSettings.vrFixedCamposY, dh.vrSettings.vrFixedCamposZ))); + message(Component.literal(LangHelper.get( + "vivecraft.messages.angles", + (float)toDegrees(asin((-2.0F * (dh.vrSettings.vrFixedCamrotQuat.y * dh.vrSettings.vrFixedCamrotQuat.z - dh.vrSettings.vrFixedCamrotQuat.w * dh.vrSettings.vrFixedCamrotQuat.x)))), + (float)toDegrees(atan2((2.0F * (dh.vrSettings.vrFixedCamrotQuat.x * dh.vrSettings.vrFixedCamrotQuat.z + dh.vrSettings.vrFixedCamrotQuat.w * dh.vrSettings.vrFixedCamrotQuat.y)), (dh.vrSettings.vrFixedCamrotQuat.w * dh.vrSettings.vrFixedCamrotQuat.w - dh.vrSettings.vrFixedCamrotQuat.x * dh.vrSettings.vrFixedCamrotQuat.x - dh.vrSettings.vrFixedCamrotQuat.y * dh.vrSettings.vrFixedCamrotQuat.y + dh.vrSettings.vrFixedCamrotQuat.z * dh.vrSettings.vrFixedCamrotQuat.z))), + (float)toDegrees(atan2((2.0F * (dh.vrSettings.vrFixedCamrotQuat.x * dh.vrSettings.vrFixedCamrotQuat.y + dh.vrSettings.vrFixedCamrotQuat.w * dh.vrSettings.vrFixedCamrotQuat.z)), (dh.vrSettings.vrFixedCamrotQuat.w * dh.vrSettings.vrFixedCamrotQuat.w - dh.vrSettings.vrFixedCamrotQuat.x * dh.vrSettings.vrFixedCamrotQuat.x + dh.vrSettings.vrFixedCamrotQuat.y * dh.vrSettings.vrFixedCamrotQuat.y - dh.vrSettings.vrFixedCamrotQuat.z * dh.vrSettings.vrFixedCamrotQuat.z))) + ))); } } } - private static void adjustCamPos(Vector3 offset) + private static void adjustCamPos(Vector3f offset) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.vr.mrMovingCamActive) + if (dh.vr.mrMovingCamActive) { - offset = dataholder.vrSettings.mrMovingCamOffsetRotQuat.multiply(offset); - dataholder.vrSettings.mrMovingCamOffsetX += offset.getX(); - dataholder.vrSettings.mrMovingCamOffsetY += offset.getY(); - dataholder.vrSettings.mrMovingCamOffsetZ += offset.getZ(); + dh.vrSettings.mrMovingCamOffsetRotQuat.transformUnit(offset); + dh.vrSettings.mrMovingCamOffsetX += offset.x; + dh.vrSettings.mrMovingCamOffsetY += offset.y; + dh.vrSettings.mrMovingCamOffsetZ += offset.z; } else { - offset = dataholder.vrSettings.vrFixedCamrotQuat.inverse().multiply(offset); - dataholder.vrSettings.vrFixedCamposX += offset.getX(); - dataholder.vrSettings.vrFixedCamposY += offset.getY(); - dataholder.vrSettings.vrFixedCamposZ += offset.getZ(); + dh.vrSettings.vrFixedCamrotQuat.conjugate(new Quaternionf()).transformUnit(offset); + dh.vrSettings.vrFixedCamposX += offset.x; + dh.vrSettings.vrFixedCamposY += offset.y; + dh.vrSettings.vrFixedCamposZ += offset.z; } } - private static void adjustCamRot(Axis axis, float degrees) + private static void adjustCamRot(float axisX, float axisY, float axisZ, float degrees) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.vr.mrMovingCamActive) + if (dh.vr.mrMovingCamActive) { - dataholder.vrSettings.mrMovingCamOffsetRotQuat.set(dataholder.vrSettings.mrMovingCamOffsetRotQuat.rotate(axis, degrees, true)); + dh.vrSettings.mrMovingCamOffsetRotQuat.rotateAxis( + toRadians(degrees), + dh.vrSettings.mrMovingCamOffsetRotQuat.transformInverse(new Vector3f(axisX, axisY, axisZ)) + ); } else { - dataholder.vrSettings.vrFixedCamrotQuat.set(dataholder.vrSettings.vrFixedCamrotQuat.rotate(axis, degrees, false)); + dh.vrSettings.vrFixedCamrotQuat.rotateAxis( + toRadians(degrees), + dh.vrSettings.vrFixedCamrotQuat.transformInverse(new Vector3f(axisX, axisY, axisZ)) + ); } } public static void snapMRCam(int controller) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - Vec3 vec3 = dataholder.vrPlayer.vrdata_room_pre.getController(controller).getPosition(); - dataholder.vrSettings.vrFixedCamposX = (float)vec3.x; - dataholder.vrSettings.vrFixedCamposY = (float)vec3.y; - dataholder.vrSettings.vrFixedCamposZ = (float)vec3.z; - Quaternion quaternion = new Quaternion(Utils.convertOVRMatrix(dataholder.vrPlayer.vrdata_room_pre.getController(controller).getMatrix())); - dataholder.vrSettings.vrFixedCamrotQuat.set(quaternion); + + Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getController(controller).getPosition(); + dh.vrSettings.vrFixedCamposX = (float)vec3.x; + dh.vrSettings.vrFixedCamposY = (float)vec3.y; + dh.vrSettings.vrFixedCamposZ = (float)vec3.z; + dh.vrSettings.vrFixedCamrotQuat.setFromNormalized(dh.vrPlayer.vrdata_room_pre.getController(controller).getMatrix()); } public static void updateMovingThirdPersonCam() { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); if (startControllerPose != null) { - VRData.VRDevicePose vrdata$vrdevicepose = dataholder.vrPlayer.vrdata_room_pre.getController(startController); + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(startController); Vec3 vec3 = startControllerPose.getPosition(); Vec3 vec31 = vrdata$vrdevicepose.getPosition().subtract(vec3); - Matrix4f matrix4f = Matrix4f.multiply(vrdata$vrdevicepose.getMatrix(), startControllerPose.getMatrix().inverted()); - Vector3 vector3 = new Vector3(startCamposX - (float)vec3.x, startCamposY - (float)vec3.y, startCamposZ - (float)vec3.z); - Vector3 vector31 = matrix4f.transform(vector3); - dataholder.vrSettings.vrFixedCamposX = startCamposX + (float)vec31.x + (vector31.getX() - vector3.getX()); - dataholder.vrSettings.vrFixedCamposY = startCamposY + (float)vec31.y + (vector31.getY() - vector3.getY()); - dataholder.vrSettings.vrFixedCamposZ = startCamposZ + (float)vec31.z + (vector31.getZ() - vector3.getZ()); - dataholder.vrSettings.vrFixedCamrotQuat.set(startCamrotQuat.multiply(new Quaternion(Utils.convertOVRMatrix(matrix4f)))); + Matrix4f matrix4f = vrdata$vrdevicepose.getMatrix().mul0(startControllerPose.getMatrix().invertAffine(), new Matrix4f()); + Vector3f vector3 = new Vector3f(startCamposX - (float)vec3.x, startCamposY - (float)vec3.y, startCamposZ - (float)vec3.z); + Vector3f vector31 = vector3.mulProject(matrix4f, new Vector3f()); + dh.vrSettings.vrFixedCamposX = startCamposX + (float)vec31.x + (vector31.x - vector3.x); + dh.vrSettings.vrFixedCamposY = startCamposY + (float)vec31.y + (vector31.y - vector3.y); + dh.vrSettings.vrFixedCamposZ = startCamposZ + (float)vec31.z + (vector31.z - vector3.z); + dh.vrSettings.vrFixedCamrotQuat.setFromNormalized(matrix4f); + startCamrotQuat.mul(dh.vrSettings.vrFixedCamrotQuat, dh.vrSettings.vrFixedCamrotQuat); } } public static void startMovingThirdPersonCam(int controller, Triggerer triggerer) { - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); + startController = controller; - startControllerPose = dataholder.vrPlayer.vrdata_room_pre.getController(controller); - startCamposX = dataholder.vrSettings.vrFixedCamposX; - startCamposY = dataholder.vrSettings.vrFixedCamposY; - startCamposZ = dataholder.vrSettings.vrFixedCamposZ; - startCamrotQuat = dataholder.vrSettings.vrFixedCamrotQuat.copy(); + startControllerPose = dh.vrPlayer.vrdata_room_pre.getController(controller); + startCamposX = dh.vrSettings.vrFixedCamposX; + startCamposY = dh.vrSettings.vrFixedCamposY; + startCamposZ = dh.vrSettings.vrFixedCamposZ; + startCamrotQuat = new Quaternionf(dh.vrSettings.vrFixedCamrotQuat); camTriggerer = triggerer; } @@ -359,34 +366,14 @@ public static void loadExternalCameraConfig() String[] astring = s.split("=", 2); String s1 = astring[0]; - switch (s1) - { - case "x": - f = Float.parseFloat(astring[1]); - break; - - case "y": - f1 = Float.parseFloat(astring[1]); - break; - - case "z": - f2 = Float.parseFloat(astring[1]); - break; - - case "rx": - f3 = Float.parseFloat(astring[1]); - break; - - case "ry": - f4 = Float.parseFloat(astring[1]); - break; - - case "rz": - f5 = Float.parseFloat(astring[1]); - break; - - case "fov": - f6 = Float.parseFloat(astring[1]); + switch (s1) { + case "x" -> f = Float.parseFloat(astring[1]); + case "y" -> f1 = Float.parseFloat(astring[1]); + case "z" -> f2 = Float.parseFloat(astring[1]); + case "rx" -> f3 = Float.parseFloat(astring[1]); + case "ry" -> f4 = Float.parseFloat(astring[1]); + case "rz" -> f5 = Float.parseFloat(astring[1]); + case "fov" -> f6 = Float.parseFloat(astring[1]); } } } @@ -396,18 +383,28 @@ public static void loadExternalCameraConfig() return; } - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - Quaternion quaternion = new Quaternion(f3, f4, f5, dataholder.vrSettings.externalCameraAngleOrder); - dataholder.vrSettings.mrMovingCamOffsetX = f; - dataholder.vrSettings.mrMovingCamOffsetY = f1; - dataholder.vrSettings.mrMovingCamOffsetZ = f2; - dataholder.vrSettings.mrMovingCamOffsetRotQuat.set(quaternion); - dataholder.vrSettings.vrFixedCamposX = f; - dataholder.vrSettings.vrFixedCamposY = f1; - dataholder.vrSettings.vrFixedCamposZ = f2; - dataholder.vrSettings.vrFixedCamrotQuat.set(quaternion); - dataholder.vrSettings.mixedRealityFov = f6; + Quaternionf quaternion0 = new Quaternionf().setAngleAxis(f3, 1.0F, 0.0F, 0.0F); + Quaternionf quaternion1 = new Quaternionf().setAngleAxis(f4, 0.0F, 1.0F, 0.0F); + Quaternionf quaternion2 = new Quaternionf().setAngleAxis(f5, 0.0F, 0.0F, 1.0F); + Quaternionf quaternion = (switch (dh.vrSettings.externalCameraAngleOrder) + { + case XYZ -> quaternion0.mul(quaternion1, new Quaternionf()).mul(quaternion2, new Quaternionf()); + case ZYX -> quaternion2.mul(quaternion1, new Quaternionf()).mul(quaternion0, new Quaternionf()); + case YXZ -> quaternion1.mul(quaternion0, new Quaternionf()).mul(quaternion2, new Quaternionf()); + case ZXY -> quaternion2.mul(quaternion0, new Quaternionf()).mul(quaternion1, new Quaternionf()); + case YZX -> quaternion1.mul(quaternion2, new Quaternionf()).mul(quaternion0, new Quaternionf()); + case XZY -> quaternion0.mul(quaternion2, new Quaternionf()).mul(quaternion1, new Quaternionf()); + } + ); + dh.vrSettings.mrMovingCamOffsetX = f; + dh.vrSettings.mrMovingCamOffsetY = f1; + dh.vrSettings.mrMovingCamOffsetZ = f2; + dh.vrSettings.mrMovingCamOffsetRotQuat.set(quaternion); + dh.vrSettings.vrFixedCamposX = f; + dh.vrSettings.vrFixedCamposY = f1; + dh.vrSettings.vrFixedCamposZ = f2; + dh.vrSettings.vrFixedCamrotQuat.set(quaternion); + dh.vrSettings.mixedRealityFov = f6; } } @@ -416,10 +413,14 @@ public static boolean hasExternalCameraConfig() return (new File("ExternalCamera.cfg")).exists(); } - public static enum Triggerer + public static boolean isKeyDown(int key) { + return glfwGetKey(mc.getWindow().getWindow(), key) == GLFW_PRESS || InputSimulator.isKeyDown(key); + } + + public enum Triggerer { BINDING, MENUBUTTON, - INTERACTION; + INTERACTION } } diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java index 1527be050..345c2a5c6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java @@ -4,58 +4,55 @@ */ package org.vivecraft.client_vr.settings; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.mod_compat_vr.ShadersHelper; -import org.vivecraft.client_vr.VRState; +import org.vivecraft.client.utils.LangHelper; import org.vivecraft.client_vr.extensions.OptionsExtension; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gui.PhysicalKeyboard.KeyboardTheme; +import org.vivecraft.client_vr.settings.profile.ProfileManager; +import org.vivecraft.client_vr.settings.profile.ProfileReader; +import org.vivecraft.client_vr.settings.profile.ProfileWriter; +import org.vivecraft.common.utils.color.Color; +import org.vivecraft.mod_compat_vr.ShadersHelper; + import com.google.gson.JsonObject; +import org.apache.commons.lang3.tuple.Pair; +import org.apache.commons.lang3.tuple.Triple; +import org.joml.Quaternionf; +import org.joml.Vector3f; +import org.joml.Vector3fc; + import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.Minecraft; + import net.minecraft.client.resources.language.I18n; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.Mth; -import org.apache.commons.lang3.tuple.Pair; -import org.apache.commons.lang3.tuple.Triple; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.vivecraft.client_vr.settings.profile.ProfileManager; -import org.vivecraft.client_vr.settings.profile.ProfileReader; -import org.vivecraft.client_vr.settings.profile.ProfileWriter; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.gui.PhysicalKeyboard; -import org.vivecraft.client.utils.LangHelper; -import org.vivecraft.common.utils.math.Angle; -import org.vivecraft.common.utils.math.Quaternion; -import org.vivecraft.common.utils.math.Vector3; -import java.awt.*; -import java.io.File; import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.util.List; import java.util.*; import java.util.function.Supplier; import java.util.stream.IntStream; import java.util.stream.Stream; +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; +import static org.joml.RoundingMode.CEILING; + public class VRSettings { public static final int VERSION = 2; - public static final Logger logger = LogManager.getLogger(); - public static VRSettings inst; public JsonObject defaults = new JsonObject(); public static final int UNKNOWN_VERSION = 0; - public static final String DEGREE = "\u00b0"; public enum InertiaFactor implements OptionEnum { - NONE(1f / 0.01f), - NORMAL(1f), - LARGE(1f / 4f), - MASSIVE(1f / 16f); + NONE(1.0F / 0.01F), + NORMAL(1.0F), + LARGE(1.0F / 4.0F), + MASSIVE(1.0F / 16.0F); private final float factor; @@ -104,6 +101,22 @@ public enum HUDLock implements OptionEnum { HEAD } + public enum PlayerStatus implements OptionEnum { + NONE, + ICON, + ENTITY, + BOTH + } + + public enum Order implements OptionEnum { + XYZ, + ZYX, + YXZ, + ZXY, + YZX, + XZY + } + public enum FreeMove implements OptionEnum { CONTROLLER, HMD, @@ -172,21 +185,21 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(VrOptions.REVERSE_HANDS) public boolean reverseHands = false; public boolean reverseShootingEye = false; - @SettingField(value = VrOptions.WORLD_SCALE) - public float worldScale = 1.0f; - @SettingField(value = VrOptions.WORLD_ROTATION) - public float worldRotation = 0f; + @SettingField(VrOptions.WORLD_SCALE) + public float worldScale = 1.0F; + @SettingField(VrOptions.WORLD_ROTATION) + public float worldRotation = 0.0F; public float worldRotationCached; @SettingField(value = VrOptions.WORLD_ROTATION_INCREMENT, config = "vrWorldRotationIncrement") - public float worldRotationIncrement = 45f; + public float worldRotationIncrement = 45.0F; @SettingField(VrOptions.X_SENSITIVITY) - public float xSensitivity=1f; + public float xSensitivity= 1.0F; @SettingField(VrOptions.Y_SENSITIVITY) - public float ySensitivity=1f; + public float ySensitivity= 1.0F; @SettingField(VrOptions.KEYHOLE) public float keyholeX=15; @SettingField - public double headToHmdLength=0.10f; + public double headToHmdLength=0.10F; @SettingField public float autoCalibration=-1; @SettingField @@ -195,10 +208,56 @@ public enum ChatServerPluginMessage implements OptionEnum { public boolean alwaysSimulateKeyboard = false; @SettingField(VrOptions.BOW_MODE) public BowMode bowMode = BowMode.ON; + @SettingField(VrOptions.SKELETAL_INPUT) + public boolean skeletalInput = false; + @SettingField(VrOptions.FINGER_VIEW) + public boolean fingerView = true; + @SettingField(VrOptions.MAIN_THUMB_THRESHOLD) + public float main_thumb_threshold = 0.75F; + @SettingField(VrOptions.MAIN_INDEX_THRESHOLD) + public float main_index_threshold = 0.75F; + @SettingField(VrOptions.MAIN_MIDDLE_THRESHOLD) + public float main_middle_threshold = 0.75F; + @SettingField(VrOptions.MAIN_RING_THRESHOLD) + public float main_ring_threshold = 0.10F; + @SettingField(VrOptions.MAIN_LITTLE_THRESHOLD) + public float main_little_threshold = 0.75F; + @SettingField(VrOptions.OFF_THUMB_THRESHOLD) + public float off_thumb_threshold = 0.75F; + @SettingField(VrOptions.OFF_INDEX_THRESHOLD) + public float off_index_threshold = 0.75F; + @SettingField(VrOptions.OFF_MIDDLE_THRESHOLD) + public float off_middle_threshold = 0.75F; + @SettingField(VrOptions.OFF_RING_THRESHOLD) + public float off_ring_threshold = 0.10F; + @SettingField(VrOptions.OFF_LITTLE_THRESHOLD) + public float off_little_threshold = 0.75F; + @SettingField(VrOptions.MAIN_THUMB_DISPLAY) + public int main_thumb_display = 5; + @SettingField(VrOptions.MAIN_INDEX_DISPLAY) + public int main_index_display = 4; + @SettingField(VrOptions.MAIN_MIDDLE_DISPLAY) + public int main_middle_display = 3; + @SettingField(VrOptions.MAIN_RING_DISPLAY) + public int main_ring_display = 2; + @SettingField(VrOptions.MAIN_LITTLE_DISPLAY) + public int main_little_display = 1; + @SettingField(VrOptions.OFF_THUMB_DISPLAY) + public int off_thumb_display = 6; + @SettingField(VrOptions.OFF_INDEX_DISPLAY) + public int off_index_display = 7; + @SettingField(VrOptions.OFF_MIDDLE_DISPLAY) + public int off_middle_display = 8; + @SettingField(VrOptions.OFF_RING_DISPLAY) + public int off_ring_display = 9; + @SettingField(VrOptions.OFF_LITTLE_DISPLAY) + public int off_little_display = 10; + @SettingField(VrOptions.FINGER_COUNT) + public boolean fingerCount = true; @SettingField - public String keyboardKeys = "`1234567890-=qwertyuiop[]\\asdfghjkl;\':\"zxcvbnm,./?<>"; + public String keyboardKeys = "`1234567890-=qwertyuiop[]\\asdfghjkl;':\"zxcvbnm,./?<>"; @SettingField - public String keyboardKeysShift ="~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL;\':\"ZXCVBNM,./?<>"; + public String keyboardKeysShift = "~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL;':\"ZXCVBNM,./?<>"; @SettingField(VrOptions.HRTF_SELECTION) public int hrtfSelection = 0; @SettingField(VrOptions.RIGHT_CLICK_DELAY) @@ -219,7 +278,7 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(value = VrOptions.WEAPON_COLLISION, config = "weaponCollisionNew") public WeaponCollision weaponCollision = WeaponCollision.AUTO; // VIVE weapon hand collides with blocks/enemies @SettingField(VrOptions.MOVEMENT_MULTIPLIER) - public float movementSpeedMultiplier = 1.0f; // VIVE - use full speed by default + public float movementSpeedMultiplier = 1.0F; // VIVE - use full speed by default @SettingField(VrOptions.FREEMOVE_MODE) public FreeMove vrFreeMoveMode = FreeMove.CONTROLLER; @SettingField(VrOptions.FREEMOVE_FLY_MODE) @@ -239,11 +298,11 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(value = VrOptions.SEATED_HMD, config = "seatedhmd") public boolean seatedUseHMD = false; @SettingField - public float jumpThreshold=0.05f; + public float jumpThreshold=0.05F; @SettingField - public float sneakThreshold=0.4f; + public float sneakThreshold=0.4F; @SettingField - public float crawlThreshold = 0.82f; + public float crawlThreshold = 0.82F; @SettingField(VrOptions.REALISTIC_JUMP) public boolean realisticJumpEnabled=true; @SettingField(VrOptions.REALISTIC_SNEAK) @@ -271,9 +330,9 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(VrOptions.AUTO_SPRINT) public boolean autoSprint = true; @SettingField(VrOptions.AUTO_SPRINT_THRESHOLD) - public float autoSprintThreshold = 0.9f; + public float autoSprintThreshold = 0.9F; @SettingField - public Vector3 originOffset = new Vector3(0.0F, 0.0F, 0.0F); + public Vector3f originOffset = new Vector3f(0.0F, 0.0F, 0.0F); @SettingField(VrOptions.ALLOW_STANDING_ORIGIN_OFFSET) public boolean allowStandingOriginOffset = false; @SettingField(VrOptions.SEATED_FREE_MOVE) @@ -290,15 +349,15 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(value = VrOptions.FOV_REDUCTION, config = "fovReduction") public boolean useFOVReduction = false; // default to off @SettingField(VrOptions.FOV_REDUCTION_OFFSET) - public float fovRedutioncOffset = 0.1f; // nice typo + public float fovRedutioncOffset = 0.1F; // nice typo @SettingField(VrOptions.FOV_REDUCTION_MIN) - public float fovReductionMin = 0.25f; + public float fovReductionMin = 0.25F; @SettingField(value = VrOptions.STENCIL_ON, config = "stencilOn") public boolean vrUseStencil = true; @SettingField public boolean insideBlockSolidColor = false; //unused @SettingField(VrOptions.RENDER_SCALEFACTOR) - public float renderScaleFactor = 1.0f; + public float renderScaleFactor = 1.0F; @SettingField(VrOptions.MIRROR_DISPLAY) public MirrorMode displayMirrorMode = MirrorMode.CROPPED; @SettingField(VrOptions.MIRROR_EYE) @@ -310,8 +369,8 @@ public enum ChatServerPluginMessage implements OptionEnum { //Mixed Reality @SettingField(VrOptions.MIXED_REALITY_KEY_COLOR) - public Color mixedRealityKeyColor = new Color(0, 0, 0); - public float mixedRealityAspectRatio = 16F / 9F; + public Color mixedRealityKeyColor = new Color(Color.BLACK); + public float mixedRealityAspectRatio = 16.0F / 9.0F; @SettingField(VrOptions.MIXED_REALITY_RENDER_HANDS) public boolean mixedRealityRenderHands = false; @SettingField(VrOptions.MIXED_REALITY_UNITY_LIKE) @@ -323,13 +382,13 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(VrOptions.MIXED_REALITY_FOV) public float mixedRealityFov = 40; @SettingField - public float vrFixedCamposX = -1.0f; + public float vrFixedCamposX = -1.0F; @SettingField - public float vrFixedCamposY = 2.4f; + public float vrFixedCamposY = 2.4F; @SettingField - public float vrFixedCamposZ = 2.7f; + public float vrFixedCamposZ = 2.7F; @SettingField(config = "vrFixedCamrot", separate = true) - public Quaternion vrFixedCamrotQuat =new Quaternion(.962f, .125f, .239f, .041f); + public Quaternionf vrFixedCamrotQuat = new Quaternionf(0.125F, 0.239F, 0.041F, 0.962F); @SettingField public float mrMovingCamOffsetX = 0; @SettingField @@ -337,13 +396,13 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField public float mrMovingCamOffsetZ = 0; @SettingField(config = "mrMovingCamOffsetRot", separate = true) - public Quaternion mrMovingCamOffsetRotQuat = new Quaternion(); + public Quaternionf mrMovingCamOffsetRotQuat = new Quaternionf(); @SettingField - public Angle.Order externalCameraAngleOrder = Angle.Order.XZY; + public Order externalCameraAngleOrder = Order.XZY; @SettingField(VrOptions.HANDHELD_CAMERA_FOV) public float handCameraFov = 70; @SettingField(VrOptions.HANDHELD_CAMERA_RENDER_SCALE) - public float handCameraResScale = 1.0f; + public float handCameraResScale = 1.0F; @SettingField(VrOptions.MIXED_REALITY_RENDER_CAMERA_MODEL) public boolean mixedRealityRenderCameraModel = true; // @@ -351,23 +410,43 @@ public enum ChatServerPluginMessage implements OptionEnum { //HUD/GUI @SettingField(VrOptions.TOUCH_HOTBAR) public boolean vrTouchHotbar = true; + @SettingField(VrOptions.TOUCH_HOTBAR_COLOR_R) + public float vrTouchHotbarR = 0; + @SettingField(VrOptions.TOUCH_HOTBAR_COLOR_G) + public float vrTouchHotbarG = 1; + @SettingField(VrOptions.TOUCH_HOTBAR_COLOR_B) + public float vrTouchHotbarB = 0; + @SettingField(VrOptions.TOUCH_HOTBAR_COLOR_A) + public float vrTouchHotbarA = 1; + @SettingField(VrOptions.TOUCH_OFFBAR_COLOR_R) + public float vrTouchOffBarR = 0; + @SettingField(VrOptions.TOUCH_OFFBAR_COLOR_G) + public float vrTouchOffBarG = 0; + @SettingField(VrOptions.TOUCH_OFFBAR_COLOR_B) + public float vrTouchOffBarB = 1; + @SettingField(VrOptions.TOUCH_OFFBAR_COLOR_A) + public float vrTouchOffBarA = 1; @SettingField(value = VrOptions.HUD_SCALE, config = "headHudScale") - public float hudScale = 1.0f; + public float hudScale = 1.0F; @SettingField(VrOptions.HUD_DISTANCE) - public float hudDistance = 1.25f; + public float hudDistance = 1.25F; @SettingField - public float hudPitchOffset = -2f; + public float hudPitchOffset = -2.0F; @SettingField - public float hudYawOffset = 0.0f; + public float hudYawOffset = 0.0F; public boolean floatInventory = true; //false not working yet, have to account for rotation and tilt in MCOpenVR>processGui() @SettingField(VrOptions.MENU_ALWAYS_FOLLOW_FACE) public boolean menuAlwaysFollowFace; @SettingField(VrOptions.HUD_LOCK_TO) public HUDLock vrHudLockMode = HUDLock.WRIST; + @SettingField(VrOptions.PLAYER_STATUS) + public PlayerStatus playerStatus = PlayerStatus.ICON; + @SettingField(VrOptions.ENTITY_STATUS) + public boolean entityStatus = false; @SettingField(VrOptions.HUD_OCCLUSION) public boolean hudOcclusion = true; @SettingField(VrOptions.CROSSHAIR_SCALE) - public float crosshairScale = 1.0f; + public float crosshairScale = 1.0F; @SettingField(VrOptions.CROSSHAIR_SCALES_WITH_DISTANCE) public boolean crosshairScalesWithDistance = false; @SettingField(VrOptions.RENDER_CROSSHAIR_MODE) @@ -375,11 +454,11 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(VrOptions.RENDER_BLOCK_OUTLINE_MODE) public RenderPointerElement renderBlockOutlineMode = RenderPointerElement.ALWAYS; @SettingField(VrOptions.HUD_OPACITY) - public float hudOpacity = 1f; + public float hudOpacity = 1.0F; @SettingField(VrOptions.RENDER_MENU_BACKGROUND) public boolean menuBackground = false; @SettingField(VrOptions.MENU_CROSSHAIR_SCALE) - public float menuCrosshairScale = 1f; + public float menuCrosshairScale = 1.0F; @SettingField(VrOptions.CROSSHAIR_OCCLUSION) public boolean useCrosshairOcclusion = true; @SettingField(VrOptions.SEATED_HUD_XHAIR) @@ -393,9 +472,9 @@ public enum ChatServerPluginMessage implements OptionEnum { @SettingField(VrOptions.PHYSICAL_KEYBOARD) public boolean physicalKeyboard = true; @SettingField(VrOptions.PHYSICAL_KEYBOARD_SCALE) - public float physicalKeyboardScale = 1.0f; + public float physicalKeyboardScale = 1.0F; @SettingField(VrOptions.PHYSICAL_KEYBOARD_THEME) - public PhysicalKeyboard.KeyboardTheme physicalKeyboardTheme = PhysicalKeyboard.KeyboardTheme.DEFAULT; + public KeyboardTheme physicalKeyboardTheme = KeyboardTheme.DEFAULT; @SettingField(VrOptions.ALLOW_ADVANCED_BINDINGS) public boolean allowAdvancedBindings = false; @SettingField(VrOptions.CHAT_NOTIFICATIONS) @@ -433,24 +512,18 @@ public enum ChatServerPluginMessage implements OptionEnum { public ServerOverrides overrides = new ServerOverrides(); - private Map> fieldEnumMap = new EnumMap<>(VrOptions.class); - private Map> fieldConfigMap = new HashMap<>(); + private final Map> fieldEnumMap = new EnumMap<>(VrOptions.class); + private final Map> fieldConfigMap = new HashMap<>(); // This map is only here to preserve old settings, not intended for general use private Map preservedSettingMap; - private Minecraft mc; - - public VRSettings( Minecraft minecraft, File dataDir ) + /** Assumes GameSettings (and hence optifine's settings) have been read first */ + public VRSettings() { // Need to do this in the instance because array sizes aren't known until instantiation initializeFieldInfo(); - // Assumes GameSettings (and hence optifine's settings) have been read first - - mc = minecraft; - inst = this; - // Store our class defaults to a member variable for later use storeDefaults(); @@ -480,9 +553,9 @@ private void initializeFieldInfo() { if (ann.separate() && field.getType().isArray()) { int len = Array.getLength(field.get(this)); IntStream.range(0, len).forEach(i -> fieldConfigMap.put(config + "_" + i, configEntry)); - } else if (ann.separate() && Quaternion.class.isAssignableFrom(field.getType())) { + } else if (ann.separate() && Quaternionf.class.isAssignableFrom(field.getType())) { Stream.of('W', 'X', 'Y', 'Z').forEach(suffix -> fieldConfigMap.put(config + suffix, configEntry)); - } else if (ann.separate() && Vector3.class.isAssignableFrom(field.getType())) { + } else if (ann.separate() && Vector3f.class.isAssignableFrom(field.getType())) { Stream.of('X', 'Y', 'Z').forEach(suffix -> fieldConfigMap.put(config + suffix, configEntry)); } else { fieldConfigMap.put(config, configEntry); @@ -504,7 +577,7 @@ private Object loadOption(String name, String value, Object currentValue, VrOpti if (type == String.class) { return value; } else if (type == Boolean.TYPE) { - return value.equals("true"); + return "true".equals(value); } else if (type == Integer.TYPE) { return Integer.parseInt(value); } else if (type == Long.TYPE) { @@ -516,8 +589,8 @@ private Object loadOption(String name, String value, Object currentValue, VrOpti } else if (type.isEnum()) { Method m = type.getMethod("valueOf", String.class); return m.invoke(null, value); - } else if (Quaternion.class.isAssignableFrom(type)) { - Quaternion quat = ((Quaternion)currentValue).copy(); + } else if (Quaternionf.class.isAssignableFrom(type)) { + Quaternionf quat = new Quaternionf((Quaternionf)currentValue); if (separate) { float f = Float.parseFloat(value); switch (name.charAt(name.length() - 1)) { @@ -534,8 +607,8 @@ private Object loadOption(String name, String value, Object currentValue, VrOpti quat.z = Float.parseFloat(split[3]); } return quat; - } else if (Vector3.class.isAssignableFrom(type)) { - Vector3 vec = ((Vector3)currentValue).copy(); + } else if (Vector3f.class.isAssignableFrom(type)) { + Vector3f vec = new Vector3f((Vector3fc)currentValue); if (separate) { float f = Float.parseFloat(value); switch (name.charAt(name.length() - 1)) { @@ -569,8 +642,8 @@ private String saveOption(String name, Object obj, VrOptions option, Class ty return obj.toString(); } else if (type.isEnum()) { return ((Enum)obj).name(); - } else if (Quaternion.class.isAssignableFrom(type)) { - Quaternion quat = (Quaternion)obj; + } else if (Quaternionf.class.isAssignableFrom(type)) { + Quaternionf quat = (Quaternionf)obj; if (separate) { return Float.toString(switch (name.charAt(name.length() - 1)) { case 'W' -> quat.w; @@ -582,8 +655,8 @@ private String saveOption(String name, Object obj, VrOptions option, Class ty } else { return quat.w + "," + quat.x + "," + quat.y + "," + quat.z; } - } else if (Vector3.class.isAssignableFrom(type)) { - Vector3 vec = (Vector3)obj; + } else if (Vector3f.class.isAssignableFrom(type)) { + Vector3f vec = (Vector3f)obj; if (separate) { return Float.toString(switch (name.charAt(name.length() - 1)) { case 'X' -> vec.x; @@ -612,7 +685,7 @@ private Object loadDefault(String name, String value, VrOptions option, Class if (type == String.class) { return value; } else if (type == Boolean.TYPE) { - return value.equals("true"); + return "true".equals(value); } else if (type == Integer.TYPE) { return Integer.parseInt(value); } else if (type == Long.TYPE) { @@ -624,46 +697,38 @@ private Object loadDefault(String name, String value, VrOptions option, Class } else if (type.isEnum()) { Method m = type.getMethod("valueOf", String.class); return m.invoke(null, value); - } else if (Quaternion.class.isAssignableFrom(type)) { - Quaternion quat = new Quaternion(); + } else if (Quaternionf.class.isAssignableFrom(type)) { if (separate) { - Stream.of('W', 'X', 'Y', 'Z').forEach(suffix -> { - String str = profileSet.get(name + suffix); - float f = Float.parseFloat(str); - switch (suffix) { - case 'W' -> quat.w = f; - case 'X' -> quat.x = f; - case 'Y' -> quat.y = f; - case 'Z' -> quat.z = f; - } - }); + return new Quaternionf( + Float.parseFloat(profileSet.get(name + 'X')), + Float.parseFloat(profileSet.get(name + 'Y')), + Float.parseFloat(profileSet.get(name + 'Z')), + Float.parseFloat(profileSet.get(name + 'W')) + ); } else { String[] split = value.split(","); - quat.w = Float.parseFloat(split[0]); - quat.x = Float.parseFloat(split[1]); - quat.y = Float.parseFloat(split[2]); - quat.z = Float.parseFloat(split[3]); - } - return quat; - } else if (Vector3.class.isAssignableFrom(type)) { - Vector3 vec = new Vector3(); + return new Quaternionf( + Float.parseFloat(split[1]), + Float.parseFloat(split[2]), + Float.parseFloat(split[3]), + Float.parseFloat(split[0]) + ); + } + } else if (Vector3f.class.isAssignableFrom(type)) { if (separate) { - Stream.of('X', 'Y', 'Z').forEach(suffix -> { - String str = profileSet.get(name + suffix); - float f = Float.parseFloat(str); - switch (suffix) { - case 'X' -> vec.x = f; - case 'Y' -> vec.y = f; - case 'Z' -> vec.z = f; - } - }); + return new Vector3f( + Float.parseFloat(profileSet.get(name + 'X')), + Float.parseFloat(profileSet.get(name + 'Y')), + Float.parseFloat(profileSet.get(name + 'Z')) + ); } else { String[] split = value.split(","); - vec.x = Float.parseFloat(split[0]); - vec.y = Float.parseFloat(split[1]); - vec.z = Float.parseFloat(split[2]); + return new Vector3f( + Float.parseFloat(split[0]), + Float.parseFloat(split[1]), + Float.parseFloat(split[2]) + ); } - return vec; } // If we get here, the value wasn't interpreted @@ -816,7 +881,7 @@ private void saveOptions(JsonObject theProfiles) String value = Objects.requireNonNull(saveOption(name, Array.get(obj, i), mapping.getMiddle(), type.getComponentType(), mapping.getRight())); joiner.add(value); } - var5.println(name + ":" + joiner.toString()); + var5.println(name + ":" + joiner); } } else { String value = Objects.requireNonNull(saveOption(name, obj, mapping.getMiddle(), type, mapping.getRight())); @@ -843,9 +908,10 @@ public void resetSettings() loadDefaults(); } - public String getButtonDisplayString( VrOptions par1EnumOptions ) + public String getButtonDisplayString(VrOptions par1EnumOptions) { - String var2 = I18n.get("vivecraft.options." + par1EnumOptions.name()); + String var2 = par1EnumOptions.getLangKey(); + var2 = var2 != null ? I18n.get(var2) : I18n.get("vivecraft.options." + par1EnumOptions.name()); String var3 = var2 + ": "; String var4 = var3; @@ -869,7 +935,7 @@ public String getButtonDisplayString( VrOptions par1EnumOptions ) return (boolean)obj ? var4 + I18n.get(langKeys.getLeft()) : var4 + I18n.get(langKeys.getRight()); } else if (type == Float.TYPE || type == Double.TYPE) { if (par1EnumOptions.getDecimalPlaces() < 0) { - return var4 + Math.round(((Number)obj).floatValue() * 100) + "%"; + return var4 + round(((Number)obj).floatValue() * 100) + "%"; } else { return var4 + String.format("%." + par1EnumOptions.getDecimalPlaces() + "f", ((Number)obj).floatValue()); } @@ -879,7 +945,7 @@ public String getButtonDisplayString( VrOptions par1EnumOptions ) return var4 + obj.toString(); } } catch (Exception ex) { - System.out.println("Failed to get VR option display string: " + par1EnumOptions); + logger.error("Failed to get VR option display string: {}", par1EnumOptions); ex.printStackTrace(); } @@ -899,11 +965,11 @@ public float getOptionFloatValue(VrOptions par1EnumOptions) return Objects.requireNonNullElse(par1EnumOptions.getOptionFloatValue(value), value); } catch (Exception ex) { - System.out.println("Failed to get VR option float value: " + par1EnumOptions); + logger.error("Failed to get VR option float value: {}", par1EnumOptions); ex.printStackTrace(); } - return 0.0f; + return 0.0F; } /** * For non-float options. Toggles the option on/off, or cycles through the list i.e. render distances. @@ -924,14 +990,14 @@ public void setOptionValue(VrOptions par1EnumOptions) } else if (OptionEnum.class.isAssignableFrom(type)) { field.set(this, ((OptionEnum)field.get(this)).getNext()); } else { - logger.warn("Don't know how to set VR option " + mapping.getMiddle() + " with type " + type.getSimpleName()); + logger.warn("Don't know how to set VR option {} with type {}", mapping.getMiddle(), type.getSimpleName()); return; } par1EnumOptions.onOptionChange(); this.saveOptions(); } catch (Exception ex) { - System.out.println("Failed to set VR option: " + par1EnumOptions); + logger.error("Failed to set VR option: {}", par1EnumOptions); ex.printStackTrace(); } } @@ -946,7 +1012,7 @@ public void setOptionFloatValue(VrOptions par1EnumOptions, float par2) float f = Objects.requireNonNullElse(par1EnumOptions.setOptionFloatValue(par2), par2); if (overrides.hasSetting(par1EnumOptions)) - f = Mth.clamp(f, overrides.getSetting(par1EnumOptions).getValueMin(), overrides.getSetting(par1EnumOptions).getValueMax()); + f = clamp(overrides.getSetting(par1EnumOptions).getValueMin(), overrides.getSetting(par1EnumOptions).getValueMax(), f); if (type == Integer.TYPE) { field.set(this, (int)f); @@ -959,7 +1025,7 @@ public void setOptionFloatValue(VrOptions par1EnumOptions, float par2) par1EnumOptions.onOptionChange(); this.saveOptions(); } catch (Exception ex) { - System.out.println("Failed to set VR option float value: " + par1EnumOptions); + logger.error("Failed to set VR option float value: {}", par1EnumOptions); ex.printStackTrace(); } } @@ -969,23 +1035,23 @@ public void setOptionFloatValue(VrOptions par1EnumOptions, float par2) */ private float parseFloat(String par1Str) { - return par1Str.equals("true") ? 1.0F : (par1Str.equals("false") ? 0.0F : Float.parseFloat(par1Str)); + return "true".equals(par1Str) ? 1.0F : ("false".equals(par1Str) ? 0.0F : Float.parseFloat(par1Str)); } public float getHeadTrackSensitivity() { //if (this.useQuaternions) - return 1.0f; + return 1.0F; //return this.headTrackSensitivity; // TODO: If head track sensitivity is working again... if } - public static enum VrOptions + public enum VrOptions { DUMMY(false, true), // Dummy - HUD_SCALE(true, false, 0.35f, 2.5f, 0.01f, -1), // Head HUD Size - HUD_DISTANCE(true, false, 0.25f, 5.0f, 0.01f, 2) { // Head HUD Distance + HUD_SCALE(true, false, 0.35F, 2.5F, 0.01F, -1), // Head HUD Size + HUD_DISTANCE(true, false, 0.25F, 5.0F, 0.01F, 2) { // Head HUD Distance @Override String getDisplayString(String prefix, Object value) { return prefix + String.format("%.2f", (float)value) + "m"; @@ -1003,7 +1069,9 @@ Object convertOption(String value) { } } }, - HUD_OPACITY(true, false, 0.15f, 1.0f, 0.05f, -1) { // HUD Opacity + PLAYER_STATUS(false, true), + ENTITY_STATUS(false, true, "vivecraft.options.entitystatus.always", "vivecraft.options.entitystatus.sometimes"), + HUD_OPACITY(true, false, 0.15F, 1.0F, 0.05F, -1) { // HUD Opacity @Override String getDisplayString(String prefix, Object value) { if ((float)value > 0.99) @@ -1014,23 +1082,23 @@ String getDisplayString(String prefix, Object value) { HUD_HIDE(false, true) { // Hide HUD (F1) @Override Object loadOption(String value) { - Minecraft.getInstance().options.hideGui = value.equals("true"); + mc.options.hideGui = "true".equals(value); return false; } @Override String saveOption(Object value) { - return Boolean.toString(Minecraft.getInstance().options.hideGui); + return Boolean.toString(mc.options.hideGui); } @Override String getDisplayString(String prefix, Object value) { - return Minecraft.getInstance().options.hideGui ? prefix + LangHelper.getYes() : prefix + LangHelper.getNo(); + return mc.options.hideGui ? prefix + LangHelper.getYes() : prefix + LangHelper.getNo(); } @Override Object setOptionValue(Object value) { - Minecraft.getInstance().options.hideGui = !Minecraft.getInstance().options.hideGui; + mc.options.hideGui = !mc.options.hideGui; return false; } }, @@ -1038,8 +1106,8 @@ Object setOptionValue(Object value) { HUD_OCCLUSION(false, true), // HUD Occlusion MENU_ALWAYS_FOLLOW_FACE(false, true, "vivecraft.options.always", "vivecraft.options.seated"), // Main Menu Follow CROSSHAIR_OCCLUSION(false, true), // Crosshair Occlusion - CROSSHAIR_SCALE(true, false, 0.25f, 1.0f, 0.01f, -1), // Crosshair Size - MENU_CROSSHAIR_SCALE(true, false, 0.25f, 2.5f, 0.05f, -1), // Menu Crosshair Size + CROSSHAIR_SCALE(true, false, 0.25F, 1.0F, 0.01F, -1), // Crosshair Size + MENU_CROSSHAIR_SCALE(true, false, 0.25F, 2.5F, 0.05F, -1), // Menu Crosshair Size RENDER_CROSSHAIR_MODE(false, true) { // Show Crosshair @Override Object convertOption(String value) { @@ -1103,10 +1171,10 @@ Object convertOption(String value) { AUTO_OPEN_KEYBOARD(false, true), // Always Open Keyboard RADIAL_MODE_HOLD(false, true, "vivecraft.options.hold", "vivecraft.options.press"), // Radial Menu Mode PHYSICAL_KEYBOARD(false, true, "vivecraft.options.keyboard.physical", "vivecraft.options.keyboard.pointer"), // Keyboard Type - PHYSICAL_KEYBOARD_SCALE(true, false, 0.75f, 1.5f, 0.01f, -1) { // Keyboard Size + PHYSICAL_KEYBOARD_SCALE(true, false, 0.75F, 1.5F, 0.01F, -1) { // Keyboard Size @Override void onOptionChange() { - KeyboardHandler.physicalKeyboard.setScale(ClientDataHolderVR.getInstance().vrSettings.physicalKeyboardScale); + KeyboardHandler.physicalKeyboard.setScale(dh.vrSettings.physicalKeyboardScale); } }, PHYSICAL_KEYBOARD_THEME(false, false), // Keyboard Theme @@ -1135,8 +1203,8 @@ Object convertOption(String value) { @Override void onOptionChange() { - if (VRState.vrRunning && !ShadersHelper.isShaderActive()) { - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("Mirror Setting Changed"); + if (vrRunning && !ShadersHelper.isShaderActive()) { + dh.vrRenderer.reinitFrameBuffers("Mirror Setting Changed"); } } @@ -1154,20 +1222,20 @@ Object setOptionValue(Object value) { private static final List> colors; static { colors = new ArrayList<>(); - colors.add(Pair.of(new Color(0, 0, 0), "vivecraft.options.color.black")); - colors.add(Pair.of(new Color(255, 0, 0), "vivecraft.options.color.red")); - colors.add(Pair.of(new Color(255, 255, 0), "vivecraft.options.color.yellow")); - colors.add(Pair.of(new Color(0, 255, 0), "vivecraft.options.color.green")); - colors.add(Pair.of(new Color(0, 255, 255), "vivecraft.options.color.cyan")); - colors.add(Pair.of(new Color(0, 0, 255), "vivecraft.options.color.blue")); - colors.add(Pair.of(new Color(255, 0, 255), "vivecraft.options.color.magenta")); + colors.add(Pair.of(new Color(Color.BLACK), "vivecraft.options.color.black")); + colors.add(Pair.of(new Color(Color.RED), "vivecraft.options.color.red")); + colors.add(Pair.of(new Color(Color.YELLOW), "vivecraft.options.color.yellow")); + colors.add(Pair.of(new Color(Color.GREEN), "vivecraft.options.color.green")); + colors.add(Pair.of(new Color(Color.CYAN), "vivecraft.options.color.cyan")); + colors.add(Pair.of(new Color(Color.BLUE), "vivecraft.options.color.blue")); + colors.add(Pair.of(new Color(Color.MAGENTA), "vivecraft.options.color.magenta")); } @Override String getDisplayString(String prefix, Object value) { Color color = (Color)value; var p = colors.stream().filter(c -> c.getLeft().equals(color)).findFirst().orElse(null); - return p != null ? prefix + I18n.get(p.getRight()) : prefix + color.getRed() + " " + color.getGreen() + " " + color.getBlue(); + return p != null ? prefix + I18n.get(p.getRight()) : prefix + color.R() + " " + color.G() + " " + color.B(); } @Override @@ -1178,8 +1246,8 @@ Object loadOption(String value) { @Override String saveOption(Object value) { - Color color = (Color)value; - return color.getRed() + "," + color.getGreen() + "," + color.getBlue(); + Color color = (Color)value; // TODO: save mixed reality colors as hexadecimal? + return color.R() + "," + color.G() + "," + color.B(); } @Override @@ -1192,30 +1260,30 @@ Object setOptionValue(Object value) { MIXED_REALITY_UNITY_LIKE(false, true, "vivecraft.options.unity", "vivecraft.options.sidebyside") { // Layout @Override void onOptionChange() { - ClientDataHolderVR.getInstance().vrRenderer.resizeFrameBuffers("MR Setting Changed"); + dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); } }, MIXED_REALITY_UNDISTORTED(false, true) { // Undistorted Pass @Override void onOptionChange() { - ClientDataHolderVR.getInstance().vrRenderer.resizeFrameBuffers("MR Setting Changed"); + dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); } }, MIXED_REALITY_ALPHA_MASK(false, true) { // Alpha Mask @Override void onOptionChange() { - ClientDataHolderVR.getInstance().vrRenderer.resizeFrameBuffers("MR Setting Changed"); + dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); } }, MIXED_REALITY_FOV(true, false, 0, 179, 1, 0) { // Third Person FOV @Override String getDisplayString(String prefix, Object value) { - return prefix + String.format("%.0f" + DEGREE, (float)value); + return prefix + String.format("%.0f°", (float)value); } }, WALK_UP_BLOCKS(false, true), // Walk up blocks //Movement/aiming controls - MOVEMENT_MULTIPLIER(true, false, 0.15f, 1.3f, 0.01f, 2), // Move. Speed Multiplier + MOVEMENT_MULTIPLIER(true, false, 0.15F, 1.3F, 0.01F, 2), // Move. Speed Multiplier INERTIA_FACTOR(false, true) { // Player Inertia @Override Object convertOption(String value) { @@ -1257,62 +1325,57 @@ String getDisplayString(String prefix, Object value) { @Override Float getOptionFloatValue(float value) { - if (value == 0.1f) return 0f; - if (value == 0.25f) return 1f; - if (value >= 0.5f && value <= 2.0f) return (value / 0.1f) - 3f; - if (value == 3) return 18f; - if (value == 4) return 19f; - if (value == 6) return 20f; - if (value == 8) return 21f; - if (value == 10) return 22f; - if (value == 12) return 23f; - if (value == 16) return 24f; - if (value == 20) return 25f; - if (value == 30) return 26f; - if (value == 50) return 27f; - if (value == 75) return 28f; - if (value == 100) return 29f; - return 7f; + if (value == 0.1F) return 0.0F; + if (value == 0.25F) return 1.0F; + if (value >= 0.5F && value <= 2.0F) return fma(value, 10F, -3.0F); + if (value == 3) return 18.0F; + if (value == 4) return 19.0F; + if (value == 6) return 20.0F; + if (value == 8) return 21.0F; + if (value == 10) return 22.0F; + if (value == 12) return 23.0F; + if (value == 16) return 24.0F; + if (value == 20) return 25.0F; + if (value == 30) return 26.0F; + if (value == 50) return 27.0F; + if (value == 75) return 28.0F; + if (value == 100) return 29.0F; + return 7.0F; } @Override Float setOptionFloatValue(float value) { - if (value == 0) return 0.1f; - else if (value == 1) return 0.25f; - else if (value >= 2 && value <= 17) return value * 0.1f + 0.3f; - else if (value == 18) return 3f; - else if (value == 19) return 4f; - else if (value == 20) return 6f; - else if (value == 21) return 8f; - else if (value == 22) return 10f; - else if (value == 23) return 12f; - else if (value == 24) return 16f; - else if (value == 25) return 20f; - else if (value == 26) return 30f; - else if (value == 27) return 50f; - else if (value == 28) return 75f; - else if (value == 29) return 100f; - else return 1f; + if (value == 0) return 0.1F; + else if (value == 1) return 0.25F; + else if (value >= 2 && value <= 17) return fma(value, 0.1F, 0.3F); + else if (value == 18) return 3.0F; + else if (value == 19) return 4.0F; + else if (value == 20) return 6.0F; + else if (value == 21) return 8.0F; + else if (value == 22) return 10.0F; + else if (value == 23) return 12.0F; + else if (value == 24) return 16.0F; + else if (value == 25) return 20.0F; + else if (value == 26) return 30.0F; + else if (value == 27) return 50.0F; + else if (value == 28) return 75.0F; + else if (value == 29) return 100.0F; + else return 1.0F; } @Override void onOptionChange() { - if (VRState.vrRunning) { - ClientDataHolderVR.getInstance().vrPlayer.roomScaleMovementDelay = 2; - ClientDataHolderVR.getInstance().vrPlayer.snapRoomOriginToPlayerEntity(Minecraft.getInstance().player, false, true); - VRPlayer.get().preTick(); + if (vrRunning) { + dh.vrPlayer.roomScaleMovementDelay = 2; + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, true); + dh.vrPlayer.preTick(); } } }, WORLD_ROTATION(true, false, 0, 360, 30, 0) { // World Rotation @Override String getDisplayString(String prefix, Object value) { - return prefix + String.format("%.0f" + DEGREE, (float)value); - } - - @Override - Float setOptionFloatValue(float value) { - return null; + return prefix + String.format("%.0f°", (float)value); } }, WORLD_ROTATION_INCREMENT(true, false, -1, 4, 1, 0) { // Rotation Increment @@ -1320,81 +1383,92 @@ Float setOptionFloatValue(float value) { String getDisplayString(String prefix, Object value) { if ((float)value == 0) return prefix + I18n.get("vivecraft.options.smooth"); - return prefix + String.format("%.0f" + DEGREE, (float)value); + return prefix + String.format("%.0f°", (float)value); } @Override Float getOptionFloatValue(float value) { - if (value == 0) return -1f; - if (value == 10f) return 0f; - if (value == 36f) return 1f; - if (value == 45f) return 2f; - if (value == 90f) return 3f; - if (value == 180f) return 4f; - return 2f; + if (value == 0) return -1.0F; + if (value == 10.0F) return 0.0F; + if (value == 36.0F) return 1.0F; + if (value == 45.0F) return 2.0F; + if (value == 90.0F) return 3.0F; + if (value == 180.0F) return 4.0F; + return 2.0F; } @Override Float setOptionFloatValue(float value) { - if (value == -1f) return 0f; - if (value == 0f) return 10f; - if (value == 1f) return 36f; - if (value == 2f) return 45f; - if (value == 3f) return 90f; - if (value == 4f) return 180f; - return 45f; + if (value == -1.0F) return 0.0F; + if (value == 0.0F) return 10.0F; + if (value == 1.0F) return 36.0F; + if (value == 2.0F) return 45.0F; + if (value == 3.0F) return 90.0F; + if (value == 4.0F) return 180.0F; + return 45.0F; } @Override void onOptionChange() { - ClientDataHolderVR.getInstance().vrSettings.worldRotation = 0; + dh.vrSettings.worldRotation = 0; } }, TOUCH_HOTBAR(false, true), // Touch Hotbar Enabled + TOUCH_HOTBAR_COLOR_R(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.red"), + TOUCH_HOTBAR_COLOR_G(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.green"), + TOUCH_HOTBAR_COLOR_B(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.blue"), + TOUCH_HOTBAR_COLOR_A(true, false, 0.0F, 1.0F, 0.01F, -1, "effect.minecraft.strength"), + TOUCH_OFFBAR_COLOR_R(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.red"), + TOUCH_OFFBAR_COLOR_G(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.green"), + TOUCH_OFFBAR_COLOR_B(true, false, 0.0F, 1.0F, 0.01F, -1, "color.minecraft.blue"), + TOUCH_OFFBAR_COLOR_A(true, false, 0.0F, 1.0F, 0.01F, -1, "effect.minecraft.strength"), PLAY_MODE_SEATED(false, true, "vivecraft.options.seated", "vivecraft.options.standing"), // Play Mode VR_HOTSWITCH(false, true), - RENDER_SCALEFACTOR(true, false, 0.1f, 9f, 0.1f, 0) { // Resolution + RENDER_SCALEFACTOR(true, false, 0.1F, 9.0F, 0.1F, 0) { // Resolution @Override String getDisplayString(String prefix, Object value) { - if (VRState.vrEnabled) { - RenderTarget eye0 = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0; - return prefix + Math.round((float) value * 100) + "% (" + (int) Math.ceil(eye0.viewWidth * Math.sqrt((float) value)) + "x" + (int) Math.ceil(eye0.viewHeight * Math.sqrt((float) value)) + ")"; + if (vrInitialized){ + RenderTarget eye0 = dh.vrRenderer.framebufferEye0; + return (prefix + round((float) value * 100) + "% (" + + roundUsing(eye0.viewWidth * sqrt((float) value), CEILING) + "x" + + roundUsing(eye0.viewHeight * sqrt((float) value), CEILING) + ")" + ); } else { - return prefix + Math.round((float) value * 100) + "%"; + return prefix + round((float) value * 100) + "%"; } } }, MONO_FOV(true, false, 1, 179, 1, 0) { // Undistorted FOV @Override String getDisplayString(String prefix, Object value) { - return prefix + String.format("%.0f" + DEGREE, (float)Minecraft.getInstance().options.fov().get()); + return prefix + String.format("%.0f°", (float)mc.options.fov().get()); } @Override Float getOptionFloatValue(float value) { - return (float)Minecraft.getInstance().options.fov().get(); + return (float)mc.options.fov().get(); } @Override Float setOptionFloatValue(float value) { - Minecraft.getInstance().options.fov().set((int) value); - return 0f; + mc.options.fov().set((int) value); + return 0.0F; } }, HANDHELD_CAMERA_FOV(true, false, 1, 179, 1, 0) { // Camera FOV @Override String getDisplayString(String prefix, Object value) { - return prefix + String.format("%.0f" + DEGREE, (float)value); + return prefix + String.format("%.0f°", (float)value); } }, - HANDHELD_CAMERA_RENDER_SCALE(true, false, 0.5f, 3.0f, 0.25f, 0) { // Camera Resolution + HANDHELD_CAMERA_RENDER_SCALE(true, false, 0.5F, 3.0F, 0.25F, 0) { // Camera Resolution @Override String getDisplayString(String prefix, Object value) { // if (Config.isShaders()) { //optifine -// RenderTarget camfb = Minecraft.getInstance().vrRenderer.cameraFramebuffer; +// RenderTarget camfb = mc.vrRenderer.cameraFramebuffer; // return prefix + camfb.viewWidth + "x" + camfb.viewHeight; // } else { - return prefix + Math.round(1920 * (float)value) + "x" + Math.round(1080 * (float)value); + return prefix + round(1920 * (float)value) + "x" + round(1080 * (float)value); // } } }, @@ -1412,7 +1486,7 @@ Object loadOption(String value) { REALISTIC_CLIMB(false, true), // Roomscale Climbing REALISTIC_SWIM(false, true), // Roomscale Swimming REALISTIC_ROW(false, true), // Roomscale Rowing - WALK_MULTIPLIER(true, false, 1f, 10f, 0.1f, 1), // Walking Multiplier + WALK_MULTIPLIER(true, false, 1.0F, 10.0F, 0.1F, 1), // Walking Multiplier FREEMOVE_MODE(false, true) { // Free Move Type @Override Object convertOption(String value) { @@ -1452,24 +1526,24 @@ Object setOptionValue(Object value) { VEHICLE_ROTATION(false, true), // Vehicle Rotation //SEATED RESET_ORIGIN(false, true), // Reset Origin - X_SENSITIVITY(true, false, 0.1f, 5f, 0.01f, 2), // Rotation Speed - Y_SENSITIVITY(true, false, 0.1f, 5f, 0.01f, 2), // Y Sensitivity - KEYHOLE(true, false, 0f, 40f, 5f, 0) { // Keyhole + X_SENSITIVITY(true, false, 0.1F, 5.0F, 0.01F, 2), // Rotation Speed + Y_SENSITIVITY(true, false, 0.1F, 5.0F, 0.01F, 2), // Y Sensitivity + KEYHOLE(true, false, 0.0F, 40.0F, 5.0F, 0) { // Keyhole @Override String getDisplayString(String prefix, Object value) { - return prefix + String.format("%.0f" + DEGREE, (float)value); + return prefix + String.format("%.0f°", (float)value); } }, FOV_REDUCTION(false, true), // FOV Comfort Reduction - FOV_REDUCTION_MIN(true, false, 0.1f, 0.7f, 0.05f, 2), // FOV Reduction Size - FOV_REDUCTION_OFFSET(true, false, 0.0f, 0.3f, 0.01f, 2), // FOV Reduction Offset + FOV_REDUCTION_MIN(true, false, 0.1F, 0.7F, 0.05F, 2), // FOV Reduction Size + FOV_REDUCTION_OFFSET(true, false, 0.0F, 0.3F, 0.01F, 2), // FOV Reduction Offset // OTher buttons SEATED_HMD(false, true, "vivecraft.options.hmd", "vivecraft.options.crosshair"), // Forward Direction SEATED_HUD_XHAIR(false, true, "vivecraft.options.crosshair", "vivecraft.options.hmd"), // HUD Follows BACKPACK_SWITCH(false, true), // Backpack Switching ANALOG_MOVEMENT(false, true), // Analog Movement AUTO_SPRINT(false, true), // Auto-sprint - AUTO_SPRINT_THRESHOLD(true, false, 0.5f, 1f, 0.01f, 2), // Auto-sprint Threshold + AUTO_SPRINT_THRESHOLD(true, false, 0.5F, 1.0F, 0.01F, 2), // Auto-sprint Threshold THIRDPERSON_ITEMTRANSFORMS(false, true), // 3rd person items BOW_MODE(false, true) { // Roomscale Bow Mode @Override @@ -1483,22 +1557,167 @@ Object convertOption(String value) { } } }, + SKELETAL_INPUT(false, true){ // Skeletal Input Enabled + @Override + public String getTooltipString(final String key){ + int MainLevel = -1; //-1; + int OffLevel = -1; //-1; + if (dh.vr != null) { + MainLevel = dh.vr.getControllerSkeletalTrackingLevel(0); + OffLevel = dh.vr.getControllerSkeletalTrackingLevel(1); + } + final boolean MainUnknown = (MainLevel > 3) || (MainLevel < 0); + final boolean OffUnknown = (OffLevel > 3) || (OffLevel < 0); + return LangHelper.get(key, + (dh.vr != null) ? + (LangHelper.get( + key + ".controller", + LangHelper.get("options.mainHand"), + LangHelper.get( + key + "." + (MainUnknown ? "unknown" : MainLevel), + MainUnknown ? MainLevel : null + ) + ) + '\n' + + LangHelper.get( + key + ".controller", + LangHelper.get("vivecraft.options.offhand"), + LangHelper.get( + key + "." + (OffUnknown ? "unknown" : OffLevel), + OffUnknown ? OffLevel : null + ) + )) + : LangHelper.get(key + ".nonvr") + ); + } + }, + FINGER_COUNT(false, true, "vivecraft.options.FINGER_COUNT.extension", "vivecraft.options.FINGER_COUNT.curl"), + FINGER_VIEW(false, true), // Finger View Enabled + MAIN_THUMB_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.mainThumb"), + MAIN_INDEX_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.mainIndex"), + MAIN_MIDDLE_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.mainMiddle"), + MAIN_RING_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.mainRing"), + MAIN_LITTLE_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.mainLittle"), + OFF_THUMB_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.offThumb"), + OFF_INDEX_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.offIndex"), + OFF_MIDDLE_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.offMiddle"), + OFF_RING_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.offRing"), + OFF_LITTLE_THRESHOLD(true, false, 0.0F, 1.0F, 0.01F, -1, "vivecraft.key.offLittle"), + MAIN_THUMB_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.mainThumb") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("options.mainHand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + MAIN_INDEX_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.mainIndex") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("options.mainHand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + MAIN_MIDDLE_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.mainMiddle") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("options.mainHand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + MAIN_RING_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.mainRing") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("options.mainHand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + MAIN_LITTLE_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.mainLittle") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("options.mainHand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + OFF_THUMB_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.offThumb") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("vivecraft.options.offhand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + OFF_INDEX_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.offIndex") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("vivecraft.options.offhand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + OFF_MIDDLE_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.offMiddle") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("vivecraft.options.offhand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + OFF_RING_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.offRing") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("vivecraft.options.offhand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, + OFF_LITTLE_DISPLAY(true, false, 1, 11, 1, 0, "vivecraft.key.offLittle") { + @Override + String getDisplayString(final String prefix, final Object value) { + return ( + ((int) value == 10) ? (prefix + LangHelper.get("vivecraft.options.offhand")) : + (((int) value > 10) ? (prefix + LangHelper.get("options.off")) : + (prefix + LangHelper.get("key.hotbar." + (int) value))) + ); + } + }, TELEPORT_DOWN_LIMIT(true, false, 0, 16, 1, 0) { // Down Limit @Override String getDisplayString(String prefix, Object value) { - return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", (int)value) : prefix + "OFF"; + return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", value) : prefix + LangHelper.get(LangHelper.OFF_KEY); } }, TELEPORT_UP_LIMIT(true, false, 0, 4, 1, 0) { // Up Limit @Override String getDisplayString(String prefix, Object value) { - return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", (int)value) : prefix + "OFF"; + return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", value) : prefix + LangHelper.get(LangHelper.OFF_KEY); } }, TELEPORT_HORIZ_LIMIT(true, false, 0, 32, 1, 0) { // Distance Limit @Override String getDisplayString(String prefix, Object value) { - return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", (int)value) : prefix + "OFF"; + return (int)value > 0 ? prefix + LangHelper.get("vivecraft.options.teleportlimit", value) : prefix + LangHelper.get(LangHelper.OFF_KEY); } }, ALLOW_STANDING_ORIGIN_OFFSET(false, true, LangHelper.YES_KEY, LangHelper.NO_KEY), // Allow Origin Offset @@ -1547,20 +1766,14 @@ String getDisplayString(String prefix, Object value) { private final float valueMin; private final float valueMax; private final int decimalPlaces; + private final String langKey; private final Pair booleanLangKeys; public static VrOptions getEnumOptions(int par0) { - VrOptions[] aoptions = values(); - int j = aoptions.length; - - for (int k = 0; k < j; ++k) - { - VrOptions options = aoptions[k]; - - if (options.returnEnumOrdinal() == par0) - { - return options; + for (VrOptions option : values()) { + if (option.returnEnumOrdinal() == par0) { + return option; } } @@ -1572,25 +1785,28 @@ public static VrOptions getEnumOptions(int par0) this(isfloat, isbool, 0.0F, 1.0F, 0.0F, 0); } - VrOptions(boolean isfloat, boolean isbool, String trueLangKey, String falseKangKey) + VrOptions(boolean isfloat, boolean isbool, String trueLangKey, String falseLangKey) { - this(isfloat, isbool, 0.0F, 1.0F, 0.0F, 0, trueLangKey, falseKangKey); + this(isfloat, isbool, 0.0F, 1.0F, 0.0F, 0, trueLangKey, falseLangKey); + } + + VrOptions(boolean isfloat, boolean isbool, String langKey) + { + this(isfloat, isbool, 0.0F, 1.0F, 0.0F, 0, langKey); } /** - * - * @param isfloat - * @param isbool - * @param min - * @param max - * @param step - * @param decimalPlaces number of decimal places for float value, negative to display as percentage + * @param decimalPlaces number of decimal places to print for float value, negative to display as percentage */ VrOptions(boolean isfloat, boolean isbool, float min, float max, float step, int decimalPlaces) { - this(isfloat, isbool, min, max, step, decimalPlaces, LangHelper.ON_KEY, LangHelper.OFF_KEY); + this(isfloat, isbool, min, max, step, decimalPlaces, LangHelper.ON_KEY, LangHelper.OFF_KEY, null); + } + + VrOptions(boolean isfloat, boolean isboolean, float min, float max, float step, int decimalPlaces, String trueLangKey, String falseLangKey){ + this(isfloat, isboolean, min, max, step, decimalPlaces, trueLangKey, falseLangKey, null); } - VrOptions(boolean isfloat, boolean isboolean, float min, float max, float step, int decimalPlaces, String trueLangKey, String falseKangKey) + VrOptions(boolean isfloat, boolean isboolean, float min, float max, float step, int decimalPlaces, String trueLangKey, String falseLangKey, String prefixLangKey) { this.enumFloat = isfloat; this.enumBoolean = isboolean; @@ -1598,7 +1814,13 @@ public static VrOptions getEnumOptions(int par0) this.valueMax = max; this.valueStep = step; this.decimalPlaces = decimalPlaces; - this.booleanLangKeys = Pair.of(trueLangKey, falseKangKey); + this.langKey = prefixLangKey; + this.booleanLangKeys = Pair.of(trueLangKey, falseLangKey); + } + + VrOptions(boolean isfloat, boolean isboolean, float min, float max, float step, int decimalPlaces, String langKey) + { + this(isfloat, isboolean, min, max, step, decimalPlaces, LangHelper.ON_KEY, LangHelper.OFF_KEY, langKey); } Object convertOption(String value) { @@ -1660,57 +1882,65 @@ public int getDecimalPlaces() { return decimalPlaces; } + public String getTooltipString(String key){ + return null; + } + + public String getLangKey() { + return this.langKey; + } + public Pair getBooleanLangKeys() { return booleanLangKeys; } - protected float snapToStep(float p_148264_1_) + protected float snapToStep(float value) { if (this.valueStep > 0.0F) { - p_148264_1_ = this.valueStep * (float)Math.round(p_148264_1_ / this.valueStep); + value = this.valueStep * (float)round(value / this.valueStep); } - return p_148264_1_; + return value; } public double normalizeValue(float value) { - return Mth.clamp((this.snapToStep(value) - this.valueMin) / (this.valueMax - this.valueMin), 0.0D, 1.0D); + return clamp(0.0D, 1.0D, (this.snapToStep(value) - this.valueMin) / (this.valueMax - this.valueMin)); } public double denormalizeValue(float value) { - return this.snapToStep((float) (this.valueMin + (this.valueMax - this.valueMin) * Mth.clamp(value, 0.0D, 1.0D))); + return this.snapToStep((float) (this.valueMin + (this.valueMax - this.valueMin) * clamp(0.0D, 1.0D, value))); } } - public static synchronized void initSettings( Minecraft mc, File dataDir ) + public static synchronized void initSettings() { - ProfileManager.init(dataDir); - var vrSettings = new VRSettings( mc, dataDir ); + ProfileManager.init(mc.gameDirectory); + var vrSettings = new VRSettings(); vrSettings.saveOptions(); - ClientDataHolderVR.getInstance().vrSettings = vrSettings; + dh.vrSettings = vrSettings; } - public static synchronized void loadAll( Minecraft mc ) + public static synchronized void loadAll() { mc.options.load(); - ClientDataHolderVR.getInstance().vrSettings.loadOptions(); + dh.vrSettings.loadOptions(); } - public static synchronized void saveAll( Minecraft mc ) + public static synchronized void saveAll() { mc.options.save(); - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } - public static synchronized void resetAll( Minecraft mc ) + public static synchronized void resetAll() { ((OptionsExtension) mc.options).resetSettings(); - ClientDataHolderVR.getInstance().vrSettings.resetSettings(); + dh.vrSettings.resetSettings(); } public static synchronized String getCurrentProfile() @@ -1736,18 +1966,15 @@ public static synchronized boolean setCurrentProfile(String profile) public static synchronized boolean setCurrentProfile(String profile, StringBuilder error) { - boolean result = true; - Minecraft mc = Minecraft.getInstance(); - // Save settings in current profile - VRSettings.saveAll(mc); + saveAll(); // Set the new profile - result = ProfileManager.setCurrentProfile(profile, error); + boolean result = ProfileManager.setCurrentProfile(profile, error); if (result) { // Load new profile - VRSettings.loadAll(mc); + loadAll(); } return result; @@ -1755,12 +1982,10 @@ public static synchronized boolean setCurrentProfile(String profile, StringBuild public static synchronized boolean createProfile(String profile, boolean useDefaults, StringBuilder error) { - boolean result = true; - Minecraft mc = Minecraft.getInstance(); - String originalProfile = VRSettings.getCurrentProfile(); + String originalProfile = getCurrentProfile(); // Save settings in original profile - VRSettings.saveAll(mc); + saveAll(); // Create the new profile if (!ProfileManager.createProfile(profile, error)) @@ -1773,17 +1998,17 @@ public static synchronized boolean createProfile(String profile, boolean useDefa if (useDefaults) { // ...unless set to use defaults - VRSettings.resetAll(mc); + resetAll(); } // Save new profile settings to file - VRSettings.saveAll(mc); + saveAll(); // Select the original profile ProfileManager.setCurrentProfile(originalProfile, error); - VRSettings.loadAll(mc); + loadAll(); - return result; + return true; } public static synchronized boolean deleteProfile(String profile) @@ -1794,47 +2019,35 @@ public static synchronized boolean deleteProfile(String profile) public static synchronized boolean deleteProfile(String profile, StringBuilder error) { - Minecraft mc = Minecraft.getInstance(); - // Save settings in current profile - VRSettings.saveAll(mc); + saveAll(); // Nuke the profile data if (!ProfileManager.deleteProfile(profile, error)) return false; // Load settings in case the selected profile has changed - VRSettings.loadAll(mc); + loadAll(); return true; } public static synchronized boolean duplicateProfile(String originalProfile, String newProfile, StringBuilder error) { - Minecraft mc = Minecraft.getInstance(); - // Save settings in current profile - VRSettings.saveAll(mc); + saveAll(); // Duplicate the profile data - if (!ProfileManager.duplicateProfile(originalProfile, newProfile, error)) - return false; - - return true; + return ProfileManager.duplicateProfile(originalProfile, newProfile, error); } public static synchronized boolean renameProfile(String originalProfile, String newProfile, StringBuilder error) { - Minecraft mc = Minecraft.getInstance(); - // Save settings in current profile - VRSettings.saveAll(mc); + saveAll(); // Rename the profile - if (!ProfileManager.renameProfile(originalProfile, newProfile, error)) - return false; - - return true; + return ProfileManager.renameProfile(originalProfile, newProfile, error); } public String[] getQuickCommandsDefaults(){ @@ -1983,16 +2196,16 @@ public Object getValue() { val = originalValue.get(); if (val instanceof Integer) - val = Mth.clamp(((Number)val).intValue(), (int)getValueMin(), (int)getValueMax()); + val = clamp((int)getValueMin(), (int)getValueMax(), ((Number)val).intValue()); else if (val instanceof Float) - val = Mth.clamp(((Number)val).floatValue(), getValueMin(), getValueMax()); + val = clamp(getValueMin(), getValueMax(), ((Number)val).floatValue()); return val; } public boolean getBoolean() { Object val = getValue(); - return val instanceof Boolean ? (boolean)val : false; + return val instanceof Boolean bool && bool; } public int getInt() { diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java index 315dc5f9c..f21c61de7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java @@ -1,22 +1,12 @@ package org.vivecraft.client_vr.settings.profile; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.StringReader; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - import com.google.gson.*; +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; + +import static org.vivecraft.common.utils.Utils.logger; public class ProfileManager { @@ -28,12 +18,12 @@ public class ProfileManager static final String KEY_PROFILES = "Profiles"; static final String KEY_SELECTED_PROFILE = "selectedProfile"; static String currentProfileName = "Default"; - static File vrProfileCfgFile = null; - static JsonObject jsonConfigRoot = null; - static JsonObject profiles = null; + static File vrProfileCfgFile; + static JsonObject jsonConfigRoot; + static JsonObject profiles; static final Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); static boolean loaded = false; - public static final String[] DEFAULT_BINDINGS = new String[] {"key.playerlist:b:6:Button 6", "axis.updown:a:2:-:Y Rotation", "walk.forward:a:0:-:Y ", "gui.axis.leftright:a:3:-:X Rotation", "gui.axis.updown:a:2:-:Y Rotation", "key.sneak:b:9:Button 9", "gui.Left:px:-", "key.itemright:b:5:Button 5", "gui.Right:px:+", "key.left:a:1:-:X ", "gui.Select:b:0:Button 0", "key.aimcenter:b:8:Button 8", "key.pickItem:b:2:Button 2", "key.menu:b:7:Button 7", "key.attack:a:4:-:Z ", "gui.Up:py:-", "key.use:a:4:+:Z ", "axis.leftright:a:3:-:X Rotation", "gui.Down:py:+", "key.right:a:1:+:X ", "key.back:a:0:+:Y ", "key.inventory:b:3:Button 3", "key.jump:b:0:Button 0", "key.drop:b:1:Button 1", "gui.Back:b:1:Button 1", "key.itemleft:b:4:Button 4"}; + public static final String[] DEFAULT_BINDINGS = {"key.playerlist:b:6:Button 6", "axis.updown:a:2:-:Y Rotation", "walk.forward:a:0:-:Y ", "gui.axis.leftright:a:3:-:X Rotation", "gui.axis.updown:a:2:-:Y Rotation", "key.sneak:b:9:Button 9", "gui.Left:px:-", "key.itemright:b:5:Button 5", "gui.Right:px:+", "key.left:a:1:-:X ", "gui.Select:b:0:Button 0", "key.aimcenter:b:8:Button 8", "key.pickItem:b:2:Button 2", "key.menu:b:7:Button 7", "key.attack:a:4:-:Z ", "gui.Up:py:-", "key.use:a:4:+:Z ", "axis.leftright:a:3:-:X Rotation", "gui.Down:py:+", "key.right:a:1:+:X ", "key.back:a:0:+:Y ", "key.inventory:b:3:Button 3", "key.jump:b:0:Button 0", "key.drop:b:1:Button 1", "gui.Back:b:1:Button 1", "key.itemleft:b:4:Button 4"}; public static synchronized void init(File dataDir) { @@ -50,7 +40,7 @@ public static synchronized void load() vrProfileCfgFile.createNewFile(); } - InputStreamReader inputstreamreader = new InputStreamReader(new FileInputStream(vrProfileCfgFile), "UTF-8"); + InputStreamReader inputstreamreader = new InputStreamReader(new FileInputStream(vrProfileCfgFile), StandardCharsets.UTF_8); try { @@ -93,7 +83,7 @@ public static synchronized void load() } catch (Exception exception1) { - System.out.println("FAILED to read VR profile settings!"); + logger.error("FAILED to read VR profile settings!"); exception1.printStackTrace(); loaded = false; } @@ -101,44 +91,37 @@ public static synchronized void load() private static void validateProfiles() throws Exception { - for (Object object : profiles.keySet()) + for (String s : profiles.keySet()) { - String s = (String)object; - Object object1 = profiles.get(s); - - if (object1 instanceof JsonObject) + if (profiles.get(s) instanceof JsonObject JsonObject) { - JsonObject JsonObject = (JsonObject)object1; JsonObject JsonObject1 = null; JsonObject JsonObject2 = null; JsonObject JsonObject3 = null; JsonObject JsonObject4 = null; - for (Object object2 : JsonObject.keySet()) + for (String s1 : JsonObject.keySet()) { - String s1 = (String)object2; - Object object3 = JsonObject.get(s1); - - if (object3 instanceof JsonObject) + if (JsonObject.get(s1) instanceof JsonObject jsonobject) { - if (s1.equals("Mc")) + if ("Mc".equals(s1)) { - JsonObject1 = (JsonObject)object3; + JsonObject1 = jsonobject; } - if (s1.equals("Of")) + if ("Of".equals(s1)) { - JsonObject2 = (JsonObject)object3; + JsonObject2 = jsonobject; } - if (s1.equals("Vr")) + if ("Vr".equals(s1)) { - JsonObject3 = (JsonObject)object3; + JsonObject3 = jsonobject; } - if (s1.equals("Controller")) + if ("Controller".equals(s1)) { - JsonObject4 = (JsonObject)object3; + JsonObject4 = jsonobject; } } } @@ -244,7 +227,7 @@ public static synchronized Map getProfileSet(String profile, Str { JsonObject JsonObject1 = JsonObject.get(set).getAsJsonObject(); - for (String s : (Set)JsonObject1.keySet()) + for (String s : JsonObject1.keySet()) { String s1 = JsonObject1.get(s).getAsString(); map.put(s, s1); @@ -263,7 +246,7 @@ public static synchronized Map getProfileSet(JsonObject theProfi { JsonObject JsonObject = theProfile.get(set).getAsJsonObject(); - for (String s : (Set)JsonObject.keySet()) + for (String s : JsonObject.keySet()) { String s1 = JsonObject.get(s).getAsString(); map.put(s, s1); @@ -316,7 +299,7 @@ public static synchronized void save() { try { - OutputStreamWriter outputstreamwriter = new OutputStreamWriter(new FileOutputStream(vrProfileCfgFile), "UTF-8"); + OutputStreamWriter outputstreamwriter = new OutputStreamWriter(new FileOutputStream(vrProfileCfgFile), StandardCharsets.UTF_8); String s = gson.toJson(jsonConfigRoot); outputstreamwriter.write(s); outputstreamwriter.flush(); @@ -341,15 +324,7 @@ public static synchronized SortedSet getProfileList() private static JsonObject getCurrentProfile() { - if (!profiles.has(currentProfileName)) - { - return null; - } - else - { - Object object = profiles.get(currentProfileName); - return object != null && object instanceof JsonObject ? (JsonObject)object : null; - } + return (profiles.get(currentProfileName) instanceof JsonObject objectJSON) ? objectJSON : null; } public static synchronized String getCurrentProfileName() @@ -361,7 +336,7 @@ public static synchronized boolean setCurrentProfile(String profileName, StringB { if (!profiles.has(profileName)) { - error.append("Profile '" + profileName + "' not found."); + error.append("Profile '").append(profileName).append("' not found."); return false; } else @@ -376,7 +351,7 @@ public static synchronized boolean createProfile(String profileName, StringBuild { if (profiles.has(profileName)) { - error.append("Profile '" + profileName + "' already exists."); + error.append("Profile '").append(profileName).append("' already exists."); return false; } else @@ -389,19 +364,19 @@ public static synchronized boolean createProfile(String profileName, StringBuild public static synchronized boolean renameProfile(String existingProfileName, String newProfileName, StringBuilder error) { - if (existingProfileName.equals("Default")) + if ("Default".equals(existingProfileName)) { error.append("Cannot rename Default profile."); return false; } else if (!profiles.has(existingProfileName)) { - error.append("Profile '" + existingProfileName + "' not found."); + error.append("Profile '").append(existingProfileName).append("' not found."); return false; } else if (profiles.has(newProfileName)) { - error.append("Profile '" + newProfileName + "' already exists."); + error.append("Profile '").append(newProfileName).append("' already exists."); return false; } else @@ -423,12 +398,12 @@ public static synchronized boolean duplicateProfile(String profileName, String d { if (!profiles.has(profileName)) { - error.append("Profile '" + profileName + "' not found."); + error.append("Profile '").append(profileName).append("' not found."); return false; } else if (profiles.has(duplicateProfileName)) { - error.append("Profile '" + duplicateProfileName + "' already exists."); + error.append("Profile '").append(duplicateProfileName).append("' already exists."); return false; } else @@ -441,14 +416,14 @@ else if (profiles.has(duplicateProfileName)) public static synchronized boolean deleteProfile(String profileName, StringBuilder error) { - if (profileName.equals("Default")) + if ("Default".equals(profileName)) { error.append("Cannot delete Default profile."); return false; } else if (!profiles.has(profileName)) { - error.append("Profile '" + profileName + "' not found."); + error.append("Profile '").append(profileName).append("' not found."); return false; } else diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java index ee353535f..21f8741dc 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java @@ -1,19 +1,19 @@ package org.vivecraft.client_vr.settings.profile; +import com.google.gson.JsonObject; + import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import com.google.gson.JsonObject; - public class ProfileReader { private String set; private String profile; - private Map currentProfile = null; - private Iterator profileSettingsIt = null; - private JsonObject theProfiles = null; + private Map currentProfile; + private Iterator profileSettingsIt; + private JsonObject theProfiles; public ProfileReader(String set) { diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java index 6c53069d4..30e029f1c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java @@ -1,15 +1,16 @@ package org.vivecraft.client_vr.settings.profile; +import com.google.gson.JsonObject; + import java.util.HashMap; import java.util.Map; -import com.google.gson.JsonObject; public class ProfileWriter { private String activeProfileName; private String set; private Map data = new HashMap<>(); - private JsonObject theProfile = null; + private JsonObject theProfile; public ProfileWriter(String set) { diff --git a/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java b/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java index 854383540..0617ca082 100644 --- a/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java +++ b/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java @@ -8,21 +8,23 @@ import java.nio.file.FileSystems; import java.util.HashMap; import java.util.Map; -import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import static org.vivecraft.common.utils.Utils.logger; public class LoaderUtils { public static URL ZipFileUrl; public static File vivecraftFile; - private static java.util.zip.ZipFile ZipFile; + private static ZipFile ZipFile; public static void init() { - try { - ZipFileUrl = getVivecraftZipLocation().toURL(); - vivecraftFile = toFile(ZipFileUrl.toURI()); - ZipFile = new java.util.zip.ZipFile(vivecraftFile); - } catch (Exception e) { - System.out.print("Error getting Vivecraft library: " + e.getLocalizedMessage()); - } + try { + ZipFileUrl = getVivecraftZipLocation().toURL(); + vivecraftFile = toFile(ZipFileUrl.toURI()); + ZipFile = new ZipFile(vivecraftFile); + } catch (Exception e) { + logger.error("Error getting Vivecraft library: " + e.getLocalizedMessage()); + } } public static URI getVivecraftZipLocation() throws URISyntaxException @@ -33,7 +35,7 @@ public static URI getVivecraftZipLocation() throws URISyntaxException } else { - ZipFileUrl = LoaderUtils.class.getProtectionDomain().getCodeSource().getLocation(); + ZipFileUrl = LoaderUtils.class.getProtectionDomain().getCodeSource().getLocation(); if (ZipFileUrl == null) { @@ -46,13 +48,13 @@ public static URI getVivecraftZipLocation() throws URISyntaxException } } - public static java.util.zip.ZipFile getVivecraftZip() throws ZipException, URISyntaxException, IOException { - if (vivecraftFile == null) { - init(); - } - return new java.util.zip.ZipFile(vivecraftFile); - } - + public static ZipFile getVivecraftZip() throws URISyntaxException, IOException { + if (vivecraftFile == null) { + init(); + } + return new ZipFile(vivecraftFile); + } + public static File toFile(URI uri) { if (!"union".equals(uri.getScheme())) @@ -67,7 +69,7 @@ public static File toFile(URI uri) if (s.contains("#")) { - s = s.substring(0, s.lastIndexOf("#")); + s = s.substring(0, s.lastIndexOf('#')); } File file1 = new File(s); diff --git a/common/src/main/java/org/vivecraft/client_vr/utils/RGBAColor.java b/common/src/main/java/org/vivecraft/client_vr/utils/RGBAColor.java deleted file mode 100644 index 0fde50e17..000000000 --- a/common/src/main/java/org/vivecraft/client_vr/utils/RGBAColor.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.vivecraft.client_vr.utils; - -// Pinched from GlStateManager and additional functionality added -public class RGBAColor { - public float r; - public float g; - public float b; - public float a; - - public RGBAColor() { - this(1.0F, 1.0F, 1.0F, 1.0F); - } - - public RGBAColor(float red, float green, float blue, float alpha) { - this.r = red; - this.g = green; - this.b = blue; - this.a = alpha; - } - - public RGBAColor(int red, int green, int blue, int alpha) { - this.r = red / 255.0F; - this.g = green / 255.0F; - this.b = blue / 255.0F; - this.a = alpha / 255.0F; - } - - public RGBAColor(int value) { - this(value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF); - } - - public int toIntEncoding() { - return (int)(this.r * 255.0F) | ((int)(this.g * 255.0F) << 8) | ((int)(this.b * 255.0F) << 16) | ((int)(this.a * 255.0F) << 24); - } - - public RGBAColor copy() { - return new RGBAColor(this.r, this.g, this.b, this.a); - } - - public static RGBAColor fromHSB(float hue, float saturation, float brightness) { - RGBAColor color = new RGBAColor(); - - if (saturation == 0.0F) { - color.r = color.g = color.b = brightness; - } else { - float f = (hue - (float)Math.floor((double)hue)) * 6.0F; - float f1 = f - (float)Math.floor((double)f); - float f2 = brightness * (1.0F - saturation); - float f3 = brightness * (1.0F - saturation * f1); - float f4 = brightness * (1.0F - saturation * (1.0F - f1)); - - switch ((int)f) { - case 0 -> { - color.r = brightness; - color.g = f4; - color.b = f2; - } - case 1 -> { - color.r = f3; - color.g = brightness; - color.b = f2; - } - case 2 -> { - color.r = f2; - color.g = brightness; - color.b = f4; - } - case 3 -> { - color.r = f2; - color.g = f3; - color.b = brightness; - } - case 4 -> { - color.r = f4; - color.g = f2; - color.b = brightness; - } - case 5 -> { - color.r = brightness; - color.g = f2; - color.b = f3; - } - } - } - - return color; - } -} diff --git a/common/src/main/java/org/vivecraft/client_vr/utils/external/jinfinadeck.java b/common/src/main/java/org/vivecraft/client_vr/utils/external/jinfinadeck.java index d492b7204..62dbf976f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/utils/external/jinfinadeck.java +++ b/common/src/main/java/org/vivecraft/client_vr/utils/external/jinfinadeck.java @@ -7,6 +7,10 @@ import com.sun.jna.ptr.FloatByReference; import com.sun.jna.ptr.IntByReference; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; + public class jinfinadeck implements Library { public static final String INFINADECK_LIBRARY_NAME = "InfinadeckAPI.dll"; @@ -63,15 +67,15 @@ public static void query() { } - yaw = (float)GetFloorSpeedAngle(); + yaw = (float) GetFloorSpeedAngle(); power = GetFloorSpeedMagnitude(); direction = 1; ismoving = GetTreadmillRunState(); - yaw *= 57.296F; + yaw = (float) toDegrees(yaw); } catch (Exception exception) { - System.out.println("Infinadeck Error: " + exception.getMessage()); + logger.error("Infinadeck Error: {}", exception.getMessage()); } } @@ -92,12 +96,12 @@ public static void resetYaw(float offsetDegrees) public static float walkDirection() { - return (float)direction; + return direction; } - public static float getSpeed() + public static double getSpeed() { - return (float)(power / (double)maxpower * (double)(walkDirection() == 1.0F ? mag : bmag)); + return power / maxpower * (walkDirection() == 1.0F ? mag : bmag); } static diff --git a/common/src/main/java/org/vivecraft/client_vr/utils/external/jkatvr.java b/common/src/main/java/org/vivecraft/client_vr/utils/external/jkatvr.java index 5430a74da..0a63fe630 100644 --- a/common/src/main/java/org/vivecraft/client_vr/utils/external/jkatvr.java +++ b/common/src/main/java/org/vivecraft/client_vr/utils/external/jkatvr.java @@ -7,6 +7,8 @@ import com.sun.jna.ptr.FloatByReference; import com.sun.jna.ptr.IntByReference; +import static org.vivecraft.common.utils.Utils.logger; + public class jkatvr implements Library { public static final String KATVR_LIBRARY_NAME = "WalkerBase.dll"; @@ -40,7 +42,7 @@ public static void query() try { boolean flag = GetWalkerData(0, y, pow, m, is, fl); - yaw = (float)y.getValue(); + yaw = y.getValue(); power = pow.getValue(); direction = -m.getValue(); ismoving = is.getValue(); @@ -48,7 +50,7 @@ public static void query() } catch (Exception exception) { - System.out.println("KATVR Error: " + exception.getMessage()); + logger.error("KATVR Error: {}", exception.getMessage()); } } @@ -69,12 +71,12 @@ public static void resetYaw(float offsetDegrees) public static float walkDirection() { - return (float)direction; + return direction; } - public static float getSpeed() + public static double getSpeed() { - return (float)(power / (double)maxpower * (double)(walkDirection() == 1.0F ? mag : bmag)); + return power / maxpower * (walkDirection() == 1.0F ? mag : bmag); } static diff --git a/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java b/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java index e33ad5201..5d1cf23de 100644 --- a/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java +++ b/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java @@ -1,14 +1,16 @@ package org.vivecraft.client_xr.render_pass; -import com.mojang.blaze3d.pipeline.MainTarget; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.PostChain; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.render.RenderPass; +import com.mojang.blaze3d.pipeline.MainTarget; + +import net.minecraft.client.renderer.PostChain; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + public class RenderPassManager { - private static final Minecraft mc = Minecraft.getInstance(); public static RenderPassManager INSTANCE; @@ -29,14 +31,14 @@ public static void setWorldRenderPass(WorldRenderPass wrp) { } public static void setGUIRenderPass() { - ClientDataHolderVR.getInstance().currentPass = RenderPass.GUI; + dh.currentPass = RenderPass.GUI; RenderPassManager.wrp = null; renderPassType = RenderPassType.GUI_ONLY; mc.mainRenderTarget = GuiHandler.guiFramebuffer; } public static void setVanillaRenderPass() { - ClientDataHolderVR.getInstance().currentPass = null; + dh.currentPass = RenderPass.VANILLA; RenderPassManager.wrp = null; renderPassType = RenderPassType.VANILLA; mc.mainRenderTarget = INSTANCE.vanillaRenderTarget; diff --git a/common/src/main/java/org/vivecraft/client_xr/render_pass/WorldRenderPass.java b/common/src/main/java/org/vivecraft/client_xr/render_pass/WorldRenderPass.java index ee8f717ad..c12a3d2cb 100644 --- a/common/src/main/java/org/vivecraft/client_xr/render_pass/WorldRenderPass.java +++ b/common/src/main/java/org/vivecraft/client_xr/render_pass/WorldRenderPass.java @@ -1,16 +1,20 @@ package org.vivecraft.client_xr.render_pass; +import org.vivecraft.client_vr.VRTextureTarget; + import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.Minecraft; + import net.minecraft.client.renderer.PostChain; import net.minecraft.resources.ResourceLocation; -import org.vivecraft.client_vr.VRTextureTarget; import java.io.IOException; -public class WorldRenderPass implements AutoCloseable { +import static org.vivecraft.client_vr.VRState.mc; + +import static net.minecraft.client.Minecraft.ON_OSX; +import static net.minecraft.client.Minecraft.useShaderTransparency; - private static final Minecraft mc = Minecraft.getInstance(); +public class WorldRenderPass implements AutoCloseable { public static WorldRenderPass stereoXR; public static WorldRenderPass center; @@ -26,11 +30,10 @@ public class WorldRenderPass implements AutoCloseable { public WorldRenderPass(VRTextureTarget target) throws IOException { this.target = target; - if (Minecraft.useShaderTransparency()) { - this.transparencyChain = createPostChain(new ResourceLocation("shaders/post/vrtransparency.json"), this.target); - } else { - this.transparencyChain = null; - } + this.transparencyChain = (useShaderTransparency() ? + createPostChain(new ResourceLocation("shaders/post/vrtransparency.json"), this.target) : + null + ); this.outlineChain = createPostChain(new ResourceLocation("shaders/post/entity_outline.json"), this.target); } @@ -41,7 +44,7 @@ private static PostChain createPostChain(ResourceLocation resourceLocation, Rend } public void resize(int width, int height) { - target.resize(width, height, Minecraft.ON_OSX); + target.resize(width, height, ON_OSX); outlineChain.resize(width, height); if (transparencyChain != null) { transparencyChain.resize(width, height); diff --git a/common/src/main/java/org/vivecraft/common/APIImpl.java b/common/src/main/java/org/vivecraft/common/APIImpl.java index ac634ec67..4b751fed8 100644 --- a/common/src/main/java/org/vivecraft/common/APIImpl.java +++ b/common/src/main/java/org/vivecraft/common/APIImpl.java @@ -1,11 +1,12 @@ package org.vivecraft.common; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; import org.vivecraft.api_beta.VivecraftAPI; import org.vivecraft.client.VRPlayersClient; import org.vivecraft.server.ServerVRPlayers; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; + public final class APIImpl implements VivecraftAPI { public static final APIImpl INSTANCE = new APIImpl(); diff --git a/common/src/main/java/org/vivecraft/common/VRServerPerms.java b/common/src/main/java/org/vivecraft/common/VRServerPerms.java index 4e766a682..3c4648a0f 100644 --- a/common/src/main/java/org/vivecraft/common/VRServerPerms.java +++ b/common/src/main/java/org/vivecraft/common/VRServerPerms.java @@ -1,19 +1,17 @@ package org.vivecraft.common; -import org.vivecraft.client_vr.ClientDataHolderVR; +import static org.vivecraft.client_vr.VRState.dh; public class VRServerPerms { - public static VRServerPerms INSTANCE = new VRServerPerms(); + public static boolean noTeleportClient = true; - public boolean noTeleportClient = true; - - public void setTeleportSupported(boolean supported) + public static void setTeleportSupported(boolean supported) { - this.noTeleportClient = !supported; + noTeleportClient = !supported; - if (ClientDataHolderVR.getInstance().vrPlayer != null) { - ClientDataHolderVR.getInstance().vrPlayer.updateTeleportKeys(); + if (dh.vrPlayer != null) { + dh.vrPlayer.updateTeleportKeys(); } } } diff --git a/common/src/main/java/org/vivecraft/common/network/CommonNetworkHelper.java b/common/src/main/java/org/vivecraft/common/network/CommonNetworkHelper.java index ccbd20616..33190f282 100644 --- a/common/src/main/java/org/vivecraft/common/network/CommonNetworkHelper.java +++ b/common/src/main/java/org/vivecraft/common/network/CommonNetworkHelper.java @@ -1,9 +1,10 @@ package org.vivecraft.common.network; +import org.joml.Quaternionf; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.utils.math.Quaternion; public class CommonNetworkHelper { @@ -42,18 +43,18 @@ public static void serializeF(FriendlyByteBuf buffer, Vec3 vec3) { buffer.writeFloat((float) vec3.z); } - public static void serialize(FriendlyByteBuf buffer, Quaternion quat) { - buffer.writeFloat(quat.w); + public static void serialize(FriendlyByteBuf buffer, Quaternionf quat) { buffer.writeFloat(quat.x); buffer.writeFloat(quat.y); buffer.writeFloat(quat.z); + buffer.writeFloat(quat.w); } public static Vec3 deserializeFVec3(FriendlyByteBuf buffer) { return new Vec3(buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } - public static Quaternion deserializeVivecraftQuaternion(FriendlyByteBuf buffer) { - return new Quaternion(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); + public static Quaternionf deserializeVivecraftQuaternion(FriendlyByteBuf buffer) { + return new Quaternionf(buffer.readFloat(), buffer.readFloat(), buffer.readFloat(), buffer.readFloat()); } } diff --git a/common/src/main/java/org/vivecraft/common/network/Pose.java b/common/src/main/java/org/vivecraft/common/network/Pose.java index 5b652f71e..770c25844 100644 --- a/common/src/main/java/org/vivecraft/common/network/Pose.java +++ b/common/src/main/java/org/vivecraft/common/network/Pose.java @@ -1,10 +1,11 @@ package org.vivecraft.common.network; +import org.joml.Quaternionf; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.utils.math.Quaternion; -public record Pose(Vec3 position, Quaternion orientation) { +public record Pose(Vec3 position, Quaternionf orientation) { public static Pose deserialize(FriendlyByteBuf byteBuf) { return new Pose(CommonNetworkHelper.deserializeFVec3(byteBuf), CommonNetworkHelper.deserializeVivecraftQuaternion(byteBuf)); diff --git a/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java b/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java new file mode 100644 index 000000000..83f6a591a --- /dev/null +++ b/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java @@ -0,0 +1,51 @@ +package org.vivecraft.common.network; + +import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.vivecraft.client_vr.render.RenderPass; + +import org.joml.Quaternionf; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +public record VRPlayerState(boolean seated, Pose hmd, boolean reverseHands, Pose controller0, boolean reverseHands1legacy, Pose controller1) { + + public static VRPlayerState create(VRPlayer vrPlayer) { + return new VRPlayerState( + dh.vrSettings.seated, + hmdPose(vrPlayer), + dh.vrSettings.reverseHands, + controllerPose(vrPlayer, 0), + dh.vrSettings.reverseHands, + controllerPose(vrPlayer, 1) + ); + } + + private static Pose hmdPose(VRPlayer vrPlayer) { + Vec3 vec3 = vrPlayer.vrdata_world_post.getEye(RenderPass.CENTER).getPosition().subtract(mc.player.position()); + Quaternionf quaternion = new Quaternionf().setFromNormalized(vrPlayer.vrdata_world_post.hmd.getMatrix()); + return new Pose(vec3, quaternion); + } + + private static Pose controllerPose(VRPlayer vrPlayer, int i) { + Vec3 position = vrPlayer.vrdata_world_post.getController(i).getPosition().subtract(mc.player.position()); + Quaternionf orientation = new Quaternionf().setFromNormalized(vrPlayer.vrdata_world_post.getController(i).getMatrix()); + return new Pose(position, orientation); + } + + public static VRPlayerState deserialize(FriendlyByteBuf byteBuf) { + return new VRPlayerState(byteBuf.readBoolean(), Pose.deserialize(byteBuf), byteBuf.readBoolean(), Pose.deserialize(byteBuf), byteBuf.readBoolean(), Pose.deserialize(byteBuf)); + } + + public void serialize(FriendlyByteBuf buffer) { + buffer.writeBoolean(this.seated); + this.hmd.serialize(buffer); + buffer.writeBoolean(this.reverseHands); + this.controller0.serialize(buffer); + buffer.writeBoolean(this.reverseHands); + this.controller1.serialize(buffer); + } +} diff --git a/common/src/main/java/org/vivecraft/common/network/VrPlayerState.java b/common/src/main/java/org/vivecraft/common/network/VrPlayerState.java deleted file mode 100644 index 4129bb997..000000000 --- a/common/src/main/java/org/vivecraft/common/network/VrPlayerState.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.vivecraft.common.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.common.utils.lwjgl.Matrix4f; -import org.vivecraft.common.utils.math.Quaternion; - -import java.nio.Buffer; -import java.nio.FloatBuffer; - -public record VrPlayerState(boolean seated, Pose hmd, boolean reverseHands, Pose controller0, boolean reverseHands1legacy, Pose controller1) { - - public static VrPlayerState create(VRPlayer vrPlayer) { - return new VrPlayerState( - ClientDataHolderVR.getInstance().vrSettings.seated, - hmdPose(vrPlayer), - ClientDataHolderVR.getInstance().vrSettings.reverseHands, - controllerPose(vrPlayer, 0), - ClientDataHolderVR.getInstance().vrSettings.reverseHands, - controllerPose(vrPlayer, 1) - ); - } - - private static Pose hmdPose(VRPlayer vrPlayer) { - FloatBuffer floatbuffer = vrPlayer.vrdata_world_post.hmd.getMatrix().toFloatBuffer(); - ((Buffer) floatbuffer).rewind(); - Matrix4f matrix4f = new Matrix4f(); - matrix4f.load(floatbuffer); - Vec3 vec3 = vrPlayer.vrdata_world_post.getEye(RenderPass.CENTER).getPosition().subtract(Minecraft.getInstance().player.position()); - Quaternion quaternion = new Quaternion(matrix4f); - return new Pose(vec3, quaternion); - } - - private static Pose controllerPose(VRPlayer vrPlayer, int i) { - Vec3 position = vrPlayer.vrdata_world_post.getController(i).getPosition().subtract(Minecraft.getInstance().player.position()); - FloatBuffer floatbuffer1 = vrPlayer.vrdata_world_post.getController(i).getMatrix().toFloatBuffer(); - ((Buffer) floatbuffer1).rewind(); - Matrix4f matrix4f1 = new Matrix4f(); - matrix4f1.load(floatbuffer1); - Quaternion orientation = new Quaternion(matrix4f1); - return new Pose(position, orientation); - } - - public static VrPlayerState deserialize(FriendlyByteBuf byteBuf) { - return new VrPlayerState(byteBuf.readBoolean(), Pose.deserialize(byteBuf), byteBuf.readBoolean(), Pose.deserialize(byteBuf), byteBuf.readBoolean(), Pose.deserialize(byteBuf)); - } - - public void serialize(FriendlyByteBuf buffer) { - buffer.writeBoolean(this.seated); - this.hmd.serialize(buffer); - buffer.writeBoolean(this.reverseHands); - this.controller0.serialize(buffer); - buffer.writeBoolean(this.reverseHands); - this.controller1.serialize(buffer); - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/Utils.java b/common/src/main/java/org/vivecraft/common/utils/Utils.java index 1e2f0533b..f3a7115c2 100644 --- a/common/src/main/java/org/vivecraft/common/utils/Utils.java +++ b/common/src/main/java/org/vivecraft/common/utils/Utils.java @@ -1,6 +1,11 @@ package org.vivecraft.common.utils; -import net.minecraft.util.Mth; +import org.vivecraft.common.utils.color.Color; + +import org.joml.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.SnowGolem; @@ -9,10 +14,177 @@ import net.minecraft.world.entity.monster.piglin.AbstractPiglin; import net.minecraft.world.entity.npc.AbstractVillager; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.ClipContext; +import net.minecraft.world.level.ClipContext.Block; +import net.minecraft.world.level.ClipContext.Fluid; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.HitResult.Type; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; + +import static org.joml.Math.*; + +@ParametersAreNonnullByDefault public class Utils { + + private static final Vector3dc dforward = new Vector3d(0.0F, 0.0F, -1.0F); + public static final Vector3fc forward = new Vector3f(0.0F, 0.0F, -1.0F); + private static final Vector3dc dbackward = new Vector3d(0.0F, 0.0F, 1.0F); + public static final Vector3fc backward = new Vector3f(0.0F, 0.0F, 1.0F); + private static final Vector3dc ddown = new Vector3d(0.0F, -1.0F, 0.0F); + public static final Vector3fc down = new Vector3f(0.0F, -1.0F, 0.0F); + private static final Vector3dc dup = new Vector3d(0.0F, 1.0F, 0.0F); + public static final Vector3fc up = new Vector3f(0.0F, 1.0F, 0.0F); + private static final Vector3dc dleft = new Vector3d(-1.0F, 0.0F, 0.0F); + public static final Vector3fc left = new Vector3f(-1.0F, 0.0F, 0.0F); + private static final Vector3dc dright = new Vector3d(1.0F, 0.0F, 0.0F); + public static final Vector3fc right = new Vector3f(1.0F, 0.0F, 0.0F); + public static Vector3dc forward() { return dforward; } + public static Vector3dc backward() { return dbackward; } + public static Vector3dc up() { return dup; } + public static Vector3dc down() { return ddown; } + public static Vector3dc right() { return dright; } + public static Vector3dc left() { return dleft; } -public class Utils { + /** + * Convert a {@link net.minecraft.world.phys.Vec3} to a {@link Color}. + *
+ * This function is helpful for handling Optifine methods. + * @apiNote Avoid this function whenever reasonably possible. + * @see Color + * @param vector the vector to convert. + * @param dest the {@link Color} to save to. + * @return the {@code dest} {@link Color} containing the x, y, and z components of {@code vector} cast to floats. + */ + public static Color convertToColor(@Nullable net.minecraft.world.phys.Vec3 vector, Color dest) + { + return vector != null ? dest.set((float) vector.x, (float) vector.y, (float) vector.z) : null; + } + + /** + * Convert a {@link Color} to a {@link net.minecraft.world.phys.Vec3}. + * This function is helpful for handling Optfine methods. + * @apiNote Use this function whenever reasonably possible. + *
+ * {@link net.minecraft.world.phys.Vec3} is superseded by {@link Vector3d} in any color context. + * @see Color + * @param color the color to convert. + * @return a new {@link net.minecraft.world.phys.Vec3} whose x, y, and z components are equal to the {@link Color#r}, {@link Color#g}, and {@link Color#b} components of {@code color}. + */ + public static net.minecraft.world.phys.Vec3 convertToVec3(Color color) + { + return new net.minecraft.world.phys.Vec3(color.getR(), color.getG(), color.getB()); + } + + /** + * Convert a {@link net.minecraft.world.phys.Vec3} to a {@link Vector3d}. + * @apiNote Use this function whenever reasonably possible. + *
+ * {@link net.minecraft.world.phys.Vec3} is superseded by {@link Vector3d} in any math context. + * @see Utils#convertToVec3(Vector3dc) + * @param vector the vector to copy. + * @return a new Vector3d containing the same x, y, and z components of vector. + */ + public static Vector3d convertToVector3d(@Nullable net.minecraft.world.phys.Vec3 vector, @Nonnull Vector3d dest) + { + return vector != null ? dest.set(vector.x, vector.y, vector.z) : dest; + } + + /** + * Convert a {@link net.minecraft.world.phys.Vec3} to a {@link Vector3f}. + * @apiNote Use this function whenever reasonably possible. + *
+ * @see Utils#convertToVec3(Vector3fc) + * @param vector the vector to copy. + * @return a new Vector3f containing the same x, y, and z components of vector. + */ + public static Vector3f convertToVector3f(net.minecraft.world.phys.Vec3 vector) + { + return new Vector3f((float)vector.x, (float)vector.y, (float)vector.z); + } + + /** + * Convert a JOML {@link Vector3d} to a {@link net.minecraft.world.phys.Vec3}. + * @apiNote Avoid this function whenever reasonably possible. + *
+ * If there is an x, y, z signature alternative, + *
+ * instead save {@code vector} and use its {@link Vector3d#x}, {@link Vector3d#y}, and {@link Vector3d#z} directly. + * @see Utils#convertToVector3d(net.minecraft.world.phys.Vec3, Vector3d) + * @param vector the vector to copy. + * @return a new Vec3 containing the same x, y, and z components of vector. + */ + public static net.minecraft.world.phys.Vec3 convertToVec3(Vector3dc vector) + { + return new net.minecraft.world.phys.Vec3(vector.x(), vector.y(), vector.z()); + } + + /** + * Convert a JOML {@link Vector3f} to a {@link net.minecraft.world.phys.Vec3}. + * @apiNote Avoid this function whenever reasonably possible. + *
+ * If there is an x, y, z signature alternative, + *
+ * instead save {@code vector} and use its {@link Vector3f#x}, {@link Vector3f#y}, and {@link Vector3f#z} directly. + * @see Utils#convertToVector3d(net.minecraft.world.phys.Vec3, Vector3d) + * @param vector the vector to copy. + * @return a new Vec3 containing the same x, y, and z components of vector. + */ + public static net.minecraft.world.phys.Vec3 convertToVec3(Vector3fc vector) + { + return new net.minecraft.world.phys.Vec3(vector.x(), vector.y(), vector.z()); + } + + /** + * Convert a row-major 3x4 matrix, like {@link org.lwjgl.openvr.HmdMatrix34}, to a column-major 4x4 matrix. + * This function is required for org.lwjgl.openvr compatibility, + * as JOML will only read-in values using column-major layout, whereas + * {@link org.lwjgl.openvr} uses row-major layout. + * @see Utils#convertRM34ToCM44(DoubleBuffer, Matrix4d) + */ + public static Matrix4f convertRM34ToCM44(FloatBuffer floatBuffer, Matrix4f dest) + { + return dest.set( + floatBuffer.get(0), floatBuffer.get(4), floatBuffer.get(8), 0.0F, + floatBuffer.get(1), floatBuffer.get(5), floatBuffer.get(9), 0.0F, + floatBuffer.get(2), floatBuffer.get(6), floatBuffer.get(10), 0.0F, + floatBuffer.get(3), floatBuffer.get(7), floatBuffer.get(11), 1.0F + ); + } + + /** + * Convert a row-major 3x4 matrix, like {@link org.lwjgl.openvr.HmdMatrix34}, to a column-major 4x4 matrix. + * This function is required for org.lwjgl.openvr compatibility, + * as JOML will only read-in values using column-major layout, whereas + * {@link org.lwjgl.openvr} uses row-major layout. + * @see Utils#convertRM34ToCM44(FloatBuffer, Matrix4d) + */ + public static Matrix4d convertRM34ToCM44(FloatBuffer floatBuffer, Matrix4d dest) + { + return dest.set( + floatBuffer.get(0), floatBuffer.get(4), floatBuffer.get(8), 0.0F, + floatBuffer.get(1), floatBuffer.get(5), floatBuffer.get(9), 0.0F, + floatBuffer.get(2), floatBuffer.get(6), floatBuffer.get(10), 0.0F, + floatBuffer.get(3), floatBuffer.get(7), floatBuffer.get(11), 1.0F + ); + } + + /** + * Convert a row-major 3x4 matrix to a column-major 4x4 matrix. + * @see Utils#convertRM34ToCM44(FloatBuffer, Matrix4f) + */ + public static Matrix4d convertRM34ToCM44(DoubleBuffer doubleBuffer, Matrix4d dest) + { + return dest.set( + doubleBuffer.get(0), doubleBuffer.get(4), doubleBuffer.get(8), 0.0F, + doubleBuffer.get(1), doubleBuffer.get(5), doubleBuffer.get(9), 0.0F, + doubleBuffer.get(2), doubleBuffer.get(6), doubleBuffer.get(10), 0.0F, + doubleBuffer.get(3), doubleBuffer.get(7), doubleBuffer.get(11), 1.0F + ); + } public static AABB getEntityHeadHitbox(Entity entity, double inflate) { if ((entity instanceof Player player && !player.isSwimming()) || // swimming players hitbox is just a box around their butt @@ -27,32 +199,92 @@ public static AABB getEntityHeadHitbox(Entity entity, double inflate) { entity instanceof AbstractVillager || entity instanceof SnowGolem || entity instanceof Vex || - entity instanceof Strider){ - - Vec3 headpos = entity.getEyePosition(); + entity instanceof Strider + ) + { + Vector3d headpos = convertToVector3d(entity.getEyePosition(), new Vector3d()); double headsize = entity.getBbWidth()*0.5; if (((LivingEntity) entity).isBaby()) { // babies have big heads headsize *= 1.20; } - return new AABB(headpos.subtract(headsize,headsize-inflate,headsize), headpos.add(headsize,headsize+inflate,headsize)).inflate(inflate); + Vector3d minHead = headpos.sub(headsize, headsize-inflate, headsize, new Vector3d()); + Vector3d maxHead = headpos.add(headsize, headsize+inflate, headsize, new Vector3d()); - } else if (!(entity instanceof EnderDragon) // no ender dragon, the code doesn't work for it - && entity instanceof LivingEntity livingEntity){ + return new AABB( + minHead.x, minHead.y, minHead.z, + maxHead.x, maxHead.y, maxHead.z + ).inflate(inflate); - float yrot = -(livingEntity.yBodyRot) * 0.017453292F; + } + // ender dragon head hitbox is unsuppported since the code doesn't work for it + else if (!(entity instanceof EnderDragon) && entity instanceof LivingEntity livingEntity) + { + float yRot = toRadians(-livingEntity.yBodyRot); // offset head in entity rotation - Vec3 headpos = entity.getEyePosition() - .add(new Vec3(Mth.sin(yrot), 0, Mth.cos(yrot)) - .scale(livingEntity.getBbWidth()*0.5F)); - - double headsize = livingEntity.getBbWidth()*0.25; - if (livingEntity.isBaby()) { + Vector3d headpos = (convertToVector3d(entity.getEyePosition(), new Vector3d()) + .add(sin(yRot), 0.0D, cos(yRot)) + .mul(livingEntity.getBbWidth() * 0.5D) + ); + double headsize = livingEntity.getBbWidth() * 0.25D; + if (livingEntity.isBaby()) + { // babies have big heads - headsize *= 1.5; + headsize *= 1.5D; } - return new AABB(headpos.subtract(headsize,headsize,headsize), headpos.add(headsize,headsize,headsize)).inflate(inflate*0.25).expandTowards(headpos.subtract(entity.position()).scale(inflate)); + Vector3d minHead = headpos.sub(headsize, headsize, headsize, new Vector3d()); + Vector3d maxHead = headpos.add(headsize, headsize, headsize, new Vector3d()); + + return ( + new AABB( + minHead.x, minHead.y, minHead.z, + maxHead.x, maxHead.y, maxHead.z + ) + .inflate(inflate*0.25D) + .expandTowards(convertToVec3(headpos.sub(convertToVector3d(entity.position(), new Vector3d())).mul(inflate))) + ); } return null; } + + public static boolean canEntityBeSeen(Entity entity, Vector3dc playerEyePos) { + return entity.level().clip( + new ClipContext(convertToVec3(playerEyePos), entity.getEyePosition(), Block.COLLIDER, Fluid.NONE, entity) + ).getType() == Type.MISS; + } + + /** + * Vivecraft's logger for printing to console. + */ + public static final Logger logger = LoggerFactory.getLogger("Vivecraft"); + + public static void printStackIfContainsClass(String className) + { + StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace(); + boolean flag = false; + + for (StackTraceElement stacktraceelement : astacktraceelement) + { + if (stacktraceelement.getClassName().equals(className)) + { + flag = true; + break; + } + } + + if (flag) + { + Thread.dumpStack(); + } + } + + public static long microTime() + { + return System.nanoTime() / 1000L; + } + + public static long milliTime() + { + return System.nanoTime() / 1000000L; + } } diff --git a/common/src/main/java/org/vivecraft/common/utils/color/Color.java b/common/src/main/java/org/vivecraft/common/utils/color/Color.java new file mode 100644 index 000000000..6ceb88471 --- /dev/null +++ b/common/src/main/java/org/vivecraft/common/utils/color/Color.java @@ -0,0 +1,1099 @@ +package org.vivecraft.common.utils.color; + +import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Objects; + +import static org.joml.Math.*; + +// TODO: further classes +// ColorB (byte accurate), +// ColorI (integer accurate), +// ColorL (long accurate), +// ColorF (float accurate), +// ColorD (double accurate), +// ColorA (Big/arbitrarily accurate), +// ColorS (static/super accurate) +// to indicate the programmer's desired accuracy. +// TODO: cache conversions +// TODO: color space conformity + +/** + *

+ * This {@link Color} class uses four {@code byte} values to express an RGBA (Red, Green, Blue, Alpha/Opacity) color. + *
+ * However, {@code byte}, {@code int}, and {@code float} are all signed values. + *
+ * To map RGBA color channels effectively to each primitive's range some definitions must be outlined. + *

+ *

+ * Definitions: + *

+ *     color {@code byte}: {@link Byte#MIN_VALUE} to {@link Byte#MAX_VALUE} | {@code (byte) -128} to {@code (byte) 127} | {@code (byte) 0x80} to {@code (byte) 0x7F} | {@code (byte) 0b10000000} to {@code (byte) 0b01111111}
+ *     color {@code int}: {@code 0} to {@code 255} | {@code 0x00} to {@code 0xFF}
+ *     color {@code float}: {@code 0} to {@code 1} | {@code 0.0F} to {@code 1.0F}
+ *     halves:
+ *         {@code byte}: {@code (byte) -1 | (byte) 0xFF}
+ *         {@code int}: {@code 127} | {@code 0x7F} | {@code 0b01111111}
+ *         {@code float}: {@code 0.5F}
+ * 
+ *

+ *

+ * It is strongly recommended to use the {@code byte} expression of RGBA channels when constructing and/or statically assigning. + *
+ * Using a {@code (byte)} explicitly in your constructors allows the code to express the exact value intended for each channel without ambiguity. + *
+ * However, other operations may be easier to understand when implemented using percent {@code float} scaling or literal {@code int} math. + *
+ * Especially when importing and exporting results to and from packages which may only handle non-{@code byte} primatives, using the complex constructors and methods is reasonable. + *
+ * Similarly, values from color pickers often provide positive decimal integer and unsigned hexadecimal expressions of RGB( rarely A ). + *
+ * Remember, the java {@code byte} uses signed notation. + *
+ * To write a signed {@code byte} using the color provided from an unsigned color picker, do the following: + *

    + *
  • + * Subtract {@code 128} from each of its decimal channels {@code ||} Subtract {@code 0x80} from each of its hexadecimal channels + *
      + *
    • + * Note: This applies to all of {@link Color#r}, {@link Color#g}, {@link Color#b}, and {@link Color#a}. + *
    • + *
    + *
  • + *
  • + * Use the result of those subtractions as the inputs to any of this Class' {@code byte} constructors. + *
  • + *
+ *

+ *

+ * Ex. + *

+ *     {@code
+ *     // int constructors
+ *     Color cyan_from_positive_decimal_int = new Color(0, 255, 255);
+ *     Color cyan_from_hexadecimal_int = new Color(0x00, 0xFF, 0xFF);
+ *     // byte constructors
+ *     Color cyan_from_signed_decimal_byte = new Color((byte) -128, (byte) 127, (byte) 127);
+ *     Color cyan_from_hexadecimal_byte = new Color((byte) 0x80, (byte) 0x7F, (byte) 0x7F);
+ *     Color cyan_from_Byte_statics = new Color(Byte.MIN_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE);
+ *     // int constructors
+ *     Color magenta_from_positive_decimal_int = new Color(255, 0, 255);
+ *     Color magenta_from_hexadecimal_int = new Color(0xFF, 0x00, 0xFF);
+ *     // byte constructors
+ *     Color magenta_from_signed_decimal_byte = new Color((byte) 127, (byte) -128, (byte) 127);
+ *     Color magenta_from_hexadecimal_byte = new Color((byte) 0x7F, (byte) 0x80, (byte) 0x7F);
+ *     Color magenta_from_Byte_statics = new Color(Byte.MAX_VALUE, Byte.MIN_VALUE, Byte.MAX_VALUE);
+ *     System.out.printf(
+ *         "Cyan Color Equality: %b\n",
+ *         cyan_from_decimal_int == cyan_from_hexadecimal_int == cyan_from_decimal_byte == cyan_from_hexadecimal_byte == cyan_from_Byte_statics
+ *     );
+ *     System.out.println(
+ *         "Magenta Color Equality: %b",
+ *         magenta_from_decimal_int == magenta_from_hexadecimal_int == magenta_from_decimal_byte == magenta_from_hexadecimal_byte == magenta_from_Byte_statics
+ *     );}
+ * Cyan Color Equality: true
+ * Magenta Color Equality: true
+ * 
+ *

+ * @implNote + * This class' conversions favor the simplest methods. + *
+ * Floating point conversion is not exactly accurate with this class. + *
+ * This intentionally incurred lack of precision is due to only using 256 values for each channel at the {@code int} and {@code byte} level. + *
+ * Ex. + *
+ * input: 0.785
+ * toInt: 200
+ * toByte: 0x48
+ * back toInt: 200
+ * back toFloat: 0.784314
+ * 
+ * @apiNote + * This class intentionally shadows {@link java.awt.Color} to prevent it from being used. + *
+ * Using {@link java.awt.Color} or any of {@link java.awt}, may crash {@link org.lwjgl} on MacOS. + */ +@ParametersAreNonnullByDefault +public class Color +{ + /** + * The red channel as a color {@code byte}. + * @see Color + */ + public byte r = Byte.MAX_VALUE; + + /** + * The green channel as a color {@code byte}. + * @see Color + */ + public byte g = Byte.MAX_VALUE; + + /** + * The blue channel as a color {@code byte}. + * @see Color + */ + public byte b = Byte.MAX_VALUE; + + /** + * The alpha channel as a color {@code byte}. + * @see Color + */ + public byte a = Byte.MAX_VALUE; + + /** + * A Color containing {@link Byte#MAX_VALUE} in {@link Color#r}, {@link Color#g}, {@link Color#b}, and {@link Color#a}. + */ + public static final Color WHITE = new Color(); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r}, {@link Color#g}, and {@link Color#b} and {@link Byte#MAX_VALUE} in {@link Color#a}. + */ + public static final Color BLACK = new Color(Byte.MIN_VALUE, Byte.MAX_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r}, {@link Color#g}, {@link Color#b}, and {@link Color#a}. + *
+ * Alias for transparent black. + */ + public static final Color OFF = new Color(Byte.MIN_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#g}, and {@link Color#b} and {@link Byte#MAX_VALUE} in {@link Color#r}, and {@link Color#a}. + */ + public static final Color RED = new Color(Byte.MAX_VALUE, Byte.MIN_VALUE, Byte.MIN_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r}, and {@link Color#b} and {@link Byte#MAX_VALUE} in {@link Color#g}, and {@link Color#a}. + */ + public static final Color GREEN = new Color(Byte.MIN_VALUE, Byte.MAX_VALUE, Byte.MIN_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r}, and {@link Color#g} and {@link Byte#MAX_VALUE} in {@link Color#b}, and {@link Color#a}. + */ + public static final Color BLUE = new Color(Byte.MIN_VALUE, Byte.MIN_VALUE, Byte.MAX_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r}, and {@link Color#g} and {@link Byte#MAX_VALUE} in {@link Color#b}, and {@link Color#a}. + */ + public static final Color YELLOW = new Color(Byte.MAX_VALUE, Byte.MAX_VALUE, Byte.MIN_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#r} and {@link Byte#MAX_VALUE} in {@link Color#g}, {@link Color#b}, and {@link Color#a}. + */ + public static final Color CYAN = new Color(Byte.MIN_VALUE, Byte.MAX_VALUE, Byte.MAX_VALUE); + + /** + * A Color containing {@link Byte#MIN_VALUE} in {@link Color#g} and {@link Byte#MAX_VALUE} in {@link Color#r}, {@link Color#b}, and {@link Color#a}. + */ + public static final Color MAGENTA = new Color(Byte.MAX_VALUE, Byte.MIN_VALUE, Byte.MAX_VALUE); + + /** + * Construct an opaque white {@link Color}. + *
+ * All channels default to {@link Byte#MAX_VALUE}. + */ + public Color(){} + + /** + * Constructs a new Color with the same channel values as {@code color}. + * @param color the Color to copy. + */ + public Color(Color color) { + this.set(color); + } + + /** + * Construct a new {@link Color} with the same color channel values as {@code color} + * @param color the {@link Color} to copy. + * @param alpha the byte to assign {@link Color#a} to. + */ + public Color(Color color, byte alpha) + { + this.set(color, alpha); + } + + /** + * Construct a new {@link Color} with the same color channel values as {@code color} + * @param color the {@link Color} to copy. + * @param alpha the integer value to convert and assign {@link Color#a} to. + */ + public Color(Color color, int alpha) + { + this.set(color, alpha); + } + + /** + * Construct a new {@link Color} with the same color channel values as {@code color} + * @param color the {@link Color} to copy. + * @param alpha the percent to convert and assign {@link Color#a} to. + */ + public Color(Color color, float alpha) + { + this.set(color, alpha); + } + + /** + * Construct a new Color by converting distinct integer values for each channel. + * @param red the integer value to assign {@link Color#r} to. + * @param green the integer value to assign {@link Color#g} to. + * @param blue the integer value to assign {@link Color#b} to. + * @param alpha the integer value to assign {@link Color#a} to. + */ + public Color(int red, int green, int blue, int alpha){ + this.set(red, green, blue, alpha); + } + + /** + * Construct a new Color by converting distinct integer values for each color channel. + * @param red the integer value to assign {@link Color#r} to. + * @param green the integer value to assign {@link Color#g} to. + * @param blue the integer value to assign {@link Color#b} to. + */ + public Color(int red, int green, int blue) + { + this.set(red, green, blue); + } + + /** + * Construct a new Color by converting an integer to reuse for all color channels, and a distinct integer value for {@code alpha}. + * @param rgb the integer value to convert and assign {@link Color#r}, {@link Color#g}, and {@link Color#b} to. + * @param alpha the integer value to convert and assign {@link Color#a} to. + */ + public Color(int rgb, int alpha) + { + this.set(rgb, alpha); + } + + /** + * Construct a new Color by converting a distinct percent {@code float} for each channel. + * @param red the percent value to convert and assign {@link Color#r} to. + * @param green the percent value to convert and assign {@link Color#g} to. + * @param blue the percent value to convert and assign {@link Color#b} to. + * @param alpha the integer value to convert and assign {@link Color#a} to. + */ + public Color(float red, float green, float blue, float alpha) + { + this.set(red, green, blue, alpha); + } + + /** + * Construct a new Color by converting a distinct percent {@code float} for each color channel. + * @param red the percent value to convert and assign {@link Color#r} to. + * @param green the percent value to convert and assign {@link Color#g} to. + * @param blue the percent value to convert and assign {@link Color#b} to. + */ + public Color(float red, float green, float blue) + { + this.set(red, green, blue); + } + + /** + * Construct a Color using a distinct byte for each channel. + * @param red {@link Color#r} + * @param green {@link Color#g} + * @param blue {@link Color#b} + * @param alpha {@link Color#a} + */ + public Color(byte red, byte green, byte blue, byte alpha) + { + this.set(red, green, blue, alpha); + } + + /** + * Construct an opaque Color using a distinct byte for each color channel. + * @param red {@link Color#r} + * @param green {@link Color#g} + * @param blue {@link Color#b} + */ + public Color(byte red, byte green, byte blue) + { + this.set(red, green, blue, Byte.MAX_VALUE); + } + + /** + * Construct a new Color by reusing a single {@code byte} for all color channels, and a distinct integer value for {@code alpha}. + * @param rgb the {@code byte} to assign {@link Color#r}, {@link Color#g}, and {@link Color#b} to. + * @param alpha the {@code byte} to assign {@link Color#a} to. + */ + public Color(byte rgb, byte alpha) + { + this.set(rgb, alpha); + } + + /** + * Constructs a new Color from an argb encoded {@code int}. + *
+ *
+	 *     Ex.
+	 *         {@code Color transparent_white = new Color((byte) 0x00FFFFFF);}
+	 *         {@code Color opaque_black = new Color((byte) 0xFF000000);}
+	 *         {@code Color opaque_lime = new Color((byte) 0xFF00FF00);}
+	 * 
+ * @param color the int to decode + */ + public Color(int color) { + this.fromARGB(color); + } + + /** + * Get {@link Color#r}. + * @return {@link Color#r} + */ + public byte r() + { + return this.r; + } + + /** + * Set {@link Color#r}. + * @param red the byte to assign {@link Color#r} to. + * @return this + */ + public Color r(byte red) + { + this.r = red; + return this; + } + + /** + * Get {@link Color#r} as a decimal integer. + * @return {@link Color#r} converted to a decimal integer ({@code 0} to {@code 255}) + */ + public int R() + { + return toInt(this.r); + } + + /** + * Set {@link Color#r} by converting a decimal integer ({@code 0} to {@code 255}). + * @param red the decimal value ({@code 0} to {@code 255}) to assign {@link Color#r} to. + * @return this + */ + public Color R(int red) + { + return this.r(toByte(red)); + } + + /** + * Set {@link Color#r} by converting a percent. + * @param red the percent ({@code 0.0F} to {@code 1.0F}) to assign {@link Color#r} to. + * @return this + */ + public Color setR(float red) + { + return this.R(toInt(red)); + } + + /** + * Get {@link Color#r} as a percent. + * @return {@link Color#r} converted to a percent ({@code 0.0F} to {@code 1.0F}) + */ + public float getR() + { + return toFloat(this.r); + } + + + /** + * Get {@link Color#g}. + * @return {@link Color#g} + */ + public byte g() + { + return this.g; + } + + + /** + * Set {@link Color#g}. + * @param green the byte to assign {@link Color#g} to. + * @return this + */ + public Color g(byte green) + { + this.g = green; + return this; + } + + /** + * Get {@link Color#g} as a decimal integer. + * @return {@link Color#g} converted to a decimal integer ({@code 0} to {@code 255}) + */ + public int G() + { + return toInt(this.g); + } + + /** + * Set {@link Color#g} by converting a decimal integer ({@code 0} to {@code 255}). + * @param green the decimal value ({@code 0} to {@code 255}) to assign {@link Color#g} to. + * @return this + */ + public Color G(int green) + { + return this.g(toByte(green)); + } + + /** + * Set {@link Color#g} by converting a percent ({@code 0.0F} to {@code 1.0F}). + * @param green the percent ({@code 0.0F} to {@code 1.0F}) to assign {@link Color#g} to. + * @return this + */ + public Color setG(float green) + { + return this.G(toInt(green)); + } + + /** + * Get {@link Color#g} as a percent ({@code 0.0F} to {@code 1.0F}). + * @return {@link Color#g} converted to a percent ({@code 0.0F} to {@code 1.0F}) + */ + public float getG() + { + return toFloat(g); + } + + /** + * Get the blue channel byte. + * @return {@link Color#b} + */ + public byte b() + { + return this.b; + } + + /** + * Set {@link Color#b}. + * @param blue the byte to set {@link Color#b} to. + * @return this + */ + public Color b(byte blue) + { + this.b = blue; + return this; + } + + /** + * Set {@link Color#b} by converting a decimal ({@code 0} to {@code 255}). + * @param blue the decimal value ({@code 0} to {@code 255}) to assign {@link Color#b} to. + * @return this + */ + public Color B(int blue) + { + return this.b(toByte(blue)); + } + + /** + * Get {@link Color#b} as a decimal integer ({@code 0} to {@code 255}). + * @return {@link Color#b} converted to a decimal integer ({@code 0} to {@code 255}) + */ + public int B() + { + return toInt(this.b); + } + + /** + * Set {@link Color#b} by converting a percent ({@code 0.0F} to {@code 1.0F}). + * @param blue the percent ({@code 0.0F} to {@code 1.0F}) to assign {@link Color#b} to. + * @return this + */ + public Color setB(float blue) + { + return this.B(toInt(blue)); + } + + /** + * Get {@link Color#b} as a percent ({@code 0.0F} to {@code 1.0F}). + * @return {@link Color#b} converted to a percent ({@code 0.0F} to {@code 1.0F}) + */ + public float getB() + { + return toFloat(b); + } + + /** + * Get {@link Color#a}. + * @return {@link Color#a} + */ + public byte a() + { + return this.a; + } + + /** + * + * @param alpha the byte to assign {@link Color#a} to. + * @return this + */ + public Color a(byte alpha) + { + this.a = alpha; + return this; + } + + /** + * Get {@link Color#a} as a decimal integer ({@code 0} to {@code 255}). + * @return {@link Color#a} converted to a decimal integer ({@code 0} to {@code 255}) + */ + public int A() + { + return toInt(this.a); + } + + /** + * Set {@link Color#a} by converting a decimal ({@code 0} to {@code 255}). + * @param alpha the decimal value ({@code 0} to {@code 255}) to assign {@link Color#a} to. + * @return this + */ + public Color A(int alpha) + { + return this.a(toByte(alpha)); + } + + /** + * Set {@link Color#a} by converting a percent ({@code 0.0F} to {@code 1.0F}). + * @param alpha the percent ({@code 0.0F} to {@code 1.0F}) to assign {@link Color#a} to. + * @return this + */ + public Color setA(float alpha) + { + return this.A(toInt(alpha)); + } + + /** + * Get {@link Color#a} as a percent ({@code 0.0F} to {@code 1.0F}). + * @return {@link Color#a} converted to a percent ({@code 0.0F} to {@code 1.0F}). + */ + public float getA() + { + return toFloat(a); + } + + /** + * Set all channels of this {@link Color} to the same {@code byte} values as {@code color}. + * @param color the {@link Color} to copy. + * @return this + */ + public Color set(Color color){ + return this.set(color.r(), color.g(), color.b(), color.a()); + } + + /** + * Set all the color channels of {@code this} {@link Color} to the same byte values as {@code color}, and {@link Color#a} to {@code alpha}. + * @param color the {@link Color} to copy. + * @param alpha the byte to assign {@link Color#a} to. + * @return this + */ + public Color set(Color color, byte alpha){ + return this.set(color.r, color.g, color.b, alpha); + } + + /** + * Set all the color channels of {@code this} {@link Color} to the same byte values as {@code color}, and {@link Color#a} to {@code alpha}. + * @param color the {@link Color} to copy. + * @param alpha the integer value to assign {@link Color#a} to. + * @return this + */ + public Color set(Color color, int alpha){ + return this.set(color.r, color.g, color.b, alpha); + } + + /** + * Set all the color channels of {@code this} {@link Color} to the same byte values as {@code color}, and {@link Color#a} to {@code alpha}. + * @param color the {@link Color} to copy. + * @param alpha the byte to assign {@link Color#a} to. + * @return this + */ + public Color set(Color color, float alpha){ + return this.set(color.r, color.g, color.b, alpha); + } + + public Color set(int red, int green, int blue, int alpha) + { + this.R(red); + this.G(green); + this.B(blue); + this.A(alpha); + return this; + } + + /** + * Set all the color channels of {@code this} {@link Color} by converting distinct integer values. + * @param red the integer value to assign {@link Color#r} to. + * @param green the integer value to assign {@link Color#g} to. + * @param blue the integer value to assign {@link Color#b} to. + * @return this + */ + public Color set(int red, int green, int blue) + { + this.R(red); + this.G(green); + this.B(blue); + return this; + } + + public Color set(int rgb, int a) + { + return this.set(toByte(rgb), toByte(a)); + } + + public Color set(float red, float green, float blue, float alpha) + { + this.setR(red); + this.setG(green); + this.setB(blue); + this.setA(alpha); + return this; + } + + public Color set(float red, float green, float blue) + { + this.setR(red); + this.setG(green); + this.setB(blue); + return this; + } + + public Color set(float rgb, float alpha) + { + return this.set(toInt(rgb), toInt(alpha)); + } + + /** + * Set all the channels to distinct bytes. + * @param red r + * @param green g + * @param blue b + * @param alpha a + * @return this + */ + public Color set(byte red, byte green, byte blue, byte alpha){ + this.r(red); + this.g(green); + this.b(blue); + this.a(alpha); + return this; + } + + /** + * Set the color channels to distinct {@code byte} values. + * @param red r + * @param green g + * @param blue b + * @return this + */ + public Color set(byte red, byte green, byte blue) + { + this.r(red); + this.g(green); + this.b(blue); + return this; + } + + /** + * Set the color channels to the same {@code byte} value and alpha to a distinct byte value. + * @param rgb r, g, b + * @param alpha a + * @return this + */ + public Color set(byte rgb, byte alpha) + { + return this.set(rgb, rgb, rgb, alpha); + } + + /** + * Set all the channels to the same {@code byte} value. + * @param rgba r, g, b, a + * @return this + */ + public Color set(byte rgba) + { + return this.set(rgba, rgba, rgba, rgba); + } + + /** + * Set all the channels using an ARGB encoded int. + *
+ * Like {@code 0xAARRGGBB} + *
+ *
+	 * Ex.
+	 *     {@code
+	 *     int ARGB = 0xFFAABBCC;
+	 *     System.out.println(new Color(ARGB) == new Color((byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xFF));
+	 *     }
+	 *     true
+	 * 
+ * @see Color#toARGB + * @param color the int to decode + * @return this + */ + public Color fromARGB(int color) + { + return this.set( + (byte)(color >> 16), + (byte)(color >> 8), + (byte)color, + (byte)(color >> 24) + ); + } + + /** + * Set all the channels using a BGRA encoded int. + *
+ * Like {@code 0xBBGGRRAA} + *
+ *
+	 * Ex.
+	 *     {@code
+	 *     int ARGB = 0xFFAABBCC;
+	 *     System.out.println(new Color(BGRA) == new Color((byte) 0xBB, (byte) 0xAA, (byte) 0xFF, (byte) 0xCC));
+	 *     }
+	 *     true
+	 * 
+ * @see Color#fromRGBA + * @param color the int to decode + * @return this + */ + public Color fromBGRA(int color) + { + return this.set( + (byte)(color >> 16), + (byte)(color >> 8), + (byte)(color >> 24), + (byte)color + ); + } + + /** + * Set all the channels using an RGBA encoded int. + *
+ * Like {@code 0xRRGGBBAA} + *
+ *
+	 * Ex.
+	 *     {@code
+	 *     int RGBA = 0xAABBCCFF;
+	 *     System.out.println(new Color().fromRGBA(RGBA) == new Color((byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xFF));
+	 *     }
+	 *     true
+	 * 
+ * @see Color#fromARGB + * @param color the int to decode + * @return this + */ + public Color fromRGBA(int color) + { + return this.set( + (byte)(color >> 24), + (byte)(color >> 16), + (byte)(color >> 8), + (byte)color + ); + } + + /** + * Set all the channels using an ABGR encoded int. + *
+ * Like {@code 0xAABBGGRR} + *
+ *
+	 * Ex.
+	 *     {@code
+	 *     int ABGR = 0xFFAABBCC;
+	 *     System.out.println(new Color(ABGR) == new Color((byte) 0xCC, (byte) 0xBB, (byte) 0xAA, (byte) 0xFF));
+	 *     }
+	 *     true
+	 * 
+ * @see Color#toARGB + * @param color the int to decode + * @return this + */ + public Color fromABGR(int color) + { + return this.set( + (byte)color, + (byte)(color >> 8), + (byte)(color >> 16), + (byte)(color >> 24) + ); + } + + /** + * Encodes this color as an {@code 0xRRGGBBAA} int. + * @see Color#fromRGBA + * @return this color as an {@code 0xRRGGBBAA} int. + */ + public int toRGBA() { + return (((int)this.r) << 24) | (((int)this.g) << 16) | (((int)this.b) << 8) | ((int)this.a); + } + + /** + * Encodes this color as an {@code 0xBBGGRRAA} int. + * @see Color#fromBGRA + * @return this color as an {@code 0xBBGGRRAA} int. + */ + public int toBGRA() { + return (((int)this.b) << 24) | (((int)this.g) << 16) | (((int)this.r) << 8) | ((int)this.a); + } + + /** + * Encodes this color as an {@code 0xAARRGGBB} int. + * @see Color#fromRGBA + * @return this color as an {@code 0xAARRGGBB} int. + */ + public int toARGB() { + return (((int)this.a) << 24) | (((int)this.r) << 16) | (((int)this.g) << 8) | ((int)this.b); + } + + /** + * Encodes this color as an {@code 0xAABBGGRR} int. + * @see Color#fromABGR + * @return this color as an {@code 0xAABBGGRR} int. + */ + public int toABGR(){ + return (((int)this.a) << 24) | (((int)this.b) << 16) | (((int)this.g) << 8) | ((int)this.r); + } + + /** + * Set all the channels using HSB floats. + * @param hue + * @param saturation + * @param brightness + * @return this + */ + public Color fromHSB(float hue, float saturation, float brightness) { + byte byteness = toByte(brightness); + + if (saturation == 0.0F) { + this.r = this.g = this.b = byteness; + } else { + float f = (hue - floor(hue)) * 6.0F; + float f1 = f - floor(f); + byte f2 = toByte(brightness * (1.0F - saturation)); + byte f3 = toByte(brightness * (1.0F - saturation * f1)); + byte f4 = toByte(brightness * (1.0F - saturation * (1.0F - f1))); + + switch ((int)f) { + case 0 -> { + this.r = byteness; + this.g = f4; + this.b = f2; + } + case 1 -> { + this.r = f3; + this.g = byteness; + this.b = f2; + } + case 2 -> { + this.r = f2; + this.g = byteness; + this.b = f4; + } + case 3 -> { + this.r = f2; + this.g = f3; + this.b = byteness; + } + case 4 -> { + this.r = f4; + this.g = f2; + this.b = byteness; + } + case 5 -> { + this.r = byteness; + this.g = f2; + this.b = f3; + } + } + } + + return this; + } + + // TODO: should something else clamp for the programmer? constructors/methods? + + /** + * Convert a {@code float} containing the percent ({@code 0.0F} to {@code 1.0F}) of a channel's strength. + * @apiNote This function will NOT {@link org.joml.Math#clamp} to the valid {@code float} range. + *
+ * This color class is not a replacement to comprehensive math libraries like {@link java.lang.Math} or {@link org.joml}. + * @param percent channel strength in percent ({@code 0.0F} to {@code 1.0F}) + * @return byte representation of {@code percent} + */ + public static byte toByte(float percent) + { + return toByte(toInt(percent)); + } + + /** + * Convert an {@code int} containing the decimal ({@code 0} to {@code 255}) representation of a channel. + * @apiNote This function will NOT {@link org.joml.Math#clamp} to the valid {@code integer} range. + *
+ * This color class is not a replacement to comprehensive math libraries like {@link java.lang.Math} or {@link org.joml}. + * @param decimal channel value in decimal ({@code 0} to {@code 255}) + * @return byte representation of {@code decimal} + */ + public static byte toByte(int decimal) + { + return (byte)(decimal - 128); + } + + /** + * Convert a channel {@code byte} to a decimal {@code int} ({@code 0} to {@code 255}). + * @param channel the channel to convert to an {@code int} + * @return decimal representation {@code channel} + */ + public static int toInt(byte channel) + { + return channel + 128; + } + + /** + * Convert a percent {@code float} ({@code 0.0F}, {@code 1.0F}) to a decimal {@code int} ({@code 0}, {@code 255}). + * @apiNote This function will NOT {@link org.joml.Math#clamp} to the valid {@code percent} range. + *
+ * This color class is not a replacement to comprehensive math libraries like {@link java.lang.Math} or {@link org.joml}. + * @param percent the percent to convert to a decimal + * @return the decimal representation of percent + */ + public static int toInt(float percent) + { + return (int)(percent * 255); + } + + /** + * Convert an {@code int} ({@code 0} to {@code 255}) to a percent {@code float} ({@code 0.0F} to {@code 1.0F}). + * @apiNote This function will NOT {@link org.joml.Math#clamp} to the valid {@code integer} range. + *
+ * This color class is not a replacement to comprehensive math libraries like {@link java.lang.Math} or {@link org.joml}. + * @param integer the integer to convert to a percent {@code float} + * @return the percent representation of {@code integer} + */ + public static float toFloat(int integer) + { + return integer / 255.0F; + } + + /** + * Convert a channel {@code byte} to a percent {@code float} ({@code 0.0F} to {@code 1.0F}). + * @param channel the channel to convert to a percent {@code float} + * @return the percent representation of {@code channel} + */ + public static float toFloat(byte channel) + { + return toFloat(toInt(channel)); + } + + /** + * Test all the channels in this {@link Color} are equal to an encoded {@code int} value. + * @see Color#toARGB() + * @implNote The channels of {@code this} are combined into an integer using {@link Color#toARGB()} for the comparison. + * @param argb the encoded integer containing color channels to test against {@link Color#r}, {@link Color#g}, {@link Color#b}, and {@link Color#a} + * @return true only when {@code argb} and {@code this} have all identical channel values. + */ + public boolean equals(int argb){ + return argb == this.toARGB(); + } + + /** + * Test the color channels in this {@link Color} are equal to {@code rgb} and {@link Color#a} is equal to {@code a}. + * @param rgb the color channel to test against {@link Color#r}, {@link Color#g}, and {@link Color#b} + * @param a the color channel to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(byte rgb, byte a){ + return this.equals(rgb, rgb, rgb, a); + } + + /** + * Test all the channels in this {@link Color} are equal to the corresponding values provided. + * @param red the color channel to test against {@link Color#r} + * @param green the color channel to test against {@link Color#g} + * @param blue the color channel to test against {@link Color#b} + * @param alpha the color channel to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(byte red, byte green, byte blue, byte alpha){ + return this.r == red && this.g == green && this.b == blue && this.a == alpha; + } + + /** + * Test the color channels in this {@link Color} are equal to {@code rgb} and {@link Color#a} is equal to {@code a}. + * @param rgb the integer to test against {@link Color#r}, {@link Color#g}, {@link Color#b}, {@link Color#a} + * @param a the integer to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(int rgb, int a){ + return this.equals(toByte(rgb), toByte(a)); + } + + /** + * Test all the channels in this {@link Color} are equal to the corresponding values provided. + * @param red the integer to test against {@link Color#r} + * @param green the integer to test against {@link Color#g} + * @param blue the integer to test against {@link Color#b} + * @param alpha the integer to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(int red, int green, int blue, int alpha){ + return this.R() == red && this.G() == green && this.B() == blue && this.A() == alpha; + } + + /** + * Test the color channels in this {@link Color} are equal to {@code rgb} and {@link Color#a} is equal to {@code a}. + * @param rgb percent to test against {@link Color#r}, {@link Color#g}, {@link Color#b}, {@link Color#a} + * @param a percent to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(float rgb, float a){ + return this.equals(toInt(rgb), toInt(a)); + } + + /** + * Test all the channels in this {@link Color} are equal to the corresponding values provided. + * @param red the percent to test against {@link Color#r} + * @param green the percent to test against {@link Color#g} + * @param blue the percent to test against {@link Color#b} + * @param alpha the percent to test against {@link Color#a} + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(float red, float green, float blue, float alpha){ + return this.getR() == red && this.getG() == green && this.getB() == blue && this.getA() == alpha; + } + + /** + * Test another {@link Color} is equal to {@code this}. + * @param color the {@link Color} to test + * @return true only when {@code color} and {@code this} have all identical channel values. + */ + public boolean equals(Color color){ + return this.equals(color.r, color.g, color.b, color.a); + } + + @Override + public boolean equals(Object obj) + { + return getClass() == obj.getClass() && this.equals((Color) obj); + } + + @Override + public int hashCode() + { + return Objects.hash(r, g, b, a); + } + + /** + * Converts this {@link Color} into a string containing the hexadecimal RGB A and decimal R G B A values. + * @return string describing this {@link Color}. + */ + @Override + public String toString() + { + return String.format( + "(#%X%X%X %X | %d %d %d %d)", this.r, this.g, this.b, this.a, this.R(), this.G(), this.B(), this.A() + ); + } +} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix.java deleted file mode 100644 index a3ef0a107..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public abstract class Matrix -{ - public abstract Matrix setIdentity(); - - public abstract Matrix invert(); - - public abstract Matrix load(FloatBuffer var1); - - public abstract Matrix loadTranspose(FloatBuffer var1); - - public abstract Matrix negate(); - - public abstract Matrix store(FloatBuffer var1); - - public abstract Matrix storeTranspose(FloatBuffer var1); - - public abstract Matrix transpose(); - - public abstract Matrix setZero(); - - public abstract float determinant(); -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix2f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix2f.java deleted file mode 100644 index ce2f48832..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix2f.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Matrix2f extends Matrix -{ - public float m00; - public float m01; - public float m10; - public float m11; - - public Matrix2f() - { - this.setIdentity(); - } - - public Matrix2f(Matrix2f src) - { - this.load(src); - } - - public Matrix2f load(Matrix2f src) - { - return load(src, this); - } - - public static Matrix2f load(Matrix2f src, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - dest.m00 = src.m00; - dest.m01 = src.m01; - dest.m10 = src.m10; - dest.m11 = src.m11; - return dest; - } - - public Matrix load(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m01 = buf.get(); - this.m10 = buf.get(); - this.m11 = buf.get(); - return this; - } - - public Matrix loadTranspose(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m10 = buf.get(); - this.m01 = buf.get(); - this.m11 = buf.get(); - return this; - } - - public Matrix store(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m01); - buf.put(this.m10); - buf.put(this.m11); - return this; - } - - public Matrix storeTranspose(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m10); - buf.put(this.m01); - buf.put(this.m11); - return this; - } - - public static Matrix2f add(Matrix2f left, Matrix2f right, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - dest.m00 = left.m00 + right.m00; - dest.m01 = left.m01 + right.m01; - dest.m10 = left.m10 + right.m10; - dest.m11 = left.m11 + right.m11; - return dest; - } - - public static Matrix2f sub(Matrix2f left, Matrix2f right, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - dest.m00 = left.m00 - right.m00; - dest.m01 = left.m01 - right.m01; - dest.m10 = left.m10 - right.m10; - dest.m11 = left.m11 - right.m11; - return dest; - } - - public static Matrix2f mul(Matrix2f left, Matrix2f right, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - float f = left.m00 * right.m00 + left.m10 * right.m01; - float f1 = left.m01 * right.m00 + left.m11 * right.m01; - float f2 = left.m00 * right.m10 + left.m10 * right.m11; - float f3 = left.m01 * right.m10 + left.m11 * right.m11; - dest.m00 = f; - dest.m01 = f1; - dest.m10 = f2; - dest.m11 = f3; - return dest; - } - - public static Vector2f transform(Matrix2f left, Vector2f right, Vector2f dest) - { - if (dest == null) - { - dest = new Vector2f(); - } - - float f = left.m00 * right.x + left.m10 * right.y; - float f1 = left.m01 * right.x + left.m11 * right.y; - dest.x = f; - dest.y = f1; - return dest; - } - - public Matrix transpose() - { - return this.transpose(this); - } - - public Matrix2f transpose(Matrix2f dest) - { - return transpose(this, dest); - } - - public static Matrix2f transpose(Matrix2f src, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - float f = src.m10; - float f1 = src.m01; - dest.m01 = f; - dest.m10 = f1; - return dest; - } - - public Matrix invert() - { - return invert(this, this); - } - - public static Matrix2f invert(Matrix2f src, Matrix2f dest) - { - float f = src.determinant(); - - if (f != 0.0F) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - float f1 = 1.0F / f; - float f2 = src.m11 * f1; - float f3 = -src.m01 * f1; - float f4 = src.m00 * f1; - float f5 = -src.m10 * f1; - dest.m00 = f2; - dest.m01 = f3; - dest.m10 = f5; - dest.m11 = f4; - return dest; - } - else - { - return null; - } - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append(this.m00).append(' ').append(this.m10).append(' ').append('\n'); - stringbuilder.append(this.m01).append(' ').append(this.m11).append(' ').append('\n'); - return stringbuilder.toString(); - } - - public Matrix negate() - { - return this.negate(this); - } - - public Matrix2f negate(Matrix2f dest) - { - return negate(this, dest); - } - - public static Matrix2f negate(Matrix2f src, Matrix2f dest) - { - if (dest == null) - { - dest = new Matrix2f(); - } - - dest.m00 = -src.m00; - dest.m01 = -src.m01; - dest.m10 = -src.m10; - dest.m11 = -src.m11; - return dest; - } - - public Matrix setIdentity() - { - return setIdentity(this); - } - - public static Matrix2f setIdentity(Matrix2f src) - { - src.m00 = 1.0F; - src.m01 = 0.0F; - src.m10 = 0.0F; - src.m11 = 1.0F; - return src; - } - - public Matrix setZero() - { - return setZero(this); - } - - public static Matrix2f setZero(Matrix2f src) - { - src.m00 = 0.0F; - src.m01 = 0.0F; - src.m10 = 0.0F; - src.m11 = 0.0F; - return src; - } - - public float determinant() - { - return this.m00 * this.m11 - this.m01 * this.m10; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix3f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix3f.java deleted file mode 100644 index 6ce2ba39f..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix3f.java +++ /dev/null @@ -1,346 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Matrix3f extends Matrix -{ - public float m00; - public float m01; - public float m02; - public float m10; - public float m11; - public float m12; - public float m20; - public float m21; - public float m22; - - public Matrix3f() - { - this.setIdentity(); - } - - public Matrix3f load(Matrix3f src) - { - return load(src, this); - } - - public static Matrix3f load(Matrix3f src, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - dest.m00 = src.m00; - dest.m10 = src.m10; - dest.m20 = src.m20; - dest.m01 = src.m01; - dest.m11 = src.m11; - dest.m21 = src.m21; - dest.m02 = src.m02; - dest.m12 = src.m12; - dest.m22 = src.m22; - return dest; - } - - public Matrix load(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m01 = buf.get(); - this.m02 = buf.get(); - this.m10 = buf.get(); - this.m11 = buf.get(); - this.m12 = buf.get(); - this.m20 = buf.get(); - this.m21 = buf.get(); - this.m22 = buf.get(); - return this; - } - - public Matrix loadTranspose(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m10 = buf.get(); - this.m20 = buf.get(); - this.m01 = buf.get(); - this.m11 = buf.get(); - this.m21 = buf.get(); - this.m02 = buf.get(); - this.m12 = buf.get(); - this.m22 = buf.get(); - return this; - } - - public Matrix store(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m01); - buf.put(this.m02); - buf.put(this.m10); - buf.put(this.m11); - buf.put(this.m12); - buf.put(this.m20); - buf.put(this.m21); - buf.put(this.m22); - return this; - } - - public Matrix storeTranspose(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m10); - buf.put(this.m20); - buf.put(this.m01); - buf.put(this.m11); - buf.put(this.m21); - buf.put(this.m02); - buf.put(this.m12); - buf.put(this.m22); - return this; - } - - public static Matrix3f add(Matrix3f left, Matrix3f right, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - dest.m00 = left.m00 + right.m00; - dest.m01 = left.m01 + right.m01; - dest.m02 = left.m02 + right.m02; - dest.m10 = left.m10 + right.m10; - dest.m11 = left.m11 + right.m11; - dest.m12 = left.m12 + right.m12; - dest.m20 = left.m20 + right.m20; - dest.m21 = left.m21 + right.m21; - dest.m22 = left.m22 + right.m22; - return dest; - } - - public static Matrix3f sub(Matrix3f left, Matrix3f right, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - dest.m00 = left.m00 - right.m00; - dest.m01 = left.m01 - right.m01; - dest.m02 = left.m02 - right.m02; - dest.m10 = left.m10 - right.m10; - dest.m11 = left.m11 - right.m11; - dest.m12 = left.m12 - right.m12; - dest.m20 = left.m20 - right.m20; - dest.m21 = left.m21 - right.m21; - dest.m22 = left.m22 - right.m22; - return dest; - } - - public static Matrix3f mul(Matrix3f left, Matrix3f right, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - float f = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02; - float f1 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02; - float f2 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02; - float f3 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12; - float f4 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12; - float f5 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12; - float f6 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22; - float f7 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22; - float f8 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22; - dest.m00 = f; - dest.m01 = f1; - dest.m02 = f2; - dest.m10 = f3; - dest.m11 = f4; - dest.m12 = f5; - dest.m20 = f6; - dest.m21 = f7; - dest.m22 = f8; - return dest; - } - - public static Vector3f transform(Matrix3f left, Vector3f right, Vector3f dest) - { - if (dest == null) - { - dest = new Vector3f(); - } - - float f = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z; - float f1 = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z; - float f2 = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z; - dest.x = f; - dest.y = f1; - dest.z = f2; - return dest; - } - - public Matrix transpose() - { - return transpose(this, this); - } - - public Matrix3f transpose(Matrix3f dest) - { - return transpose(this, dest); - } - - public static Matrix3f transpose(Matrix3f src, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - float f = src.m00; - float f1 = src.m10; - float f2 = src.m20; - float f3 = src.m01; - float f4 = src.m11; - float f5 = src.m21; - float f6 = src.m02; - float f7 = src.m12; - float f8 = src.m22; - dest.m00 = f; - dest.m01 = f1; - dest.m02 = f2; - dest.m10 = f3; - dest.m11 = f4; - dest.m12 = f5; - dest.m20 = f6; - dest.m21 = f7; - dest.m22 = f8; - return dest; - } - - public float determinant() - { - return this.m00 * (this.m11 * this.m22 - this.m12 * this.m21) + this.m01 * (this.m12 * this.m20 - this.m10 * this.m22) + this.m02 * (this.m10 * this.m21 - this.m11 * this.m20); - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append(this.m00).append(' ').append(this.m10).append(' ').append(this.m20).append(' ').append('\n'); - stringbuilder.append(this.m01).append(' ').append(this.m11).append(' ').append(this.m21).append(' ').append('\n'); - stringbuilder.append(this.m02).append(' ').append(this.m12).append(' ').append(this.m22).append(' ').append('\n'); - return stringbuilder.toString(); - } - - public Matrix invert() - { - return invert(this, this); - } - - public static Matrix3f invert(Matrix3f src, Matrix3f dest) - { - float f = src.determinant(); - - if (f != 0.0F) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - float f1 = 1.0F / f; - float f2 = src.m11 * src.m22 - src.m12 * src.m21; - float f3 = -src.m10 * src.m22 + src.m12 * src.m20; - float f4 = src.m10 * src.m21 - src.m11 * src.m20; - float f5 = -src.m01 * src.m22 + src.m02 * src.m21; - float f6 = src.m00 * src.m22 - src.m02 * src.m20; - float f7 = -src.m00 * src.m21 + src.m01 * src.m20; - float f8 = src.m01 * src.m12 - src.m02 * src.m11; - float f9 = -src.m00 * src.m12 + src.m02 * src.m10; - float f10 = src.m00 * src.m11 - src.m01 * src.m10; - dest.m00 = f2 * f1; - dest.m11 = f6 * f1; - dest.m22 = f10 * f1; - dest.m01 = f5 * f1; - dest.m10 = f3 * f1; - dest.m20 = f4 * f1; - dest.m02 = f8 * f1; - dest.m12 = f9 * f1; - dest.m21 = f7 * f1; - return dest; - } - else - { - return null; - } - } - - public Matrix negate() - { - return this.negate(this); - } - - public Matrix3f negate(Matrix3f dest) - { - return negate(this, dest); - } - - public static Matrix3f negate(Matrix3f src, Matrix3f dest) - { - if (dest == null) - { - dest = new Matrix3f(); - } - - dest.m00 = -src.m00; - dest.m01 = -src.m02; - dest.m02 = -src.m01; - dest.m10 = -src.m10; - dest.m11 = -src.m12; - dest.m12 = -src.m11; - dest.m20 = -src.m20; - dest.m21 = -src.m22; - dest.m22 = -src.m21; - return dest; - } - - public Matrix setIdentity() - { - return setIdentity(this); - } - - public static Matrix3f setIdentity(Matrix3f m) - { - m.m00 = 1.0F; - m.m01 = 0.0F; - m.m02 = 0.0F; - m.m10 = 0.0F; - m.m11 = 1.0F; - m.m12 = 0.0F; - m.m20 = 0.0F; - m.m21 = 0.0F; - m.m22 = 1.0F; - return m; - } - - public Matrix setZero() - { - return setZero(this); - } - - public static Matrix3f setZero(Matrix3f m) - { - m.m00 = 0.0F; - m.m01 = 0.0F; - m.m02 = 0.0F; - m.m10 = 0.0F; - m.m11 = 0.0F; - m.m12 = 0.0F; - m.m20 = 0.0F; - m.m21 = 0.0F; - m.m22 = 0.0F; - return m; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix4f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix4f.java deleted file mode 100644 index 1b00b03bf..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Matrix4f.java +++ /dev/null @@ -1,648 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Matrix4f extends Matrix -{ - public float m00; - public float m01; - public float m02; - public float m03; - public float m10; - public float m11; - public float m12; - public float m13; - public float m20; - public float m21; - public float m22; - public float m23; - public float m30; - public float m31; - public float m32; - public float m33; - - public Matrix4f() - { - this.setIdentity(); - } - - public Matrix4f(Matrix4f src) - { - this.load(src); - } - - public Matrix4f(org.joml.Matrix4f src) - { - this.m00 = src.m00(); - this.m01 = src.m01(); - this.m02 = src.m02(); - this.m03 = src.m03(); - this.m10 = src.m10(); - this.m11 = src.m11(); - this.m12 = src.m12(); - this.m13 = src.m13(); - this.m20 = src.m20(); - this.m21 = src.m21(); - this.m22 = src.m22(); - this.m23 = src.m23(); - this.m30 = src.m30(); - this.m31 = src.m31(); - this.m32 = src.m32(); - this.m33 = src.m33(); - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append(this.m00).append(' ').append(this.m10).append(' ').append(this.m20).append(' ').append(this.m30).append('\n'); - stringbuilder.append(this.m01).append(' ').append(this.m11).append(' ').append(this.m21).append(' ').append(this.m31).append('\n'); - stringbuilder.append(this.m02).append(' ').append(this.m12).append(' ').append(this.m22).append(' ').append(this.m32).append('\n'); - stringbuilder.append(this.m03).append(' ').append(this.m13).append(' ').append(this.m23).append(' ').append(this.m33).append('\n'); - return stringbuilder.toString(); - } - - public Matrix setIdentity() - { - return setIdentity(this); - } - - public static Matrix4f setIdentity(Matrix4f m) - { - m.m00 = 1.0F; - m.m01 = 0.0F; - m.m02 = 0.0F; - m.m03 = 0.0F; - m.m10 = 0.0F; - m.m11 = 1.0F; - m.m12 = 0.0F; - m.m13 = 0.0F; - m.m20 = 0.0F; - m.m21 = 0.0F; - m.m22 = 1.0F; - m.m23 = 0.0F; - m.m30 = 0.0F; - m.m31 = 0.0F; - m.m32 = 0.0F; - m.m33 = 1.0F; - return m; - } - - public Matrix setZero() - { - return setZero(this); - } - - public static Matrix4f setZero(Matrix4f m) - { - m.m00 = 0.0F; - m.m01 = 0.0F; - m.m02 = 0.0F; - m.m03 = 0.0F; - m.m10 = 0.0F; - m.m11 = 0.0F; - m.m12 = 0.0F; - m.m13 = 0.0F; - m.m20 = 0.0F; - m.m21 = 0.0F; - m.m22 = 0.0F; - m.m23 = 0.0F; - m.m30 = 0.0F; - m.m31 = 0.0F; - m.m32 = 0.0F; - m.m33 = 0.0F; - return m; - } - - public Matrix4f load(Matrix4f src) - { - return load(src, this); - } - - public static Matrix4f load(Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m00 = src.m00; - dest.m01 = src.m01; - dest.m02 = src.m02; - dest.m03 = src.m03; - dest.m10 = src.m10; - dest.m11 = src.m11; - dest.m12 = src.m12; - dest.m13 = src.m13; - dest.m20 = src.m20; - dest.m21 = src.m21; - dest.m22 = src.m22; - dest.m23 = src.m23; - dest.m30 = src.m30; - dest.m31 = src.m31; - dest.m32 = src.m32; - dest.m33 = src.m33; - return dest; - } - - public Matrix load(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m01 = buf.get(); - this.m02 = buf.get(); - this.m03 = buf.get(); - this.m10 = buf.get(); - this.m11 = buf.get(); - this.m12 = buf.get(); - this.m13 = buf.get(); - this.m20 = buf.get(); - this.m21 = buf.get(); - this.m22 = buf.get(); - this.m23 = buf.get(); - this.m30 = buf.get(); - this.m31 = buf.get(); - this.m32 = buf.get(); - this.m33 = buf.get(); - return this; - } - - public Matrix loadTranspose(FloatBuffer buf) - { - this.m00 = buf.get(); - this.m10 = buf.get(); - this.m20 = buf.get(); - this.m30 = buf.get(); - this.m01 = buf.get(); - this.m11 = buf.get(); - this.m21 = buf.get(); - this.m31 = buf.get(); - this.m02 = buf.get(); - this.m12 = buf.get(); - this.m22 = buf.get(); - this.m32 = buf.get(); - this.m03 = buf.get(); - this.m13 = buf.get(); - this.m23 = buf.get(); - this.m33 = buf.get(); - return this; - } - - public Matrix store(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m01); - buf.put(this.m02); - buf.put(this.m03); - buf.put(this.m10); - buf.put(this.m11); - buf.put(this.m12); - buf.put(this.m13); - buf.put(this.m20); - buf.put(this.m21); - buf.put(this.m22); - buf.put(this.m23); - buf.put(this.m30); - buf.put(this.m31); - buf.put(this.m32); - buf.put(this.m33); - return this; - } - - public Matrix storeTranspose(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m10); - buf.put(this.m20); - buf.put(this.m30); - buf.put(this.m01); - buf.put(this.m11); - buf.put(this.m21); - buf.put(this.m31); - buf.put(this.m02); - buf.put(this.m12); - buf.put(this.m22); - buf.put(this.m32); - buf.put(this.m03); - buf.put(this.m13); - buf.put(this.m23); - buf.put(this.m33); - return this; - } - - public Matrix store3f(FloatBuffer buf) - { - buf.put(this.m00); - buf.put(this.m01); - buf.put(this.m02); - buf.put(this.m10); - buf.put(this.m11); - buf.put(this.m12); - buf.put(this.m20); - buf.put(this.m21); - buf.put(this.m22); - return this; - } - - public static Matrix4f add(Matrix4f left, Matrix4f right, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m00 = left.m00 + right.m00; - dest.m01 = left.m01 + right.m01; - dest.m02 = left.m02 + right.m02; - dest.m03 = left.m03 + right.m03; - dest.m10 = left.m10 + right.m10; - dest.m11 = left.m11 + right.m11; - dest.m12 = left.m12 + right.m12; - dest.m13 = left.m13 + right.m13; - dest.m20 = left.m20 + right.m20; - dest.m21 = left.m21 + right.m21; - dest.m22 = left.m22 + right.m22; - dest.m23 = left.m23 + right.m23; - dest.m30 = left.m30 + right.m30; - dest.m31 = left.m31 + right.m31; - dest.m32 = left.m32 + right.m32; - dest.m33 = left.m33 + right.m33; - return dest; - } - - public static Matrix4f sub(Matrix4f left, Matrix4f right, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m00 = left.m00 - right.m00; - dest.m01 = left.m01 - right.m01; - dest.m02 = left.m02 - right.m02; - dest.m03 = left.m03 - right.m03; - dest.m10 = left.m10 - right.m10; - dest.m11 = left.m11 - right.m11; - dest.m12 = left.m12 - right.m12; - dest.m13 = left.m13 - right.m13; - dest.m20 = left.m20 - right.m20; - dest.m21 = left.m21 - right.m21; - dest.m22 = left.m22 - right.m22; - dest.m23 = left.m23 - right.m23; - dest.m30 = left.m30 - right.m30; - dest.m31 = left.m31 - right.m31; - dest.m32 = left.m32 - right.m32; - dest.m33 = left.m33 - right.m33; - return dest; - } - - public static Matrix4f mul(Matrix4f left, Matrix4f right, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - float f = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02 + left.m30 * right.m03; - float f1 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02 + left.m31 * right.m03; - float f2 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02 + left.m32 * right.m03; - float f3 = left.m03 * right.m00 + left.m13 * right.m01 + left.m23 * right.m02 + left.m33 * right.m03; - float f4 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12 + left.m30 * right.m13; - float f5 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12 + left.m31 * right.m13; - float f6 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12 + left.m32 * right.m13; - float f7 = left.m03 * right.m10 + left.m13 * right.m11 + left.m23 * right.m12 + left.m33 * right.m13; - float f8 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22 + left.m30 * right.m23; - float f9 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22 + left.m31 * right.m23; - float f10 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22 + left.m32 * right.m23; - float f11 = left.m03 * right.m20 + left.m13 * right.m21 + left.m23 * right.m22 + left.m33 * right.m23; - float f12 = left.m00 * right.m30 + left.m10 * right.m31 + left.m20 * right.m32 + left.m30 * right.m33; - float f13 = left.m01 * right.m30 + left.m11 * right.m31 + left.m21 * right.m32 + left.m31 * right.m33; - float f14 = left.m02 * right.m30 + left.m12 * right.m31 + left.m22 * right.m32 + left.m32 * right.m33; - float f15 = left.m03 * right.m30 + left.m13 * right.m31 + left.m23 * right.m32 + left.m33 * right.m33; - dest.m00 = f; - dest.m01 = f1; - dest.m02 = f2; - dest.m03 = f3; - dest.m10 = f4; - dest.m11 = f5; - dest.m12 = f6; - dest.m13 = f7; - dest.m20 = f8; - dest.m21 = f9; - dest.m22 = f10; - dest.m23 = f11; - dest.m30 = f12; - dest.m31 = f13; - dest.m32 = f14; - dest.m33 = f15; - return dest; - } - - public static Vector4f transform(Matrix4f left, Vector4f right, Vector4f dest) - { - if (dest == null) - { - dest = new Vector4f(); - } - - float f = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z + left.m30 * right.w; - float f1 = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z + left.m31 * right.w; - float f2 = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z + left.m32 * right.w; - float f3 = left.m03 * right.x + left.m13 * right.y + left.m23 * right.z + left.m33 * right.w; - dest.x = f; - dest.y = f1; - dest.z = f2; - dest.w = f3; - return dest; - } - - public Matrix transpose() - { - return this.transpose(this); - } - - public Matrix4f translate(Vector2f vec) - { - return this.translate(vec, this); - } - - public Matrix4f translate(Vector3f vec) - { - return this.translate(vec, this); - } - - public Matrix4f scale(Vector3f vec) - { - return scale(vec, this, this); - } - - public static Matrix4f scale(Vector3f vec, Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m00 = src.m00 * vec.x; - dest.m01 = src.m01 * vec.x; - dest.m02 = src.m02 * vec.x; - dest.m03 = src.m03 * vec.x; - dest.m10 = src.m10 * vec.y; - dest.m11 = src.m11 * vec.y; - dest.m12 = src.m12 * vec.y; - dest.m13 = src.m13 * vec.y; - dest.m20 = src.m20 * vec.z; - dest.m21 = src.m21 * vec.z; - dest.m22 = src.m22 * vec.z; - dest.m23 = src.m23 * vec.z; - return dest; - } - - public Matrix4f rotate(float angle, Vector3f axis) - { - return this.rotate(angle, axis, this); - } - - public Matrix4f rotate(float angle, Vector3f axis, Matrix4f dest) - { - return rotate(angle, axis, this, dest); - } - - public static Matrix4f rotate(float angle, Vector3f axis, Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - float f = (float)Math.cos((double)angle); - float f1 = (float)Math.sin((double)angle); - float f2 = 1.0F - f; - float f3 = axis.x * axis.y; - float f4 = axis.y * axis.z; - float f5 = axis.x * axis.z; - float f6 = axis.x * f1; - float f7 = axis.y * f1; - float f8 = axis.z * f1; - float f9 = axis.x * axis.x * f2 + f; - float f10 = f3 * f2 + f8; - float f11 = f5 * f2 - f7; - float f12 = f3 * f2 - f8; - float f13 = axis.y * axis.y * f2 + f; - float f14 = f4 * f2 + f6; - float f15 = f5 * f2 + f7; - float f16 = f4 * f2 - f6; - float f17 = axis.z * axis.z * f2 + f; - float f18 = src.m00 * f9 + src.m10 * f10 + src.m20 * f11; - float f19 = src.m01 * f9 + src.m11 * f10 + src.m21 * f11; - float f20 = src.m02 * f9 + src.m12 * f10 + src.m22 * f11; - float f21 = src.m03 * f9 + src.m13 * f10 + src.m23 * f11; - float f22 = src.m00 * f12 + src.m10 * f13 + src.m20 * f14; - float f23 = src.m01 * f12 + src.m11 * f13 + src.m21 * f14; - float f24 = src.m02 * f12 + src.m12 * f13 + src.m22 * f14; - float f25 = src.m03 * f12 + src.m13 * f13 + src.m23 * f14; - dest.m20 = src.m00 * f15 + src.m10 * f16 + src.m20 * f17; - dest.m21 = src.m01 * f15 + src.m11 * f16 + src.m21 * f17; - dest.m22 = src.m02 * f15 + src.m12 * f16 + src.m22 * f17; - dest.m23 = src.m03 * f15 + src.m13 * f16 + src.m23 * f17; - dest.m00 = f18; - dest.m01 = f19; - dest.m02 = f20; - dest.m03 = f21; - dest.m10 = f22; - dest.m11 = f23; - dest.m12 = f24; - dest.m13 = f25; - return dest; - } - - public Matrix4f translate(Vector3f vec, Matrix4f dest) - { - return translate(vec, this, dest); - } - - public static Matrix4f translate(Vector3f vec, Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m30 += src.m00 * vec.x + src.m10 * vec.y + src.m20 * vec.z; - dest.m31 += src.m01 * vec.x + src.m11 * vec.y + src.m21 * vec.z; - dest.m32 += src.m02 * vec.x + src.m12 * vec.y + src.m22 * vec.z; - dest.m33 += src.m03 * vec.x + src.m13 * vec.y + src.m23 * vec.z; - return dest; - } - - public Matrix4f translate(Vector2f vec, Matrix4f dest) - { - return translate(vec, this, dest); - } - - public static Matrix4f translate(Vector2f vec, Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m30 += src.m00 * vec.x + src.m10 * vec.y; - dest.m31 += src.m01 * vec.x + src.m11 * vec.y; - dest.m32 += src.m02 * vec.x + src.m12 * vec.y; - dest.m33 += src.m03 * vec.x + src.m13 * vec.y; - return dest; - } - - public Matrix4f transpose(Matrix4f dest) - { - return transpose(this, dest); - } - - public static Matrix4f transpose(Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - float f = src.m00; - float f1 = src.m10; - float f2 = src.m20; - float f3 = src.m30; - float f4 = src.m01; - float f5 = src.m11; - float f6 = src.m21; - float f7 = src.m31; - float f8 = src.m02; - float f9 = src.m12; - float f10 = src.m22; - float f11 = src.m32; - float f12 = src.m03; - float f13 = src.m13; - float f14 = src.m23; - float f15 = src.m33; - dest.m00 = f; - dest.m01 = f1; - dest.m02 = f2; - dest.m03 = f3; - dest.m10 = f4; - dest.m11 = f5; - dest.m12 = f6; - dest.m13 = f7; - dest.m20 = f8; - dest.m21 = f9; - dest.m22 = f10; - dest.m23 = f11; - dest.m30 = f12; - dest.m31 = f13; - dest.m32 = f14; - dest.m33 = f15; - return dest; - } - - public float determinant() - { - float f = this.m00 * (this.m11 * this.m22 * this.m33 + this.m12 * this.m23 * this.m31 + this.m13 * this.m21 * this.m32 - this.m13 * this.m22 * this.m31 - this.m11 * this.m23 * this.m32 - this.m12 * this.m21 * this.m33); - f = f - this.m01 * (this.m10 * this.m22 * this.m33 + this.m12 * this.m23 * this.m30 + this.m13 * this.m20 * this.m32 - this.m13 * this.m22 * this.m30 - this.m10 * this.m23 * this.m32 - this.m12 * this.m20 * this.m33); - f = f + this.m02 * (this.m10 * this.m21 * this.m33 + this.m11 * this.m23 * this.m30 + this.m13 * this.m20 * this.m31 - this.m13 * this.m21 * this.m30 - this.m10 * this.m23 * this.m31 - this.m11 * this.m20 * this.m33); - return f - this.m03 * (this.m10 * this.m21 * this.m32 + this.m11 * this.m22 * this.m30 + this.m12 * this.m20 * this.m31 - this.m12 * this.m21 * this.m30 - this.m10 * this.m22 * this.m31 - this.m11 * this.m20 * this.m32); - } - - private static float determinant3x3(float t00, float t01, float t02, float t10, float t11, float t12, float t20, float t21, float t22) - { - return t00 * (t11 * t22 - t12 * t21) + t01 * (t12 * t20 - t10 * t22) + t02 * (t10 * t21 - t11 * t20); - } - - public Matrix invert() - { - return invert(this, this); - } - - public static Matrix4f invert(Matrix4f src, Matrix4f dest) - { - float f = src.determinant(); - - if (f != 0.0F) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - float f1 = 1.0F / f; - float f2 = determinant3x3(src.m11, src.m12, src.m13, src.m21, src.m22, src.m23, src.m31, src.m32, src.m33); - float f3 = -determinant3x3(src.m10, src.m12, src.m13, src.m20, src.m22, src.m23, src.m30, src.m32, src.m33); - float f4 = determinant3x3(src.m10, src.m11, src.m13, src.m20, src.m21, src.m23, src.m30, src.m31, src.m33); - float f5 = -determinant3x3(src.m10, src.m11, src.m12, src.m20, src.m21, src.m22, src.m30, src.m31, src.m32); - float f6 = -determinant3x3(src.m01, src.m02, src.m03, src.m21, src.m22, src.m23, src.m31, src.m32, src.m33); - float f7 = determinant3x3(src.m00, src.m02, src.m03, src.m20, src.m22, src.m23, src.m30, src.m32, src.m33); - float f8 = -determinant3x3(src.m00, src.m01, src.m03, src.m20, src.m21, src.m23, src.m30, src.m31, src.m33); - float f9 = determinant3x3(src.m00, src.m01, src.m02, src.m20, src.m21, src.m22, src.m30, src.m31, src.m32); - float f10 = determinant3x3(src.m01, src.m02, src.m03, src.m11, src.m12, src.m13, src.m31, src.m32, src.m33); - float f11 = -determinant3x3(src.m00, src.m02, src.m03, src.m10, src.m12, src.m13, src.m30, src.m32, src.m33); - float f12 = determinant3x3(src.m00, src.m01, src.m03, src.m10, src.m11, src.m13, src.m30, src.m31, src.m33); - float f13 = -determinant3x3(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12, src.m30, src.m31, src.m32); - float f14 = -determinant3x3(src.m01, src.m02, src.m03, src.m11, src.m12, src.m13, src.m21, src.m22, src.m23); - float f15 = determinant3x3(src.m00, src.m02, src.m03, src.m10, src.m12, src.m13, src.m20, src.m22, src.m23); - float f16 = -determinant3x3(src.m00, src.m01, src.m03, src.m10, src.m11, src.m13, src.m20, src.m21, src.m23); - float f17 = determinant3x3(src.m00, src.m01, src.m02, src.m10, src.m11, src.m12, src.m20, src.m21, src.m22); - dest.m00 = f2 * f1; - dest.m11 = f7 * f1; - dest.m22 = f12 * f1; - dest.m33 = f17 * f1; - dest.m01 = f6 * f1; - dest.m10 = f3 * f1; - dest.m20 = f4 * f1; - dest.m02 = f10 * f1; - dest.m12 = f11 * f1; - dest.m21 = f8 * f1; - dest.m03 = f14 * f1; - dest.m30 = f5 * f1; - dest.m13 = f15 * f1; - dest.m31 = f9 * f1; - dest.m32 = f13 * f1; - dest.m23 = f16 * f1; - return dest; - } - else - { - return null; - } - } - - public Matrix negate() - { - return this.negate(this); - } - - public Matrix4f negate(Matrix4f dest) - { - return negate(this, dest); - } - - public static Matrix4f negate(Matrix4f src, Matrix4f dest) - { - if (dest == null) - { - dest = new Matrix4f(); - } - - dest.m00 = -src.m00; - dest.m01 = -src.m01; - dest.m02 = -src.m02; - dest.m03 = -src.m03; - dest.m10 = -src.m10; - dest.m11 = -src.m11; - dest.m12 = -src.m12; - dest.m13 = -src.m13; - dest.m20 = -src.m20; - dest.m21 = -src.m21; - dest.m22 = -src.m22; - dest.m23 = -src.m23; - dest.m30 = -src.m30; - dest.m31 = -src.m31; - dest.m32 = -src.m32; - dest.m33 = -src.m33; - return dest; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector.java deleted file mode 100644 index a6f01a5d2..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public abstract class Vector -{ - protected Vector() - { - } - - public final float length() - { - return (float)Math.sqrt(this.lengthSquared()); - } - - public abstract float lengthSquared(); - - public abstract Vector load(FloatBuffer var1); - - public abstract Vector negate(); - - public final Vector normalise() - { - float f = this.length(); - - if (f != 0.0F) - { - float f1 = 1.0F / f; - return this.scale(f1); - } - else - { - throw new IllegalStateException("Zero length vector"); - } - } - - public abstract Vector store(FloatBuffer var1); - - public abstract Vector scale(float var1); -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector2f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector2f.java deleted file mode 100644 index efdf83f9c..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector2f.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Vector2f extends Vector -{ - public float x; - public float y; - - public Vector2f() - { - } - - public Vector2f(float x, float y) - { - this.set(x, y); - } - - public void set(float x, float y) - { - this.x = x; - this.y = y; - } - - public float lengthSquared() - { - return this.x * this.x + this.y * this.y; - } - - public Vector2f translate(float x, float y) - { - this.x += x; - this.y += y; - return this; - } - - public Vector negate() - { - this.x = -this.x; - this.y = -this.y; - return this; - } - - public Vector2f negate(Vector2f dest) - { - if (dest == null) - { - dest = new Vector2f(); - } - - dest.x = -this.x; - dest.y = -this.y; - return dest; - } - - public Vector2f normalise(Vector2f dest) - { - float f = this.length(); - - if (dest == null) - { - dest = new Vector2f(this.x / f, this.y / f); - } - else - { - dest.set(this.x / f, this.y / f); - } - - return dest; - } - - public static float dot(Vector2f left, Vector2f right) - { - return left.x * right.x + left.y * right.y; - } - - public static float angle(Vector2f a, Vector2f b) - { - float f = dot(a, b) / (a.length() * b.length()); - - if (f < -1.0F) - { - f = -1.0F; - } - else if (f > 1.0F) - { - f = 1.0F; - } - - return (float)Math.acos((double)f); - } - - public static Vector2f add(Vector2f left, Vector2f right, Vector2f dest) - { - if (dest == null) - { - return new Vector2f(left.x + right.x, left.y + right.y); - } - else - { - dest.set(left.x + right.x, left.y + right.y); - return dest; - } - } - - public static Vector2f sub(Vector2f left, Vector2f right, Vector2f dest) - { - if (dest == null) - { - return new Vector2f(left.x - right.x, left.y - right.y); - } - else - { - dest.set(left.x - right.x, left.y - right.y); - return dest; - } - } - - public Vector store(FloatBuffer buf) - { - buf.put(this.x); - buf.put(this.y); - return this; - } - - public Vector load(FloatBuffer buf) - { - this.x = buf.get(); - this.y = buf.get(); - return this; - } - - public Vector scale(float scale) - { - this.x *= scale; - this.y *= scale; - return this; - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(64); - stringbuilder.append("Vector2f["); - stringbuilder.append(this.x); - stringbuilder.append(", "); - stringbuilder.append(this.y); - stringbuilder.append(']'); - return stringbuilder.toString(); - } - - public final float getX() - { - return this.x; - } - - public final float getY() - { - return this.y; - } - - public final void setX(float x) - { - this.x = x; - } - - public final void setY(float y) - { - this.y = y; - } - - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - else if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Vector2f vector2f = (Vector2f)obj; - return this.x == vector2f.x && this.y == vector2f.y; - } - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector3f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector3f.java deleted file mode 100644 index 0c7d05678..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector3f.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Vector3f extends Vector -{ - public float x; - public float y; - public float z; - - public Vector3f() - { - } - - public Vector3f(float x, float y, float z) - { - this.set(x, y, z); - } - - public void set(float x, float y) - { - this.x = x; - this.y = y; - } - - public void set(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public float lengthSquared() - { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - - public Vector3f translate(float x, float y, float z) - { - this.x += x; - this.y += y; - this.z += z; - return this; - } - - public static Vector3f add(Vector3f left, Vector3f right, Vector3f dest) - { - if (dest == null) - { - return new Vector3f(left.x + right.x, left.y + right.y, left.z + right.z); - } - else - { - dest.set(left.x + right.x, left.y + right.y, left.z + right.z); - return dest; - } - } - - public static Vector3f sub(Vector3f left, Vector3f right, Vector3f dest) - { - if (dest == null) - { - return new Vector3f(left.x - right.x, left.y - right.y, left.z - right.z); - } - else - { - dest.set(left.x - right.x, left.y - right.y, left.z - right.z); - return dest; - } - } - - public static Vector3f cross(Vector3f left, Vector3f right, Vector3f dest) - { - if (dest == null) - { - dest = new Vector3f(); - } - - dest.set(left.y * right.z - left.z * right.y, right.x * left.z - right.z * left.x, left.x * right.y - left.y * right.x); - return dest; - } - - public Vector negate() - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - return this; - } - - public Vector3f negate(Vector3f dest) - { - if (dest == null) - { - dest = new Vector3f(); - } - - dest.x = -this.x; - dest.y = -this.y; - dest.z = -this.z; - return dest; - } - - public Vector3f normalise(Vector3f dest) - { - float f = this.length(); - - if (dest == null) - { - dest = new Vector3f(this.x / f, this.y / f, this.z / f); - } - else - { - dest.set(this.x / f, this.y / f, this.z / f); - } - - return dest; - } - - public static float dot(Vector3f left, Vector3f right) - { - return left.x * right.x + left.y * right.y + left.z * right.z; - } - - public static float angle(Vector3f a, Vector3f b) - { - float f = dot(a, b) / (a.length() * b.length()); - - if (f < -1.0F) - { - f = -1.0F; - } - else if (f > 1.0F) - { - f = 1.0F; - } - - return (float)Math.acos((double)f); - } - - public Vector load(FloatBuffer buf) - { - this.x = buf.get(); - this.y = buf.get(); - this.z = buf.get(); - return this; - } - - public Vector scale(float scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - return this; - } - - public Vector store(FloatBuffer buf) - { - buf.put(this.x); - buf.put(this.y); - buf.put(this.z); - return this; - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(64); - stringbuilder.append("Vector3f["); - stringbuilder.append(this.x); - stringbuilder.append(", "); - stringbuilder.append(this.y); - stringbuilder.append(", "); - stringbuilder.append(this.z); - stringbuilder.append(']'); - return stringbuilder.toString(); - } - - public final float getX() - { - return this.x; - } - - public final float getY() - { - return this.y; - } - - public final void setX(float x) - { - this.x = x; - } - - public final void setY(float y) - { - this.y = y; - } - - public void setZ(float z) - { - this.z = z; - } - - public float getZ() - { - return this.z; - } - - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - else if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Vector3f vector3f = (Vector3f)obj; - return this.x == vector3f.x && this.y == vector3f.y && this.z == vector3f.z; - } - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector4f.java b/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector4f.java deleted file mode 100644 index e45b9d37d..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/lwjgl/Vector4f.java +++ /dev/null @@ -1,235 +0,0 @@ -package org.vivecraft.common.utils.lwjgl; - -import java.nio.FloatBuffer; - -@Deprecated -public class Vector4f extends Vector -{ - public float x; - public float y; - public float z; - public float w; - - public Vector4f() - { - } - - public Vector4f(float x, float y, float z, float w) - { - this.set(x, y, z, w); - } - - public void set(float x, float y) - { - this.x = x; - this.y = y; - } - - public void set(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public void set(float x, float y, float z, float w) - { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - - public float lengthSquared() - { - return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - } - - public Vector4f translate(float x, float y, float z, float w) - { - this.x += x; - this.y += y; - this.z += z; - this.w += w; - return this; - } - - public static Vector4f add(Vector4f left, Vector4f right, Vector4f dest) - { - if (dest == null) - { - return new Vector4f(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); - } - else - { - dest.set(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); - return dest; - } - } - - public static Vector4f sub(Vector4f left, Vector4f right, Vector4f dest) - { - if (dest == null) - { - return new Vector4f(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); - } - else - { - dest.set(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); - return dest; - } - } - - public Vector negate() - { - this.x = -this.x; - this.y = -this.y; - this.z = -this.z; - this.w = -this.w; - return this; - } - - public Vector4f negate(Vector4f dest) - { - if (dest == null) - { - dest = new Vector4f(); - } - - dest.x = -this.x; - dest.y = -this.y; - dest.z = -this.z; - dest.w = -this.w; - return dest; - } - - public Vector4f normalise(Vector4f dest) - { - float f = this.length(); - - if (dest == null) - { - dest = new Vector4f(this.x / f, this.y / f, this.z / f, this.w / f); - } - else - { - dest.set(this.x / f, this.y / f, this.z / f, this.w / f); - } - - return dest; - } - - public static float dot(Vector4f left, Vector4f right) - { - return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; - } - - public static float angle(Vector4f a, Vector4f b) - { - float f = dot(a, b) / (a.length() * b.length()); - - if (f < -1.0F) - { - f = -1.0F; - } - else if (f > 1.0F) - { - f = 1.0F; - } - - return (float)Math.acos((double)f); - } - - public Vector load(FloatBuffer buf) - { - this.x = buf.get(); - this.y = buf.get(); - this.z = buf.get(); - this.w = buf.get(); - return this; - } - - public Vector scale(float scale) - { - this.x *= scale; - this.y *= scale; - this.z *= scale; - this.w *= scale; - return this; - } - - public Vector store(FloatBuffer buf) - { - buf.put(this.x); - buf.put(this.y); - buf.put(this.z); - buf.put(this.w); - return this; - } - - public String toString() - { - return "Vector4f: " + this.x + " " + this.y + " " + this.z + " " + this.w; - } - - public final float getX() - { - return this.x; - } - - public final float getY() - { - return this.y; - } - - public final void setX(float x) - { - this.x = x; - } - - public final void setY(float y) - { - this.y = y; - } - - public void setZ(float z) - { - this.z = z; - } - - public float getZ() - { - return this.z; - } - - public void setW(float w) - { - this.w = w; - } - - public float getW() - { - return this.w; - } - - public boolean equals(Object obj) - { - if (this == obj) - { - return true; - } - else if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Vector4f vector4f = (Vector4f)obj; - return this.x == vector4f.x && this.y == vector4f.y && this.z == vector4f.z && this.w == vector4f.w; - } - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Angle.java b/common/src/main/java/org/vivecraft/common/utils/math/Angle.java deleted file mode 100644 index c1f1d9569..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Angle.java +++ /dev/null @@ -1,206 +0,0 @@ -package org.vivecraft.common.utils.math; - -import org.vivecraft.common.utils.lwjgl.Matrix4f; - -public class Angle -{ - private float pitch; - private float yaw; - private float roll; - private Order order; - - public Angle() - { - this.order = Order.YXZ; - } - - public Angle(Order order) - { - this.order = order; - } - - public Angle(float pitch, float yaw, float roll, Order order) - { - this.pitch = pitch; - this.yaw = yaw; - this.roll = roll; - this.order = order; - } - - public Angle(float pitch, float yaw, float roll) - { - this(pitch, yaw, roll, Order.YXZ); - } - - public Angle(float pitch, float yaw) - { - this(pitch, yaw, 0.0F, Order.YXZ); - } - - public Angle(Angle other) - { - this.pitch = other.pitch; - this.yaw = other.yaw; - this.roll = other.roll; - this.order = other.order; - } - - public Angle copy() - { - return new Angle(this); - } - - public void set(float pitch, float yaw, float roll) - { - this.pitch = pitch; - this.yaw = yaw; - this.roll = roll; - } - - public void set(Angle other) - { - this.pitch = other.pitch; - this.yaw = other.yaw; - this.roll = other.roll; - } - - public float getPitch() - { - return this.pitch; - } - - public void setPitch(float pitch) - { - this.pitch = pitch; - } - - public float getYaw() - { - return this.yaw; - } - - public void setYaw(float yaw) - { - this.yaw = yaw; - } - - public float getRoll() - { - return this.roll; - } - - public void setRoll(float roll) - { - this.roll = roll; - } - - public Order getOrder() - { - return this.order; - } - - public void setOrder(Order order) - { - this.order = order; - } - - public Angle rotate(Axis axis, float degrees) - { - switch (axis) - { - case PITCH: - return new Angle(this.pitch + degrees, this.yaw, this.roll); - - case YAW: - return new Angle(this.pitch, this.yaw + degrees, this.roll); - - case ROLL: - return new Angle(this.pitch, this.yaw, this.roll + degrees); - - default: - return new Angle(this); - } - } - - public Angle add(Angle other) - { - return new Angle(this.pitch + other.pitch, this.yaw + other.yaw, this.roll + other.roll, this.order); - } - - public Angle subtract(Angle other) - { - return new Angle(this.pitch - other.pitch, this.yaw - other.yaw, this.roll - other.roll, this.order); - } - - public Matrix4f getMatrix() - { - return (new Quaternion(this)).getMatrix(); - } - - public Vector3 forward() - { - return (new Vector3(0.0F, 0.0F, -1.0F)).multiply(this.getMatrix()); - } - - public Vector3 up() - { - return (new Vector3(0.0F, 1.0F, 0.0F)).multiply(this.getMatrix()); - } - - public Vector3 right() - { - return (new Vector3(1.0F, 0.0F, 0.0F)).multiply(this.getMatrix()); - } - - public int hashCode() - { - int i = 5; - i = 89 * i + Float.floatToIntBits(this.pitch); - i = 89 * i + Float.floatToIntBits(this.yaw); - return 89 * i + Float.floatToIntBits(this.roll); - } - - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Angle angle = (Angle)obj; - - if (Float.floatToIntBits(this.pitch) != Float.floatToIntBits(angle.pitch)) - { - return false; - } - else if (Float.floatToIntBits(this.yaw) != Float.floatToIntBits(angle.yaw)) - { - return false; - } - else - { - return Float.floatToIntBits(this.roll) == Float.floatToIntBits(angle.roll); - } - } - } - - public String toString() - { - return "Angle{pitch=" + this.pitch + ", yaw=" + this.yaw + ", roll=" + this.roll + '}'; - } - - public static enum Order - { - XYZ, - ZYX, - YXZ, - ZXY, - YZX, - XZY; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Axis.java b/common/src/main/java/org/vivecraft/common/utils/math/Axis.java deleted file mode 100644 index 1d5c16fd8..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Axis.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.vivecraft.common.utils.math; - -public enum Axis -{ - PITCH(1.0F, 0.0F, 0.0F), - YAW(0.0F, 1.0F, 0.0F), - ROLL(0.0F, 0.0F, 1.0F), - UNKNOWN(0.0F, 0.0F, 0.0F); - - private Vector3 vector; - - private Axis(float x, float y, float z) - { - this.vector = new Vector3(x, y, z); - } - - public Vector3 getVector() - { - return this.vector.copy(); - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Convert.java b/common/src/main/java/org/vivecraft/common/utils/math/Convert.java deleted file mode 100644 index 8ea8edb00..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Convert.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.vivecraft.common.utils.math; - -import java.nio.Buffer; -import java.nio.FloatBuffer; - -public class Convert -{ - public static Matrix matrix(float[] floatArray) - { - return new Matrix(floatArray); - } - - public static Matrix matrix(float[][] float2Array) - { - float[] afloat = new float[float2Array.length * float2Array[0].length]; - - for (int i = 0; i < float2Array.length; ++i) - { - for (int j = 0; j < float2Array[0].length; ++j) - { - afloat[i * float2Array[0].length + j] = float2Array[i][j]; - } - } - - return matrix(afloat); - } - - public static Matrix matrix(FloatBuffer floatBuffer) - { - float[] afloat = new float[floatBuffer.capacity()]; - ((Buffer)floatBuffer).position(0); - floatBuffer.get(afloat); - ((Buffer)floatBuffer).position(0); - return matrix(afloat); - } - - public static Matrix matrix(org.vivecraft.common.utils.lwjgl.Matrix4f matrix4f) - { - FloatBuffer floatbuffer = FloatBuffer.allocate(16); - matrix4f.store(floatbuffer); - return matrix(floatbuffer); - } - - public static Matrix matrix(Quaternion quaternion) - { - return matrix(quaternion.getMatrix()); - } - - public static class Matrix - { - int dimension; - float[] floatArray; - double[] doubleArray; - int[] intArray; - boolean floatFilled = false; - boolean doubleFilled = false; - boolean intFilled = false; - - public Matrix(float[] floatArray) - { - this.dimension = (int)Math.sqrt((double)floatArray.length); - - if (this.dimension * this.dimension != floatArray.length) - { - throw new IllegalArgumentException("Input array has invalid length"); - } - else - { - this.floatArray = floatArray; - this.floatFilled = true; - } - } - - private void needFloats() - { - if (!this.floatFilled) - { - for (int i = 0; i < this.floatArray.length; ++i) - { - if (this.doubleFilled) - { - this.floatArray[i] = (float)this.doubleArray[i]; - } - else if (this.intFilled) - { - this.floatArray[i] = (float)this.intArray[i]; - } - } - - this.floatFilled = true; - } - } - - private void needDoubles() - { - if (!this.doubleFilled) - { - for (int i = 0; i < this.doubleArray.length; ++i) - { - if (this.floatFilled) - { - this.doubleArray[i] = (double)this.floatArray[i]; - } - else if (this.intFilled) - { - this.doubleArray[i] = (double)this.intArray[i]; - } - } - - this.doubleFilled = true; - } - } - - private void needInts() - { - if (!this.intFilled) - { - for (int i = 0; i < this.intArray.length; ++i) - { - if (this.doubleFilled) - { - this.intArray[i] = (int)this.doubleArray[i]; - } - else if (this.floatFilled) - { - this.intArray[i] = (int)this.floatArray[i]; - } - } - - this.intFilled = true; - } - } - - public Matrix4f toOVRMatrix4f() - { - this.needFloats(); - - if (this.dimension == 3) - { - return new Matrix4f(this.floatArray[0], this.floatArray[1], this.floatArray[2], this.floatArray[3], this.floatArray[4], this.floatArray[5], this.floatArray[6], this.floatArray[7], this.floatArray[8]); - } - else if (this.dimension == 4) - { - return new Matrix4f(this.floatArray[0], this.floatArray[1], this.floatArray[2], this.floatArray[3], this.floatArray[4], this.floatArray[5], this.floatArray[6], this.floatArray[7], this.floatArray[8], this.floatArray[9], this.floatArray[10], this.floatArray[11], this.floatArray[12], this.floatArray[13], this.floatArray[14], this.floatArray[15]); - } - else - { - throw new IllegalArgumentException("Wrong dimension! Can't convert Matrix" + this.dimension + " to Matrix4f"); - } - } - - public org.joml.Matrix4f toMCMatrix4f() - { - this.needFloats(); - - if (this.dimension == 4) - { - org.joml.Matrix4f matrix4f = new org.joml.Matrix4f(); - matrix4f.get(this.toFloatBuffer()); - return matrix4f; - } - else - { - throw new IllegalArgumentException("Wrong dimension! Can't convert Matrix" + this.dimension + " to Matrix4f"); - } - } - - public FloatBuffer toFloatBuffer() - { - return FloatBuffer.wrap(this.floatArray); - } - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Matrix4f.java b/common/src/main/java/org/vivecraft/common/utils/math/Matrix4f.java deleted file mode 100644 index 2f09bea75..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Matrix4f.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.vivecraft.common.utils.math; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; - -@Deprecated -public class Matrix4f -{ - public float[][] M = new float[4][4]; - - public Matrix4f(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) - { - this.M[0][0] = m11; - this.M[0][1] = m12; - this.M[0][2] = m13; - this.M[0][3] = m14; - this.M[1][0] = m21; - this.M[1][1] = m22; - this.M[1][2] = m23; - this.M[1][3] = m24; - this.M[2][0] = m31; - this.M[2][1] = m32; - this.M[2][2] = m33; - this.M[2][3] = m34; - this.M[3][0] = m41; - this.M[3][1] = m42; - this.M[3][2] = m43; - this.M[3][3] = m44; - } - - public Matrix4f(float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33) - { - this.M[0][0] = m11; - this.M[0][1] = m12; - this.M[0][2] = m13; - this.M[0][3] = 0.0F; - this.M[1][0] = m21; - this.M[1][1] = m22; - this.M[1][2] = m23; - this.M[1][3] = 0.0F; - this.M[2][0] = m31; - this.M[2][1] = m32; - this.M[2][2] = m33; - this.M[2][3] = 0.0F; - this.M[3][0] = 0.0F; - this.M[3][1] = 0.0F; - this.M[3][2] = 0.0F; - this.M[3][3] = 1.0F; - } - - public Matrix4f(Quaternion q) - { - float f = q.w * q.w; - float f1 = q.x * q.x; - float f2 = q.y * q.y; - float f3 = q.z * q.z; - this.M[0][0] = f + f1 - f2 - f3; - this.M[0][1] = 2.0F * (q.x * q.y - q.w * q.z); - this.M[0][2] = 2.0F * (q.x * q.z + q.w * q.y); - this.M[0][3] = 0.0F; - this.M[1][0] = 2.0F * (q.x * q.y + q.w * q.z); - this.M[1][1] = f - f1 + f2 - f3; - this.M[1][2] = 2.0F * (q.y * q.z - q.w * q.x); - this.M[1][3] = 0.0F; - this.M[2][0] = 2.0F * (q.x * q.z - q.w * q.y); - this.M[2][1] = 2.0F * (q.y * q.z + q.w * q.x); - this.M[2][2] = f - f1 - f2 + f3; - this.M[2][3] = 0.0F; - this.M[3][0] = 0.0F; - this.M[3][1] = 0.0F; - this.M[3][2] = 0.0F; - this.M[3][3] = 1.0F; - } - - public Matrix4f() - { - this.SetIdentity(); - } - - public void SetIdentity() - { - this.M[0][0] = this.M[1][1] = this.M[2][2] = this.M[3][3] = 1.0F; - this.M[0][1] = this.M[1][0] = this.M[2][3] = this.M[3][1] = 0.0F; - this.M[0][2] = this.M[1][2] = this.M[2][0] = this.M[3][2] = 0.0F; - this.M[0][3] = this.M[1][3] = this.M[2][1] = this.M[3][0] = 0.0F; - } - - Matrix4f(Matrix4f c) - { - for (int i = 0; i < 4; ++i) - { - for (int j = 0; j < 4; ++j) - { - this.M[i][j] = c.M[i][j]; - } - } - } - - public Matrix4f inverted() - { - float f = this.Determinant(); - return f == 0.0F ? null : this.Adjugated().Multiply(1.0F / f); - } - - Matrix4f Multiply(float s) - { - Matrix4f matrix4f = new Matrix4f(this); - - for (int i = 0; i < 4; ++i) - { - for (int j = 0; j < 4; ++j) - { - float[] afloat = matrix4f.M[i]; - afloat[j] *= s; - } - } - - return matrix4f; - } - - public static Matrix4f multiply(Matrix4f a, Matrix4f b) - { - int i = 0; - Matrix4f matrix4f = new Matrix4f(); - - do - { - matrix4f.M[i][0] = a.M[i][0] * b.M[0][0] + a.M[i][1] * b.M[1][0] + a.M[i][2] * b.M[2][0] + a.M[i][3] * b.M[3][0]; - matrix4f.M[i][1] = a.M[i][0] * b.M[0][1] + a.M[i][1] * b.M[1][1] + a.M[i][2] * b.M[2][1] + a.M[i][3] * b.M[3][1]; - matrix4f.M[i][2] = a.M[i][0] * b.M[0][2] + a.M[i][1] * b.M[1][2] + a.M[i][2] * b.M[2][2] + a.M[i][3] * b.M[3][2]; - matrix4f.M[i][3] = a.M[i][0] * b.M[0][3] + a.M[i][1] * b.M[1][3] + a.M[i][2] * b.M[2][3] + a.M[i][3] * b.M[3][3]; - ++i; - } - while (i < 4); - - return matrix4f; - } - - public Matrix4f transposed() - { - return new Matrix4f(this.M[0][0], this.M[1][0], this.M[2][0], this.M[3][0], this.M[0][1], this.M[1][1], this.M[2][1], this.M[3][1], this.M[0][2], this.M[1][2], this.M[2][2], this.M[3][2], this.M[0][3], this.M[1][3], this.M[2][3], this.M[3][3]); - } - - float SubDet(int[] rows, int[] cols) - { - return this.M[rows[0]][cols[0]] * (this.M[rows[1]][cols[1]] * this.M[rows[2]][cols[2]] - this.M[rows[1]][cols[2]] * this.M[rows[2]][cols[1]]) - this.M[rows[0]][cols[1]] * (this.M[rows[1]][cols[0]] * this.M[rows[2]][cols[2]] - this.M[rows[1]][cols[2]] * this.M[rows[2]][cols[0]]) + this.M[rows[0]][cols[2]] * (this.M[rows[1]][cols[0]] * this.M[rows[2]][cols[1]] - this.M[rows[1]][cols[1]] * this.M[rows[2]][cols[0]]); - } - - float Cofactor(int I, int J) - { - int[][] aint = new int[][] {{1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2}}; - return (I + J & 1) != 0 ? -this.SubDet(aint[I], aint[J]) : this.SubDet(aint[I], aint[J]); - } - - float Determinant() - { - return this.M[0][0] * this.Cofactor(0, 0) + this.M[0][1] * this.Cofactor(0, 1) + this.M[0][2] * this.Cofactor(0, 2) + this.M[0][3] * this.Cofactor(0, 3); - } - - Matrix4f Adjugated() - { - return new Matrix4f(this.Cofactor(0, 0), this.Cofactor(1, 0), this.Cofactor(2, 0), this.Cofactor(3, 0), this.Cofactor(0, 1), this.Cofactor(1, 1), this.Cofactor(2, 1), this.Cofactor(3, 1), this.Cofactor(0, 2), this.Cofactor(1, 2), this.Cofactor(2, 2), this.Cofactor(3, 2), this.Cofactor(0, 3), this.Cofactor(1, 3), this.Cofactor(2, 3), this.Cofactor(3, 3)); - } - - public FloatBuffer toFloatBuffer() - { - FloatBuffer floatbuffer = ByteBuffer.allocateDirect(64).order(ByteOrder.nativeOrder()).asFloatBuffer(); - floatbuffer.put(this.M[0][0]); - floatbuffer.put(this.M[0][1]); - floatbuffer.put(this.M[0][2]); - floatbuffer.put(this.M[0][3]); - floatbuffer.put(this.M[1][0]); - floatbuffer.put(this.M[1][1]); - floatbuffer.put(this.M[1][2]); - floatbuffer.put(this.M[1][3]); - floatbuffer.put(this.M[2][0]); - floatbuffer.put(this.M[2][1]); - floatbuffer.put(this.M[2][2]); - floatbuffer.put(this.M[2][3]); - floatbuffer.put(this.M[3][0]); - floatbuffer.put(this.M[3][1]); - floatbuffer.put(this.M[3][2]); - floatbuffer.put(this.M[3][3]); - ((Buffer)floatbuffer).flip(); - return floatbuffer; - } - - public static Matrix4f rotationY(float angle) - { - double d0 = Math.sin((double)angle); - double d1 = Math.cos((double)angle); - return new Matrix4f((float)d1, 0.0F, (float)d0, 0.0F, 1.0F, 0.0F, -((float)d0), 0.0F, (float)d1); - } - - public Vector3 transform(Vector3 v) - { - float f = 1.0F / (this.M[3][0] * v.x + this.M[3][1] * v.y + this.M[3][2] * v.z + this.M[3][3]); - return new Vector3((this.M[0][0] * v.x + this.M[0][1] * v.y + this.M[0][2] * v.z + this.M[0][3]) * f, (this.M[1][0] * v.x + this.M[1][1] * v.y + this.M[1][2] * v.z + this.M[1][3]) * f, (this.M[2][0] * v.x + this.M[2][1] * v.y + this.M[2][2] * v.z + this.M[2][3]) * f); - } - - public static Matrix4f translation(Vector3 v) - { - Matrix4f matrix4f = new Matrix4f(); - matrix4f.M[0][3] = v.x; - matrix4f.M[1][3] = v.y; - matrix4f.M[2][3] = v.z; - return matrix4f; - } - - public static Matrix4f lookAtRH(Vector3 eye, Vector3 at, Vector3 up) - { - Vector3 vector3 = eye.subtract(at).normalized(); - Vector3 vector31 = up.cross(vector3).normalized(); - Vector3 vector32 = vector3.cross(vector31); - return new Matrix4f(vector31.x, vector31.y, vector31.z, -vector31.dot(eye), vector32.x, vector32.y, vector32.z, -vector32.dot(eye), vector3.x, vector3.y, vector3.z, -vector3.dot(eye), 0.0F, 0.0F, 0.0F, 1.0F); - } - - public org.joml.Matrix4f toMCMatrix() - { - return new org.joml.Matrix4f(this.M[0][0], this.M[1][0], this.M[2][0], this.M[3][0], - this.M[0][1], this.M[1][1], this.M[2][1], this.M[3][1], - this.M[0][2], this.M[1][2], this.M[2][2], this.M[3][2], - this.M[0][3], this.M[1][3], this.M[2][3], this.M[3][3]); - } - - public String toString() - { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append(this.M[0][0]).append(' ').append(this.M[1][0]).append(' ').append(this.M[2][0]).append(' ').append(this.M[3][0]).append('\n'); - stringbuilder.append(this.M[0][1]).append(' ').append(this.M[1][1]).append(' ').append(this.M[2][1]).append(' ').append(this.M[3][1]).append('\n'); - stringbuilder.append(this.M[0][2]).append(' ').append(this.M[1][2]).append(' ').append(this.M[2][2]).append(' ').append(this.M[3][2]).append('\n'); - stringbuilder.append(this.M[0][3]).append(' ').append(this.M[1][3]).append(' ').append(this.M[2][3]).append(' ').append(this.M[3][3]).append('\n'); - return stringbuilder.toString(); - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Quaternion.java b/common/src/main/java/org/vivecraft/common/utils/math/Quaternion.java deleted file mode 100644 index 53303cce7..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Quaternion.java +++ /dev/null @@ -1,403 +0,0 @@ -package org.vivecraft.common.utils.math; - -import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.utils.lwjgl.Matrix3f; -import org.vivecraft.client.utils.Utils; - -@Deprecated -public class Quaternion -{ - public float w; - public float x; - public float y; - public float z; - - public Quaternion() - { - this.w = 1.0F; - } - - public Quaternion(float w, float x, float y, float z) - { - this.w = w; - this.x = x; - this.y = y; - this.z = z; - } - - public Quaternion(Quaternion other) - { - this.w = other.w; - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public Quaternion(Vector3 vector, float rotation) - { - rotation = (float)Math.toRadians((double)rotation); - float f = (float)Math.sin((double)(rotation / 2.0F)); - this.w = (float)Math.cos((double)(rotation / 2.0F)); - this.x = vector.x * f; - this.y = vector.y * f; - this.z = vector.z * f; - } - - public Quaternion(Axis axis, float rotation) - { - this(axis.getVector(), rotation); - } - - public Quaternion(float pitch, float yaw, float roll, Angle.Order order) - { - Quaternion quaternion = new Quaternion(new Vector3(1.0F, 0.0F, 0.0F), pitch); - Quaternion quaternion1 = new Quaternion(new Vector3(0.0F, 1.0F, 0.0F), yaw); - Quaternion quaternion2 = new Quaternion(new Vector3(0.0F, 0.0F, 1.0F), roll); - Quaternion quaternion3 = null; - - switch (order) - { - case XYZ: - quaternion3 = quaternion.multiply(quaternion1).multiply(quaternion2); - break; - - case ZYX: - quaternion3 = quaternion2.multiply(quaternion1).multiply(quaternion); - break; - - case YXZ: - quaternion3 = quaternion1.multiply(quaternion).multiply(quaternion2); - break; - - case ZXY: - quaternion3 = quaternion2.multiply(quaternion).multiply(quaternion1); - break; - - case YZX: - quaternion3 = quaternion1.multiply(quaternion2).multiply(quaternion); - break; - - case XZY: - quaternion3 = quaternion.multiply(quaternion2).multiply(quaternion1); - } - - this.w = quaternion3.w; - this.x = quaternion3.x; - this.y = quaternion3.y; - this.z = quaternion3.z; - } - - public Quaternion(float pitch, float yaw, float roll) - { - this(pitch, yaw, roll, Angle.Order.YXZ); - } - - public Quaternion(Angle angle) - { - this(angle.getPitch(), angle.getYaw(), angle.getRoll(), angle.getOrder()); - } - - public Quaternion(Matrix3f matrix) - { - this(matrix.m00, matrix.m01, matrix.m02, matrix.m10, matrix.m11, matrix.m12, matrix.m20, matrix.m21, matrix.m22); - } - - public Quaternion(org.vivecraft.common.utils.lwjgl.Matrix4f matrix) - { - this(matrix.m00, matrix.m01, matrix.m02, matrix.m10, matrix.m11, matrix.m12, matrix.m20, matrix.m21, matrix.m22); - } - - public Quaternion(Matrix4f matrix) - { - this(matrix.M[0][0], matrix.M[0][1], matrix.M[0][2], matrix.M[1][0], matrix.M[1][1], matrix.M[1][2], matrix.M[2][0], matrix.M[2][1], matrix.M[2][2]); - } - - private Quaternion(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22) - { - float f1 = m00 + m11 + m22; - - if ((double)f1 >= 0.0D) - { - float f = (float)Math.sqrt((double)f1 + 1.0D); - this.w = f * 0.5F; - f = 0.5F / f; - this.x = (m21 - m12) * f; - this.y = (m02 - m20) * f; - this.z = (m10 - m01) * f; - } - else - { - float f2 = Math.max(Math.max(m00, m11), m22); - - if (f2 == m00) - { - float f3 = (float)Math.sqrt((double)(m00 - (m11 + m22)) + 1.0D); - this.x = f3 * 0.5F; - f3 = 0.5F / f3; - this.y = (m01 + m10) * f3; - this.z = (m20 + m02) * f3; - this.w = (m21 - m12) * f3; - } - else if (f2 == m11) - { - float f4 = (float)Math.sqrt((double)(m11 - (m22 + m00)) + 1.0D); - this.y = f4 * 0.5F; - f4 = 0.5F / f4; - this.z = (m12 + m21) * f4; - this.x = (m01 + m10) * f4; - this.w = (m02 - m20) * f4; - } - else - { - float f5 = (float)Math.sqrt((double)(m22 - (m00 + m11)) + 1.0D); - this.z = f5 * 0.5F; - f5 = 0.5F / f5; - this.x = (m20 + m02) * f5; - this.y = (m12 + m21) * f5; - this.w = (m10 - m01) * f5; - } - } - } - - public Quaternion copy() - { - return new Quaternion(this); - } - - public float getW() - { - return this.w; - } - - public void setW(float w) - { - this.w = w; - } - - public float getX() - { - return this.x; - } - - public void setX(float x) - { - this.x = x; - } - - public float getY() - { - return this.y; - } - - public void setY(float y) - { - this.y = y; - } - - public float getZ() - { - return this.z; - } - - public void setZ(float z) - { - this.z = z; - } - - public void set(Quaternion other) - { - this.w = other.w; - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public void normalize() - { - float f = (float)Math.sqrt((double)(this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z)); - - if (f > 0.0F) - { - this.w /= f; - this.x /= f; - this.y /= f; - this.z /= f; - } - else - { - this.w = 1.0F; - this.x = 0.0F; - this.y = 0.0F; - this.z = 0.0F; - } - } - - public Quaternion normalized() - { - float f4 = (float)Math.sqrt((double)(this.w * this.w + this.x * this.x + this.y * this.y + this.z * this.z)); - float f; - float f1; - float f2; - float f3; - - if (f4 > 0.0F) - { - f = this.w / f4; - f1 = this.x / f4; - f2 = this.y / f4; - f3 = this.z / f4; - } - else - { - f = 1.0F; - f1 = 0.0F; - f2 = 0.0F; - f3 = 0.0F; - } - - return new Quaternion(f, f1, f2, f3); - } - - public Angle toEuler() - { - Angle angle = new Angle(); - angle.setYaw((float)Math.toDegrees(Math.atan2((double)(2.0F * (this.x * this.z + this.w * this.y)), (double)(this.w * this.w - this.x * this.x - this.y * this.y + this.z * this.z)))); - angle.setPitch((float)Math.toDegrees(Math.asin((double)(-2.0F * (this.y * this.z - this.w * this.x))))); - angle.setRoll((float)Math.toDegrees(Math.atan2((double)(2.0F * (this.x * this.y + this.w * this.z)), (double)(this.w * this.w - this.x * this.x + this.y * this.y - this.z * this.z)))); - return angle; - } - - public Quaternion rotate(Axis axis, float degrees, boolean local) - { - if (local) - { - return this.multiply(new Quaternion(axis, degrees)); - } - else - { - org.vivecraft.common.utils.lwjgl.Matrix4f matrix4f = this.getMatrix(); - matrix4f.rotate((float)Math.toRadians((double)degrees), Utils.convertVector(axis.getVector())); - return new Quaternion(matrix4f); - } - } - - public Quaternion multiply(Quaternion other) - { - float f = this.w * other.w - this.x * other.x - this.y * other.y - this.z * other.z; - float f1 = this.w * other.x + other.w * this.x + this.y * other.z - this.z * other.y; - float f2 = this.w * other.y + other.w * this.y - this.x * other.z + this.z * other.x; - float f3 = this.w * other.z + other.w * this.z + this.x * other.y - this.y * other.x; - return new Quaternion(f, f1, f2, f3); - } - - public org.vivecraft.common.utils.lwjgl.Matrix4f getMatrix() - { - org.vivecraft.common.utils.lwjgl.Matrix4f matrix4f = new org.vivecraft.common.utils.lwjgl.Matrix4f(); - float f = this.w * this.w; - float f1 = this.x * this.x; - float f2 = this.y * this.y; - float f3 = this.z * this.z; - float f4 = 1.0F / (f1 + f2 + f3 + f); - matrix4f.m00 = (f1 - f2 - f3 + f) * f4; - matrix4f.m11 = (-f1 + f2 - f3 + f) * f4; - matrix4f.m22 = (-f1 - f2 + f3 + f) * f4; - float f5 = this.x * this.y; - float f6 = this.z * this.w; - matrix4f.m10 = 2.0F * (f5 + f6) * f4; - matrix4f.m01 = 2.0F * (f5 - f6) * f4; - f5 = this.x * this.z; - f6 = this.y * this.w; - matrix4f.m20 = 2.0F * (f5 - f6) * f4; - matrix4f.m02 = 2.0F * (f5 + f6) * f4; - f5 = this.y * this.z; - f6 = this.x * this.w; - matrix4f.m21 = 2.0F * (f5 + f6) * f4; - matrix4f.m12 = 2.0F * (f5 - f6) * f4; - return matrix4f; - } - - public Quaternion inverse() - { - return new Quaternion(this.w, -this.x, -this.y, -this.z); - } - - public static Quaternion createFromToVector(Vector3 from, Vector3 to) - { - Vector3 vector3 = from.cross(to); - float f = (float)(Math.sqrt(Math.pow((double)from.length(), 2.0D) * Math.pow((double)to.length(), 2.0D)) + (double)from.dot(to)); - return (new Quaternion(f, vector3.x, vector3.y, vector3.z)).normalized(); - } - - public int hashCode() - { - int i = 3; - i = 23 * i + Float.floatToIntBits(this.w); - i = 23 * i + Float.floatToIntBits(this.x); - i = 23 * i + Float.floatToIntBits(this.y); - return 23 * i + Float.floatToIntBits(this.z); - } - - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Quaternion quaternion = (Quaternion)obj; - - if (Float.floatToIntBits(this.w) != Float.floatToIntBits(quaternion.w)) - { - return false; - } - else if (Float.floatToIntBits(this.x) != Float.floatToIntBits(quaternion.x)) - { - return false; - } - else if (Float.floatToIntBits(this.y) != Float.floatToIntBits(quaternion.y)) - { - return false; - } - else - { - return Float.floatToIntBits(this.z) == Float.floatToIntBits(quaternion.z); - } - } - } - - public Vector3 multiply(Vector3 vec) - { - float f = this.x * 2.0F; - float f1 = this.y * 2.0F; - float f2 = this.z * 2.0F; - float f3 = this.x * f; - float f4 = this.y * f1; - float f5 = this.z * f2; - float f6 = this.x * f1; - float f7 = this.x * f2; - float f8 = this.y * f2; - float f9 = this.w * f; - float f10 = this.w * f1; - float f11 = this.w * f2; - Vector3 vector3 = new Vector3(); - vector3.x = (1.0F - (f4 + f5)) * vec.x + (f6 - f11) * vec.y + (f7 + f10) * vec.z; - vector3.y = (f6 + f11) * vec.x + (1.0F - (f3 + f5)) * vec.y + (f8 - f9) * vec.z; - vector3.z = (f7 - f10) * vec.x + (f8 + f9) * vec.y + (1.0F - (f3 + f4)) * vec.z; - return vector3; - } - - public Vec3 multiply(Vec3 vec) - { - return this.multiply(new Vector3(vec)).toVector3d(); - } - - public String toString() - { - return "Quaternion{w=" + this.w + ", x=" + this.x + ", y=" + this.y + ", z=" + this.z + '}'; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Vector2.java b/common/src/main/java/org/vivecraft/common/utils/math/Vector2.java deleted file mode 100644 index f91b3c1c8..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Vector2.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.vivecraft.common.utils.math; - -import org.vivecraft.common.utils.lwjgl.Vector2f; - -@Deprecated -public class Vector2 -{ - protected float x; - protected float y; - - public Vector2() - { - } - - public Vector2(float x, float y) - { - this.x = x; - this.y = y; - } - - public Vector2(Vector2 other) - { - this.x = other.x; - this.y = other.y; - } - - public Vector2(Vector2f other) - { - this.x = other.x; - this.y = other.y; - } - - public Vector2 copy() - { - return new Vector2(this); - } - - public float getX() - { - return this.x; - } - - public void setX(float x) - { - this.x = x; - } - - public float getY() - { - return this.y; - } - - public void setY(float y) - { - this.y = y; - } - - public void set(float x, float y) - { - this.x = x; - this.y = y; - } - - public void set(Vector2 other) - { - this.x = other.x; - this.y = other.y; - } - - public Vector2 add(Vector2 other) - { - return new Vector2(this.x + other.x, this.y + other.y); - } - - public Vector2 subtract(Vector2 other) - { - return new Vector2(this.x - other.x, this.y - other.y); - } - - public Vector2 multiply(float number) - { - return new Vector2(this.x * number, this.y * number); - } - - public Vector2 divide(float number) - { - return new Vector2(this.x / number, this.y / number); - } - - public Vector2 negate() - { - return new Vector2(-this.x, -this.y); - } - - public float angle(Vector2 other) - { - return (float)Math.toDegrees(Math.atan2((double)(other.y - this.y), (double)(other.x - this.x))); - } - - public float length() - { - return (float)Math.sqrt((double)(this.x * this.x + this.y * this.y)); - } - - public float lengthSquared() - { - return this.x * this.x + this.y * this.y; - } - - public float distance(Vector2 other) - { - return other.subtract(this).length(); - } - - public float distanceSquared(Vector2 other) - { - return other.subtract(this).lengthSquared(); - } - - public void normalize() - { - this.set(this.divide(this.length())); - } - - public Vector2 normalized() - { - return this.divide(this.length()); - } - - public float dot(Vector2 other) - { - return this.x * other.x + this.y * other.y; - } - - public static Vector2 direction(float angle) - { - double d0 = Math.toRadians((double)angle); - return new Vector2((float)Math.cos(d0), (float)Math.sin(d0)); - } - - public int hashCode() - { - int i = 7; - i = 37 * i + Float.floatToIntBits(this.x); - return 37 * i + Float.floatToIntBits(this.y); - } - - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Vector2 vector2 = (Vector2)obj; - - if (Float.floatToIntBits(this.x) != Float.floatToIntBits(vector2.x)) - { - return false; - } - else - { - return Float.floatToIntBits(this.y) == Float.floatToIntBits(vector2.y); - } - } - } - - public String toString() - { - return "Vector2{x=" + this.x + ", y=" + this.y + '}'; - } -} diff --git a/common/src/main/java/org/vivecraft/common/utils/math/Vector3.java b/common/src/main/java/org/vivecraft/common/utils/math/Vector3.java deleted file mode 100644 index 0f22677be..000000000 --- a/common/src/main/java/org/vivecraft/common/utils/math/Vector3.java +++ /dev/null @@ -1,320 +0,0 @@ -package org.vivecraft.common.utils.math; - -import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.utils.lwjgl.Matrix3f; -import org.vivecraft.common.utils.lwjgl.Matrix4f; -import org.vivecraft.common.utils.lwjgl.Vector3f; - -@Deprecated -public class Vector3 -{ - public float x; - public float y; - public float z; - - public Vector3() - { - } - - public Vector3(Vec3 vec3d) - { - this.x = (float)vec3d.x; - this.y = (float)vec3d.y; - this.z = (float)vec3d.z; - } - - public Vector3(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public Vector3(Vector3 other) - { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public Vector3(Vector3f other) - { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public Vec3 toVector3d() - { - return new Vec3((double)this.x, (double)this.y, (double)this.z); - } - - public Vector3 copy() - { - return new Vector3(this); - } - - public float getX() - { - return this.x; - } - - public void setX(float x) - { - this.x = x; - } - - public float getY() - { - return this.y; - } - - public void setY(float y) - { - this.y = y; - } - - public float getZ() - { - return this.z; - } - - public void setZ(float z) - { - this.z = z; - } - - public void set(float x, float y, float z) - { - this.x = x; - this.y = y; - this.z = z; - } - - public void set(Vector3 other) - { - this.x = other.x; - this.y = other.y; - this.z = other.z; - } - - public Vector3 add(Vector3 other) - { - return new Vector3(this.x + other.x, this.y + other.y, this.z + other.z); - } - - public Vector3 add(float number) - { - return new Vector3(this.x + number, this.y + number, this.z + number); - } - - public Vector3 subtract(Vector3 other) - { - return new Vector3(this.x - other.x, this.y - other.y, this.z - other.z); - } - - public Vector3 subtract(float number) - { - return new Vector3(this.x - number, this.y - number, this.z - number); - } - - public Vector3 multiply(float number) - { - return new Vector3(this.x * number, this.y * number, this.z * number); - } - - public Vector3 multiply(Matrix3f matrix) - { - float f = matrix.m00 * this.x + matrix.m01 * this.y + matrix.m02 * this.z; - float f1 = matrix.m10 * this.x + matrix.m11 * this.y + matrix.m12 * this.z; - float f2 = matrix.m20 * this.x + matrix.m21 * this.y + matrix.m22 * this.z; - return new Vector3(f, f1, f2); - } - - public Vector3 multiply(Matrix4f matrix) - { - float f = matrix.m00 * this.x + matrix.m01 * this.y + matrix.m02 * this.z + matrix.m03; - float f1 = matrix.m10 * this.x + matrix.m11 * this.y + matrix.m12 * this.z + matrix.m13; - float f2 = matrix.m20 * this.x + matrix.m21 * this.y + matrix.m22 * this.z + matrix.m23; - return new Vector3(f, f1, f2); - } - - public Vector3 divide(float number) - { - return new Vector3(this.x / number, this.y / number, this.z / number); - } - - public Vector3 negate() - { - return new Vector3(-this.x, -this.y, -this.z); - } - - public Angle angle(Vector3 other) - { - float f = other.x - this.x; - float f1 = other.z - this.z; - float f2 = (float)Math.toDegrees(Math.atan2((double)(other.y - this.y), Math.sqrt((double)(f * f + f1 * f1)))); - float f3 = (float)Math.toDegrees(Math.atan2((double)(-f), (double)(-f1))); - return new Angle(f2, f3); - } - - public float length() - { - return (float)Math.sqrt((double)(this.x * this.x + this.y * this.y + this.z * this.z)); - } - - public float lengthSquared() - { - return this.x * this.x + this.y * this.y + this.z * this.z; - } - - public float distance(Vector3 other) - { - float f = other.x - this.x; - float f1 = other.y - this.y; - float f2 = other.z - this.z; - return (float)Math.sqrt((double)(f * f + f1 * f1 + f2 * f2)); - } - - public float distanceSquared(Vector3 other) - { - float f = other.x - this.x; - float f1 = other.y - this.y; - float f2 = other.z - this.z; - return f * f + f1 * f1 + f2 * f2; - } - - public float distance2D(Vector2 other) - { - return other.subtract(new Vector2(this.x, this.z)).length(); - } - - public float distanceSquared2D(Vector2 other) - { - return other.subtract(new Vector2(this.x, this.z)).lengthSquared(); - } - - public float distance2D(Vector3 other) - { - return this.distance2D(new Vector2(other.x, other.z)); - } - - public float distanceSquared2D(Vector3 other) - { - return this.distanceSquared2D(new Vector2(other.x, other.z)); - } - - public void normalize() - { - this.set(this.divide(this.length())); - } - - public Vector3 normalized() - { - return this.divide(this.length()); - } - - public float dot(Vector3 other) - { - return this.x * other.x + this.y * other.y + this.z * other.z; - } - - public Vector3 cross(Vector3 other) - { - return new Vector3(this.y * other.z - this.z * other.y, this.z * other.x - this.x * other.z, this.x * other.y - this.y * other.x); - } - - public Vector3 project(Vector3 other) - { - return other.multiply(other.dot(this) / other.dot(other)); - } - - public static Vector3 forward() - { - return new Vector3(0.0F, 0.0F, -1.0F); - } - - public static Vector3 up() - { - return new Vector3(0.0F, -1.0F, 0.0F); - } - - public static Vector3 right() - { - return new Vector3(-1.0F, 0.0F, 0.0F); - } - - public static Vector3 lerp(Vector3 start, Vector3 end, float fraction) - { - return start.add(end.subtract(start).multiply(fraction)); - } - - public static Vector3 slerp(Vector3 start, Vector3 end, float fraction) - { - float f = start.dot(end); - float f1 = (float)Math.acos((double)f) * fraction; - Vector3 vector3 = end.subtract(start.multiply(f)); - vector3.normalize(); - return start.multiply((float)Math.cos((double)f1)).add(vector3.multiply((float)Math.sin((double)f1))); - } - - public static Matrix3f lookMatrix(Vector3 forward, Vector3 up) - { - Vector3 vector3 = forward.normalized(); - Vector3 vector31 = up.cross(vector3).normalized(); - Vector3 vector32 = vector3.cross(vector31); - Matrix3f matrix3f = new Matrix3f(); - matrix3f.m00 = vector31.x; - matrix3f.m01 = vector31.y; - matrix3f.m02 = vector31.z; - matrix3f.m10 = vector32.x; - matrix3f.m11 = vector32.y; - matrix3f.m12 = vector32.z; - matrix3f.m20 = vector3.x; - matrix3f.m21 = vector3.y; - matrix3f.m22 = vector3.z; - return matrix3f; - } - - public int hashCode() - { - int i = 7; - i = 53 * i + Float.floatToIntBits(this.x); - i = 53 * i + Float.floatToIntBits(this.y); - return 53 * i + Float.floatToIntBits(this.z); - } - - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - else if (this.getClass() != obj.getClass()) - { - return false; - } - else - { - Vector3 vector3 = (Vector3)obj; - - if (Float.floatToIntBits(this.x) != Float.floatToIntBits(vector3.x)) - { - return false; - } - else if (Float.floatToIntBits(this.y) != Float.floatToIntBits(vector3.y)) - { - return false; - } - else - { - return Float.floatToIntBits(this.z) == Float.floatToIntBits(vector3.z); - } - } - } - - public String toString() - { - return "(" + String.format("%.2f", this.x) + ", " + String.format("%.2f", this.y) + ", " + String.format("%.2f", this.z) + ")"; - } -} diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java index 917b67949..b47579b34 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java @@ -1,7 +1,9 @@ package org.vivecraft.mixin.client.blaze3d; -import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Vector3f; + +import com.mojang.blaze3d.systems.RenderSystem; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java index c8eb97064..29d240155 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java @@ -1,24 +1,28 @@ package org.vivecraft.mixin.client.blaze3d; -import com.mojang.blaze3d.pipeline.RenderTarget; +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11C; +//import org.lwjgl.opengl.GL12C; +import org.lwjgl.opengl.GL30C; + import com.mojang.blaze3d.platform.TextureUtil; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; -import net.minecraft.client.Minecraft; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + import net.minecraft.client.renderer.ShaderInstance; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL30; + +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Debug; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.*; -import org.vivecraft.client.extensions.RenderTargetExtension; @Debug(export = true) -@Mixin(RenderTarget.class) -public abstract class RenderTargetMixin implements RenderTargetExtension { +@Mixin(com.mojang.blaze3d.pipeline.RenderTarget.class) +public abstract class RenderTargetMixin implements org.vivecraft.client.extensions.RenderTargetExtension { @Unique private int texid = -1; @@ -62,7 +66,7 @@ public void setUseStencil(boolean useStencil){ @Override public boolean getUseStencil(){ - return useStencil; + return this.useStencil; } @Override @@ -70,10 +74,10 @@ public void clearWithColor(float r, float g, float b, float a, boolean isMac) { RenderSystem.assertOnRenderThreadOrInit(); this._bindWrite(true); RenderSystem.clearColor(r, g, b, a); - int i = 16384; + int i = GL11C.GL_COLOR_BUFFER_BIT; if (this.useDepth) { RenderSystem.clearDepth(1.0); - i |= 0x100; + i |= GL11C.GL_DEPTH_BUFFER_BIT; } RenderSystem.clear(i, isMac); this.unbindWrite(); @@ -91,12 +95,10 @@ public void isLinearFilter(boolean linearFilter){ @Override public String toString() { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("\n"); - stringbuilder.append("Size: " + this.viewWidth + " x " + this.viewHeight).append("\n"); - stringbuilder.append("FB ID: " + this.frameBufferId).append("\n"); - stringbuilder.append("Tex ID: " + this.colorTextureId).append("\n"); - return stringbuilder.toString(); + return "\n" + + "Size: " + this.viewWidth + " x " + this.viewHeight + "\n" + + "FB ID: " + this.frameBufferId + "\n" + + "Tex ID: " + this.colorTextureId + "\n"; } @@ -131,26 +133,26 @@ public String toString() { // if (this.useDepth) { // this.depthBufferId = TextureUtil.generateTextureId(); // GlStateManager._bindTexture(this.depthBufferId); -// GlStateManager._texParameter(3553, 10241, linearFilter ? GL11.GL_LINEAR : 9728); -// GlStateManager._texParameter(3553, 10240, linearFilter ? GL11.GL_LINEAR : 9728); -// GlStateManager._texParameter(3553, 34892, 0); -// GlStateManager._texParameter(3553, 10242, 33071); -// GlStateManager._texParameter(3553, 10243, 33071); -// GlStateManager._texImage2D(3553, 0, 36013, this.width, this.height, 0, 34041, 36269, null); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MIN_FILTER, linearFilter ? GL11C.GL_LINEAR : GL11C.GL_NEAREST); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_MAG_FILTER, linearFilter ? GL11C.GL_LINEAR : GL11C.GL_NEAREST); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL14C.GL_TEXTURE_COMPARE_MODE, 0); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_S, GL12C.GL_CLAMP_TO_EDGE); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_T, GL12C.GL_CLAMP_TO_EDGE); +// GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL30C.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, GL30C.GL_DEPTH_STENCIL, GL30C.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); // } // if (linearFilter) -// this.setFilterMode(GL11.GL_LINEAR); +// this.setFilterMode(GL11C.GL_LINEAR); // else -// this.setFilterMode(9728); +// this.setFilterMode(GL11C.GL_NEAREST); // GlStateManager._bindTexture(this.colorTextureId); -// GlStateManager._texParameter(3553, 10242, 33071); -// GlStateManager._texParameter(3553, 10243, 33071); -// GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, (IntBuffer)null); -// GlStateManager._glBindFramebuffer(36160, this.frameBufferId); -// GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_S, GL12C.GL_CLAMP_TO_EDGE); +// GlStateManager._texParameter(GL11C.GL_TEXTURE_2D, GL11C.GL_TEXTURE_WRAP_T, GL12C.GL_CLAMP_TO_EDGE); +// GlStateManager._texImage2D(GL11C.GL_TEXTURE_2D, 0, GL11C.GL_RGBA8, this.width, this.height, 0, GL11C.GL_RGBA, GL11C.GL_UNSIGNED_BYTE, (IntBuffer)null); +// GlStateManager._glBindFramebuffer(GL30C.GL_FRAMEBUFFER, this.frameBufferId); +// GlStateManager._glFramebufferTexture2D(GL30C.GL_FRAMEBUFFER, GL30C.GL_COLOR_ATTACHMENT0, GL11C.GL_TEXTURE_2D, this.colorTextureId, 0); // if (this.useDepth) { -// GlStateManager._glFramebufferTexture2D(GlConst.GL_FRAMEBUFFER, 36096, 3553, this.depthBufferId, 0); -// GlStateManager._glFramebufferTexture2D(GlConst.GL_FRAMEBUFFER, 36128, 3553, this.depthBufferId, 0); +// GlStateManager._glFramebufferTexture2D(GL30C.GL_FRAMEBUFFER, GL30C.GL_DEPTH_ATTACHMENT, GL11C.GL_TEXTURE_2D, this.depthBufferId, 0); +// GlStateManager._glFramebufferTexture2D(GL30C.GL_FRAMEBUFFER, GL30C.GL_STENCIL_ATTACHMENT, GL11C.GL_TEXTURE_2D, this.depthBufferId, 0); // } // // this.checkStatus(); @@ -172,25 +174,25 @@ public int genTextureId() { @ModifyArg(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texImage2D(IIIIIIIILjava/nio/IntBuffer;)V", ordinal = 0), method = "createBuffers", index = 2) public int modifyTexImage2DInternalformat(int internalformat) { - return useStencil ? GL30.GL_DEPTH32F_STENCIL8 : internalformat; + return this.useStencil ? GL30C.GL_DEPTH32F_STENCIL8 : internalformat; } @ModifyArg(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texImage2D(IIIIIIIILjava/nio/IntBuffer;)V", ordinal = 0), method = "createBuffers", index = 6) public int modifyTexImage2DFormat(int format) { - return useStencil ? GL30.GL_DEPTH_STENCIL : format; + return this.useStencil ? GL30C.GL_DEPTH_STENCIL : format; } @ModifyArg(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_texImage2D(IIIIIIIILjava/nio/IntBuffer;)V", ordinal = 0), method = "createBuffers", index = 7) public int modifyTexImage2DType(int type) { - return useStencil ? GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV : type; + return this.useStencil ? GL30C.GL_FLOAT_32_UNSIGNED_INT_24_8_REV : type; } @ModifyConstant(method = "createBuffers", constant = @Constant(intValue = 9728)) public int changeTextPar(int i) { - return linearFilter ? GL11.GL_LINEAR : i; + return this.linearFilter ? GL11C.GL_LINEAR : i; } @ModifyArg(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_glFramebufferTexture2D(IIIII)V", ordinal = 1), method = "createBuffers", index = 1) public int modifyGlFramebufferTexture2DAttachment(int attachment) { - return useStencil ? GL30.GL_DEPTH_STENCIL_ATTACHMENT : attachment; + return this.useStencil ? GL30C.GL_DEPTH_STENCIL_ATTACHMENT : attachment; } public void blitToScreen(ShaderInstance instance, int left, int width, int height, int top, boolean disableBlend, float xCropFactor, @@ -214,10 +216,9 @@ public void blitFovReduction(ShaderInstance instance, int width, int height) { RenderSystem.depthMask(false); RenderSystem.viewport(0, 0, width, height); RenderSystem.disableBlend(); - Minecraft minecraft = Minecraft.getInstance(); RenderSystem.setShaderTexture(0, this.colorTextureId); if (instance == null) { - instance = minecraft.gameRenderer.blitShader; + instance = mc.gameRenderer.blitShader; instance.setSampler("DiffuseSampler", this.colorTextureId); } else { for (int k = 0; k < RenderSystemAccessor.getShaderTextures().length; ++k) { @@ -225,32 +226,30 @@ public void blitFovReduction(ShaderInstance instance, int width, int height) { instance.setSampler("Sampler" + k, l); } } - Matrix4f matrix4f = new Matrix4f().setOrtho(0, width, height, 0,1000.0f, 3000.0f); + Matrix4f matrix4f = new Matrix4f().setOrtho(0, width, height, 0,1000.0F, 3000.0F); RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); if (instance.MODEL_VIEW_MATRIX != null) { - instance.MODEL_VIEW_MATRIX.set(new Matrix4f().translation(0.0f, 0.0f, -2000.0f)); + instance.MODEL_VIEW_MATRIX.set(new Matrix4f().translation(0.0F, 0.0F, -2000.0F)); } if (instance.PROJECTION_MATRIX != null) { instance.PROJECTION_MATRIX.set(matrix4f); } instance.apply(); - float f = width; - float g = height; - float h = (float)this.viewWidth / (float)this.width; - float k = (float)this.viewHeight / (float)this.height; + float h = (float)this.viewWidth / this.width; + float k = (float)this.viewHeight / this.height; Tesselator tesselator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tesselator.getBuilder(); - bufferBuilder.begin(VertexFormat.Mode.QUADS, instance.getVertexFormat()); + bufferBuilder.begin(Mode.QUADS, instance.getVertexFormat()); if (instance.getVertexFormat() == DefaultVertexFormat.POSITION_TEX) { - bufferBuilder.vertex(0.0, g, 0.0).uv(0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(f, g, 0.0).uv(h, 0.0f).endVertex(); - bufferBuilder.vertex(f, 0.0, 0.0).uv(h, k).endVertex(); - bufferBuilder.vertex(0.0, 0.0, 0.0).uv(0.0f, k).endVertex(); + bufferBuilder.vertex(0.0D, height, 0.0D).uv(0.0F, 0.0F).endVertex(); + bufferBuilder.vertex(width, height, 0.0D).uv(h, 0.0F).endVertex(); + bufferBuilder.vertex(width, 0.0D, 0.0D).uv(h, k).endVertex(); + bufferBuilder.vertex(0.0D, 0.0D, 0.0D).uv(0.0F, k).endVertex(); } else if (instance.getVertexFormat() == DefaultVertexFormat.POSITION_TEX_COLOR) { - bufferBuilder.vertex(0.0, g, 0.0).uv(0.0f, 0.0f).color(255, 255, 255, 255).endVertex(); - bufferBuilder.vertex(f, g, 0.0).uv(h, 0.0f).color(255, 255, 255, 255).endVertex(); - bufferBuilder.vertex(f, 0.0, 0.0).uv(h, k).color(255, 255, 255, 255).endVertex(); - bufferBuilder.vertex(0.0, 0.0, 0.0).uv(0.0f, k).color(255, 255, 255, 255).endVertex(); + bufferBuilder.vertex(0.0D, height, 0.0D).uv(0.0F, 0.0F).color(255, 255, 255, 255).endVertex(); + bufferBuilder.vertex(width, height, 0.0D).uv(h, 0.0F).color(255, 255, 255, 255).endVertex(); + bufferBuilder.vertex(width, 0.0D, 0.0D).uv(h, k).color(255, 255, 255, 255).endVertex(); + bufferBuilder.vertex(0.0D, 0.0D, 0.0D).uv(0.0F, k).color(255, 255, 255, 255).endVertex(); } else { throw new IllegalStateException("Unexpected vertex format " + instance.getVertexFormat()); } @@ -271,38 +270,37 @@ private void _blitToScreen(ShaderInstance instance, int left, int width, int hei RenderSystem.disableBlend(); } - Minecraft minecraft = Minecraft.getInstance(); - float f = (float) width / (float) height; - float f1 = (float) this.viewWidth / (float) this.viewHeight; - float f2 = (float) width; - float f3 = (float) height; + float f = (float) width / height; + float f1 = (float) this.viewWidth / this.viewHeight; + float f2 = width; + float f3 = height; float f4 = 0.0F; float f5 = 0.0F; if (keepAspect) { if (f > f1) { - float f6 = (float) width / (float) this.viewWidth; + float f6 = (float) width / this.viewWidth; f4 = 0.0F; - f2 = (float) width; - f5 = (float) height / 2.0F - (float) this.viewHeight / 2.0F * f6; - f3 = (float) height / 2.0F + (float) this.viewHeight / 2.0F * f6; + f2 = width; + f5 = height / 2.0F - this.viewHeight / 2.0F * f6; + f3 = height / 2.0F + this.viewHeight / 2.0F * f6; } else { - float f10 = (float) height / (float) this.viewHeight; - f4 = (float) width / 2.0F - (float) this.viewWidth / 2.0F * f10; - f2 = (float) width / 2.0F + (float) this.viewWidth / 2.0F * f10; + float f10 = (float) height / this.viewHeight; + f4 = width / 2.0F - this.viewWidth / 2.0F * f10; + f2 = width / 2.0F + this.viewWidth / 2.0F * f10; f5 = 0.0F; - f3 = (float) height; + f3 = height; } } - float f11 = (float) width; - float f7 = (float) height; - float f8 = (float) this.viewWidth / (float) this.width; - float f9 = (float) this.viewHeight / (float) this.height; + float f11 = width; + float f7 = height; + float f8 = (float) this.viewWidth / this.width; + float f9 = (float) this.viewHeight / this.height; if (instance == null) { - instance = minecraft.gameRenderer.blitShader; + instance = mc.gameRenderer.blitShader; instance.setSampler("DiffuseSampler", this.colorTextureId); } else { for (int k = 0; k < RenderSystemAccessor.getShaderTextures().length; ++k) { @@ -310,7 +308,7 @@ private void _blitToScreen(ShaderInstance instance, int left, int width, int hei instance.setSampler("Sampler" + k, l); } } - Matrix4f matrix4f = new Matrix4f().setOrtho(0, (float) width, (float) (height), 0, 1000.0F, 3000.0F); + Matrix4f matrix4f = new Matrix4f().setOrtho(0, width, height, 0, 1000.0F, 3000.0F); RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); if (instance.MODEL_VIEW_MATRIX != null) { @@ -325,15 +323,11 @@ private void _blitToScreen(ShaderInstance instance, int left, int width, int hei Tesselator tesselator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferbuilder = tesselator.getBuilder(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, instance.getVertexFormat()); - bufferbuilder.vertex((double) f4, (double) f3, 0.0D).uv(xCropFactor, yCropFactor).color(255, 255, 255, 255) - .endVertex(); - bufferbuilder.vertex((double) f2, (double) f3, 0.0D).uv(f8 - xCropFactor, yCropFactor) - .color(255, 255, 255, 255).endVertex(); - bufferbuilder.vertex((double) f2, (double) f5, 0.0D).uv(f8 - xCropFactor, f9 - yCropFactor) - .color(255, 255, 255, 255).endVertex(); - bufferbuilder.vertex((double) f4, (double) f5, 0.0D).uv(xCropFactor, f9 - yCropFactor) - .color(255, 255, 255, 255).endVertex(); + bufferbuilder.begin(Mode.QUADS, instance.getVertexFormat()); + bufferbuilder.vertex(f4, f3, 0.0D).uv(xCropFactor, yCropFactor).color(255, 255, 255, 255).endVertex(); + bufferbuilder.vertex(f2, f3, 0.0D).uv(f8 - xCropFactor, yCropFactor).color(255, 255, 255, 255).endVertex(); + bufferbuilder.vertex(f2, f5, 0.0D).uv(f8 - xCropFactor, f9 - yCropFactor).color(255, 255, 255, 255).endVertex(); + bufferbuilder.vertex(f4, f5, 0.0D).uv(xCropFactor, f9 - yCropFactor).color(255, 255, 255, 255).endVertex(); BufferUploader.draw(bufferbuilder.end()); instance.clear(); diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/components/events/ContainerEventHandlerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/components/events/ContainerEventHandlerVRMixin.java index c8df1c5ba..a8cffadc6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/components/events/ContainerEventHandlerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/components/events/ContainerEventHandlerVRMixin.java @@ -1,9 +1,9 @@ package org.vivecraft.mixin.client.gui.components.events; -import org.spongepowered.asm.mixin.Mixin; - import net.minecraft.client.gui.components.events.ContainerEventHandler; +import org.spongepowered.asm.mixin.Mixin; + @Mixin(ContainerEventHandler.class) public class ContainerEventHandlerVRMixin { diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/ScreenMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/ScreenMixin.java index 53f9ad484..1e58fb6ef 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/ScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/ScreenMixin.java @@ -1,13 +1,17 @@ package org.vivecraft.mixin.client.gui.screens; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.gui.VivecraftClickEvent; +import org.vivecraft.client.gui.VivecraftClickEvent.VivecraftAction; + import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Style; + +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client.gui.VivecraftClickEvent; @Mixin(Screen.class) public abstract class ScreenMixin { @@ -15,12 +19,12 @@ public abstract class ScreenMixin { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/network/chat/ClickEvent;getAction()Lnet/minecraft/network/chat/ClickEvent$Action;", ordinal = 0), method = "handleComponentClicked(Lnet/minecraft/network/chat/Style;)Z", cancellable = true) public void handleVivecraftClickEvents(Style style, CallbackInfoReturnable cir) { if (style.getClickEvent() instanceof VivecraftClickEvent) { - VivecraftClickEvent.VivecraftAction action = ((VivecraftClickEvent) style.getClickEvent()).getVivecraftAction(); - if (action == VivecraftClickEvent.VivecraftAction.OPEN_SCREEN) { - Minecraft.getInstance().setScreen((Screen) ((VivecraftClickEvent) style.getClickEvent()).getVivecraftValue()); + VivecraftAction action = ((VivecraftClickEvent) style.getClickEvent()).getVivecraftAction(); + if (action == VivecraftAction.OPEN_SCREEN) { + mc.setScreen((Screen) ((VivecraftClickEvent) style.getClickEvent()).getVivecraftValue()); cir.setReturnValue(true); } } } -} \ No newline at end of file +} diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java index 9655584ce..ff51f6b05 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java @@ -1,21 +1,28 @@ package org.vivecraft.mixin.client.gui.screens; +import org.vivecraft.client.gui.screens.UpdateScreen; +import org.vivecraft.client.utils.UpdateChecker; + import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.*; -import net.minecraft.client.gui.screens.*; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.renderer.PanoramaRenderer; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.*; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client.utils.UpdateChecker; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client.gui.screens.UpdateScreen; -@Mixin(TitleScreen.class) -public abstract class TitleScreenMixin extends Screen { +@Mixin(net.minecraft.client.gui.screens.TitleScreen.class) +public abstract class TitleScreenMixin extends net.minecraft.client.gui.screens.Screen { protected TitleScreenMixin(Component component) { super(component); @@ -29,62 +36,62 @@ protected TitleScreenMixin(Component component) { private Button updateButton; - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/TitleScreen;addRenderableWidget(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;", shift = At.Shift.AFTER, ordinal = 1), method = "createNormalMenuOptions") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/TitleScreen;addRenderableWidget(Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;", shift = Shift.AFTER, ordinal = 1), method = "createNormalMenuOptions") public void initFullGame(CallbackInfo ci) { - addVRModeButton(); + this.addVRModeButton(); } @Inject(at = @At("TAIL"), method = "createDemoMenuOptions") public void initDemo(CallbackInfo ci) { - addVRModeButton(); + this.addVRModeButton(); } private void addVRModeButton() { - vrModeButton = new Button.Builder(Component.translatable("vivecraft.gui.vr", getIcon() , VRState.vrEnabled ? CommonComponents.OPTION_ON : CommonComponents.OPTION_OFF), (button) -> { - showError = false; - VRState.vrEnabled = !VRState.vrEnabled; - ClientDataHolderVR.getInstance().vrSettings.vrEnabled = VRState.vrEnabled; - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); + this.vrModeButton = new Builder(Component.translatable("vivecraft.gui.vr", this.getIcon() , vrEnabled ? CommonComponents.OPTION_ON : CommonComponents.OPTION_OFF), (button) -> { + this.showError = false; + vrEnabled = !vrEnabled; + dh.vrSettings.vrEnabled = vrEnabled; + dh.vrSettings.saveOptions(); - button.setMessage(Component.translatable("vivecraft.gui.vr", getIcon(), VRState.vrEnabled ? CommonComponents.OPTION_ON : CommonComponents.OPTION_OFF)); + button.setMessage(Component.translatable("vivecraft.gui.vr", this.getIcon(), vrEnabled ? CommonComponents.OPTION_ON : CommonComponents.OPTION_OFF)); }) .size(56, 20) .pos(this.width / 2 + 104, this.height / 4 + 72) .build(); - this.addRenderableWidget(vrModeButton); + this.addRenderableWidget(this.vrModeButton); - updateButton = new Button.Builder(Component.translatable("vivecraft.gui.update"), (button) -> minecraft.setScreen(new UpdateScreen())) + this.updateButton = new Builder(Component.translatable("vivecraft.gui.update"), (button) -> this.minecraft.setScreen(new UpdateScreen())) .size(56, 20) .pos(this.width / 2 + 104, this.height / 4 + 96) .build(); - updateButton.visible = UpdateChecker.hasUpdate; + this.updateButton.visible = UpdateChecker.hasUpdate; - this.addRenderableWidget(updateButton); + this.addRenderableWidget(this.updateButton); } private String getIcon() { - return (showError ? "§c\u26A0§r " : ""); + return (this.showError ? "§c⚠§r " : ""); } @Inject(at = @At("TAIL"), method = "render") public void renderToolTip(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo ci) { - updateButton.visible = UpdateChecker.hasUpdate; + this.updateButton.visible = UpdateChecker.hasUpdate; - if (vrModeButton.isMouseOver(i, j)) { - guiGraphics.renderTooltip(font, font.split(Component.translatable("vivecraft.options.VR_MODE.tooltip"), Math.max(width / 2 - 43, 170)), i, j); + if (this.vrModeButton.isMouseOver(i, j)) { + guiGraphics.renderTooltip(this.font, this.font.split(Component.translatable("vivecraft.options.VR_MODE.tooltip"), max(this.width / 2 - 43, 170)), i, j); } - if (VRState.vrInitialized && !VRState.vrRunning) { + if (vrInitialized && !vrRunning) { Component hotswitchMessage = Component.translatable("vivecraft.messages.vrhotswitchinginfo"); - guiGraphics.renderTooltip(font, font.split(hotswitchMessage, 280), width / 2 - 140 - 12, 17); + guiGraphics.renderTooltip(this.font, this.font.split(hotswitchMessage, 280), this.width / 2 - 140 - 12, 17); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/PanoramaRenderer;render(FF)V"), method = "render") public void maybeNoPanorama(PanoramaRenderer instance, float f, float g){ - if (VRState.vrRunning && ClientDataHolderVR.getInstance().menuWorldRenderer.isReady()){ + if (vrRunning && dh.menuWorldRenderer.isReady()){ return; } instance.render(f, g); diff --git a/common/src/main/java/org/vivecraft/mixin/client/main/MainMixin.java b/common/src/main/java/org/vivecraft/mixin/client/main/MainMixin.java index 583d14bdf..70bc9cacb 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/main/MainMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/main/MainMixin.java @@ -1,8 +1,14 @@ package org.vivecraft.mixin.client.main; -import com.google.common.base.Stopwatch; import org.vivecraft.client.utils.UpdateChecker; -import org.vivecraft.client_vr.ClientDataHolderVR; + +import com.google.common.base.Stopwatch; +import joptsimple.OptionParser; +import joptsimple.OptionSet; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.common.utils.Utils.logger; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -10,11 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import joptsimple.OptionParser; -import joptsimple.OptionSet; -import net.minecraft.client.main.Main; - -@Mixin(Main.class) +@Mixin(net.minecraft.client.main.Main.class) public class MainMixin { @Inject(at = @At(value = "INVOKE", target = "Ljoptsimple/OptionParser;allowsUnrecognizedOptions()V"), method = "main", locals = LocalCapture.CAPTURE_FAILHARD, remap = false) @@ -26,28 +28,28 @@ private static void options(String[] strings, CallbackInfo ci, Stopwatch stopwat } @Redirect(at = @At(value = "INVOKE", target = "Ljoptsimple/OptionParser;parse([Ljava/lang/String;)Ljoptsimple/OptionSet;", remap = false) , method = "main", remap = false) - private static OptionSet kiosk(OptionParser optionparser, String[] p_129642_) { + private static OptionSet kiosk(OptionParser optionparser, String[] cmdOptions) { new Thread(UpdateChecker::checkForUpdates).start(); - OptionSet optionset = optionparser.parse(p_129642_); - ClientDataHolderVR.kiosk = optionset.has("kiosk"); + OptionSet optionset = optionparser.parse(cmdOptions); + dh.kiosk = optionset.has("kiosk"); - if (ClientDataHolderVR.kiosk) + if (dh.kiosk) { - System.out.println("Setting kiosk"); + logger.info("Setting kiosk"); } - if (ClientDataHolderVR.kiosk) + if (dh.kiosk) { - ClientDataHolderVR.viewonly = optionset.has("viewonly"); + dh.viewonly = optionset.has("viewonly"); - if (ClientDataHolderVR.viewonly) + if (dh.viewonly) { - System.out.println("Setting viewonly"); + logger.info("Setting viewonly"); } } - ClientDataHolderVR.katvr = optionset.has("katvr"); - ClientDataHolderVR.infinadeck = optionset.has("infinadeck"); + dh.katvr = optionset.has("katvr"); + dh.infinadeck = optionset.has("infinadeck"); return optionset; } } diff --git a/common/src/main/java/org/vivecraft/mixin/client/player/AbstractClientPlayerMixin.java b/common/src/main/java/org/vivecraft/mixin/client/player/AbstractClientPlayerMixin.java index 50dec8a0f..7810ab861 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/player/AbstractClientPlayerMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/player/AbstractClientPlayerMixin.java @@ -1,13 +1,16 @@ package org.vivecraft.mixin.client.player; +import org.vivecraft.client.network.PatreonReceiver; + import com.mojang.authlib.GameProfile; + import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.AbstractClientPlayer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client.network.PatreonReceiver; @Mixin(AbstractClientPlayer.class) public class AbstractClientPlayerMixin { diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/block/LiquidBlockRendererMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/block/LiquidBlockRendererMixin.java index 01cd0f45f..08f7789b4 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/block/LiquidBlockRendererMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/block/LiquidBlockRendererMixin.java @@ -1,13 +1,12 @@ package org.vivecraft.mixin.client.renderer.block; +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.ModifyConstant; -import net.minecraft.client.renderer.block.LiquidBlockRenderer; -import org.vivecraft.client_vr.ClientDataHolderVR; - -@Mixin(LiquidBlockRenderer.class) +@Mixin(net.minecraft.client.renderer.block.LiquidBlockRenderer.class) public class LiquidBlockRendererMixin { //TODO a bit hacky, when does it happen? @@ -15,7 +14,7 @@ public class LiquidBlockRendererMixin { public int chunckClipping(int i) { // -1 is 0xFFFF FFFF // so no change - return ClientDataHolderVR.getInstance().skipStupidGoddamnChunkBoundaryClipping ? -1 : 15; + return dh.skipStupidGoddamnChunkBoundaryClipping ? -1 : 15; } // //TODO not found? diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/culling/FrustumVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/culling/FrustumVRMixin.java index 08df8fe7e..1629857ba 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/culling/FrustumVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/culling/FrustumVRMixin.java @@ -1,13 +1,12 @@ package org.vivecraft.mixin.client.renderer.culling; -import org.vivecraft.client_vr.extensions.FrustumExtension; -import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.world.phys.AABB; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -@Mixin(Frustum.class) -public abstract class FrustumVRMixin implements FrustumExtension { +@Mixin(net.minecraft.client.renderer.culling.Frustum.class) +public abstract class FrustumVRMixin implements org.vivecraft.client_vr.extensions.FrustumExtension { @Shadow private double camX; diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java index a3e62ffad..3e1bf3436 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java @@ -1,12 +1,27 @@ package org.vivecraft.mixin.client.renderer.entity; -import java.util.HashMap; -import java.util.Map; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.VRPlayersClient.RotInfo; +import org.vivecraft.client.extensions.EntityRenderDispatcherExtension; +import org.vivecraft.client.render.VRPlayerRenderer; +import org.vivecraft.common.utils.Utils; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; + +import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.client.renderer.entity.EntityRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; +import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.server.packs.resources.ResourceManagerReloadListener; +import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.AABB; + +import java.util.HashMap; +import java.util.Map; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -15,18 +30,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client.extensions.EntityRenderDispatcherExtension; -import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.client.render.VRPlayerRenderer; - -import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.server.packs.resources.ResourceManagerReloadListener; -import net.minecraft.world.entity.Entity; -import org.vivecraft.common.utils.Utils; @Mixin(EntityRenderDispatcher.class) public abstract class EntityRenderDispatcherMixin implements ResourceManagerReloadListener, EntityRenderDispatcherExtension { @@ -35,14 +38,14 @@ public abstract class EntityRenderDispatcherMixin implements ResourceManagerRelo private final Map skinMapVR = new HashMap<>(); public Map getSkinMapVR() { - return skinMapVR; + return this.skinMapVR; } @Unique private final Map skinMapVRSeated = new HashMap<>(); public Map getSkinMapVRSeated() { - return skinMapVRSeated; + return this.skinMapVRSeated; } @Unique private VRPlayerRenderer playerRendererVR; @@ -55,10 +58,10 @@ private static void headHitbox(PoseStack poseStack, VertexConsumer vertexConsume AABB headBox; if ((headBox = Utils.getEntityHeadHitbox(entity, 0.0)) != null) { // raw head box - LevelRenderer.renderLineBox(poseStack, vertexConsumer, headBox.move(-entity.getX(), -entity.getY(), -entity.getZ()), 1.0f, 1.0f, 0.0f, 1.0f); + LevelRenderer.renderLineBox(poseStack, vertexConsumer, headBox.move(-entity.getX(), -entity.getY(), -entity.getZ()), 1.0F, 1.0F, 0.0F, 1.0F); // inflated head box for arrows AABB headBoxArrow = Utils.getEntityHeadHitbox(entity, 0.3); - LevelRenderer.renderLineBox(poseStack, vertexConsumer, headBoxArrow.move(-entity.getX(), -entity.getY(), -entity.getZ()), 1.0f, 0.0f, 0.0f, 1.0f); + LevelRenderer.renderLineBox(poseStack, vertexConsumer, headBoxArrow.move(-entity.getX(), -entity.getY(), -entity.getZ()), 1.0F, 0.0F, 0.0F, 1.0F); } } @@ -67,7 +70,7 @@ private static void headHitbox(PoseStack poseStack, VertexConsumer vertexConsume public void renderer(Entity pEntity, CallbackInfoReturnable> info) { if (pEntity instanceof AbstractClientPlayer) { String s = ((AbstractClientPlayer) pEntity).getModelName(); - VRPlayersClient.RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(pEntity.getUUID()); + RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(pEntity.getUUID()); if (playermodelcontroller$rotinfo != null) { VRPlayerRenderer vrplayerrenderer; if (playermodelcontroller$rotinfo.seated) { @@ -89,21 +92,21 @@ public void renderer(Entity pEntity, CallbackInfoReturnable list, ItemStack itemStack, int i, int j, CallbackInfo ci, boolean bl, PoseStack.Pose pose, Iterator var9, BakedQuad bakedQuad, int k, float f, float g, float h) { - if (ClientDataHolderVR.getInstance().jumpTracker.isBoots(itemStack)) { - k = this.makeColor(1, 0, 255, 0); + @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexConsumer;putBulkData(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lnet/minecraft/client/renderer/block/model/BakedQuad;FFFII)V", shift = Shift.BY, by = -3), method = "renderQuadList", locals = LocalCapture.CAPTURE_FAILHARD) + public void specialItems(PoseStack poseStack, VertexConsumer vertexConsumer, List list, ItemStack itemStack, int i, int j, CallbackInfo ci, boolean bl, Pose pose, Iterator var9, BakedQuad bakedQuad, int k, float f, float g, float h) { + if (dh.jumpTracker.isBoots(itemStack)) { + k = 0x0100FF00; // 0xAARRGGBB } - else if (ClientDataHolderVR.getInstance().climbTracker.isClaws(itemStack)) { - k = this.makeColor(1, 130, 0, 75); + else if (dh.climbTracker.isClaws(itemStack)) { + k = 0x0182004B; // 0xAARRGGBB } else if (TelescopeTracker.isLegacyTelescope(itemStack)) { - k = this.makeColor(1, 190, 110, 135); + k = 0x01BE6E87; // 0xAARRGGBB } } - private int makeColor(int a, int r, int g, int b) { - return a << 24 | r << 16 | g << 8 | b; - } - } diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/PlayerRendererMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/PlayerRendererMixin.java index c7da60eb8..4a75adaac 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/PlayerRendererMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/PlayerRendererMixin.java @@ -1,28 +1,31 @@ package org.vivecraft.mixin.client.renderer.entity; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.extensions.EntityRenderDispatcherExtension; +import org.vivecraft.client.extensions.RenderLayerExtension; +import org.vivecraft.client.utils.RenderLayerTypes.LayerType; + import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.entity.RenderLayerParent; -import net.minecraft.client.renderer.entity.layers.*; +import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.world.entity.LivingEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.vivecraft.client.extensions.EntityRenderDispatcherExtension; -import org.vivecraft.client.extensions.RenderLayerExtension; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client.utils.RenderLayerTypes; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import static org.vivecraft.client.utils.RenderLayerTypes.LayerType.*; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; /** * A hacky way of copying regular PlayerRenderer layers to the VRPlayerRenderers @@ -34,7 +37,7 @@ public abstract class PlayerRendererMixin> extends LivingEntityRenderer { // dummy constructor - public PlayerRendererMixin(EntityRendererProvider.Context context, M entityModel, float f) { + public PlayerRendererMixin(Context context, M entityModel, float f) { super(context, entityModel, f); } @@ -43,11 +46,11 @@ public boolean addLayer(RenderLayer renderLayer) { // check if the layer gets added from the PlayerRenderer, we don't want to copy, if we add it to the VRPlayerRenderer // also check that the VRPlayerRenderers were created, this method also gets called in the constructor, // those default Layers already are added to the VRPlayerRenderer there - if ((Object)this.getClass() == PlayerRenderer.class && !((EntityRenderDispatcherExtension) Minecraft.getInstance().getEntityRenderDispatcher()).getSkinMapVRSeated().isEmpty()) { + if ((Object)this.getClass() == PlayerRenderer.class && !((EntityRenderDispatcherExtension) mc.getEntityRenderDispatcher()).getSkinMapVRSeated().isEmpty()) { // try to find a suitable constructor, so we can create a new Object without issues Constructor constructor = null; - RenderLayerTypes.LayerType type = OTHER; + LayerType type = OTHER; for (Constructor c : renderLayer.getClass().getConstructors()) { if (c.getParameterCount() == 1 && RenderLayerParent.class.isAssignableFrom(c.getParameterTypes()[0])) { @@ -72,21 +75,21 @@ public boolean addLayer(RenderLayer renderLayer) { // if no suitable constructor was found, use do a basic Object.clone call, and replace the parent of the copy if (constructor == null) { // do a hacky clone, and replace parent - if (((PlayerModel) model).slim) { - addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVRSeated().get("slim")); - addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVR().get("slim")); + if (((PlayerModel)this.model).slim) { + this.addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVRSeated().get("slim")); + this.addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVR().get("slim")); } else { - addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVRSeated().get("default")); - addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVR().get("default")); + this.addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVRSeated().get("default")); + this.addLayerClone(renderLayer, (LivingEntityRenderer) ((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVR().get("default")); } } else { // make a new instance with the vr model as parent - if (((PlayerModel) model).slim) { - addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVRSeated().get("slim")); - addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVR().get("slim")); + if (((PlayerModel)this.model).slim) { + this.addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVRSeated().get("slim")); + this.addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVR().get("slim")); } else { - addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVRSeated().get("default")); - addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension) entityRenderDispatcher).getSkinMapVR().get("default")); + this.addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVRSeated().get("default")); + this.addLayerConstructor(constructor, type, (LivingEntityRenderer)((EntityRenderDispatcherExtension)this.entityRenderDispatcher).getSkinMapVR().get("default")); } } } @@ -99,7 +102,7 @@ public boolean addLayer(RenderLayer renderLayer) { @Unique private void addLayerClone(RenderLayer renderLayer, LivingEntityRenderer target){ try { - VRSettings.logger.warn("Copying layer: {} with Object.copy, this could cause issues", renderLayer.getClass()); + logger.warn("Copying layer: {} with Object.copy, this could cause issues", renderLayer.getClass()); RenderLayer newLayer = (RenderLayer)((RenderLayerExtension) renderLayer).clone(); newLayer.renderer = target; target.addLayer(newLayer); @@ -112,20 +115,27 @@ private void addLayerClone(RenderLayer renderLayer, LivingEntityRenderer constructor, RenderLayerTypes.LayerType type, LivingEntityRenderer target){ + private void addLayerConstructor(Constructor constructor, LayerType type, LivingEntityRenderer target){ try { switch (type) { case PARENT_ONLY -> target.addLayer((RenderLayer) constructor.newInstance(target)); - case PARENT_MODELSET -> target.addLayer((RenderLayer) constructor.newInstance(target, Minecraft.getInstance().getEntityModels())); + case PARENT_MODELSET -> target.addLayer((RenderLayer) constructor.newInstance(target, mc.getEntityModels())); case PARENT_MODEL_MODEL -> { - if (((PlayerModel) model).slim) { - target.addLayer((RenderLayer) constructor.newInstance(target, - new HumanoidModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.PLAYER_SLIM_INNER_ARMOR)), - new HumanoidModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.PLAYER_SLIM_OUTER_ARMOR)))); - } else { - target.addLayer((RenderLayer) constructor.newInstance(target, - new HumanoidModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), - new HumanoidModel(Minecraft.getInstance().getEntityModels().bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)))); + if (((PlayerModel)this.model).slim) + { + target.addLayer((RenderLayer) constructor.newInstance( + target, + new HumanoidModel(mc.getEntityModels().bakeLayer(ModelLayers.PLAYER_SLIM_INNER_ARMOR)), + new HumanoidModel(mc.getEntityModels().bakeLayer(ModelLayers.PLAYER_SLIM_OUTER_ARMOR)) + )); + } + else + { + target.addLayer((RenderLayer) constructor.newInstance( + target, + new HumanoidModel(mc.getEntityModels().bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), + new HumanoidModel(mc.getEntityModels().bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)) + )); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/layers/RenderLayerMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/layers/RenderLayerMixin.java index 5ffda0873..10a0bfa96 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/layers/RenderLayerMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/layers/RenderLayerMixin.java @@ -1,10 +1,12 @@ package org.vivecraft.mixin.client.renderer.entity.layers; +import org.vivecraft.client.extensions.RenderLayerExtension; + import net.minecraft.client.model.EntityModel; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.world.entity.Entity; + import org.spongepowered.asm.mixin.Mixin; -import org.vivecraft.client.extensions.RenderLayerExtension; /** * part of the hacky way, to copy RenderLayers from the regular PlayerRenderer, to the VRPlayerRenderer diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/ClientBrandRetrieverVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/ClientBrandRetrieverVRMixin.java index 933eb4796..21be10b6a 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/ClientBrandRetrieverVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/ClientBrandRetrieverVRMixin.java @@ -1,17 +1,19 @@ package org.vivecraft.mixin.client_vr; import net.minecraft.client.ClientBrandRetriever; + +import static org.vivecraft.client_vr.VRState.vrEnabled; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; @Mixin(ClientBrandRetriever.class) public class ClientBrandRetrieverVRMixin { @Inject(at = @At("RETURN"), method = "getClientModName", remap = false, cancellable = true) private static void vivecraftClientBrand(CallbackInfoReturnable cir) { - if (VRState.vrEnabled) { + if (vrEnabled) { cir.setReturnValue("vivecraft"); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardHandlerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardHandlerVRMixin.java index 8cfcc21e3..9d398dca0 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardHandlerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardHandlerVRMixin.java @@ -1,49 +1,49 @@ package org.vivecraft.mixin.client_vr; -import net.minecraft.client.Screenshot; -import org.lwjgl.glfw.GLFW; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.MethodHolder; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; +import org.vivecraft.client_vr.settings.VRHotkeys; + import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.KeyboardHandler; -import net.minecraft.client.Minecraft; + +import net.minecraft.client.Screenshot; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import org.spongepowered.asm.mixin.Final; + +import java.io.File; +import java.util.function.Consumer; + +import static org.vivecraft.client_vr.VRState.*; + +import static org.lwjgl.glfw.GLFW.*; + 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.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; -import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.VRState; -import java.io.File; -import java.util.function.Consumer; - -@Mixin(KeyboardHandler.class) +@Mixin(net.minecraft.client.KeyboardHandler.class) public class KeyboardHandlerVRMixin { - @Final - @Shadow - private Minecraft minecraft; - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/KeyboardHandler;debugCrashKeyTime:J", ordinal = 0), method = "keyPress", cancellable = true) public void screenHandler(long l, int i, int j, int k, int m, CallbackInfo ci) { - if (i == 256 && k == 1) { - if (org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler.Showing) + if (i == GLFW_KEY_ESCAPE && k == GLFW_PRESS) + { + if (KeyboardHandler.isShowing()) { - org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler.setOverlayShowing(false); - if(this.minecraft.screen instanceof ChatScreen) { - minecraft.screen.onClose(); + KeyboardHandler.setOverlayShowing(false); + if(mc.screen instanceof ChatScreen) + { + mc.screen.onClose(); } ci.cancel(); } - if (RadialHandler.isShowing()) { + if (RadialHandler.isShowing()) + { RadialHandler.setOverlayShowing(false, null); ci.cancel(); } @@ -56,21 +56,21 @@ public void screenHandler(long l, int i, int j, int k, int m, CallbackInfo ci) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Screenshot;grab(Ljava/io/File;Lcom/mojang/blaze3d/pipeline/RenderTarget;Ljava/util/function/Consumer;)V"), method = "keyPress") public void noScreenshot(File file, RenderTarget renderTarget, Consumer consumer) { - if (!VRState.vrRunning) { + if (!vrRunning) { Screenshot.grab(file, renderTarget, consumer); } else { - ClientDataHolderVR.getInstance().grabScreenShot = true; + dh.grabScreenShot = true; } } //TODO really bad @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", ordinal = 2), method = "keyPress") - public Screen screenKey(Minecraft instance) { - return !MethodHolder.isKeyDown(GLFW.GLFW_KEY_RIGHT_CONTROL) ? instance.screen : null; + public Screen screenKey(net.minecraft.client.Minecraft instance) { + return !VRHotkeys.isKeyDown(GLFW_KEY_RIGHT_CONTROL) ? instance.screen : null; } - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Options;hideGui:Z", ordinal = 1, shift = At.Shift.AFTER), method = "keyPress") + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Options;hideGui:Z", ordinal = 1, shift = Shift.AFTER), method = "keyPress") public void saveHideGuiOptions(long l, int i, int j, int k, int m, CallbackInfo ci) { - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardInputVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardInputVRMixin.java index 5d559c3cb..8f63820dd 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardInputVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyboardInputVRMixin.java @@ -1,9 +1,15 @@ package org.vivecraft.mixin.client_vr; -import net.minecraft.client.Minecraft; -import net.minecraft.client.Options; -import net.minecraft.client.player.Input; -import net.minecraft.client.player.KeyboardInput; +import org.vivecraft.client.VivecraftVRMod; +import org.vivecraft.client.utils.Utils; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; + +import org.joml.Vector2f; + +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.client_vr.provider.openvr_lwjgl.control.VivecraftMovementInput.getMovementAxisValue; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -11,22 +17,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.common.utils.math.Vector2; - -import static org.vivecraft.client_vr.provider.openvr_lwjgl.control.VivecraftMovementInput.getMovementAxisValue; -@Mixin(KeyboardInput.class) -public class KeyboardInputVRMixin extends Input { +@Mixin(net.minecraft.client.player.KeyboardInput.class) +public class KeyboardInputVRMixin extends net.minecraft.client.player.Input { @Final @Shadow - private Options options; + private net.minecraft.client.Options options; @Unique private boolean autoSprintActive = false; @Unique @@ -43,7 +40,7 @@ private float axisToDigitalMovement(float value) { @Inject(method = "tick", at = @At("HEAD"), cancellable = true) public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } @@ -51,11 +48,9 @@ public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { this.leftImpulse = 0.0F; this.forwardImpulse = 0.0F; - Minecraft minecraft = Minecraft.getInstance(); - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - boolean climbing = dataholder.climbTracker.isClimbeyClimb() && !minecraft.player.isInWater() && dataholder.climbTracker.isGrabbingLadder(); + boolean climbing = dh.climbTracker.isClimbeyClimb() && !mc.player.isInWater() && dh.climbTracker.isGrabbingLadder(); - if (climbing || !this.options.keyUp.isDown() && !VivecraftVRMod.INSTANCE.keyTeleportFallback.isDown()) { + if (climbing || !this.options.keyUp.isDown() && !VivecraftVRMod.keyTeleportFallback.isDown()) { this.up = false; } else { ++this.forwardImpulse; @@ -86,33 +81,33 @@ public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { boolean flag1 = false; float f = 0.0F; - if (!climbing && !dataholder.vrSettings.seated && minecraft.screen == null && !KeyboardHandler.Showing) { - VRInputAction vrinputaction = dataholder.vr.getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveStrafe); - VRInputAction vrinputaction1 = dataholder.vr.getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveRotate); - Vector2 vector2 = vrinputaction.getAxis2DUseTracked(); - Vector2 vector21 = vrinputaction1.getAxis2DUseTracked(); + if (!climbing && !dh.vrSettings.seated && mc.screen == null && !KeyboardHandler.isShowing()) { + VRInputAction vrinputaction = dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveStrafe); + VRInputAction vrinputaction1 = dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveRotate); + Vector2f vector2 = vrinputaction.getAxis2DUseTracked(); + Vector2f vector21 = vrinputaction1.getAxis2DUseTracked(); - if (vector2.getX() == 0.0F && vector2.getY() == 0.0F) { - if (vector21.getY() != 0.0F) { + if (vector2.x() == 0.0F && vector2.y() == 0.0F) { + if (vector21.y() != 0.0F) { flag1 = true; - f = vector21.getY(); + f = vector21.y(); - if (dataholder.vrSettings.analogMovement) { - this.forwardImpulse = vector21.getY(); + if (dh.vrSettings.analogMovement) { + this.forwardImpulse = vector21.y(); this.leftImpulse = 0.0F; this.leftImpulse -= getMovementAxisValue(this.options.keyRight); this.leftImpulse += getMovementAxisValue(this.options.keyLeft); } else { - this.forwardImpulse = this.axisToDigitalMovement(vector21.getY()); + this.forwardImpulse = this.axisToDigitalMovement(vector21.y()); } - } else if (dataholder.vrSettings.analogMovement) { + } else if (dh.vrSettings.analogMovement) { flag1 = true; this.forwardImpulse = 0.0F; this.leftImpulse = 0.0F; float f1 = getMovementAxisValue(this.options.keyUp); if (f1 == 0.0F) { - f1 = getMovementAxisValue(VivecraftVRMod.INSTANCE.keyTeleportFallback); + f1 = getMovementAxisValue(VivecraftVRMod.keyTeleportFallback); } f = f1; @@ -126,14 +121,14 @@ public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { } } else { flag1 = true; - f = vector2.getY(); + f = vector2.y(); - if (dataholder.vrSettings.analogMovement) { - this.forwardImpulse = vector2.getY(); - this.leftImpulse = -vector2.getX(); + if (dh.vrSettings.analogMovement) { + this.forwardImpulse = vector2.y(); + this.leftImpulse = -vector2.x(); } else { - this.forwardImpulse = this.axisToDigitalMovement(vector2.getY()); - this.leftImpulse = this.axisToDigitalMovement(-vector2.getX()); + this.forwardImpulse = this.axisToDigitalMovement(vector2.y()); + this.leftImpulse = this.axisToDigitalMovement(-vector2.x()); } } @@ -148,13 +143,13 @@ public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { VRInputAction.setKeyBindState(this.options.keyLeft, this.left); VRInputAction.setKeyBindState(this.options.keyRight, this.right); - if (dataholder.vrSettings.autoSprint) { - if (f >= dataholder.vrSettings.autoSprintThreshold) { - minecraft.player.setSprinting(true); + if (dh.vrSettings.autoSprint) { + if (f >= dh.vrSettings.autoSprintThreshold) { + mc.player.setSprinting(true); this.autoSprintActive = true; this.forwardImpulse = 1.0F; - } else if (this.forwardImpulse > 0.0F && dataholder.vrSettings.analogMovement) { - this.forwardImpulse = this.forwardImpulse / dataholder.vrSettings.autoSprintThreshold * 1.0F; + } else if (this.forwardImpulse > 0.0F && dh.vrSettings.analogMovement) { + this.forwardImpulse = this.forwardImpulse / dh.vrSettings.autoSprintThreshold * 1.0F; } } } @@ -169,14 +164,14 @@ public void tick(boolean isSneaking, float sneakSpeed, CallbackInfo ci) { this.movementSetByAnalog = flag1; - if (this.autoSprintActive && f < dataholder.vrSettings.autoSprintThreshold) { - minecraft.player.setSprinting(false); + if (this.autoSprintActive && f < dh.vrSettings.autoSprintThreshold) { + mc.player.setSprinting(false); this.autoSprintActive = false; } - boolean flag2 = minecraft.screen == null && (dataholder.vrPlayer.getFreeMove() || dataholder.vrSettings.simulateFalling) && !climbing; + boolean flag2 = mc.screen == null && (dh.vrPlayer.getFreeMove() || dh.vrSettings.simulateFalling) && !climbing; this.jumping = this.options.keyJump.isDown() && flag2; - this.shiftKeyDown = (dataholder.sneakTracker.sneakCounter > 0 || dataholder.sneakTracker.sneakOverride || this.options.keyShift.isDown()) && minecraft.screen == null; + this.shiftKeyDown = (dh.sneakTracker.sneakCounter > 0 || dh.sneakTracker.sneakOverride || this.options.keyShift.isDown()) && mc.screen == null; if (isSneaking) { this.leftImpulse = (float) ((double) this.leftImpulse * sneakSpeed); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index eab18fb27..a4c8e3c2b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -1,6 +1,45 @@ package org.vivecraft.mixin.client_vr; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.VivecraftVRMod; +import org.vivecraft.client.Xevents; +import org.vivecraft.client.Xplat; +import org.vivecraft.client.extensions.RenderTargetExtension; +import org.vivecraft.client.gui.VivecraftClickEvent; +import org.vivecraft.client.gui.VivecraftClickEvent.VivecraftAction; +import org.vivecraft.client.gui.screens.ErrorScreen; +import org.vivecraft.client.gui.screens.UpdateScreen; +import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.client.utils.LangHelper; +import org.vivecraft.client.utils.UpdateChecker; +import org.vivecraft.client_vr.extensions.*; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; +import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; +import org.vivecraft.client_vr.menuworlds.MenuWorldDownloader; +import org.vivecraft.client_vr.menuworlds.MenuWorldExporter; +import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; +import org.vivecraft.client_vr.render.RenderConfigException; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; +import org.vivecraft.client_vr.render.VRShaders; +import org.vivecraft.client_vr.settings.VRHotkeys; +import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; +import org.vivecraft.client_xr.render_pass.RenderPassManager; +import org.vivecraft.client_xr.render_pass.WorldRenderPass; +import org.vivecraft.mod_compat_vr.iris.IrisHelper; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; +import org.vivecraft.mod_compat_vr.sodium.SodiumHelper; + +import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.lwjgl.opengl.GL11C; +import org.lwjgl.opengl.GL13C; + import com.mojang.blaze3d.pipeline.MainTarget; import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; @@ -10,10 +49,11 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexSorting; + import net.minecraft.ChatFormatting; import net.minecraft.Util; -import net.minecraft.client.*; import net.minecraft.client.Timer; +import net.minecraft.client.*; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; @@ -35,11 +75,11 @@ import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.HoverEvent.Action; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.util.FrameTimer; -import net.minecraft.util.Mth; import net.minecraft.util.profiling.ProfileResults; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.thread.ReentrantBlockableEventLoop; @@ -50,55 +90,6 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import org.joml.Matrix4f; -import org.lwjgl.glfw.GLFW; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.*; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client.gui.VivecraftClickEvent; -import org.vivecraft.client.gui.screens.UpdateScreen; -import org.vivecraft.client.utils.UpdateChecker; -import org.vivecraft.client_vr.extensions.*; -import org.vivecraft.client_vr.menuworlds.MenuWorldDownloader; -import org.vivecraft.client_vr.menuworlds.MenuWorldExporter; -import org.vivecraft.mod_compat_vr.iris.IrisHelper; -import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; -import org.vivecraft.mod_compat_vr.sodium.SodiumHelper; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client.extensions.RenderTargetExtension; -import org.vivecraft.client.Xevents; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.MethodHolder; -import org.vivecraft.client.Xplat; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; -import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; -import org.vivecraft.client.gui.screens.ErrorScreen; -import org.vivecraft.client_vr.provider.openvr_lwjgl.VRInputAction; -import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.client_vr.render.RenderConfigException; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; -import org.vivecraft.client_vr.render.VRShaders; -import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client.utils.LangHelper; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.client_xr.render_pass.RenderPassManager; -import org.vivecraft.client_xr.render_pass.WorldRenderPass; -import org.vivecraft.common.utils.math.Vector3; -//import org.vivecraft.provider.ovr_lwjgl.MC_OVR; -//import org.vivecraft.provider.ovr_lwjgl.OVR_StereoRenderer; -//import org.vivecraft.provider.ovr_lwjgl.OVR_StereoRenderer; import javax.annotation.Nullable; import java.io.File; @@ -108,6 +99,25 @@ import java.util.*; import java.util.concurrent.CompletableFuture; +import static org.vivecraft.client.utils.Utils.*; +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.forward; +import static org.vivecraft.common.utils.Utils.logger; + +import static java.lang.Math.pow; +import static org.joml.Math.*; +import static org.lwjgl.glfw.GLFW.*; + +import static org.objectweb.asm.Opcodes.PUTFIELD; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + @Mixin(Minecraft.class) public abstract class MinecraftVRMixin extends ReentrantBlockableEventLoop implements WindowEventHandler, MinecraftExtension { @@ -138,17 +148,11 @@ public MinecraftVRMixin(String string) { @Unique private long currentNanoTime; - @Shadow - protected int missTime; - @Final @Shadow public Gui gui; - @Shadow @Final - public File gameDirectory; - @Shadow public Options options; @@ -274,9 +278,6 @@ public MinecraftVRMixin(String string) { @Final private EntityRenderDispatcher entityRenderDispatcher; - @Shadow - protected abstract boolean startAttack(); - @Shadow public abstract RenderTarget getMainRenderTarget(); @@ -294,23 +295,32 @@ public MinecraftVRMixin(String string) { @Shadow public abstract IntegratedServer getSingleplayerServer(); + @Shadow static Minecraft instance; + + @Shadow public static Minecraft getInstance() { + return instance; + } + @Unique private List resourcepacks; @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setOverlay(Lnet/minecraft/client/gui/screens/Overlay;)V"), method = "", index = 0) public Overlay initVivecraft(Overlay overlay) { + mc = getInstance(); // Assign early during Vivecraft's initialization to ensure subsequent accesses are safe. RenderPassManager.INSTANCE = new RenderPassManager((MainTarget) this.getMainRenderTarget()); - VRSettings.initSettings((Minecraft) (Object) this, this.gameDirectory); + VRSettings.initSettings(); // register a resource reload listener, to reload the menu world - resourceManager.registerReloadListener((ResourceManagerReloadListener) resourceManager -> { + this.resourceManager.registerReloadListener((ResourceManagerReloadListener) resourceManager -> { List newPacks = resourceManager.listPacks().map(PackResources::packId).toList(); - if ((resourcepacks == null || !resourcepacks.equals(newPacks)) && - ClientDataHolderVR.getInstance().menuWorldRenderer != null - && ClientDataHolderVR.getInstance().menuWorldRenderer.isReady()) { - resourcepacks = newPacks; + if (!newPacks.equals(this.resourcepacks) && + dh.menuWorldRenderer != null && + dh.menuWorldRenderer.isReady() + ) + { + this.resourcepacks = newPacks; try { - ClientDataHolderVR.getInstance().menuWorldRenderer.destroy(); - ClientDataHolderVR.getInstance().menuWorldRenderer.prepare(); + dh.menuWorldRenderer.destroy(); + dh.menuWorldRenderer.prepare(); } catch (Exception exception) { exception.printStackTrace(); } @@ -327,25 +337,25 @@ public Overlay initVivecraft(Overlay overlay) { public void initVROnLaunch(CallbackInfo ci) { // init vr after resource loading try { - if (ClientDataHolderVR.getInstance().vrSettings.vrEnabled) { - VRState.vrEnabled = true; - VRState.vrRunning = true; - VRState.initializeVR(); + if (dh.vrSettings.vrEnabled) { + vrEnabled = true; + vrRunning = true; + initializeVR(); } } catch (Exception exception) { exception.printStackTrace(); } // set initial resourcepacks - resourcepacks = resourceManager.listPacks().map(PackResources::packId).toList(); + this.resourcepacks = this.resourceManager.listPacks().map(PackResources::packId).toList(); - if (OptifineHelper.isOptifineLoaded() && ClientDataHolderVR.getInstance().menuWorldRenderer != null && ClientDataHolderVR.getInstance().menuWorldRenderer.isReady()) { + if (OptifineHelper.isOptifineLoaded() && dh.menuWorldRenderer != null && dh.menuWorldRenderer.isReady()) { // with optifine this texture somehow fails to load, so manually reload it try { - textureManager.getTexture(Gui.GUI_ICONS_LOCATION).load(resourceManager); + this.textureManager.getTexture(Gui.GUI_ICONS_LOCATION).load(this.resourceManager); } catch (IOException e) { // if there was an error, just reload everything - reloadResourcePacks(); + this.reloadResourcePacks(); } } } @@ -354,51 +364,51 @@ public void initVROnLaunch(CallbackInfo ci) { public void destroy(CallbackInfo info) { try { // the game crashed probably not because of us, so keep the vr choice - VRState.destroyVR(false); + destroyVR(false); } catch (Exception ignored) { } } @Inject(at = @At("HEAD"), method = "runTick(Z)V", cancellable = true) public void replaceTick(boolean bl, CallbackInfo callback) { - if (VRState.vrEnabled) { - VRState.initializeVR(); - } else if (VRState.vrInitialized) { - VRState.destroyVR(true); - resizeDisplay(); + if (vrEnabled) { + initializeVR(); + } else if (vrInitialized) { + destroyVR(true); + this.resizeDisplay(); } - if (!VRState.vrInitialized) { + if (!vrInitialized) { return; } - boolean vrActive = !ClientDataHolderVR.getInstance().vrSettings.vrHotswitchingEnabled || ClientDataHolderVR.getInstance().vr.isActive(); - if (VRState.vrRunning != vrActive && (ClientNetworking.serverAllowsVrSwitching || player == null)) { - VRState.vrRunning = vrActive; + boolean vrActive = !dh.vrSettings.vrHotswitchingEnabled || dh.vr.isActive(); + if (vrRunning != vrActive && (ClientNetworking.serverAllowsVrSwitching || this.player == null)) { + vrRunning = vrActive; if (vrActive) { - if (player != null) { - ClientDataHolderVR.getInstance().vrPlayer.snapRoomOriginToPlayerEntity(player, false, false); + if (this.player != null) { + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); } // release mouse when switching to standing - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { - mouseHandler.releaseMouse(); - InputConstants.grabOrReleaseMouse(window.getWindow(), GLFW.GLFW_CURSOR_NORMAL, mouseHandler.xpos(), mouseHandler.ypos()); + if (!dh.vrSettings.seated) { + this.mouseHandler.releaseMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, this.mouseHandler.xpos(), this.mouseHandler.ypos()); } } else { GuiHandler.guiPos_room = null; GuiHandler.guiRotation_room = null; GuiHandler.guiScale = 1.0F; - if (player != null) { - VRPlayersClient.getInstance().disableVR(player.getUUID()); + if (this.player != null) { + VRPlayersClient.getInstance().disableVR(this.player.getUUID()); } - if (gameRenderer != null) { - gameRenderer.checkEntityPostEffect(this.options.getCameraType().isFirstPerson() ? this.getCameraEntity() : null); + if (this.gameRenderer != null) { + this.gameRenderer.checkEntityPostEffect(this.options.getCameraType().isFirstPerson() ? this.getCameraEntity() : null); } // grab/release mouse - if (screen != null || level == null) { - mouseHandler.releaseMouse(); - InputConstants.grabOrReleaseMouse(window.getWindow(), GLFW.GLFW_CURSOR_NORMAL, mouseHandler.xpos(), mouseHandler.ypos()); + if (this.screen != null || this.level == null) { + this.mouseHandler.releaseMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, this.mouseHandler.xpos(), this.mouseHandler.ypos()); } else { - mouseHandler.grabMouse(); - InputConstants.grabOrReleaseMouse(window.getWindow(), GLFW.GLFW_CURSOR_DISABLED, mouseHandler.xpos(), mouseHandler.ypos()); + this.mouseHandler.grabMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_DISABLED, this.mouseHandler.xpos(), this.mouseHandler.ypos()); } } var connection = this.getConnection(); @@ -406,12 +416,12 @@ public void replaceTick(boolean bl, CallbackInfo callback) { connection.send(ClientNetworking.createVRActivePacket(vrActive)); } // reload sound manager, to toggle HRTF between VR and NONVR one - if (!Minecraft.getInstance().getSoundManager().getAvailableSounds().isEmpty()) { - Minecraft.getInstance().getSoundManager().reload(); + if (!instance.getSoundManager().getAvailableSounds().isEmpty()) { + instance.getSoundManager().reload(); } - resizeDisplay(); + this.resizeDisplay(); } - if (!VRState.vrRunning) { + if (!vrRunning) { return; } if (SodiumHelper.isLoaded()) { @@ -430,7 +440,7 @@ public void replaceTick(boolean bl, CallbackInfo callback) { // the VR runtime handles the frame limit, no need to manually limit it 60fps @ModifyConstant(constant = @Constant(longValue = 16), method = "doWorldLoad", expect = 0) private long noWaitOnLevelLoadFabric(long constant) { - if (VRState.vrRunning) { + if (vrRunning) { return 0L; } return constant; @@ -439,7 +449,7 @@ private long noWaitOnLevelLoadFabric(long constant) { //Replaces normal runTick public void newRunTick(boolean bl) { - currentNanoTime = Util.getNanos(); + this.currentNanoTime = Util.getNanos(); // v this.profiler.push("setupRenderConfiguration"); @@ -453,13 +463,13 @@ public void newRunTick(boolean bl) { // PoseStack i = RenderSystem.getModelViewStack(); // i.pushPose(); // RenderSystem.applyModelViewMatrix(); -// RenderSystem.clear(16640, ON_OSX); +// RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); // this.mainRenderTarget.bindWrite(true); // v try { this.checkGLError("pre render setup "); - ClientDataHolderVR.getInstance().vrRenderer.setupRenderConfiguration(); + dh.vrRenderer.setupRenderConfiguration(); this.checkGLError("post render setup "); } catch (Exception exception1) { exception1.printStackTrace(); @@ -467,7 +477,7 @@ public void newRunTick(boolean bl) { float f = this.pause ? this.pausePartialTick : this.timer.partialTick; this.profiler.popPush("preRender"); - ClientDataHolderVR.getInstance().vrPlayer.preRender(f); + dh.vrPlayer.preRender(f); this.profiler.popPush("2D"); // @@ -500,7 +510,7 @@ public void newRunTick(boolean bl) { RenderSystem.depthMask(true); RenderSystem.colorMask(true, true, true, true); this.mainRenderTarget = GuiHandler.guiFramebuffer; - this.mainRenderTarget.clear(Minecraft.ON_OSX); + this.mainRenderTarget.clear(ON_OSX); this.mainRenderTarget.bindWrite(true); // draw screen/gui to buffer @@ -509,40 +519,40 @@ public void newRunTick(boolean bl) { // only draw the gui when the level was rendered once, since some mods expect that ((GameRendererExtension) this.gameRenderer).setShouldDrawGui(bl && this.entityRenderDispatcher.camera != null); - this.gameRenderer.render(f, currentNanoTime, false); + this.gameRenderer.render(f, this.currentNanoTime, false); // draw cursor - if (Minecraft.getInstance().screen != null) { + if (instance.screen != null) { PoseStack poseStack = RenderSystem.getModelViewStack(); poseStack.pushPose(); poseStack.setIdentity(); - poseStack.translate(0.0f, 0.0f, -2000.0f); + poseStack.last().pose().translate(0.0F, 0.0F, -2000.0F); RenderSystem.applyModelViewMatrix(); - int x = (int) (Minecraft.getInstance().mouseHandler.xpos() * (double) Minecraft.getInstance().getWindow().getGuiScaledWidth() / (double) Minecraft.getInstance().getWindow().getScreenWidth()); - int y = (int) (Minecraft.getInstance().mouseHandler.ypos() * (double) Minecraft.getInstance().getWindow().getGuiScaledHeight() / (double) Minecraft.getInstance().getWindow().getScreenHeight()); - ((GuiExtension) Minecraft.getInstance().gui).drawMouseMenuQuad(x, y); + int x = (int) (instance.mouseHandler.xpos() * instance.getWindow().getGuiScaledWidth() / instance.getWindow().getScreenWidth()); + int y = (int) (instance.mouseHandler.ypos() * instance.getWindow().getGuiScaledHeight() / instance.getWindow().getScreenHeight()); + ((GuiExtension) instance.gui).drawMouseMenuQuad(x, y); poseStack.popPose(); RenderSystem.applyModelViewMatrix(); } // draw debug pie - drawProfiler(); + this.drawProfiler(); RenderSystem.getModelViewStack().popPose(); RenderSystem.applyModelViewMatrix(); // generate mipmaps // TODO: does this do anything? - mainRenderTarget.bindRead(); - ((RenderTargetExtension) mainRenderTarget).genMipMaps(); - mainRenderTarget.unbindRead(); + this.mainRenderTarget.bindRead(); + ((RenderTargetExtension) this.mainRenderTarget).genMipMaps(); + this.mainRenderTarget.unbindRead(); this.profiler.popPush("2D Keyboard"); - GuiGraphics guiGraphics = new GuiGraphics((Minecraft) (Object)this, renderBuffers.bufferSource()); - if (KeyboardHandler.Showing - && !ClientDataHolderVR.getInstance().vrSettings.physicalKeyboard) { + GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); + if (KeyboardHandler.isShowing() + && !dh.vrSettings.physicalKeyboard) { this.mainRenderTarget = KeyboardHandler.Framebuffer; - this.mainRenderTarget.clear(Minecraft.ON_OSX); + this.mainRenderTarget.clear(ON_OSX); this.mainRenderTarget.bindWrite(true); ((GameRendererExtension) this.gameRenderer).drawScreen(f, KeyboardHandler.UI, guiGraphics); @@ -565,7 +575,7 @@ public void newRunTick(boolean bl) { this.profiler.popPush("Radial Menu"); if (RadialHandler.isShowing()) { this.mainRenderTarget = RadialHandler.Framebuffer; - this.mainRenderTarget.clear(Minecraft.ON_OSX); + this.mainRenderTarget.clear(ON_OSX); this.mainRenderTarget.bindWrite(true); ((GameRendererExtension) this.gameRenderer).drawScreen(f, RadialHandler.UI, guiGraphics); guiGraphics.flush(); @@ -575,7 +585,7 @@ public void newRunTick(boolean bl) { this.checkGLError("post 2d "); VRHotkeys.updateMovingThirdPersonCam(); this.profiler.popPush("sound"); - ClientDataHolderVR.getInstance().currentPass = RenderPass.CENTER; + dh.currentPass = RenderPass.CENTER; this.soundManager.updateSource(this.gameRenderer.getMainCamera()); this.profiler.pop(); // @@ -585,11 +595,11 @@ public void newRunTick(boolean bl) { // } if (!this.noRender) { - List list = ClientDataHolderVR.getInstance().vrRenderer.getRenderPasses(); + List list = dh.vrRenderer.getRenderPasses(); - ClientDataHolderVR.getInstance().isFirstPass = true; + dh.isFirstPass = true; for (RenderPass renderpass : list) { - ClientDataHolderVR.getInstance().currentPass = renderpass; + dh.currentPass = renderpass; switch (renderpass) { case LEFT, RIGHT -> RenderPassManager.setWorldRenderPass(WorldRenderPass.stereoXR); @@ -600,49 +610,41 @@ public void newRunTick(boolean bl) { case CAMERA -> RenderPassManager.setWorldRenderPass(WorldRenderPass.camera); } - this.profiler.push("Eye:" + ClientDataHolderVR.getInstance().currentPass); + this.profiler.push("Eye:" + dh.currentPass); this.profiler.push("setup"); this.mainRenderTarget.bindWrite(true); this.profiler.pop(); - this.renderSingleView(renderpass, f, bl); + this.renderSingleView(f, bl); this.profiler.pop(); - if (ClientDataHolderVR.getInstance().grabScreenShot) { - boolean flag; - - if (list.contains(RenderPass.CAMERA)) { - flag = renderpass == RenderPass.CAMERA; - } else if (list.contains(RenderPass.CENTER)) { - flag = renderpass == RenderPass.CENTER; - } else { - flag = ClientDataHolderVR.getInstance().vrSettings.displayMirrorLeftEye ? renderpass == RenderPass.LEFT - : renderpass == RenderPass.RIGHT; - } - - if (flag) { - RenderTarget rendertarget = this.mainRenderTarget; - - if (renderpass == RenderPass.CAMERA) { - rendertarget = ClientDataHolderVR.getInstance().vrRenderer.cameraFramebuffer; - } - - this.mainRenderTarget.unbindWrite(); - Utils.takeScreenshot(rendertarget); - this.window.updateDisplay(); - ClientDataHolderVR.getInstance().grabScreenShot = false; + if (dh.grabScreenShot && + switch(renderpass){ + case CAMERA, CENTER -> list.contains(renderpass); + case LEFT -> dh.vrSettings.displayMirrorLeftEye; + case RIGHT -> !dh.vrSettings.displayMirrorLeftEye; + default -> false; } + ) + { + this.mainRenderTarget.unbindWrite(); + takeScreenshot(renderpass == RenderPass.CAMERA ? + dh.vrRenderer.cameraFramebuffer : + this.mainRenderTarget + ); + this.window.updateDisplay(); + dh.grabScreenShot = false; } - ClientDataHolderVR.getInstance().isFirstPass = false; + dh.isFirstPass = false; } - ClientDataHolderVR.getInstance().vrPlayer.postRender(f); + dh.vrPlayer.postRender(f); this.profiler.push("Display/Reproject"); try { - ClientDataHolderVR.getInstance().vrRenderer.endFrame(); + dh.vrRenderer.endFrame(); } catch (RenderConfigException exception) { - VRSettings.logger.error(exception.toString()); + logger.error(exception.toString()); } this.profiler.pop(); @@ -678,7 +680,7 @@ public void preRender(boolean tick) { runnable.run(); } - ++ClientDataHolderVR.getInstance().frameIndex; + ++dh.frameIndex; if (tick) { int i = this.timer.advanceTime(Util.getMillis()); @@ -687,11 +689,11 @@ public void preRender(boolean tick) { this.profiler.pop(); try { - ClientDataHolderVR.getInstance().vrRenderer.setupRenderConfiguration(); + dh.vrRenderer.setupRenderConfiguration(); } catch (RenderConfigException renderConfigException) { // TODO: could disabling VR here cause issues? - Minecraft.getInstance().setScreen(new ErrorScreen("VR Render Error", Component.translatable("vivecraft.messages.rendersetupfailed", renderConfigException.error + "\nVR provider: " + ClientDataHolderVR.getInstance().vr.getName()))); - VRState.destroyVR(true); + instance.setScreen(new ErrorScreen("VR Render Error", Component.translatable("vivecraft.messages.rendersetupfailed", renderConfigException.error + "\nVR provider: " + dh.vr.getName()))); + destroyVR(true); return; } catch (Exception exception2) { exception2.printStackTrace(); @@ -699,35 +701,35 @@ public void preRender(boolean tick) { RenderPassManager.setGUIRenderPass(); this.profiler.push("VR Poll/VSync"); - ClientDataHolderVR.getInstance().vr.poll(ClientDataHolderVR.getInstance().frameIndex); + dh.vr.poll(dh.frameIndex); this.profiler.pop(); - ClientDataHolderVR.getInstance().vrPlayer.postPoll(); + dh.vrPlayer.postPoll(); this.profiler.push("tick"); // reset camera position, if there is on, since it only gets set at the start of rendering, and the last renderpass can be anywhere - if (gameRenderer != null && gameRenderer.getMainCamera() != null) { - if (gameRenderer.getMainCamera().getEntity() != null) { - gameRenderer.getMainCamera().setPosition(gameRenderer.getMainCamera().getEntity().getEyePosition()); - } else if (player != null){ - gameRenderer.getMainCamera().setPosition(player.getEyePosition()); + if (this.gameRenderer != null && this.gameRenderer.getMainCamera() != null) { + if (this.gameRenderer.getMainCamera().getEntity() != null) { + this.gameRenderer.getMainCamera().setPosition(this.gameRenderer.getMainCamera().getEntity().getEyePosition()); + } else if (this.player != null){ + this.gameRenderer.getMainCamera().setPosition(this.player.getEyePosition()); } } - for (int j = 0; j < Math.min(10, i); ++j) { + for (int j = 0; j < min(10, i); ++j) { this.profiler.incrementCounter("clientTick"); - ClientDataHolderVR.getInstance().vrPlayer.preTick(); + dh.vrPlayer.preTick(); this.tick(); - ClientDataHolderVR.getInstance().vrPlayer.postTick(); + dh.vrPlayer.postTick(); } this.profiler.pop(); } else { RenderPassManager.setGUIRenderPass(); this.profiler.push("VR Poll/VSync"); - ClientDataHolderVR.getInstance().vr.poll(ClientDataHolderVR.getInstance().frameIndex); + dh.vr.poll(dh.frameIndex); this.profiler.pop(); - ClientDataHolderVR.getInstance().vrPlayer.postPoll(); + dh.vrPlayer.postPoll(); } } @@ -738,7 +740,7 @@ private void handleBadConfig(RenderConfigException renderconfigexception) { RenderSystem.viewport(0, 0, this.window.getScreenWidth(), this.window.getScreenHeight()); /*if (this.overlay != null) { - RenderSystem.clear(256, ON_OSX); + RenderSystem.clear(GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); Matrix4f matrix4f = new Matrix4f().setOrtho( 0, (float) (this.window.getScreenWidth() / this.window.getGuiScale()), (float) (this.window.getScreenHeight() / this.window.getGuiScale()), 0, 1000.0F, 3000.0F); @@ -747,14 +749,14 @@ private void handleBadConfig(RenderConfigException renderconfigexception) { p.translate(0, 0, -2000); this.overlay.render(p, 0, 0, 0.0F); } else */{ - if (MethodHolder.isKeyDown(GLFW.GLFW_KEY_Q)) { - System.out.println("Resetting VR status!"); + if (VRHotkeys.isKeyDown(GLFW_KEY_Q)) { + logger.warn("Resetting VR status!"); Path file = Xplat.getConfigPath("vivecraft-config.properties"); Properties properties = new Properties(); try { properties.load(Files.newInputStream(file)); - } catch (IOException e) { + } catch (IOException ignored) { } properties.setProperty("vrStatus", "false"); @@ -763,20 +765,20 @@ private void handleBadConfig(RenderConfigException renderconfigexception) { } catch (IOException e) { throw new RuntimeException(e); } - Minecraft.getInstance().stop(); + instance.stop(); } this.notifyMirror( LangHelper.get("vivecraft.messages.rendersetupfailed", renderconfigexception.error), true, 10000); this.drawNotifyMirror(); - if (ClientDataHolderVR.getInstance().frameIndex % 300L == 0L) { - System.out.println(renderconfigexception.title + " " + renderconfigexception.error); + if (dh.frameIndex % 300L == 0L) { + logger.error(renderconfigexception.title + " " + renderconfigexception.error); } try { Thread.sleep(10L); - } catch (InterruptedException interruptedexception) { + } catch (InterruptedException ignored) { } } @@ -791,8 +793,8 @@ public void postRender() { this.window.setErrorSection("Post render"); ++this.frames; boolean bl3 = this.hasSingleplayerServer() - && (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen()) - && !this.singleplayerServer.isPublished(); + && (this.screen != null && this.screen.isPauseScreen() || this.overlay != null && this.overlay.isPauseScreen()) + && !this.singleplayerServer.isPublished(); if (this.pause != bl3) { if (this.pause) { this.pausePartialTick = this.timer.partialTick; @@ -817,24 +819,26 @@ public void postRender() { // } while(Util.getMillis() >= this.lastTime + 1000L) { - String string; - if (this.gpuUtilization > 0.0) { - string = " GPU: " + (this.gpuUtilization > 100.0 ? ChatFormatting.RED + "100%" : Math.round(this.gpuUtilization) + "%"); - } else { - string = ""; - } + String string = (this.gpuUtilization > 0.0 ? + " GPU: " + (this.gpuUtilization > 100.0 ? ChatFormatting.RED + "100%" : round(this.gpuUtilization) + "%") : + "" + ); fps = this.frames; this.fpsString = String.format( - Locale.ROOT, - "%d fps T: %s%s%s%s B: %d%s", - fps, - k == 260 ? "inf" : k, - this.options.enableVsync().get() ? " vsync" : "", - this.options.graphicsMode().get(), - this.options.cloudStatus().get() == CloudStatus.OFF ? "" : (this.options.cloudStatus().get() == CloudStatus.FAST ? " fast-clouds" : " fancy-clouds"), - this.options.biomeBlendRadius().get(), - string + Locale.ROOT, + "%d fps T: %s%s%s%s B: %d%s", + fps, + k == 260 ? "inf" : k, + this.options.enableVsync().get() ? " vsync" : "", + this.options.graphicsMode().get(), + switch(this.options.cloudStatus().get()){ + case FAST -> " fast-clouds"; + case FANCY -> " fancy-clouds"; + default -> ""; // OFF + }, + this.options.biomeBlendRadius().get(), + string ); this.lastTime += 1000L; this.frames = 0; @@ -845,10 +849,10 @@ public void postRender() { @Inject(at = @At("HEAD"), method = "resizeDisplay") void restoreVanillaState(CallbackInfo ci) { - if (VRState.vrInitialized) { + if (vrInitialized) { // restore vanilla post chains before the resize, or it will resize the wrong ones - if (levelRenderer != null) { - ((LevelRendererExtension) levelRenderer).restoreVanillaPostChains(); + if (this.levelRenderer != null) { + ((LevelRendererExtension) this.levelRenderer).restoreVanillaPostChains(); } RenderPassManager.setVanillaRenderPass(); } @@ -857,7 +861,7 @@ void restoreVanillaState(CallbackInfo ci) { public void drawProfiler() { if (this.fpsPieResults != null) { this.profiler.push("fpsPie"); - GuiGraphics guiGraphics = new GuiGraphics((Minecraft)(Object) this, renderBuffers.bufferSource()); + GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); this.renderFpsMeter(guiGraphics, this.fpsPieResults); guiGraphics.flush(); this.profiler.pop(); @@ -866,7 +870,7 @@ public void drawProfiler() { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;swing(Lnet/minecraft/world/InteractionHand;)V"), method = "continueAttack(Z)V") public void swingArmContinueAttack(LocalPlayer player, InteractionHand hand) { - if (VRState.vrRunning) { + if (vrRunning) { ((PlayerExtension) player).swingArm(InteractionHand.MAIN_HAND, VRFirstPersonArmSwing.Attack); } else { player.swing(hand); @@ -875,28 +879,27 @@ public void swingArmContinueAttack(LocalPlayer player, InteractionHand hand) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;stopDestroyBlock()V"), method = "continueAttack(Z)V") public void destroyseated(MultiPlayerGameMode gm) { - if (!VRState.vrRunning || ClientDataHolderVR.getInstance().vrSettings.seated || lastClick) { + if (!vrRunning || dh.vrSettings.seated || this.lastClick) { this.gameMode.stopDestroyBlock(); - lastClick = false; + this.lastClick = false; } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;isDestroying()Z"), method = "startUseItem()V") public boolean seatedCheck(MultiPlayerGameMode gameMode) { - return gameMode.isDestroying() && (!VRState.vrRunning || ClientDataHolderVR.getInstance().vrSettings.seated); + return gameMode.isDestroying() && (!vrRunning || dh.vrSettings.seated); } - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;rightClickDelay:I", shift = Shift.AFTER, opcode = Opcodes.PUTFIELD), method = "startUseItem()V") + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;rightClickDelay:I", shift = Shift.AFTER, opcode = PUTFIELD), method = "startUseItem()V") public void breakDelay(CallbackInfo info) { - if (VRState.vrRunning) { - if (ClientDataHolderVR.getInstance().vrSettings.rightclickDelay == VRSettings.RightClickDelay.VANILLA) - this.rightClickDelay = 4; - else if (ClientDataHolderVR.getInstance().vrSettings.rightclickDelay == VRSettings.RightClickDelay.SLOW) - this.rightClickDelay = 6; - else if (ClientDataHolderVR.getInstance().vrSettings.rightclickDelay == VRSettings.RightClickDelay.SLOWER) - this.rightClickDelay = 8; - else if (ClientDataHolderVR.getInstance().vrSettings.rightclickDelay == VRSettings.RightClickDelay.SLOWEST) - this.rightClickDelay = 10; + if (vrRunning) { + switch(dh.vrSettings.rightclickDelay) + { + case SLOW -> this.rightClickDelay = 6; + case SLOWER -> this.rightClickDelay = 8; + case SLOWEST -> this.rightClickDelay = 10; + default -> this.rightClickDelay = 4; + } } } @@ -908,14 +911,14 @@ public ItemStack handItemStore(ItemStack itemInHand) { @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;hitResult:Lnet/minecraft/world/phys/HitResult;", ordinal = 1), method = "startUseItem", locals = LocalCapture.CAPTURE_FAILHARD) public void activeHandSend(CallbackInfo ci, InteractionHand[] var1, int var2, int var3, InteractionHand interactionHand) { - if (VRState.vrRunning && (ClientDataHolderVR.getInstance().vrSettings.seated || !TelescopeTracker.isTelescope(itemInHand))) { + if (vrRunning && (dh.vrSettings.seated || !TelescopeTracker.isTelescope(this.itemInHand))) { ClientNetworking.sendActiveHand((byte) interactionHand.ordinal()); } } @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;hitResult:Lnet/minecraft/world/phys/HitResult;", ordinal = 1), method = "startUseItem") public HitResult activeHand2(Minecraft instance) { - if (!VRState.vrRunning || ClientDataHolderVR.getInstance().vrSettings.seated || !TelescopeTracker.isTelescope(itemInHand)) { + if (!vrRunning || dh.vrSettings.seated || !TelescopeTracker.isTelescope(this.itemInHand)) { return instance.hitResult; } return null; @@ -924,7 +927,7 @@ public HitResult activeHand2(Minecraft instance) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;swing(Lnet/minecraft/world/InteractionHand;)V"), method = "startUseItem") public void swingUse(LocalPlayer instance, InteractionHand interactionHand) { - if (VRState.vrRunning) { + if (vrRunning) { ((PlayerExtension) instance).swingArm(interactionHand, VRFirstPersonArmSwing.Use); } else { instance.swing(interactionHand); @@ -933,69 +936,69 @@ public void swingUse(LocalPlayer instance, InteractionHand interactionHand) { @Inject(at = @At("HEAD"), method = "tick()V") public void vrTick(CallbackInfo info) { - ++ClientDataHolderVR.getInstance().tickCounter; + ++dh.tickCounter; // general chat notifications if (this.level != null) { - if (!ClientDataHolderVR.getInstance().showedUpdateNotification && UpdateChecker.hasUpdate && (ClientDataHolderVR.getInstance().vrSettings.alwaysShowUpdates || !UpdateChecker.newestVersion.equals(ClientDataHolderVR.getInstance().vrSettings.lastUpdate))) { - ClientDataHolderVR.getInstance().vrSettings.lastUpdate = UpdateChecker.newestVersion; - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); - ClientDataHolderVR.getInstance().showedUpdateNotification = true; - this.gui.getChat().addMessage(Component.translatable("vivecraft.messages.updateAvailable", Component.literal(UpdateChecker.newestVersion).withStyle(ChatFormatting.ITALIC, ChatFormatting.GREEN)) + if (!dh.showedUpdateNotification && UpdateChecker.hasUpdate && (dh.vrSettings.alwaysShowUpdates || !UpdateChecker.newestVersion.equals(dh.vrSettings.lastUpdate))) { + dh.vrSettings.lastUpdate = UpdateChecker.newestVersion; + dh.vrSettings.saveOptions(); + dh.showedUpdateNotification = true; + message(Component.translatable("vivecraft.messages.updateAvailable", Component.literal(UpdateChecker.newestVersion).withStyle(ChatFormatting.ITALIC, ChatFormatting.GREEN)) .withStyle(style -> style - .withClickEvent(new VivecraftClickEvent(VivecraftClickEvent.VivecraftAction.OPEN_SCREEN, new UpdateScreen())) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("vivecraft.messages.click"))))); + .withClickEvent(new VivecraftClickEvent(VivecraftAction.OPEN_SCREEN, new UpdateScreen())) + .withHoverEvent(new HoverEvent(Action.SHOW_TEXT, Component.translatable("vivecraft.messages.click"))))); } } // VR enabled only chat notifications - if (VRState.vrInitialized && this.level != null && ClientDataHolderVR.getInstance().vrPlayer != null) { - if (ClientDataHolderVR.getInstance().vrPlayer.chatWarningTimer >= 0 && --ClientDataHolderVR.getInstance().vrPlayer.chatWarningTimer == 0) { - boolean showMessage = !ClientNetworking.displayedChatWarning || ClientDataHolderVR.getInstance().vrSettings.showServerPluginMissingMessageAlways; + if (vrInitialized && this.level != null && dh.vrPlayer != null) { + if (dh.vrPlayer.chatWarningTimer >= 0 && --dh.vrPlayer.chatWarningTimer == 0) { + boolean showMessage = !ClientNetworking.displayedChatWarning || dh.vrSettings.showServerPluginMissingMessageAlways; - if (ClientDataHolderVR.getInstance().vrPlayer.teleportWarning) { + if (dh.vrPlayer.teleportWarning) { if(showMessage) - this.gui.getChat().addMessage(Component.translatable("vivecraft.messages.noserverplugin")); - ClientDataHolderVR.getInstance().vrPlayer.teleportWarning = false; + message(Component.translatable("vivecraft.messages.noserverplugin")); + dh.vrPlayer.teleportWarning = false; // allow vr switching on vanilla server ClientNetworking.serverAllowsVrSwitching = true; } - if (ClientDataHolderVR.getInstance().vrPlayer.vrSwitchWarning) { + if (dh.vrPlayer.vrSwitchWarning) { if (showMessage) - this.gui.getChat().addMessage(Component.translatable("vivecraft.messages.novrhotswitchinglegacy")); - ClientDataHolderVR.getInstance().vrPlayer.vrSwitchWarning = false; + message(Component.translatable("vivecraft.messages.novrhotswitchinglegacy")); + dh.vrPlayer.vrSwitchWarning = false; } ClientNetworking.displayedChatWarning = true; } } - if (VRState.vrRunning) { + if (vrRunning) { - if (ClientDataHolderVR.getInstance().menuWorldRenderer.isReady()) { + if (dh.menuWorldRenderer.isReady()) { // update textures in the menu if (this.level == null) { this.textureManager.tick(); } - ClientDataHolderVR.getInstance().menuWorldRenderer.tick(); + dh.menuWorldRenderer.tick(); } this.profiler.push("vrProcessInputs"); - ClientDataHolderVR.getInstance().vr.processInputs(); - ClientDataHolderVR.getInstance().vr.processBindings(); + dh.vr.processInputs(); + dh.vr.processBindings(); this.profiler.popPush("vrInputActionsTick"); - for (VRInputAction vrinputaction : ClientDataHolderVR.getInstance().vr.getInputActions()) { + for (VRInputAction vrinputaction : dh.vr.getInputActions()) { vrinputaction.tick(); } - if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY || ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) { + if (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY || dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON) { VRHotkeys.handleMRKeys(); } - if (this.level != null && ClientDataHolderVR.getInstance().vrPlayer != null) { - ClientDataHolderVR.getInstance().vrPlayer.updateFreeMove(); + if (this.level != null && dh.vrPlayer != null) { + dh.vrPlayer.updateFreeMove(); } this.profiler.pop(); } @@ -1004,59 +1007,54 @@ public void vrTick(CallbackInfo info) { VRPlayersClient.getInstance().tick(); - if (VivecraftVRMod.INSTANCE.keyExportWorld.consumeClick() && level != null && player != null) + if (VivecraftVRMod.keyExportWorld.consumeClick() && this.level != null && this.player != null) { Throwable error = null; try { - final BlockPos blockpos = player.blockPosition(); + final BlockPos blockpos = this.player.blockPosition(); int size = 320; int offset = size/2; File file1 = new File(MenuWorldDownloader.customWorldFolder); file1.mkdirs(); int i = 0; - - while (true) - { - final File file2 = new File(file1, "world" + i + ".mmw"); - - if (!file2.exists()) + for (File fileChecked = new File(file1, "world" + i + ".mmw"); + !fileChecked.exists(); + fileChecked = new File(file1, "world" + (++i) + ".mmw") + ){ + final File file2 = fileChecked; + logger.info("Exporting world... area size: " + size); + logger.info("Saving to " + file2.getAbsolutePath()); + + if (this.isLocalServer()) { - VRSettings.logger.info("Exporting world... area size: " + size); - VRSettings.logger.info("Saving to " + file2.getAbsolutePath()); - - if (isLocalServer()) - { - final Level level = getSingleplayerServer().getLevel(player.level().dimension()); - CompletableFuture completablefuture = getSingleplayerServer().submit(() -> { - try - { - MenuWorldExporter.saveAreaToFile(level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); - } - catch (Throwable throwable) - { - throwable.printStackTrace(); - return throwable; - } - return null; - }); - - error = completablefuture.get(); - } - else - { - MenuWorldExporter.saveAreaToFile(level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); - gui.getChat().addMessage(Component.translatable("vivecraft.messages.menuworldexportclientwarning")); - } - - if (error == null) { - gui.getChat().addMessage(Component.translatable("vivecraft.messages.menuworldexportcomplete.1", size)); - gui.getChat().addMessage(Component.translatable("vivecraft.messages.menuworldexportcomplete.2", file2.getAbsolutePath())); - } - break; + final Level level = this.getSingleplayerServer().getLevel(this.player.level().dimension()); + CompletableFuture completablefuture = this.getSingleplayerServer().submit(() -> { + try + { + MenuWorldExporter.saveAreaToFile(level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return throwable; + } + return null; + }); + + error = completablefuture.get(); + } + else + { + MenuWorldExporter.saveAreaToFile(this.level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); + message(Component.translatable("vivecraft.messages.menuworldexportclientwarning")); } - ++i; + if (error == null) + { + message(Component.translatable("vivecraft.messages.menuworldexportcomplete.1", size)); + message(Component.translatable("vivecraft.messages.menuworldexportcomplete.2", file2.getAbsolutePath())); + } } } catch (Throwable throwable) @@ -1065,7 +1063,7 @@ public void vrTick(CallbackInfo info) { error = throwable; } finally { if (error != null) { - gui.getChat().addMessage(Component.translatable("vivecraft.messages.menuworldexporterror", error.getMessage())); + message(Component.translatable("vivecraft.messages.menuworldexporterror", error.getMessage())); } } } @@ -1075,16 +1073,16 @@ public void vrTick(CallbackInfo info) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;pick(F)V"), method = "tick") public void removePick(GameRenderer instance, float f) { - if (!VRState.vrRunning) { + if (!vrRunning) { instance.pick(f); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Options;setCameraType(Lnet/minecraft/client/CameraType;)V"), method = "handleKeybinds") public void vrMirrorOption(Options instance, CameraType cameraType) { - if (VRState.vrRunning) { - ClientDataHolderVR.getInstance().vrSettings.setOptionValue(VRSettings.VrOptions.MIRROR_DISPLAY); - this.notifyMirror(ClientDataHolderVR.getInstance().vrSettings.getButtonDisplayString(VRSettings.VrOptions.MIRROR_DISPLAY), false, 3000); + if (vrRunning) { + dh.vrSettings.setOptionValue(VrOptions.MIRROR_DISPLAY); + this.notifyMirror(dh.vrSettings.getButtonDisplayString(VrOptions.MIRROR_DISPLAY), false, 3000); // this.levelRenderer.needsUpdate(); } else { instance.setCameraType(cameraType); @@ -1093,15 +1091,15 @@ public void vrMirrorOption(Options instance, CameraType cameraType) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;checkEntityPostEffect(Lnet/minecraft/world/entity/Entity;)V"), method = "handleKeybinds") public void noPosEffect(GameRenderer instance, Entity entity) { - if (!VRState.vrRunning) { + if (!vrRunning) { instance.checkEntityPostEffect(entity); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;swing(Lnet/minecraft/world/InteractionHand;)V"), method = "handleKeybinds()V") public void swingArmhandleKeybinds(LocalPlayer instance, InteractionHand interactionHand) { - if (VRState.vrRunning) { - ((PlayerExtension) player).swingArm(InteractionHand.MAIN_HAND, VRFirstPersonArmSwing.Attack); + if (vrRunning) { + ((PlayerExtension) this.player).swingArm(InteractionHand.MAIN_HAND, VRFirstPersonArmSwing.Attack); } else { instance.swing(interactionHand); } @@ -1109,12 +1107,12 @@ public void swingArmhandleKeybinds(LocalPlayer instance, InteractionHand interac @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyMapping;isDown()Z", ordinal = 2), method = "handleKeybinds") public boolean vrKeyuse(KeyMapping instance) { - return !(!instance.isDown() && (!VRState.vrRunning || ((!ClientDataHolderVR.getInstance().bowTracker.isActive(this.player) || ClientDataHolderVR.getInstance().vrSettings.seated) && !ClientDataHolderVR.getInstance().autoFood.isEating()))); + return !(!instance.isDown() && (!vrRunning || ((!dh.bowTracker.isActive() || dh.vrSettings.seated) && !dh.eatingTracker.isEating()))); } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;releaseUsingItem(Lnet/minecraft/world/entity/player/Player;)V", shift = Shift.BEFORE), method = "handleKeybinds") public void activeHand(CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { ClientNetworking.sendActiveHand((byte) this.player.getUsedItemHand().ordinal()); } } @@ -1127,17 +1125,17 @@ public void attackDown(CallbackInfo ci) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;isMouseGrabbed()Z"), method = "handleKeybinds") public boolean vrAlwaysGrapped(MouseHandler instance) { - return VRState.vrRunning || instance.isMouseGrabbed(); + return vrRunning || instance.isMouseGrabbed(); } @Inject(at = @At("HEAD"), method = "setLevel(Lnet/minecraft/client/multiplayer/ClientLevel;)V") public void roomScale(ClientLevel pLevelClient, CallbackInfo info) { - if (VRState.vrRunning) { - ClientDataHolderVR.getInstance().vrPlayer.setRoomOrigin(0.0D, 0.0D, 0.0D, true); + if (vrRunning) { + dh.vrPlayer.setRoomOrigin(0.0D, 0.0D, 0.0D, true); } } - @Inject(at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", shift = At.Shift.BEFORE, ordinal = 0), method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") + @Inject(at = @At(value = "FIELD", opcode = PUTFIELD, target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", shift = Shift.BEFORE, ordinal = 0), method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") public void onOpenScreen(Screen pGuiScreen, CallbackInfo info) { GuiHandler.onScreenChanged(this.screen, pGuiScreen, true); } @@ -1157,33 +1155,36 @@ public void onCloseScreen(Screen screen, CallbackInfo info) { private void drawNotifyMirror() { if (System.currentTimeMillis() < this.mirroNotifyStart + this.mirroNotifyLen) { RenderSystem.viewport(0, 0, this.window.getScreenWidth(), this.window.getScreenHeight()); - Matrix4f matrix4f = new Matrix4f().setOrtho(0.0F, (float) this.window.getScreenWidth(), - (float) this.window.getScreenHeight(), 0.0F, 1000.0F, 3000.0F); - RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.ORTHOGRAPHIC_Z); + RenderSystem.setProjectionMatrix(new Matrix4f().setOrtho( + 0.0F, + this.window.getScreenWidth(), + this.window.getScreenHeight(), + 0.0F, + 1000.0F, + 3000.0F + ), VertexSorting.ORTHOGRAPHIC_Z); RenderSystem.getModelViewStack().pushPose(); RenderSystem.getModelViewStack().setIdentity(); - RenderSystem.getModelViewStack().translate(0, 0, -2000); + RenderSystem.getModelViewStack().last().pose().translate(0.0F, 0.0F, -2000.0F); RenderSystem.applyModelViewMatrix(); - PoseStack p = new PoseStack(); - p.scale(3, 3, 3); - RenderSystem.clear(256, ON_OSX); + RenderSystem.clear(GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); if (this.mirrorNotifyClear) { RenderSystem.clearColor(0, 0, 0, 0); - RenderSystem.clear(16384, ON_OSX); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT, ON_OSX); } int i = this.window.getScreenWidth() / 22; ArrayList arraylist = new ArrayList<>(); if (this.mirrorNotifyText != null) { - Utils.wordWrap(this.mirrorNotifyText, i, arraylist); + wordWrap(this.mirrorNotifyText, i, arraylist); } int j = 1; int k = 12; - GuiGraphics guiGraphics = new GuiGraphics((Minecraft)(Object) this, renderBuffers.bufferSource()); + GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); for (String s : arraylist) { guiGraphics.drawString(this.font, s, 1, j, 16777215); j += 12; @@ -1196,7 +1197,7 @@ private void drawNotifyMirror() { @Override public void notifyMirror(String text, boolean clear, int lengthMs) { this.mirroNotifyStart = System.currentTimeMillis(); - this.mirroNotifyLen = (long) lengthMs; + this.mirroNotifyLen = lengthMs; this.mirrorNotifyText = text; this.mirrorNotifyClear = clear; } @@ -1209,305 +1210,331 @@ private void checkGLError(String string) { } - private void renderSingleView(RenderPass eye, float nano, boolean renderworld) { + private void renderSingleView(float nano, boolean renderworld) { RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 1.0F); - RenderSystem.clear(16384, ON_OSX); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT, ON_OSX); RenderSystem.enableDepthTest(); this.profiler.push("updateCameraAndRender"); - this.gameRenderer.render(nano, currentNanoTime, renderworld); + this.gameRenderer.render(nano, this.currentNanoTime, renderworld); this.profiler.pop(); - this.checkGLError("post game render " + eye.name()); + this.checkGLError("post game render " + dh.currentPass.name()); + switch(dh.currentPass){ + case LEFT, RIGHT -> + { + this.profiler.push("postprocesseye"); + RenderTarget rendertarget = this.mainRenderTarget; - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT - || ClientDataHolderVR.getInstance().currentPass == RenderPass.RIGHT) { - this.profiler.push("postprocesseye"); - RenderTarget rendertarget = this.mainRenderTarget; + if (dh.vrSettings.useFsaa) { + RenderSystem.clearColor(RenderSystem.getShaderFogColor()[0], RenderSystem.getShaderFogColor()[1], RenderSystem.getShaderFogColor()[2], RenderSystem.getShaderFogColor()[3]); + if (dh.currentPass == RenderPass.LEFT) { + dh.vrRenderer.framebufferEye0.bindWrite(true); + } else { + dh.vrRenderer.framebufferEye1.bindWrite(true); + } + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT, ON_OSX); + this.profiler.push("fsaa"); + // DataHolder.getInstance().vrRenderer.doFSAA(Config.isShaders()); TODO + dh.vrRenderer.doFSAA(false); + rendertarget = dh.vrRenderer.fsaaLastPassResultFBO; + this.checkGLError("fsaa " + dh.currentPass.name()); + this.profiler.pop(); + } - if (ClientDataHolderVR.getInstance().vrSettings.useFsaa) { - RenderSystem.clearColor(RenderSystem.getShaderFogColor()[0], RenderSystem.getShaderFogColor()[1], RenderSystem.getShaderFogColor()[2], RenderSystem.getShaderFogColor()[3]); - if (eye == RenderPass.LEFT) { - ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0.bindWrite(true); + if (dh.currentPass == RenderPass.LEFT) { + dh.vrRenderer.framebufferEye0.bindWrite(true); } else { - ClientDataHolderVR.getInstance().vrRenderer.framebufferEye1.bindWrite(true); + dh.vrRenderer.framebufferEye1.bindWrite(true); } - RenderSystem.clear(16384, ON_OSX); - this.profiler.push("fsaa"); - // DataHolder.getInstance().vrRenderer.doFSAA(Config.isShaders()); TODO - ClientDataHolderVR.getInstance().vrRenderer.doFSAA(false); - rendertarget = ClientDataHolderVR.getInstance().vrRenderer.fsaaLastPassResultFBO; - this.checkGLError("fsaa " + eye.name()); - this.profiler.pop(); - } - if (eye == RenderPass.LEFT) { - ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0.bindWrite(true); - } else { - ClientDataHolderVR.getInstance().vrRenderer.framebufferEye1.bindWrite(true); - } + if (dh.vrSettings.useFOVReduction && dh.vrPlayer.getFreeMove()) { + if ((this.player != null) && ((abs(this.player.zza) > 0.0F) || (abs(this.player.xxa) > 0.0F))) { + this.fov = (float) (this.fov - 0.05D); - if (ClientDataHolderVR.getInstance().vrSettings.useFOVReduction - && ClientDataHolderVR.getInstance().vrPlayer.getFreeMove()) { - if (this.player != null && (Math.abs(this.player.zza) > 0.0F || Math.abs(this.player.xxa) > 0.0F)) { - this.fov = (float) ((double) this.fov - 0.05D); + if (this.fov < dh.vrSettings.fovReductionMin) { + this.fov = dh.vrSettings.fovReductionMin; + } + } else { + this.fov = (float) (this.fov + 0.01D); - if (this.fov < ClientDataHolderVR.getInstance().vrSettings.fovReductionMin) { - this.fov = ClientDataHolderVR.getInstance().vrSettings.fovReductionMin; + if (this.fov > 0.8D) { + this.fov = 0.8F; + } } } else { - this.fov = (float) ((double) this.fov + 0.01D); - - if ((double) this.fov > 0.8D) { - this.fov = 0.8F; - } + this.fov = 1.0F; } - } else { - this.fov = 1.0F; - } - VRShaders._FOVReduction_OffsetUniform.set( - ClientDataHolderVR.getInstance().vrSettings.fovRedutioncOffset); - float red = 0.0F; - float black = 0.0F; - float blue = 0.0F; - float time = (float) Util.getMillis() / 1000.0F; - - if (this.player != null && this.level != null) { - if (((GameRendererExtension) this.gameRenderer) - .wasInWater() != ((GameRendererExtension) this.gameRenderer).isInWater()) { - ClientDataHolderVR.getInstance().watereffect = 2.3F; - } else { - if (((GameRendererExtension) this.gameRenderer).isInWater()) { - ClientDataHolderVR.getInstance().watereffect -= 0.008333334F; + VRShaders._FOVReduction_OffsetUniform.set(dh.vrSettings.fovRedutioncOffset); + float red = 0.0F; + float black = 0.0F; + float blue = 0.0F; + float time = Util.getMillis() / 1000.0F; + + if (this.player != null && this.level != null) { + GameRendererExtension GRE = (GameRendererExtension) this.gameRenderer; + if (GRE.wasInWater() != GRE.isInWater()) { + dh.watereffect = 2.3F; } else { - ClientDataHolderVR.getInstance().watereffect -= 0.016666668F; + if (GRE.isInWater()) { + dh.watereffect -= 0.008333334F; + } else { + dh.watereffect -= 0.016666668F; + } + + if (dh.watereffect < 0.0F) { + dh.watereffect = 0.0F; + } } - if (ClientDataHolderVR.getInstance().watereffect < 0.0F) { - ClientDataHolderVR.getInstance().watereffect = 0.0F; + GRE.setWasInWater(GRE.isInWater()); + + if (Xplat.isModLoaded("iris") || Xplat.isModLoaded("oculus")) { + if (!IrisHelper.hasWaterEffect()) { + dh.watereffect = 0.0F; + } } - } - ((GameRendererExtension) this.gameRenderer) - .setWasInWater(((GameRendererExtension) this.gameRenderer).isInWater()); + if (GRE.isInPortal()) { + dh.portaleffect = 1.0F; + } else { + dh.portaleffect -= 0.016666668F; - if (Xplat - .isModLoaded("iris") || Xplat.isModLoaded("oculus")) { - if (!IrisHelper.hasWaterEffect()) { - ClientDataHolderVR.getInstance().watereffect = 0.0F; + if (dh.portaleffect < 0.0F) { + dh.portaleffect = 0.0F; + } } - } - if (((GameRendererExtension) this.gameRenderer).isInPortal()) { - ClientDataHolderVR.getInstance().portaleffect = 1.0F; - } else { - ClientDataHolderVR.getInstance().portaleffect -= 0.016666668F; + ItemStack itemstack = this.player.getInventory().getArmor(3); - if (ClientDataHolderVR.getInstance().portaleffect < 0.0F) { - ClientDataHolderVR.getInstance().portaleffect = 0.0F; + if ((itemstack.getItem() == Blocks.CARVED_PUMPKIN.asItem()) + && (!itemstack.hasTag() || (itemstack.getTag().getInt("CustomModelData") == 0))) { + dh.pumpkineffect = 1.0F; + } else { + dh.pumpkineffect = 0.0F; } - } - ItemStack itemstack = this.player.getInventory().getArmor(3); + float hurtTimer = this.player.hurtTime - nano; + float healthpercent = 1.0F - (this.player.getHealth() / this.player.getMaxHealth()); + healthpercent = (healthpercent - 0.5F) * 0.75F; - if (itemstack.getItem() == Blocks.CARVED_PUMPKIN.asItem() - && (!itemstack.hasTag() || itemstack.getTag().getInt("CustomModelData") == 0)) { - ClientDataHolderVR.getInstance().pumpkineffect = 1.0F; - } else { - ClientDataHolderVR.getInstance().pumpkineffect = 0.0F; - } + if (hurtTimer > 0.0F) { // hurt flash + hurtTimer = hurtTimer / this.player.hurtDuration; + hurtTimer = fma((float)sin(pow(hurtTimer, 4) * PI), 0.5F, healthpercent); + red = hurtTimer; + } else if (dh.vrSettings.low_health_indicator) { // red due to low health + red = (float) (healthpercent * abs(sin((2.5F * time) / ((1.0F - healthpercent) + 0.1D)))); - float hurtTimer = (float) this.player.hurtTime - nano; - float healthpercent = 1.0F - this.player.getHealth() / this.player.getMaxHealth(); - healthpercent = (healthpercent - 0.5F) * 0.75F; - - if (hurtTimer > 0.0F) { // hurt flash - hurtTimer = hurtTimer / (float) this.player.hurtDuration; - hurtTimer = healthpercent - + Mth.sin(hurtTimer * hurtTimer * hurtTimer * hurtTimer * (float) Math.PI) * 0.5F; - red = hurtTimer; - } else if (ClientDataHolderVR.getInstance().vrSettings.low_health_indicator) { // red due to low health - red = (float) ((double) healthpercent - * Math.abs(Math.sin((double) (2.5F * time) / ((double) (1.0F - healthpercent) + 0.1D)))); - - if (this.player.isCreative()) { - red = 0.0F; + if (this.player.isCreative()) { + red = 0.0F; + } } - } - float freeze = this.player.getPercentFrozen(); - if (freeze > 0) { - blue = red; - blue = Math.max(freeze / 2, blue); - red = 0; - } + float freeze = this.player.getPercentFrozen(); + if (freeze > 0) { + blue = red; + blue = max(freeze / 2, blue); + red = 0; + } - if (this.player.isSleeping() && (double) black < 0.8D) { - black = 0.5F + 0.3F * this.player.getSleepTimer() * 0.01F; + if (this.player.isSleeping() && black < 0.8D) { + black = 0.5F + 0.3F * this.player.getSleepTimer() * 0.01F; + } + + if (dh.vr.isWalkingAbout && black < 0.8D) { + black = 0.5F; + } + } else { + dh.watereffect = 0.0F; + dh.portaleffect = 0.0F; + dh.pumpkineffect = 0.0F; } - if (ClientDataHolderVR.getInstance().vr.isWalkingAbout && (double) black < 0.8D) { - black = 0.5F; + if (dh.pumpkineffect > 0.0F) { + VRShaders._FOVReduction_RadiusUniform.set(0.3F); + VRShaders._FOVReduction_BorderUniform.set(0.0F); + } else { + VRShaders._FOVReduction_RadiusUniform.set(this.fov); + VRShaders._FOVReduction_BorderUniform.set(0.06F); } - } else { - ClientDataHolderVR.getInstance().watereffect = 0.0F; - ClientDataHolderVR.getInstance().portaleffect = 0.0F; - ClientDataHolderVR.getInstance().pumpkineffect = 0.0F; - } - if (ClientDataHolderVR.getInstance().pumpkineffect > 0.0F) { - VRShaders._FOVReduction_RadiusUniform.set(0.3F); - VRShaders._FOVReduction_BorderUniform.set(0.0F); - } else { - VRShaders._FOVReduction_RadiusUniform.set(this.fov); - VRShaders._FOVReduction_BorderUniform.set(0.06F); + VRShaders._Overlay_HealthAlpha.set(red); + VRShaders._Overlay_FreezeAlpha.set(blue); + VRShaders._Overlay_BlackAlpha.set(black); + VRShaders._Overlay_time.set(time); + VRShaders._Overlay_waterAmplitude.set(dh.watereffect); + VRShaders._Overlay_portalAmplitutde.set(dh.portaleffect); + VRShaders._Overlay_pumpkinAmplitutde.set(dh.pumpkineffect); + + VRShaders._Overlay_eye.set(dh.currentPass == RenderPass.LEFT ? 1 : -1); + ((RenderTargetExtension) rendertarget).blitFovReduction( + VRShaders.fovReductionShader, + dh.vrRenderer.framebufferEye0.viewWidth, + dh.vrRenderer.framebufferEye0.viewHeight + ); + GlStateManager._glUseProgram(0); + this.checkGLError("post overlay" + dh.currentPass); + this.profiler.pop(); + } + case CAMERA -> + { + this.profiler.push("cameracopy"); + dh.vrRenderer.cameraFramebuffer.bindWrite(true); + RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 1.0F); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); + ((RenderTargetExtension) dh.vrRenderer.cameraRenderFramebuffer).blitToScreen( + 0, + dh.vrRenderer.cameraFramebuffer.viewWidth, + dh.vrRenderer.cameraFramebuffer.viewHeight, + 0, + true, + 0.0F, + 0.0F, + false + ); + this.profiler.pop(); } - - VRShaders._Overlay_HealthAlpha.set(red); - VRShaders._Overlay_FreezeAlpha.set(blue); - VRShaders._Overlay_BlackAlpha.set(black); - VRShaders._Overlay_time.set(time); - VRShaders._Overlay_waterAmplitude.set(ClientDataHolderVR.getInstance().watereffect); - VRShaders._Overlay_portalAmplitutde.set(ClientDataHolderVR.getInstance().portaleffect); - VRShaders._Overlay_pumpkinAmplitutde.set( - ClientDataHolderVR.getInstance().pumpkineffect); - RenderPass renderpass = ClientDataHolderVR.getInstance().currentPass; - - VRShaders._Overlay_eye.set( - ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT ? 1 : -1); - ((RenderTargetExtension) rendertarget).blitFovReduction(VRShaders.fovReductionShader, ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0.viewWidth, - ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0.viewHeight); - GlStateManager._glUseProgram(0); - this.checkGLError("post overlay" + eye); - this.profiler.pop(); } - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.CAMERA) { - this.profiler.push("cameracopy"); - ClientDataHolderVR.getInstance().vrRenderer.cameraFramebuffer.bindWrite(true); - RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 1.0F); - RenderSystem.clear(16640, ON_OSX); - ((RenderTargetExtension) ClientDataHolderVR.getInstance().vrRenderer.cameraRenderFramebuffer).blitToScreen(0, - ClientDataHolderVR.getInstance().vrRenderer.cameraFramebuffer.viewWidth, - ClientDataHolderVR.getInstance().vrRenderer.cameraFramebuffer.viewHeight, 0, true, 0.0F, 0.0F, false); - this.profiler.pop(); - } } private void copyToMirror() { // TODO: fix mixed reality... again - if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.OFF - && ClientDataHolderVR.getInstance().vr.isHMDTracking()) { - this.notifyMirror("Mirror is OFF", true, 1000); - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { - if (VRShaders.depthMaskShader != null) { - this.doMixedRealityMirror(); - } else { - this.notifyMirror("Shader compile failed, see log", true, 10000); - } - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.DUAL) { - RenderTarget rendertarget = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0; - RenderTarget rendertarget1 = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye1; - - if (rendertarget != null) { - ((RenderTargetExtension) rendertarget).blitToScreen(0, this.window.getScreenWidth() / 2, - this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false); + int left = 0; + int width = this.window.getScreenWidth(); + int height = this.window.getScreenHeight(); + int top = 0; + boolean disableBlend = true; + float xCropFactor = 0.0F; + float yCropFactor = 0.0F; + boolean keepAspect = false; + RenderTarget source = switch (dh.vrSettings.displayMirrorMode) + { + case MIXED_REALITY -> + { + if (VRShaders.depthMaskShader != null) + { + this.doMixedRealityMirror(); + } + else + { + this.notifyMirror("Shader compile failed, see log", true, 10000); + } + yield null; } - - if (rendertarget1 != null) { - ((RenderTargetExtension) rendertarget1).blitToScreen(this.window.getScreenWidth() / 2, - this.window.getScreenWidth() / 2, this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false); + case DUAL -> + { + // run eye0 + width /= 2; + if (dh.vrRenderer.framebufferEye0 != null) + { + ((RenderTargetExtension)dh.vrRenderer.framebufferEye0).blitToScreen( + left, + width, + height, + top, + disableBlend, + xCropFactor, + yCropFactor, + keepAspect + ); + } + left = width; // setup for eye1 + yield dh.vrRenderer.framebufferEye1; } - } else { - float xcrop = 0.0F; - float ycrop = 0.0F; - boolean ar = false; - RenderTarget source = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0; - - if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.FIRST_PERSON) { - source = ClientDataHolderVR.getInstance().vrRenderer.framebufferUndistorted; - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON) { - source = ClientDataHolderVR.getInstance().vrRenderer.framebufferMR; - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.GUI) { - source = GuiHandler.guiFramebuffer; - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.SINGLE - || ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.OFF) { - if (!ClientDataHolderVR.getInstance().vrSettings.displayMirrorLeftEye) - source = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye1; - } else if (ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.CROPPED) { - if (!ClientDataHolderVR.getInstance().vrSettings.displayMirrorLeftEye) - source = ClientDataHolderVR.getInstance().vrRenderer.framebufferEye1; - - xcrop = 0.15F; - ycrop = 0.15F; - ar = true; + case FIRST_PERSON -> dh.vrRenderer.framebufferUndistorted; + case THIRD_PERSON -> dh.vrRenderer.framebufferMR; + case GUI -> GuiHandler.guiFramebuffer; + case OFF -> { + if (dh.vr.isHMDTracking()) + { + this.notifyMirror("Mirror is OFF", true, 1000); + } + yield (!dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + ); } - // Debug - // source = GuiHandler.guiFramebuffer; - // source = DataHolder.getInstance().vrRenderer.telescopeFramebufferR; - // - if (source != null) { - ((RenderTargetExtension) source).blitToScreen(0, this.window.getScreenWidth(), - this.window.getScreenHeight(), 0, true, xcrop, ycrop, ar); + case SINGLE -> (!dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + ); + case CROPPED -> + { + xCropFactor = 0.15F; + yCropFactor = 0.15F; + keepAspect = true; + yield (!dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + ); } + }; + // Debug + // source = GuiHandler.guiFramebuffer; + // source = DataHolder.getInstance().vrRenderer.telescopeFramebufferR; + // + if (source != null) + { + ((RenderTargetExtension)source).blitToScreen( + left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect + ); } } private void doMixedRealityMirror() { // boolean flag = Config.isShaders(); - boolean flag = false; - boolean flag1 = ClientDataHolderVR.getInstance().vrSettings.mixedRealityUnityLike - && ClientDataHolderVR.getInstance().vrSettings.mixedRealityAlphaMask; +// boolean flag = false; + boolean alphaMask = dh.vrSettings.mixedRealityUnityLike && dh.vrSettings.mixedRealityAlphaMask; - if (!flag1) { + if (!alphaMask) { RenderSystem.clearColor( - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getRed() / 255.0F, - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getGreen() / 255.0F, - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getBlue() / 255.0F, 1.0F); + dh.vrSettings.mixedRealityKeyColor.getR(), + dh.vrSettings.mixedRealityKeyColor.getG(), + dh.vrSettings.mixedRealityKeyColor.getB(), + 1.0F + ); } else { RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 1.0F); } - RenderSystem.clear(16640, ON_OSX); - Vec3 vec3 = ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getHeadPivot() - .subtract(ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); - Matrix4f matrix4f = ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD) - .getMatrix().transposed().toMCMatrix(); - Vector3 vector3 = ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix() - .transform(Vector3.forward()); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); + Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot() + .subtract(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); + Vector3f vector3 = new Vector3f().set(forward).mulProject(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix()); VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) this.gameRenderer).getThirdPassProjectionMatrix()); - VRShaders._DepthMask_viewMatrix.set(matrix4f); - VRShaders._DepthMask_hmdViewPosition.set((float) vec3.x, (float) vec3.y, - (float) vec3.z); - VRShaders._DepthMask_hmdPlaneNormal.set(-vector3.getX(), 0.0F, -vector3.getZ()); + VRShaders._DepthMask_viewMatrix.set(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix()); + VRShaders._DepthMask_hmdViewPosition.set((float) vec3.x, (float) vec3.y, (float) vec3.z); + VRShaders._DepthMask_hmdPlaneNormal.set(-vector3.x, 0.0F, -vector3.z); VRShaders._DepthMask_keyColorUniform.set( - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getRed() / 255.0F, - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getGreen() / 255.0F, - (float) ClientDataHolderVR.getInstance().vrSettings.mixedRealityKeyColor.getBlue() / 255.0F); - VRShaders._DepthMask_alphaModeUniform.set(flag1 ? 1 : 0); - RenderSystem.activeTexture(33985); - RenderSystem.setShaderTexture(0, ClientDataHolderVR.getInstance().vrRenderer.framebufferMR.getColorTextureId()); - RenderSystem.activeTexture(33986); + dh.vrSettings.mixedRealityKeyColor.getR(), + dh.vrSettings.mixedRealityKeyColor.getG(), + dh.vrSettings.mixedRealityKeyColor.getB() + ); + VRShaders._DepthMask_alphaModeUniform.set(alphaMask ? 1 : 0); + RenderSystem.activeTexture(GL13C.GL_TEXTURE1); + RenderSystem.setShaderTexture(0, dh.vrRenderer.framebufferMR.getColorTextureId()); + RenderSystem.activeTexture(GL13C.GL_TEXTURE2); // if (flag && Shaders.dfb != null) { TODO // GlStateManager._bindTexture(Shaders.dfb.depthTextures.get(0)); // } else { - RenderSystem.setShaderTexture(1, ClientDataHolderVR.getInstance().vrRenderer.framebufferMR.getDepthTextureId()); + RenderSystem.setShaderTexture(1, dh.vrRenderer.framebufferMR.getDepthTextureId()); // } - RenderSystem.activeTexture(33984); + RenderSystem.activeTexture(GL13C.GL_TEXTURE0); - for (int i = 0; i < (flag1 ? 3 : 2); ++i) { + for (int i = 0; i < (alphaMask ? 3 : 2); ++i) { int j = this.window.getScreenWidth() / 2; int k = this.window.getScreenHeight(); int l = this.window.getScreenWidth() / 2 * i; int i1 = 0; - if (ClientDataHolderVR.getInstance().vrSettings.mixedRealityUnityLike) { + if (dh.vrSettings.mixedRealityUnityLike) { j = this.window.getScreenWidth() / 2; k = this.window.getScreenHeight() / 2; - if (ClientDataHolderVR.getInstance().vrSettings.mixedRealityAlphaMask && i == 2) { + if (dh.vrSettings.mixedRealityAlphaMask && i == 2) { l = this.window.getScreenWidth() / 2; i1 = this.window.getScreenHeight() / 2; } else { @@ -1516,25 +1543,38 @@ private void doMixedRealityMirror() { } } - VRShaders._DepthMask_resolutionUniform.set((float) j, (float) k); - VRShaders._DepthMask_positionUniform.set((float) l, (float) i1); + VRShaders._DepthMask_resolutionUniform.set((float) j, k); + VRShaders._DepthMask_positionUniform.set((float) l, i1); VRShaders._DepthMask_passUniform.set(i); - ((RenderTargetExtension) ClientDataHolderVR.getInstance().vrRenderer.framebufferMR).blitToScreen(VRShaders.depthMaskShader, l, j, k, i1, true, - 0.0F, 0.0F, false); + ((RenderTargetExtension) dh.vrRenderer.framebufferMR).blitToScreen( + VRShaders.depthMaskShader, + l, + j, + k, + i1, + true, + 0.0F, + 0.0F, + false + ); } GlStateManager._glUseProgram(0); - if (ClientDataHolderVR.getInstance().vrSettings.mixedRealityUnityLike) { - if (ClientDataHolderVR.getInstance().vrSettings.mixedRealityUndistorted) { - ((RenderTargetExtension) ClientDataHolderVR.getInstance().vrRenderer.framebufferUndistorted).blitToScreen( - this.window.getScreenWidth() / 2, this.window.getScreenWidth() / 2, - this.window.getScreenHeight() / 2, 0, true, 0.0F, 0.0F, false); - } else { - ((RenderTargetExtension) ClientDataHolderVR.getInstance().vrRenderer.framebufferEye0).blitToScreen( - this.window.getScreenWidth() / 2, this.window.getScreenWidth() / 2, - this.window.getScreenHeight() / 2, 0, true, 0.0F, 0.0F, false); - } + if (dh.vrSettings.mixedRealityUnityLike) { + ((RenderTargetExtension)(dh.vrSettings.mixedRealityUndistorted ? + dh.vrRenderer.framebufferUndistorted : + dh.vrRenderer.framebufferEye0 + )).blitToScreen( + this.window.getScreenWidth() / 2, + this.window.getScreenWidth() / 2, + this.window.getScreenHeight() / 2, + 0, + true, + 0.0F, + 0.0F, + false + ); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java index 92644cc7d..6d63d3dec 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java @@ -1,29 +1,28 @@ package org.vivecraft.mixin.client_vr; +import org.joml.Vector3d; + import net.minecraft.client.player.LocalPlayer; -import org.vivecraft.client_vr.ClientDataHolderVR; -import net.minecraft.client.Minecraft; -import net.minecraft.client.MouseHandler; -import org.spongepowered.asm.mixin.Final; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.MCVR; -@Mixin(MouseHandler.class) +@Mixin(net.minecraft.client.MouseHandler.class) public class MouseHandlerVRMixin { @Shadow private boolean mouseGrabbed; - @Final - @Shadow - private Minecraft minecraft; // TODO, this seems unnecessary, and wrong - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z", shift = At.Shift.BEFORE), method = "onScroll", cancellable = true) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z", shift = Shift.BEFORE), method = "onScroll", cancellable = true) public void cancelScroll(long g, double h, double f, CallbackInfo ci) { - if (this.minecraft.screen.mouseScrolled(g, h, f)) { + if (mc.screen.mouseScrolled(g, h, f)) { ci.cancel(); } } @@ -36,25 +35,25 @@ private boolean checkNull(LocalPlayer instance) { @Inject(at = @At("HEAD"), method = "turnPlayer", cancellable = true) public void noTurnStanding(CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { + if (!dh.vrSettings.seated) { // call the tutorial before canceling // head movement - // this.minecraft.getTutorial().onMouse(1.0 - MCVR.get().hmdHistory.averagePosition(0.2).subtract(MCVR.get().hmdPivotHistory.averagePosition(0.2)).normalize().dot(MCVR.get().hmdHistory.averagePosition(1.0).subtract(MCVR.get().hmdPivotHistory.averagePosition(1.0)).normalize()),0); + // mc.getTutorial().onMouse(1.0 - dh.vr.hmdHistory.averagePosition(0.2).subtract(dh.vr.hmdPivotHistory.averagePosition(0.2)).normalize().dot(dh.vr.hmdHistory.averagePosition(1.0).subtract(dh.vr.hmdPivotHistory.averagePosition(1.0)).normalize()),0); // controller movement - int mainController = ClientDataHolderVR.getInstance().vrSettings.reverseHands ? 1 : 0; - this.minecraft.getTutorial().onMouse(1.0 - MCVR.get().controllerForwardHistory[mainController].averagePosition(0.2).normalize().dot(MCVR.get().controllerForwardHistory[mainController].averagePosition(1.0).normalize()),0); + int mainController = dh.vrSettings.reverseHands ? 1 : 0; + mc.getTutorial().onMouse(1.0 - dh.vr.controllerForwardHistory[mainController].averagePosition(0.2, new Vector3d()).normalize().dot(dh.vr.controllerForwardHistory[mainController].averagePosition(1.0, new Vector3d()).normalize()),0); ci.cancel(); } } // cancel after tutorial call - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/Tutorial;onMouse(DD)V", shift = At.Shift.AFTER), method = "turnPlayer", cancellable = true) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/Tutorial;onMouse(DD)V", shift = Shift.AFTER), method = "turnPlayer", cancellable = true) public void noTurnSeated(CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } @@ -63,23 +62,23 @@ public void noTurnSeated(CallbackInfo ci) { @Inject(at = @At("HEAD"), method = "grabMouse", cancellable = true) public void seated(CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { + if (!dh.vrSettings.seated) { this.mouseGrabbed = true; ci.cancel(); } } - @Inject(at = @At(value = "HEAD"), method = "releaseMouse", cancellable = true) + @Inject(at = @At("HEAD"), method = "releaseMouse", cancellable = true) public void grabMouse(CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { + if (!dh.vrSettings.seated) { this.mouseGrabbed = false; ci.cancel(); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java index 2a1a5e8e5..04dd148d1 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java @@ -2,21 +2,58 @@ import net.minecraft.client.KeyMapping; import net.minecraft.client.Options; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.client.VivecraftVRMod; + +import java.util.Arrays; +import java.util.MissingResourceException; +import java.util.stream.Stream; + +import static org.vivecraft.client.VivecraftVRMod.userKeyBindingSet; +import static org.vivecraft.client.VivecraftVRMod.vanillaBindingSet; + +import static org.objectweb.asm.Opcodes.PUTFIELD; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; @Mixin(Options.class) -public abstract class OptionsVRMixin { - @Shadow - public KeyMapping[] keyMappings; +public abstract class OptionsVRMixin +{ - @Redirect(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Options;load()V")) - void processOptionsMixin(Options instance) { - this.keyMappings = VivecraftVRMod.INSTANCE.initializeBindings(this.keyMappings); - instance.load(); + @WrapOperation( + method = "", + at = @At( + value = "FIELD", + opcode = PUTFIELD, + target = "Lnet/minecraft/client/Options;keyMappings:[Lnet/minecraft/client/KeyMapping;" + ) + ) + void processOptionsMixin(Options instance, KeyMapping[] keyMappings, Operation original) + { + if (keyMappings != null) + { + if (keyMappings.length > 0) + { + keyMappings = Stream.concat(Arrays.stream(keyMappings), userKeyBindingSet.stream()).toArray(KeyMapping[]::new); + vanillaBindingSet.addAll(Arrays.asList(keyMappings)); + KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", 8); + KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", 9); + KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", 10); + original.call(instance, keyMappings); + } + else + { + throw new MissingResourceException( + "keyMappings is empty!", + keyMappings.getClass().getName(), + Arrays.toString(keyMappings) + ); + } + } + else + { + throw new NullPointerException("keyMappings is null!"); + } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/audio/LibraryVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/audio/LibraryVRMixin.java index 556a983f5..106f53de5 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/audio/LibraryVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/audio/LibraryVRMixin.java @@ -1,16 +1,17 @@ package org.vivecraft.mixin.client_vr.blaze3d.audio; -import com.mojang.blaze3d.audio.Library; import org.slf4j.Logger; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Final; 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.ModifyVariable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(Library.class) +@Mixin(com.mojang.blaze3d.audio.Library.class) public class LibraryVRMixin { @Shadow @Final @@ -18,10 +19,10 @@ public class LibraryVRMixin { @ModifyVariable(method = "init", at = @At("HEAD"), argsOnly = true) private boolean shouldDoHRTF(boolean vanillaHRTF) { - if (VRState.vrRunning) { + if (vrRunning) { // don't force HRTF in nonvr - LOGGER.info("enabling HRTF: {}", ClientDataHolderVR.getInstance().vrSettings.hrtfSelection >= 0); - return ClientDataHolderVR.getInstance().vrSettings.hrtfSelection >= 0; + LOGGER.info("enabling HRTF: {}", dh.vrSettings.hrtfSelection >= 0); + return dh.vrSettings.hrtfSelection >= 0; } return vanillaHRTF; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java index dcef28e50..156fd93fe 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java @@ -1,15 +1,18 @@ package org.vivecraft.mixin.client_vr.blaze3d.platform; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.injection.*; import static com.mojang.blaze3d.platform.GlStateManager.BLEND; import static com.mojang.blaze3d.platform.GlStateManager.glBlendFuncSeparate; -@Mixin(GlStateManager.class) +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(com.mojang.blaze3d.platform.GlStateManager.class) public class GlStateManagerVRMixin { //Change the limit of textures to 32 @@ -33,8 +36,8 @@ private static int properId(int i) { @Overwrite(remap = false) public static void _blendFuncSeparate(int i, int j, int k, int l) { RenderSystem.assertOnRenderThread(); - if (i == GlStateManager.SourceFactor.SRC_ALPHA.value && j == GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value && k == GlStateManager.SourceFactor.ONE.value && l == GlStateManager.DestFactor.ZERO.value) { - l = GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value; + if (i == SourceFactor.SRC_ALPHA.value && j == DestFactor.ONE_MINUS_SRC_ALPHA.value && k == SourceFactor.ONE.value && l == DestFactor.ZERO.value) { + l = DestFactor.ONE_MINUS_SRC_ALPHA.value; } if (i != BLEND.srcRgb || j != BLEND.dstRgb || k != BLEND.srcAlpha || l != BLEND.dstAlpha) { BLEND.srcRgb = i; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/InputConstantsVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/InputConstantsVRMixin.java index 3ca52b072..9e2a8d17e 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/InputConstantsVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/InputConstantsVRMixin.java @@ -1,19 +1,23 @@ package org.vivecraft.mixin.client_vr.blaze3d.platform; +import org.vivecraft.client_vr.provider.InputSimulator; + import com.mojang.blaze3d.platform.InputConstants; -import org.lwjgl.glfw.GLFW; + +import static org.vivecraft.client_vr.VRState.vrRunning; + +import static org.lwjgl.glfw.GLFW.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.InputSimulator; @Mixin(InputConstants.class) public class InputConstantsVRMixin { @Inject(at = @At("HEAD"), method = "isKeyDown", cancellable = true) - private static void keyDown(long l, int i, CallbackInfoReturnable cir){ - cir.setReturnValue(GLFW.glfwGetKey(l,i) == 1 || (VRState.vrRunning && InputSimulator.isKeyDown(i))) ; + private static void keyDown(long window, int key, CallbackInfoReturnable cir){ + cir.setReturnValue(glfwGetKey(window, key) == GLFW_PRESS || (vrRunning && InputSimulator.isKeyDown(key))); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/WindowVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/WindowVRMixin.java index 67acc3b67..fdf17f99d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/WindowVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/WindowVRMixin.java @@ -1,84 +1,81 @@ package org.vivecraft.mixin.client_vr.blaze3d.platform; -import com.mojang.blaze3d.platform.Window; -import net.minecraft.client.Minecraft; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.*; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; + +import static org.vivecraft.client_vr.VRState.*; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.client_vr.VRState; -@Mixin(Window.class) +@Mixin(com.mojang.blaze3d.platform.Window.class) public abstract class WindowVRMixin { // TODO: check if that actually works like that with sodium extras adaptive sync @ModifyVariable(method = "updateVsync", ordinal = 0, at = @At("HEAD"), argsOnly = true) boolean overwriteVsync(boolean v) { - if (VRState.vrRunning) { - return false; - } - return v; + return !vrRunning && v; } @Inject(method = {/*"getScreenWidth", */"getWidth"}, at = @At("HEAD"), cancellable = true) void getVivecraftWidth(CallbackInfoReturnable cir) { - if (shouldOverrideSide()) { + if (this.shouldOverrideSide()) { // if (mcxrGameRenderer.reloadingDepth > 0) { // var swapchain = MCXRPlayClient.OPEN_XR_STATE.session.swapchain; // cir.setReturnValue(swapchain.getRenderWidth()); // } else { - var mainTarget = Minecraft.getInstance().getMainRenderTarget(); - cir.setReturnValue(mainTarget.viewWidth); + cir.setReturnValue(mc.getMainRenderTarget().viewWidth); // } } } @Inject(method = {/*"getScreenHeight",*/ "getHeight"}, at = @At("HEAD"), cancellable = true) void getVivecraftHeight(CallbackInfoReturnable cir) { - if (shouldOverrideSide()) { + if (this.shouldOverrideSide()) { // if (mcxrGameRenderer.reloadingDepth > 0) { // var swapchain = MCXRPlayClient.OPEN_XR_STATE.session.swapchain; // cir.setReturnValue(swapchain.getRenderHeight()); // } else { - var mainTarget = Minecraft.getInstance().getMainRenderTarget(); - cir.setReturnValue(mainTarget.viewHeight); + cir.setReturnValue(mc.getMainRenderTarget().viewHeight); // } } } @Inject(method = "getGuiScaledHeight", at = @At("HEAD"), cancellable = true) void getScaledHeight(CallbackInfoReturnable cir) { - if (shouldOverrideSide()) { + if (this.shouldOverrideSide()) { cir.setReturnValue(GuiHandler.scaledHeight); } } @Inject(method = "getGuiScaledWidth", at = @At("HEAD"), cancellable = true) void getScaledWidth(CallbackInfoReturnable cir) { - if (shouldOverrideSide()) { + if (this.shouldOverrideSide()) { cir.setReturnValue(GuiHandler.scaledWidth); } } @Inject(method = "getGuiScale", at = @At("HEAD"), cancellable = true) void getScaleFactor(CallbackInfoReturnable cir) { - if (shouldOverrideSide()) { + if (this.shouldOverrideSide()) { cir.setReturnValue((double) GuiHandler.guiScaleFactor); } } @Inject(method = "onResize", at = @At("HEAD")) private void resizeFrameBuffers(long l, int i, int j, CallbackInfo ci){ - if (VRState.vrEnabled) { - ClientDataHolderVR.getInstance().vrRenderer.resizeFrameBuffers("Main Window Resized"); + if (vrEnabled) { + dh.vrRenderer.resizeFrameBuffers("Main Window Resized"); } } @Unique private boolean shouldOverrideSide() { //MCXR: return mcxrGameRenderer.overrideWindowSize || (mcxrGameRenderer.isXrMode() && mcxrGameRenderer.reloadingDepth > 0); - return VRState.vrRunning; + return vrRunning; } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/systems/RenderSystemVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/systems/RenderSystemVRMixin.java index 25b8d634c..44429c114 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/systems/RenderSystemVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/systems/RenderSystemVRMixin.java @@ -1,21 +1,22 @@ package org.vivecraft.mixin.client_vr.blaze3d.systems; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; + +import static com.mojang.blaze3d.systems.RenderSystem.blendFuncSeparate; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import static com.mojang.blaze3d.systems.RenderSystem.blendFuncSeparate; - -@Mixin(RenderSystem.class) +@Mixin(com.mojang.blaze3d.systems.RenderSystem.class) public class RenderSystemVRMixin { // do remap because of forge @Inject(at = @At("HEAD"), method = "defaultBlendFunc", cancellable = true, remap = false) private static void defaultBlendFunc(CallbackInfo ci) { - blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + blendFuncSeparate(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); ci.cancel(); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/EditBoxVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/EditBoxVRMixin.java index 3eecbbe49..42f86e20c 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/EditBoxVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/EditBoxVRMixin.java @@ -1,30 +1,30 @@ package org.vivecraft.mixin.client_vr.gui; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; + +import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.vrRunning; + 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 net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.gui.components.EditBox; -import net.minecraft.network.chat.Component; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; - -@Mixin(EditBox.class) -public abstract class EditBoxVRMixin extends AbstractWidget{ +@Mixin(net.minecraft.client.gui.components.EditBox.class) +public abstract class EditBoxVRMixin extends net.minecraft.client.gui.components.AbstractWidget { @Shadow private boolean canLoseFocus; - public EditBoxVRMixin(int p_93629_, int p_93630_, int p_93631_, int p_93632_, Component p_93633_) { - super(p_93629_, p_93630_, p_93631_, p_93632_, p_93633_); + public EditBoxVRMixin(int x, int y, int width, int height, Component message) { + super(x, y, width, height, message); } - @Inject(at = @At(value = "HEAD"), method = "onClick") + @Inject(at = @At("HEAD"), method = "onClick") public void openKeyboard(double d, double e, CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { KeyboardHandler.setOverlayShowing(true); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiComponentVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiComponentVRMixin.java index 3f13b1bfa..1c94e903b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiComponentVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiComponentVRMixin.java @@ -1,29 +1,34 @@ package org.vivecraft.mixin.client_vr.gui; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.gui.GuiGraphics; + +import static org.vivecraft.client_vr.VRState.vrRunning; + +import static com.mojang.blaze3d.platform.GlStateManager.BLEND; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; -@Mixin(GuiGraphics.class) +@Mixin(net.minecraft.client.gui.GuiGraphics.class) public class GuiComponentVRMixin { - @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShader(Ljava/util/function/Supplier;)V", shift = At.Shift.AFTER), method = "innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFFFFFF)V") + @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShader(Ljava/util/function/Supplier;)V", shift = Shift.AFTER), method = "innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFFFFFF)V") private void addBlend(CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { RenderSystem.enableBlend(); // only change the alpha blending - RenderSystem.blendFuncSeparate(GlStateManager.BLEND.srcRgb, GlStateManager.BLEND.dstRgb, GlStateManager.SourceFactor.ONE.value, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value); + RenderSystem.blendFuncSeparate(BLEND.srcRgb, BLEND.dstRgb, SourceFactor.ONE.value, DestFactor.ONE_MINUS_SRC_ALPHA.value); } } @Inject(at = @At("TAIL"), method = "innerBlit(Lnet/minecraft/resources/ResourceLocation;IIIIIFFFFFFFF)V") private void stopBlend(CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { RenderSystem.disableBlend(); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java index 13c0359f9..dccd474d3 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java @@ -1,37 +1,43 @@ package org.vivecraft.mixin.client_vr.gui; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.player.LocalPlayer; -import net.minecraft.resources.ResourceLocation; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.extensions.GuiExtension; -import com.mojang.blaze3d.platform.GlStateManager; +import org.vivecraft.client_xr.render_pass.RenderPassType; + +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import net.minecraft.client.KeyMapping; import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_xr.render_pass.RenderPassType; -@Mixin(Gui.class) -public abstract class GuiVRMixin implements GuiExtension { +@Mixin(net.minecraft.client.gui.Gui.class) +public abstract class GuiVRMixin implements org.vivecraft.client_vr.extensions.GuiExtension { @Unique public boolean showPlayerList; @@ -39,9 +45,6 @@ public abstract class GuiVRMixin implements GuiExtension { private int screenWidth; @Shadow private int screenHeight; - @Final - @Shadow - private Minecraft minecraft; @Final @Shadow @@ -91,60 +94,60 @@ public void cancelRenderCrosshair(GuiGraphics guiGraphics, CallbackInfo ci) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getSleepTimer()I"), method = "render") public int noSleepOverlay(LocalPlayer instance) { - return VRState.vrRunning ? 0 : instance.getSleepTimer(); + return vrRunning ? 0 : instance.getSleepTimer(); } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyMapping;isDown()Z"), method = "render") public boolean toggleableTabList(KeyMapping instance) { - return instance.isDown() || showPlayerList; + return instance.isDown() || this.showPlayerList; } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 1, shift = At.Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 1, shift = Shift.AFTER), method = "renderHotbar") public void hotbarContext(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().interactTracker.hotbar >= 0 && ClientDataHolderVR.getInstance().interactTracker.hotbar < 9 && this.getCameraPlayer().getInventory().selected != ClientDataHolderVR.getInstance().interactTracker.hotbar && ClientDataHolderVR.getInstance().interactTracker.isActive(minecraft.player)) { + if (vrRunning && dh.interactTracker.hotbar >= 0 && dh.interactTracker.hotbar < 9 && this.getCameraPlayer().getInventory().selected != dh.interactTracker.hotbar && dh.interactTracker.isActive()) { int i = this.screenWidth / 2; RenderSystem.setShaderColor(0.0F, 1.0F, 0.0F, 1.0F); - guiGraphics.blit(WIDGETS_LOCATION, i - 91 - 1 + ClientDataHolderVR.getInstance().interactTracker.hotbar * 20, this.screenHeight - 22 - 1, 0, 22, 24, 22); + guiGraphics.blit(WIDGETS_LOCATION, i - 91 - 1 + dh.interactTracker.hotbar * 20, this.screenHeight - 22 - 1, 0, 22, 24, 22); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEmpty()Z", ordinal = 0), method = "renderHotbar") public boolean slotSwap(ItemStack instance) { - return !(!instance.isEmpty() || (VRState.vrRunning && ClientDataHolderVR.getInstance().vrSettings.vrTouchHotbar)); + return !(!instance.isEmpty() || (vrRunning && dh.vrSettings.vrTouchHotbar)); } @Inject(at = @At("HEAD"), method = "renderHotbar", cancellable = true) public void notHotbarOnScreens(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && minecraft.screen != null) { + if (vrRunning && mc.screen != null) { ci.cancel(); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = At.Shift.BEFORE), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = Shift.BEFORE), method = "renderHotbar") public void renderVRHotbarLeft(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().interactTracker.hotbar == 9 && ClientDataHolderVR.getInstance().interactTracker.isActive(minecraft.player)) { + if (vrRunning && dh.interactTracker.hotbar == 9 && dh.interactTracker.isActive()) { RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = At.Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = Shift.AFTER), method = "renderHotbar") public void renderVRHotbarLeftReset(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().interactTracker.hotbar == 9) { + if (vrRunning && dh.interactTracker.hotbar == 9) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = At.Shift.BEFORE), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = Shift.BEFORE), method = "renderHotbar") public void renderVRHotbarRight(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().interactTracker.hotbar == 9 && ClientDataHolderVR.getInstance().interactTracker.isActive(minecraft.player)){ + if (vrRunning && dh.interactTracker.hotbar == 9 && dh.interactTracker.isActive()){ RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = At.Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = Shift.AFTER), method = "renderHotbar") public void renderVRHotbarRightReset(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().interactTracker.hotbar == 9){ + if (vrRunning && dh.interactTracker.hotbar == 9){ RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } @@ -152,14 +155,15 @@ public void renderVRHotbarRightReset(float f, GuiGraphics guiGraphics, CallbackI // do remap because of forge @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;disableBlend()V"), method = "renderHotbar") public void renderVive(float f, GuiGraphics guiGraphics, CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { this.renderViveHudIcons(guiGraphics); } } - private void renderViveHudIcons(GuiGraphics guiGraphics) { - if (this.minecraft.getCameraEntity() instanceof Player) { - Player player = (Player)this.minecraft.getCameraEntity(); + private void renderViveHudIcons(GuiGraphics guiGraphics) + { + if (mc.getCameraEntity() instanceof Player player) + { int k = 0; MobEffect mobeffect = null; @@ -178,12 +182,12 @@ private void renderViveHudIcons(GuiGraphics guiGraphics) { if (player.isFallFlying()) { k = -1; } - if (ClientDataHolderVR.getInstance().crawlTracker.crawling) { + if (dh.crawlTracker.crawling) { k = -2; } - int x = this.minecraft.getWindow().getGuiScaledWidth() / 2 - 109; - int y = this.minecraft.getWindow().getGuiScaledHeight() - 39; + int x = mc.getWindow().getGuiScaledWidth() / 2 - 109; + int y = mc.getWindow().getGuiScaledHeight() - 39; if (k == -1) { guiGraphics.renderFakeItem(new ItemStack(Items.ELYTRA), x, y); @@ -200,7 +204,7 @@ else if (k == -2) { guiGraphics.renderFakeItem(new ItemStack(Items.RABBIT_FOOT), x2, y); } if (mobeffect != null) { - TextureAtlasSprite textureatlassprite = this.minecraft.getMobEffectTextures().get(mobeffect); + TextureAtlasSprite textureatlassprite = mc.getMobEffectTextures().get(mobeffect); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); guiGraphics.blit(x, y, 0, 18, 18, textureatlassprite); } @@ -225,8 +229,8 @@ public void drawMouseMenuQuad(int mouseX, int mouseY) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderTexture(0, GUI_ICONS_LOCATION); - float f = 16.0F * ClientDataHolderVR.getInstance().vrSettings.menuCrosshairScale; - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, GlStateManager.DestFactor.ZERO, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); + float f = 16.0F * dh.vrSettings.menuCrosshairScale; + RenderSystem.blendFuncSeparate(SourceFactor.ONE_MINUS_DST_COLOR, DestFactor.ZERO, SourceFactor.ONE, DestFactor.ONE); this.drawCentredTexturedModalRect(mouseX, mouseY, f, f, 0, 0, 15, 15); RenderSystem.disableBlend(); RenderSystem.defaultBlendFunc(); @@ -236,10 +240,10 @@ public void drawCentredTexturedModalRect(int centreX, int centreY, float width, float f = 0.00390625F; float f1 = 0.00390625F; BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferbuilder.vertex((double)((float)centreX - width / 2.0F), (double)((float)centreY + height / 2.0F), 0).uv((float)(u + 0) * f, (float)(v + texHeight) * f1).endVertex(); - bufferbuilder.vertex((double)((float)centreX + width / 2.0F), (double)((float)centreY + height / 2.0F), 0).uv((float)(u + texWidth) * f, (float)(v + texHeight) * f1).endVertex(); - bufferbuilder.vertex((double)((float)centreX + width / 2.0F), (double)((float)centreY - height / 2.0F), 0).uv((float)(u + texWidth) * f, (float)(v + 0) * f1).endVertex();bufferbuilder.vertex((double)((float)centreX - width / 2.0F), (double)((float)centreY - height / 2.0F), 0).uv((float)(u + 0) * f, (float)(v + 0) * f1).endVertex(); + bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferbuilder.vertex(centreX - width / 2.0F, centreY + height / 2.0F, 0).uv((u) * f, (v + texHeight) * f1).endVertex(); + bufferbuilder.vertex(centreX + width / 2.0F, centreY + height / 2.0F, 0).uv((u + texWidth) * f, (v + texHeight) * f1).endVertex(); + bufferbuilder.vertex(centreX + width / 2.0F, centreY - height / 2.0F, 0).uv((u + texWidth) * f, v * f1).endVertex();bufferbuilder.vertex(centreX - width / 2.0F, centreY - height / 2.0F, 0).uv(u * f, v * f1).endVertex(); BufferUploader.drawWithShader(bufferbuilder.end()); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java index 250f08d50..96b814609 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java @@ -5,10 +5,15 @@ import net.minecraft.client.gui.components.toasts.ToastComponent; import net.minecraft.client.gui.components.toasts.TutorialToast; import net.minecraft.network.chat.Component; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -24,15 +29,16 @@ public abstract class TutorialToastVRMixin implements Toast{ @Final private Component message; + @Unique private int offset; - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", shift = At.Shift.AFTER), method = "render") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", shift = Shift.AFTER), method = "render") private void extendToast(GuiGraphics guiGraphics, ToastComponent toastComponent, long l, CallbackInfoReturnable cir){ - int width = Math.max(toastComponent.getMinecraft().font.width(this.title), message != null ? toastComponent.getMinecraft().font.width(this.message) : 0) + 34; - offset = Math.min(this.width()-width, 0); - if (offset < 0) { + int width = max(toastComponent.getMinecraft().font.width(this.title), this.message != null ? toastComponent.getMinecraft().font.width(this.message) : 0) + 34; + this.offset = min(this.width() - width, 0); + if (this.offset < 0) { // draw a bigger toast from right to left, to override the left border - for (int i = offset - (this.width() - 8) * (offset / (this.width() - 8)); i >= offset; i -= this.width() - 8) { + for (int i = this.offset - (this.width() - 8) * (this.offset / (this.width() - 8)); i >= this.offset; i -= this.width() - 8) { guiGraphics.blit(TEXTURE, i, 0, 0, 96, this.width() - 4, this.height()); } } @@ -40,22 +46,22 @@ private void extendToast(GuiGraphics guiGraphics, ToastComponent toastComponent, @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;render(Lnet/minecraft/client/gui/GuiGraphics;II)V"), method = "render", index = 1) private int offsetIcon(int x){ - return x + offset; + return x + this.offset; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIZ)I"), method = "render", index = 2) private int offsetText(int x){ - return x + offset; + return x + this.offset; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), method = "render", index = 0) private int offsetProgressStart(int x){ - return x + offset; + return x + this.offset; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V", ordinal = 1), method = "render", index = 2) private int offsetProgressEnd(int x){ - return x + offset - (int)((float)x / TutorialToast.PROGRESS_BAR_WIDTH * offset ); + return x + this.offset - (int)((float)x / TutorialToast.PROGRESS_BAR_WIDTH * this.offset); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java index 87cc798d4..ed8733893 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java @@ -1,18 +1,24 @@ package org.vivecraft.mixin.client_vr.gui.screens; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.gui.settings.GuiMainVRSettings; + import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.layouts.GridLayout; -import net.minecraft.client.gui.screens.OptionsScreen; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client.gui.settings.GuiMainVRSettings; -@Mixin(OptionsScreen.class) +@Mixin(net.minecraft.client.gui.screens.OptionsScreen.class) public class OptionsScreenVRMixin extends Screen { protected OptionsScreenVRMixin(Component component) { super(component); @@ -25,8 +31,8 @@ private AbstractWidget addVivecraftSettings(OptionInstance option, Options optio if (option == options.fov()) { return new Button.Builder( Component.translatable("vivecraft.options.screen.main.button"), (p) -> { - Minecraft.getInstance().options.save(); - Minecraft.getInstance().setScreen(new GuiMainVRSettings(this)); + mc.options.save(); + mc.setScreen(new GuiMainVRSettings(this)); }) .size( k, 20) .pos(i, j) @@ -43,11 +49,11 @@ private int makeSpacer1wide(int layoutElement) { return 1; } @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;I)Lnet/minecraft/client/gui/layouts/LayoutElement;"), locals = LocalCapture.CAPTURE_FAILHARD) - private void addVivecraftSettings(CallbackInfo ci, GridLayout gridLayout, GridLayout.RowHelper rowHelper) { - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.options.screen.main.button"), (p) -> + private void addVivecraftSettings(CallbackInfo ci, GridLayout gridLayout, RowHelper rowHelper) { + rowHelper.addChild(new Builder(Component.translatable("vivecraft.options.screen.main.button"), (p) -> { - Minecraft.getInstance().options.save(); - Minecraft.getInstance().setScreen(new GuiMainVRSettings(this)); + mc.options.save(); + mc.setScreen(new GuiMainVRSettings(this)); }) .build()); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java index a2b6abf7e..35d2e9de8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java @@ -1,30 +1,35 @@ package org.vivecraft.mixin.client_vr.gui.screens; -import net.minecraft.client.Minecraft; +import org.vivecraft.client.gui.settings.GuiQuickCommandsInGame; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.settings.AutoCalibration; +import org.vivecraft.client_vr.settings.VRHotkeys; +import org.vivecraft.client_vr.settings.VRHotkeys.Triggerer; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; +import org.vivecraft.client_vr.utils.external.jkatvr; + import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.Button.Builder; import net.minecraft.client.gui.layouts.GridLayout; +import net.minecraft.client.gui.layouts.GridLayout.RowHelper; import net.minecraft.client.gui.layouts.LayoutElement; import net.minecraft.client.gui.screens.ChatScreen; -import net.minecraft.client.gui.screens.PauseScreen; -import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.social.SocialInteractionsScreen; import net.minecraft.network.chat.Component; -import org.objectweb.asm.Opcodes; + +import static org.vivecraft.client_vr.VRState.*; + +import static org.objectweb.asm.Opcodes.PUTFIELD; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client.gui.settings.GuiQuickCommandsInGame; -import org.vivecraft.client_vr.settings.AutoCalibration; -import org.vivecraft.client_vr.settings.VRHotkeys; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client_vr.utils.external.jkatvr; -@Mixin(value = PauseScreen.class, priority = 900) -public abstract class PauseScreenVRMixin extends Screen { +@Mixin(value = net.minecraft.client.gui.screens.PauseScreen.class, priority = 900) +public abstract class PauseScreenVRMixin extends net.minecraft.client.gui.screens.Screen { protected PauseScreenVRMixin(Component component) { super(component); @@ -32,112 +37,116 @@ protected PauseScreenVRMixin(Component component) { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;)Lnet/minecraft/client/gui/layouts/LayoutElement;", ordinal = 4), method = "createPauseMenu", locals = LocalCapture.CAPTURE_FAILHARD) - public void addInit(CallbackInfo ci, GridLayout gridWidget, GridLayout.RowHelper rowHelper) { - if (!VRState.vrEnabled) { + public void addInit(CallbackInfo ci, GridLayout gridWidget, RowHelper rowHelper) { + if (!vrEnabled) { return; } // reset row to above try { rowHelper.addChild(null, -2); - } catch (IllegalArgumentException e) {} + } catch (IllegalArgumentException ignored) {} - if (!Minecraft.getInstance().isMultiplayerServer()) { - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.chat"), (p) -> + if (!mc.isMultiplayerServer()) { + rowHelper.addChild(new Builder(Component.translatable("vivecraft.gui.chat"), (p) -> { - this.minecraft.setScreen(new ChatScreen("")); - if (ClientDataHolderVR.getInstance().vrSettings.autoOpenKeyboard) + mc.setScreen(new ChatScreen("")); + if (dh.vrSettings.autoOpenKeyboard) KeyboardHandler.setOverlayShowing(true); }).width(98).build()); } else { GridLayout gridWidgetChat_Social = new GridLayout(); gridWidgetChat_Social.defaultCellSetting().paddingRight(1); - GridLayout.RowHelper rowHelperChat_Social = gridWidgetChat_Social.createRowHelper(2); - rowHelperChat_Social.addChild(new Button.Builder(Component.translatable("vivecraft.gui.chat"), (p) -> + RowHelper rowHelperChat_Social = gridWidgetChat_Social.createRowHelper(2); + rowHelperChat_Social.addChild(new Builder(Component.translatable("vivecraft.gui.chat"), (p) -> { - this.minecraft.setScreen(new ChatScreen("")); - if (ClientDataHolderVR.getInstance().vrSettings.autoOpenKeyboard) + mc.setScreen(new ChatScreen("")); + if (dh.vrSettings.autoOpenKeyboard) KeyboardHandler.setOverlayShowing(true); }).width(48).build()); - rowHelperChat_Social.addChild(new Button.Builder(Component.translatable("vivecraft.gui.social"), (p) -> this.minecraft.setScreen(new SocialInteractionsScreen())).width(48).pos(50, 0).build()); + rowHelperChat_Social.addChild(new Builder(Component.translatable("vivecraft.gui.social"), (p) -> + mc.setScreen(new SocialInteractionsScreen())).width(48).pos(50, 0).build() + ); rowHelper.addChild(gridWidgetChat_Social); } - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.commands"), (p) -> this.minecraft.setScreen(new GuiQuickCommandsInGame(this))).width(98).build()); + rowHelper.addChild(new Builder(Component.translatable("vivecraft.gui.commands"), (p) -> + mc.setScreen(new GuiQuickCommandsInGame(this))).width(98).build() + ); } - @Inject(at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD,target = "Lnet/minecraft/client/gui/screens/PauseScreen;disconnectButton:Lnet/minecraft/client/gui/components/Button;", shift = At.Shift.BY, by = -3), method = "createPauseMenu", locals = LocalCapture.CAPTURE_FAILHARD) - public void addLowerButtons(CallbackInfo ci, GridLayout gridWidget, GridLayout.RowHelper rowHelper) { - if (!VRState.vrEnabled) { + @Inject(at = @At(value = "FIELD", opcode = PUTFIELD,target = "Lnet/minecraft/client/gui/screens/PauseScreen;disconnectButton:Lnet/minecraft/client/gui/components/Button;", shift = Shift.BY, by = -3), method = "createPauseMenu", locals = LocalCapture.CAPTURE_FAILHARD) + public void addLowerButtons(CallbackInfo ci, GridLayout gridWidget, RowHelper rowHelper) { + if (!vrEnabled) { return; } GridLayout gridWidgetOverlay_Profiler = new GridLayout(); gridWidgetOverlay_Profiler.defaultCellSetting().paddingRight(1); - GridLayout.RowHelper rowHelperOverlay_Profiler = gridWidgetOverlay_Profiler.createRowHelper(2); - rowHelperOverlay_Profiler.addChild(new Button.Builder(Component.translatable("vivecraft.gui.overlay"), (p) -> + RowHelper rowHelperOverlay_Profiler = gridWidgetOverlay_Profiler.createRowHelper(2); + rowHelperOverlay_Profiler.addChild(new Builder(Component.translatable("vivecraft.gui.overlay"), (p) -> { - this.minecraft.options.renderDebug = !this.minecraft.options.renderDebug; - this.minecraft.setScreen((Screen) null); + mc.options.renderDebug = !mc.options.renderDebug; + mc.setScreen(null); }).width(48).build()); - rowHelperOverlay_Profiler.addChild(new Button.Builder(Component.translatable("vivecraft.gui.profiler"), (p) -> + rowHelperOverlay_Profiler.addChild(new Builder(Component.translatable("vivecraft.gui.profiler"), (p) -> { - if (!this.minecraft.options.renderDebug) this.minecraft.options.renderDebugCharts = false; - this.minecraft.options.renderDebugCharts = !this.minecraft.options.renderDebugCharts; - this.minecraft.options.renderDebug = this.minecraft.options.renderDebugCharts; - this.minecraft.setScreen((Screen) null); + if (!mc.options.renderDebug) mc.options.renderDebugCharts = false; + mc.options.renderDebugCharts = !mc.options.renderDebugCharts; + mc.options.renderDebug = mc.options.renderDebugCharts; + mc.setScreen(null); }).width(48).pos(50, 0).build()); rowHelper.addChild(gridWidgetOverlay_Profiler); - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.screenshot"), (p) -> + rowHelper.addChild(new Builder(Component.translatable("vivecraft.gui.screenshot"), (p) -> { - this.minecraft.setScreen((Screen) null); - ClientDataHolderVR.getInstance().grabScreenShot = true; + mc.setScreen(null); + dh.grabScreenShot = true; }).width(98).build()); - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.calibrateheight"), (p) -> + if (!dh.vrSettings.seated) { + rowHelper.addChild(new Builder(Component.translatable("vivecraft.gui.calibrateheight"), (p) -> { AutoCalibration.calibrateManual(); - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); - this.minecraft.setScreen((Screen) null); + dh.vrSettings.saveOptions(); + mc.setScreen(null); }).width(98).build()); } - if (ClientDataHolderVR.katvr) { - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.alignkatwalk"), (p) -> + if (dh.katvr) { + rowHelper.addChild(new Builder(Component.translatable("vivecraft.gui.alignkatwalk"), (p) -> { - jkatvr.resetYaw(ClientDataHolderVR.getInstance().vrPlayer.vrdata_room_pre.hmd.getYaw()); - this.minecraft.setScreen((Screen) null); + jkatvr.resetYaw(dh.vrPlayer.vrdata_room_pre.hmd.getYaw()); + mc.setScreen(null); }).width(98).build()); } - if (!ClientDataHolderVR.getInstance().vrSettings.seated || ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.THIRD_PERSON || ClientDataHolderVR.getInstance().vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { + if (!dh.vrSettings.seated || dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON || dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY) { rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.gui.movethirdpersoncam"), (p) -> { if (!VRHotkeys.isMovingThirdPersonCam()) { - VRHotkeys.startMovingThirdPersonCam(1, VRHotkeys.Triggerer.MENUBUTTON); - } else if (VRHotkeys.getMovingThirdPersonCamTriggerer() == VRHotkeys.Triggerer.MENUBUTTON) { + VRHotkeys.startMovingThirdPersonCam(1, Triggerer.MENUBUTTON); + } else if (VRHotkeys.getMovingThirdPersonCamTriggerer() == Triggerer.MENUBUTTON) { VRHotkeys.stopMovingThirdPersonCam(); - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); + dh.vrSettings.saveOptions(); } }).width(98).build()); } } @Redirect(method = "createPauseMenu", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;)Lnet/minecraft/client/gui/layouts/LayoutElement;", ordinal = 2)) - private LayoutElement remove(GridLayout.RowHelper instance, LayoutElement layoutElement) { + private LayoutElement remove(RowHelper instance, LayoutElement layoutElement) { // Feedback button // don't remove, just hide, so mods that rely on it being there, still work - ((Button)layoutElement).visible = !VRState.vrEnabled; + ((Button)layoutElement).visible = !vrEnabled; return instance.addChild(layoutElement); } @Redirect(method = "createPauseMenu", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;)Lnet/minecraft/client/gui/layouts/LayoutElement;", ordinal = 3)) - private LayoutElement remove2(GridLayout.RowHelper instance, LayoutElement layoutElement) { + private LayoutElement remove2(RowHelper instance, LayoutElement layoutElement) { // report bugs button // don't remove, just hide, so mods that rely on it being there, still work - ((Button)layoutElement).visible = !VRState.vrEnabled; + ((Button)layoutElement).visible = !vrEnabled; return instance.addChild(layoutElement); } // TODO this seems unneeded? diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java index 66b2dd36a..723f2566f 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java @@ -1,25 +1,26 @@ package org.vivecraft.mixin.client_vr.gui.screens; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.Renderable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import net.minecraft.client.gui.components.events.AbstractContainerEventHandler; -import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.client_vr.VRState; -@Mixin(Screen.class) -public abstract class ScreenVRMixin extends AbstractContainerEventHandler implements Renderable { +@Mixin(net.minecraft.client.gui.screens.Screen.class) +public abstract class ScreenVRMixin extends net.minecraft.client.gui.components.events.AbstractContainerEventHandler implements + net.minecraft.client.gui.components.Renderable +{ @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fillGradient(IIIIII)V"), method = "renderBackground") public void vrBackground(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, int n) { - if (VRState.vrRunning && ClientDataHolderVR.getInstance().vrSettings != null && !ClientDataHolderVR.getInstance().vrSettings.menuBackground) { + if (vrRunning && dh.vrSettings != null && !dh.vrSettings.menuBackground) { guiGraphics.fillGradient(i, j, k, l, 0, 0); } else { guiGraphics.fillGradient(i, j, k, l, m, n); } } -} \ No newline at end of file +} diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/SoundOptionsScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/SoundOptionsScreenVRMixin.java index d9dba796b..a86cb238e 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/SoundOptionsScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/SoundOptionsScreenVRMixin.java @@ -1,42 +1,48 @@ package org.vivecraft.mixin.client_vr.gui.screens; -import net.minecraft.client.Minecraft; +import org.vivecraft.client_vr.settings.VRSettings.VrOptions; + import net.minecraft.client.OptionInstance; import net.minecraft.client.gui.components.OptionsList; import net.minecraft.client.gui.components.Tooltip; -import net.minecraft.client.gui.screens.SoundOptionsScreen; import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + 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.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; -@Mixin(SoundOptionsScreen.class) +@Mixin(net.minecraft.client.gui.screens.SoundOptionsScreen.class) public class SoundOptionsScreenVRMixin { @Shadow private OptionsList list; - @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/OptionsList;addSmall([Lnet/minecraft/client/OptionInstance;)V", ordinal = 1, shift = At.Shift.AFTER)) + @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/OptionsList;addSmall([Lnet/minecraft/client/OptionInstance;)V", ordinal = 1, shift = Shift.AFTER)) private void addVivecraftSettings(CallbackInfo ci) { - this.list.addSmall(OptionInstance.createBoolean( - "vivecraft.options.HRTF_SELECTION", - boolean_ -> Tooltip.create(Component.translatable("vivecraft.options.HRTF_SELECTION.tooltip")), - ClientDataHolderVR.getInstance().vrSettings.hrtfSelection >= 0, - boolean_ -> { - ClientDataHolderVR.getInstance().vrSettings.hrtfSelection = boolean_ ? 0 : -1; - ClientDataHolderVR.getInstance().vrSettings.setOptionValue(VRSettings.VrOptions.HRTF_SELECTION); - ClientDataHolderVR.getInstance().vrSettings.saveOptions(); - - SoundManager soundManager = Minecraft.getInstance().getSoundManager(); - soundManager.reload(); - soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - }) - ,null); + this.list.addSmall( + OptionInstance.createBoolean( + "vivecraft.options.HRTF_SELECTION", + boolean_ -> Tooltip.create(Component.translatable("vivecraft.options.HRTF_SELECTION.tooltip")), + dh.vrSettings.hrtfSelection >= 0, + boolean_ -> { + dh.vrSettings.hrtfSelection = boolean_ ? 0 : -1; + dh.vrSettings.setOptionValue(VrOptions.HRTF_SELECTION); + dh.vrSettings.saveOptions(); + + SoundManager soundManager = mc.getSoundManager(); + soundManager.reload(); + soundManager.play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + } + ), + null + ); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/WinScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/WinScreenVRMixin.java index 6ecd358d0..399783ec3 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/WinScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/WinScreenVRMixin.java @@ -1,8 +1,11 @@ package org.vivecraft.mixin.client_vr.gui.screens; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.screens.WinScreen; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -10,7 +13,7 @@ @Mixin(WinScreen.class) public class WinScreenVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;blendFunc(Lcom/mojang/blaze3d/platform/GlStateManager$SourceFactor;Lcom/mojang/blaze3d/platform/GlStateManager$DestFactor;)V"), method = "render") - private void dontDestroyAlpha(GlStateManager.SourceFactor sourceFactor, GlStateManager.DestFactor destFactor){ - RenderSystem.blendFuncSeparate(sourceFactor, destFactor, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + private void dontDestroyAlpha(SourceFactor sourceFactor, DestFactor destFactor){ + RenderSystem.blendFuncSeparate(sourceFactor, destFactor, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractContainerScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractContainerScreenVRMixin.java index af0c5bf56..751239721 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractContainerScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractContainerScreenVRMixin.java @@ -2,6 +2,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractSignEditScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractSignEditScreenVRMixin.java index d4bd6accc..cbfec9143 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractSignEditScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/AbstractSignEditScreenVRMixin.java @@ -1,27 +1,30 @@ package org.vivecraft.mixin.client_vr.gui.screens.inventory; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; + import net.minecraft.client.gui.screens.inventory.AbstractSignEditScreen; + +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; @Mixin(AbstractSignEditScreen.class) public class AbstractSignEditScreenVRMixin { @Inject(at = @At("HEAD"), method = "init") public void showOverlay(CallbackInfo ci) { - if(VRState.vrRunning) { + if(vrRunning) { KeyboardHandler.setOverlayShowing(true); } } @Inject(at = @At("HEAD"), method = "removed") public void dontShowOverlay(CallbackInfo ci) { - if(VRState.vrRunning) { + if(vrRunning) { KeyboardHandler.setOverlayShowing(false); - } + } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/BookEditScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/BookEditScreenVRMixin.java index 08bee0d46..017a3b427 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/BookEditScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/BookEditScreenVRMixin.java @@ -1,19 +1,23 @@ package org.vivecraft.mixin.client_vr.gui.screens.inventory; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; + import net.minecraft.client.gui.screens.inventory.BookEditScreen; + +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; @Mixin(BookEditScreen.class) public class BookEditScreenVRMixin { - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/BookEditScreen;updateButtonVisibility()V", shift = At.Shift.BEFORE), method = "init") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/BookEditScreen;updateButtonVisibility()V", shift = Shift.BEFORE), method = "init") public void overlay(CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { KeyboardHandler.setOverlayShowing(true); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java index 4041626ef..c668348d8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/inventory/CreativeModeInventoryScreenVRMixin.java @@ -1,8 +1,7 @@ package org.vivecraft.mixin.client_vr.gui.screens.inventory; import net.minecraft.client.gui.components.EditBox; -import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; -import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; +import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.ItemPickerMenu; import net.minecraft.core.NonNullList; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; @@ -13,31 +12,35 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(CreativeModeInventoryScreen.class) -public abstract class CreativeModeInventoryScreenVRMixin extends EffectRenderingInventoryScreen { +@Mixin(net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen.class) +public abstract class CreativeModeInventoryScreenVRMixin extends + net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen +{ @Shadow private EditBox searchBox; - public CreativeModeInventoryScreenVRMixin(CreativeModeInventoryScreen.ItemPickerMenu abstractContainerMenu, Inventory inventory, Component component) { + public CreativeModeInventoryScreenVRMixin(ItemPickerMenu abstractContainerMenu, Inventory inventory, Component component) { super(abstractContainerMenu, inventory, component); } - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen;scrollOffs:F", shift = At.Shift.BEFORE), method = "refreshSearchResults") + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen;scrollOffs:F", shift = Shift.BEFORE), method = "refreshSearchResults") public void search(CallbackInfo ci) { - addCreativeSearch(this.searchBox.getValue(), this.menu.items); + this.addCreativeSearch(this.searchBox.getValue(), this.menu.items); } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/core/NonNullList;addAll(Ljava/util/Collection;)Z", ordinal = 1), method = "selectTab") public void fill(CreativeModeTab creativeModeTab, CallbackInfo ci) { - addCreativeItems(creativeModeTab, this.menu.items); + this.addCreativeItems(creativeModeTab, this.menu.items); } @Unique @@ -65,7 +68,7 @@ private void addCreativeItems(CreativeModeTab tab, NonNullList list) @Unique private void addCreativeSearch(String query, NonNullList list) { NonNullList nonnulllist = NonNullList.create(); - addCreativeItems((CreativeModeTab)null, nonnulllist); + this.addCreativeItems(null, nonnulllist); for (ItemStack itemstack : nonnulllist) { if (query.isEmpty() || itemstack.getHoverName().toString().toLowerCase().contains(query.toLowerCase())) { diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java index 4d66b8759..f49554867 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java @@ -1,49 +1,47 @@ package org.vivecraft.mixin.client_vr.multiplayer; +import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.client_vr.settings.VRSettings.ChatNotifications; +import org.vivecraft.common.VRServerPerms; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; + import com.mojang.authlib.GameProfile; + import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.telemetry.WorldSessionTelemetryManager; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.Connection; -import net.minecraft.network.protocol.game.*; -import org.spongepowered.asm.mixin.Unique; -import org.vivecraft.client.VRPlayersClient; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.common.network.CommonNetworkHelper; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.*; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; import net.minecraft.world.level.GameType; import net.minecraft.world.phys.Vec3; -import org.spongepowered.asm.mixin.Final; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.common.VRServerPerms; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.settings.VRSettings; -@Mixin(ClientPacketListener.class) +@Mixin(net.minecraft.client.multiplayer.ClientPacketListener.class) public class ClientPacketListenerVRMixin { - @Final - @Shadow - private Minecraft minecraft; @Inject(at = @At("TAIL"), method = "") - public void init(Minecraft minecraft, Screen screen, Connection connection, ServerData serverData, GameProfile gameProfile, WorldSessionTelemetryManager worldSessionTelemetryManager, CallbackInfo ci) { + public void init(net.minecraft.client.Minecraft minecraft, Screen screen, Connection connection, ServerData serverData, GameProfile gameProfile, WorldSessionTelemetryManager worldSessionTelemetryManager, CallbackInfo ci) { if (ClientNetworking.needsReset) { - ClientDataHolderVR.getInstance().vrSettings.overrides.resetAll(); + dh.vrSettings.overrides.resetAll(); ClientNetworking.resetServerSettings(); ClientNetworking.displayedChatMessage = false; ClientNetworking.displayedChatWarning = false; @@ -56,11 +54,11 @@ public void login(ClientboundLoginPacket p_105030_, CallbackInfo callback) { VRPlayersClient.clear(); ClientNetworking.sendVersionInfo(); - if (VRState.vrInitialized) { + if (vrInitialized) { // set the timer, even if vr is currently not running - ClientDataHolderVR.getInstance().vrPlayer.chatWarningTimer = 200; - ClientDataHolderVR.getInstance().vrPlayer.teleportWarning = true; - ClientDataHolderVR.getInstance().vrPlayer.vrSwitchWarning = false; + dh.vrPlayer.chatWarningTimer = 200; + dh.vrPlayer.teleportWarning = true; + dh.vrPlayer.vrSwitchWarning = false; } } @@ -72,18 +70,18 @@ public void noTelemetry(WorldSessionTelemetryManager instance, GameType gameType @Inject(at = @At("TAIL"), method = "onDisconnect") public void disconnect(Component component, CallbackInfo ci) { - VRServerPerms.INSTANCE.setTeleportSupported(false); - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vrPlayer.setTeleportOverride(false); + VRServerPerms.setTeleportSupported(false); + if (vrInitialized) { + dh.vrPlayer.setTeleportOverride(false); } - ClientDataHolderVR.getInstance().vrSettings.overrides.resetAll(); + dh.vrSettings.overrides.resetAll(); } @Inject(at = @At("TAIL"), method = "close") public void cleanup(CallbackInfo ci) { ClientNetworking.needsReset = true; } - @Unique String lastMsg = null; + @Unique String lastMsg; @Inject(at = @At("TAIL"), method = "sendChat") public void chatMsg(String string, CallbackInfo ci) { this.lastMsg = string; @@ -96,55 +94,54 @@ public void commandMsg(String string, CallbackInfo ci) { @Inject(at = @At("TAIL"), method = "handlePlayerChat") public void chat(ClientboundPlayerChatPacket clientboundPlayerChatPacket, CallbackInfo ci) { - if (VRState.vrRunning && (minecraft.player == null || lastMsg == null || clientboundPlayerChatPacket.sender() == minecraft.player.getUUID())) { - triggerHapticSound(); + if (vrRunning && (mc.player == null || this.lastMsg == null || clientboundPlayerChatPacket.sender() == mc.player.getUUID())) { + this.triggerHapticSound(); } - lastMsg = null; + this.lastMsg = null; } @Inject(at = @At("TAIL"), method = "handleSystemChat") public void chatSystem(ClientboundSystemChatPacket clientboundSystemChatPacket, CallbackInfo ci) { - if (VRState.vrRunning && (minecraft.player == null || lastMsg == null || clientboundSystemChatPacket.content().getString().contains(lastMsg))) { - triggerHapticSound(); + if (vrRunning && (mc.player == null || this.lastMsg == null || clientboundSystemChatPacket.content().getString().contains(this.lastMsg))) { + this.triggerHapticSound(); } - lastMsg = null; + this.lastMsg = null; } @Unique private void triggerHapticSound(){ - ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); - if (dataholder.vrSettings.chatNotifications != VRSettings.ChatNotifications.NONE) { - if ((dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.HAPTIC || dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.BOTH) && !dataholder.vrSettings.seated) { - dataholder.vr.triggerHapticPulse(ControllerType.LEFT, 0.2F, 1000.0F, 1.0F);} - - if (dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.SOUND || dataholder.vrSettings.chatNotifications == VRSettings.ChatNotifications.BOTH) { - Vec3 vec3 = dataholder.vrPlayer.vrdata_world_pre.getController(1).getPosition(); - minecraft.level.playLocalSound(vec3.x(), vec3.y(), vec3.z(), BuiltInRegistries.SOUND_EVENT.get(new ResourceLocation(dataholder.vrSettings.chatNotificationSound)), SoundSource.NEUTRAL, 0.3F, 0.1F, false); + if (dh.vrSettings.chatNotifications != ChatNotifications.NONE) { + if ((dh.vrSettings.chatNotifications == ChatNotifications.HAPTIC || dh.vrSettings.chatNotifications == ChatNotifications.BOTH) && !dh.vrSettings.seated) { + dh.vr.triggerHapticPulse(ControllerType.LEFT, 0.2F, 1000.0F, 1.0F);} + + if (dh.vrSettings.chatNotifications == ChatNotifications.SOUND || dh.vrSettings.chatNotifications == ChatNotifications.BOTH) { + Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); + mc.level.playLocalSound(vec3.x(), vec3.y(), vec3.z(), BuiltInRegistries.SOUND_EVENT.get(new ResourceLocation(dh.vrSettings.chatNotificationSound)), SoundSource.NEUTRAL, 0.3F, 0.1F, false); } } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;adjustPlayer(Lnet/minecraft/world/entity/player/Player;)V", shift = At.Shift.BEFORE), method = "handleRespawn") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;adjustPlayer(Lnet/minecraft/world/entity/player/Player;)V", shift = Shift.BEFORE), method = "handleRespawn") public void readdInput2(ClientboundRespawnPacket clientboundRespawnPacket, CallbackInfo ci) { ClientNetworking.resetServerSettings(); ClientNetworking.sendVersionInfo(); - if (VRState.vrInitialized) { + if (vrInitialized) { // set the timer, even if vr is currently not running - ClientDataHolderVR.getInstance().vrPlayer.chatWarningTimer = 200; - ClientDataHolderVR.getInstance().vrPlayer.teleportWarning = true; - ClientDataHolderVR.getInstance().vrPlayer.vrSwitchWarning = false; + dh.vrPlayer.chatWarningTimer = 200; + dh.vrPlayer.teleportWarning = true; + dh.vrPlayer.vrSwitchWarning = false; } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V", ordinal = 0, shift = At.Shift.AFTER), method = "handleRespawn(Lnet/minecraft/network/protocol/game/ClientboundRespawnPacket;)V") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V", ordinal = 0, shift = Shift.AFTER), method = "handleRespawn(Lnet/minecraft/network/protocol/game/ClientboundRespawnPacket;)V") public void respawn(ClientboundRespawnPacket packet, CallbackInfo callback) { - ClientDataHolderVR.getInstance().vrSettings.overrides.resetAll(); + dh.vrSettings.overrides.resetAll(); } @Inject(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;getData()Lnet/minecraft/network/FriendlyByteBuf;"), method = "handleCustomPayload(Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;)V", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) - public void handlepacket(ClientboundCustomPayloadPacket p_105004_, CallbackInfo info, ResourceLocation channelID, FriendlyByteBuf buffer) { + public void handlepacket(ClientboundCustomPayloadPacket packet, CallbackInfo info, ResourceLocation channelID, FriendlyByteBuf buffer) { if (channelID.equals(CommonNetworkHelper.CHANNEL)) { - var packetID = CommonNetworkHelper.PacketDiscriminators.values()[buffer.readByte()]; + var packetID = PacketDiscriminators.values()[buffer.readByte()]; ClientNetworking.handlePacket(packetID, buffer); buffer.release(); info.cancel(); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java index 493088e44..646e01d38 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java @@ -1,40 +1,43 @@ package org.vivecraft.mixin.client_vr.multiplayer; -import org.vivecraft.client_vr.ClientDataHolderVR; -import net.minecraft.client.multiplayer.MultiPlayerGameMode; +import org.vivecraft.client.network.ClientNetworking; + import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; 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; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.VRState; -@Mixin(MultiPlayerGameMode.class) + +@Mixin(net.minecraft.client.multiplayer.MultiPlayerGameMode.class) public class MultiPlayerGameModeVRMixin { @Inject(at = @At("HEAD"), method = "useItem") public void overrideUse(Player player, InteractionHand interactionHand, CallbackInfoReturnable cir) { - if (VRState.vrRunning) { - ClientNetworking.overrideLook(player, ClientDataHolderVR.getInstance().vrPlayer.getRightClickLookOverride(player, interactionHand.ordinal())); + if (vrRunning) { + ClientNetworking.overrideLook(player, dh.vrPlayer.getRightClickLookOverride(player, interactionHand.ordinal())); } } @Inject(at = @At("HEAD"), method = "releaseUsingItem") public void overrideReleaseUse(Player player, CallbackInfo ci) { - if (VRState.vrRunning) { - ClientNetworking.overrideLook(player, ClientDataHolderVR.getInstance().vrPlayer.getRightClickLookOverride(player, player.getUsedItemHand().ordinal())); + if (vrRunning) { + ClientNetworking.overrideLook(player, dh.vrPlayer.getRightClickLookOverride(player, player.getUsedItemHand().ordinal())); } } @Inject(at = @At("HEAD"), method = "useItemOn") public void overrideUseOn(LocalPlayer localPlayer, InteractionHand interactionHand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { - if (VRState.vrRunning) { + if (vrRunning) { ClientNetworking.overrideLook(localPlayer, blockHitResult.getLocation().subtract(localPlayer.getEyePosition(1.0F)).normalize()); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java index 8dc79f74d..017f24541 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java @@ -1,26 +1,27 @@ package org.vivecraft.mixin.client_vr.particle; -import net.minecraft.world.entity.Entity; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.*; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.extensions.GameRendererExtension; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.ItemPickupParticle; -import net.minecraft.util.Mth; +import org.vivecraft.mod_compat_vr.pehkui.PehkuiHelper; + +import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.client_vr.VRState.vrRunning; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(ItemPickupParticle.class) +@Mixin(net.minecraft.client.particle.ItemPickupParticle.class) public class ItemPickupParticleVRMixin { - @Unique - private static final Minecraft mc = Minecraft.getInstance(); - @Final @Shadow private Entity target; @@ -33,37 +34,37 @@ public class ItemPickupParticleVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;lerp(DDD)D", ordinal = 0), method = "render") public double updateX(double d, double e, double f) { - if (VRState.vrRunning && target == mc.player) { - playerPos = ((GameRendererExtension) mc.gameRenderer).getControllerRenderPos(0); - e = f = playerPos.x; + if (vrRunning && this.target == mc.player) { + this.playerPos = ((GameRendererExtension) mc.gameRenderer).getControllerRenderPos(0); + e = f = this.playerPos.x; } - return Mth.lerp(d, e, f); + return lerp(e, f, d); } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;lerp(DDD)D", ordinal = 1), method = "render") public double updateY(double d, double e, double f) { - if (VRState.vrRunning && target == mc.player) { + if (vrRunning && this.target == mc.player) { float offset = 0.5F; if (Xplat.isModLoaded("pehkui")) { // pehkui changes the offset, need to account for that - offset *= PehkuiHelper.getPlayerScale(target, (float) d); + offset *= PehkuiHelper.getPlayerScale(this.target, (float) d); } // offset, so the particle is centered around the arm - offset += itemEntity.getBbHeight(); - e = f = playerPos.y - offset; + offset += this.itemEntity.getBbHeight(); + e = f = this.playerPos.y - offset; } - return Mth.lerp(d, e, f); + return lerp(e, f, d); } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;lerp(DDD)D", ordinal = 2), method = "render") public double updateZ(double d, double e, double f) { - if (VRState.vrRunning && target == mc.player) { - e = f = playerPos.z; - playerPos = null; + if (vrRunning && this.target == mc.player) { + e = f = this.playerPos.z; + this.playerPos = null; } - return Mth.lerp(d, e, f); + return lerp(e, f, d); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java index 34e80de03..d0ca26a5d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java @@ -1,49 +1,54 @@ package org.vivecraft.mixin.client_vr.player; -import net.minecraft.network.protocol.Packet; -import net.minecraft.world.level.Level; -import org.spongepowered.asm.mixin.injection.*; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.client_vr.VRState; +import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; import org.vivecraft.client_vr.extensions.PlayerExtension; +import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; +import org.vivecraft.client_vr.settings.VRSettings.FreeMove; +import org.vivecraft.client_vr.utils.external.jinfinadeck; +import org.vivecraft.client_vr.utils.external.jkatvr; +import org.vivecraft.common.network.CommonNetworkHelper; + import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; + +import com.mojang.authlib.GameProfile; + import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientPacketListener; +import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.Input; +import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; +import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; import net.minecraft.sounds.SoundEvent; -import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.Pose; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; -import org.vivecraft.client_vr.utils.external.jinfinadeck; -import org.vivecraft.client_vr.utils.external.jkatvr; +import net.minecraft.world.phys.Vec3; -import com.mojang.authlib.GameProfile; +import static org.vivecraft.client_vr.VRState.*; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.player.LocalPlayer; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.MoverType; -import net.minecraft.world.entity.Pose; -import net.minecraft.world.phys.Vec3; +import static org.joml.Math.*; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(LocalPlayer.class) public abstract class LocalPlayerVRMixin extends AbstractClientPlayer implements PlayerExtension { @@ -68,7 +73,6 @@ public abstract class LocalPlayerVRMixin extends AbstractClientPlayer implements @Shadow @Final public ClientPacketListener connection; - private final ClientDataHolderVR dataholder = ClientDataHolderVR.getInstance(); @Shadow private InteractionHand usingItemHand; @Shadow @@ -86,30 +90,30 @@ public LocalPlayerVRMixin(ClientLevel clientLevel, GameProfile gameProfile) { @Inject(at = @At("TAIL"), method = "startRiding") public void startRidingTracker(Entity entity, boolean bl, CallbackInfoReturnable cir) { - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vehicleTracker.onStartRiding(entity, (LocalPlayer) (Object) this); + if (vrInitialized) { + dh.vehicleTracker.onStartRiding(entity, (LocalPlayer) (Object) this); } } @Inject(at = @At("TAIL"), method = "removeVehicle") public void stopRidingTracker(CallbackInfo ci) { - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vehicleTracker.onStopRiding((LocalPlayer) (Object) this); + if (vrInitialized) { + dh.vehicleTracker.onStopRiding((LocalPlayer) (Object) this); } } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;tick()V", shift = At.Shift.BEFORE), method = "tick") public void overrideLookPre(CallbackInfo ci) { - if (VRState.vrRunning) { - ClientDataHolderVR.getInstance().vrPlayer.doPermanantLookOverride((LocalPlayer) (Object) this, ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_pre); + if (vrRunning) { + dh.vrPlayer.doPermanentLookOverride((LocalPlayer) (Object) this, dh.vrPlayer.vrdata_world_pre); } } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;tick()V", shift = At.Shift.AFTER), method = "tick") public void overridePose(CallbackInfo ci) { - if (VRState.vrRunning) { + if (vrRunning) { ClientNetworking.overridePose((LocalPlayer) (Object) this); - ClientDataHolderVR.getInstance().vrPlayer.doPermanantLookOverride((LocalPlayer) (Object) this, ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_pre); + dh.vrPlayer.doPermanentLookOverride((LocalPlayer) (Object) this, dh.vrPlayer.vrdata_world_pre); } } @@ -141,7 +145,7 @@ public void noMovePacketsOnTeleport(ClientPacketListener instance, Packet pac public void walkUp(CallbackInfo ci) { // clear teleport here, after all the packets would be sent this.teleported = false; - if (VRState.vrRunning && ClientDataHolderVR.getInstance().vrSettings.walkUpBlocks) { + if (vrRunning && dh.vrSettings.walkUpBlocks) { this.minecraft.options.autoJump().set(false); } } @@ -154,42 +158,42 @@ public void swingArm(InteractionHand interactionhand, VRFirstPersonArmSwing inte @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;aiStep()V"), method = "aiStep") public void ai(CallbackInfo ci) { - if (VRState.vrRunning) { - this.dataholder.vrPlayer.tick((LocalPlayer) (Object) this, this.minecraft, this.random); + if (vrRunning) { + dh.vrPlayer.tick((LocalPlayer) (Object) this, this.minecraft, this.random); } } @Inject(at = @At("HEAD"), method = "move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V", cancellable = true) public void overwriteMove(MoverType pType, Vec3 pPos, CallbackInfo info) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } this.moveMulIn = this.stuckSpeedMultiplier; if (pPos.length() != 0.0D && !this.isPassenger()) { - boolean flag = VRPlayer.get().getFreeMove(); - boolean flag1 = flag || ClientDataHolderVR.getInstance().vrSettings.simulateFalling && !this.onClimbable() + boolean flag = dh.vrPlayer.getFreeMove(); + boolean flag1 = flag || dh.vrSettings.simulateFalling && !this.onClimbable() && !this.isShiftKeyDown(); - if (ClientDataHolderVR.getInstance().climbTracker.isActive((LocalPlayer) (Object) this) - && (flag || ClientDataHolderVR.getInstance().climbTracker.isGrabbingLadder())) { + if (dh.climbTracker.isActive() + && (flag || dh.climbTracker.isGrabbingLadder())) { flag1 = true; } - Vec3 vec3 = VRPlayer.get().roomOrigin; + Vec3 vec3 = dh.vrPlayer.roomOrigin; - if ((ClientDataHolderVR.getInstance().climbTracker.isGrabbingLadder() || flag - || ClientDataHolderVR.getInstance().swimTracker.isActive((LocalPlayer) (Object) this)) - && (this.zza != 0.0F || this.isFallFlying() || Math.abs(this.getDeltaMovement().x) > 0.01D - || Math.abs(this.getDeltaMovement().z) > 0.01D)) { + if ((dh.climbTracker.isGrabbingLadder() || flag + || dh.swimTracker.isActive()) + && (this.zza != 0.0F || this.isFallFlying() || abs(this.getDeltaMovement().x) > 0.01D + || abs(this.getDeltaMovement().z) > 0.01D)) { double d0 = vec3.x - this.getX(); double d1 = vec3.z - this.getZ(); double d2 = this.getX(); double d3 = this.getZ(); super.move(pType, pPos); - if (ClientDataHolderVR.getInstance().vrSettings.walkUpBlocks) { + if (dh.vrSettings.walkUpBlocks) { this.setMaxUpStep(this.getBlockJumpFactor() == 1.0F ? 1.0F : 0.6F); } else { this.setMaxUpStep(0.6F); @@ -197,11 +201,11 @@ public void overwriteMove(MoverType pType, Vec3 pPos, CallbackInfo info) { } double d4 = this.getY() + this.getRoomYOffsetFromPose(); - VRPlayer.get().setRoomOrigin(this.getX() + d0, d4, this.getZ() + d1, false); + dh.vrPlayer.setRoomOrigin(this.getX() + d0, d4, this.getZ() + d1, false); } else if (flag1) { super.move(pType, new Vec3(0.0D, pPos.y, 0.0D)); - VRPlayer.get().setRoomOrigin(VRPlayer.get().roomOrigin.x, this.getY() + this.getRoomYOffsetFromPose(), - VRPlayer.get().roomOrigin.z, false); + dh.vrPlayer.setRoomOrigin(dh.vrPlayer.roomOrigin.x, this.getY() + this.getRoomYOffsetFromPose(), + dh.vrPlayer.roomOrigin.z, false); } else { this.setOnGround(true); } @@ -216,7 +220,7 @@ public double getRoomYOffsetFromPose() { double d0 = 0.0D; if (this.getPose() == Pose.FALL_FLYING || this.getPose() == Pose.SPIN_ATTACK - || this.getPose() == Pose.SWIMMING && !ClientDataHolderVR.getInstance().crawlTracker.crawlsteresis) { + || this.getPose() == Pose.SWIMMING && !dh.crawlTracker.crawlsteresis) { d0 = -1.2D; } @@ -225,70 +229,69 @@ public double getRoomYOffsetFromPose() { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;sin(F)F"), method = "updateAutoJump") private float modifyAutoJumpSin(float original) { - return VRState.vrRunning ? ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_pre.getBodyYaw() * ((float) Math.PI / 180) : original; + return vrRunning ? dh.vrPlayer.vrdata_world_pre.getBodyYaw() * ((float) PI / 180) : original; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;cos(F)F"), method = "updateAutoJump") private float modifyAutoJumpCos(float original) { - return VRState.vrRunning ? ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_pre.getBodyYaw() * ((float) Math.PI / 180) : original; + return vrRunning ? dh.vrPlayer.vrdata_world_pre.getBodyYaw() * ((float) PI / 180) : original; } @Override public ItemStack eat(Level level, ItemStack itemStack) { - if (VRState.vrRunning && itemStack.isEdible() && ((LocalPlayer) (Object) this) == Minecraft.getInstance().player && itemStack.getHoverName().getString().equals("EAT ME")) { - ClientDataHolderVR.getInstance().vrPlayer.wfMode = 0.5D; - ClientDataHolderVR.getInstance().vrPlayer.wfCount = 400; + if (vrRunning && itemStack.isEdible() && ((LocalPlayer) (Object) this) == mc.player && itemStack.getHoverName().getString().equals("EAT ME")) { + dh.vrPlayer.wfMode = 0.5D; + dh.vrPlayer.wfCount = 400; } return super.eat(level, itemStack); } @Override - public void moveTo(double pX, double p_20109_, double pY, float p_20111_, float pZ) { - super.moveTo(pX, p_20109_, pY, p_20111_, pZ); - if (!VRState.vrRunning) { + public void moveTo(double x, double y, double z, float yRot, float xRot) { + super.moveTo(x, y, z, yRot, xRot); + if (!vrRunning) { return; } if (this.initFromServer) { - ClientDataHolderVR.getInstance().vrPlayer.snapRoomOriginToPlayerEntity((LocalPlayer) (Object) this, false, false); + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); } } @Override - public void absMoveTo(double pX, double p_19892_, double pY, float p_19894_, float pZ) { - super.absMoveTo(pX, p_19892_, pY, p_19894_, pZ); - if (!VRState.vrRunning) { + public void absMoveTo(double x, double y, double z, float yRot, float xRot) { + super.absMoveTo(x, y, z, yRot, xRot); + if (!vrRunning) { return; } - ClientDataHolderVR.getInstance().vrPlayer.snapRoomOriginToPlayerEntity((LocalPlayer) (Object) this, false, false); + dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); } @Override - public void setPos(double pX, double p_20211_, double pY) { + public void setPos(double x, double y, double z) { this.initFromServer = true; - if (!VRState.vrRunning) { - super.setPos(pX, p_20211_, pY); + if (!vrRunning) { + super.setPos(x, y, z); return; } double d0 = this.getX(); double d1 = this.getY(); double d2 = this.getZ(); - super.setPos(pX, p_20211_, pY); + super.setPos(x, y, z); double d3 = this.getX(); double d4 = this.getY(); double d5 = this.getZ(); Entity entity = this.getVehicle(); if (this.isPassenger()) { - Vec3 vec3 = ClientDataHolderVR.getInstance().vehicleTracker.Premount_Pos_Room; - vec3 = vec3.yRot(ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_pre.rotation_radians); - pX = pX - vec3.x; - p_20211_ = ClientDataHolderVR.getInstance().vehicleTracker.getVehicleFloor(entity, p_20211_); - pY = pY - vec3.z; - ClientDataHolderVR.getInstance().vrPlayer.setRoomOrigin(pX, p_20211_, pY, pX + p_20211_ + pY == 0.0D); + Vec3 vec3 = dh.vehicleTracker.Premount_Pos_Room; + vec3 = vec3.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); + x = x - vec3.x; + y = dh.vehicleTracker.getVehicleFloor(entity, y); + z = z - vec3.z; + dh.vrPlayer.setRoomOrigin(x, y, z, x + y + z == 0.0D); } else { - Vec3 vec31 = ClientDataHolderVR.getInstance().vrPlayer.roomOrigin; - VRPlayer.get().setRoomOrigin(vec31.x + (d3 - d0), vec31.y + (d4 - d1), vec31.z + (d5 - d2), - pX + p_20211_ + pY == 0.0D); + Vec3 vec31 = dh.vrPlayer.roomOrigin; + dh.vrPlayer.setRoomOrigin(vec31.x + (d3 - d0), vec31.y + (d4 - d1), vec31.z + (d5 - d2), x + y + z == 0.0D); } } @@ -303,15 +306,15 @@ public void doDrag() { // account for stock drag code we can't change in LivingEntity#travel this.setDeltaMovement(this.getDeltaMovement().x / xFactor, this.getDeltaMovement().y, this.getDeltaMovement().z / zFactor); - double addFactor = dataholder.vrSettings.inertiaFactor.getFactor(); + double addFactor = dh.vrSettings.inertiaFactor.getFactor(); - double boundedAdditionX = getBoundedAddition(additionX); - double targetLimitX = (friction * boundedAdditionX) / (1f - friction); + double boundedAdditionX = this.getBoundedAddition(this.additionX); + double targetLimitX = (friction * boundedAdditionX) / (1.0f - friction); double multiFactorX = targetLimitX / (friction * (targetLimitX + (boundedAdditionX * addFactor))); xFactor *= multiFactorX; - double boundedAdditionZ = getBoundedAddition(additionZ); - double targetLimitZ = (friction * boundedAdditionZ) / (1f - friction); + double boundedAdditionZ = this.getBoundedAddition(this.additionZ); + double targetLimitZ = (friction * boundedAdditionZ) / (1.0f - friction); double multiFactorZ = targetLimitZ / (friction * (targetLimitZ + (boundedAdditionZ * addFactor))); zFactor *= multiFactorZ; @@ -324,7 +327,7 @@ public double getBoundedAddition(double orig) { @Override public void moveRelative(float pAmount, Vec3 pRelative) { - if (!VRState.vrRunning) { + if (!vrRunning) { super.moveRelative(pAmount, pRelative); return; } @@ -332,19 +335,18 @@ public void moveRelative(float pAmount, Vec3 pRelative) { double d0 = pRelative.y; double d1 = pRelative.x; double d2 = pRelative.z; - VRPlayer vrplayer = this.dataholder.vrPlayer; - if (vrplayer.getFreeMove()) { + if (dh.vrPlayer.getFreeMove()) { double d3 = d1 * d1 + d2 * d2; double d4 = 0.0D; double d5 = 0.0D; double d6 = 0.0D; double d7 = 1.0D; - if (d3 >= (double) 1.0E-4F || ClientDataHolderVR.katvr) { - d3 = (double) Mth.sqrt((float) d3); + if (d3 >= (double) 1.0E-4F || dh.katvr) { + d3 = (double) sqrt((float) d3); - if (d3 < 1.0D && !ClientDataHolderVR.katvr) { + if (d3 < 1.0D && !dh.katvr) { d3 = 1.0D; } @@ -352,73 +354,70 @@ public void moveRelative(float pAmount, Vec3 pRelative) { d1 = d1 * d3; d2 = d2 * d3; Vec3 vec3 = new Vec3(d1, 0.0D, d2); - VRPlayer vrplayer1 = this.dataholder.vrPlayer; boolean isFlyingOrSwimming = !this.isPassenger() && (this.getAbilities().flying || this.isSwimming()); - if (ClientDataHolderVR.katvr) { + if (dh.katvr) { jkatvr.query(); - d3 = (double) (jkatvr.getSpeed() * jkatvr.walkDirection() * this.dataholder.vrSettings.movementSpeedMultiplier); + d3 = (double) (jkatvr.getSpeed() * jkatvr.walkDirection() * dh.vrSettings.movementSpeedMultiplier); vec3 = new Vec3(0.0D, 0.0D, d3); if (isFlyingOrSwimming) { - vec3 = vec3.xRot(vrplayer1.vrdata_world_pre.hmd.getPitch() * ((float) Math.PI / 180F)); + vec3 = vec3.xRot(toRadians(dh.vrPlayer.vrdata_world_pre.hmd.getPitch())); } - vec3 = vec3.yRot(-jkatvr.getYaw() * ((float) Math.PI / 180F) + this.dataholder.vrPlayer.vrdata_world_pre.rotation_radians); - } else if (ClientDataHolderVR.infinadeck) { + vec3 = vec3.yRot(toRadians(-jkatvr.getYaw()) + dh.vrPlayer.vrdata_world_pre.rotation_radians); + } else if (dh.infinadeck) { jinfinadeck.query(); - d3 = (double) (jinfinadeck.getSpeed() * jinfinadeck.walkDirection() * this.dataholder.vrSettings.movementSpeedMultiplier); + d3 = (double) (jinfinadeck.getSpeed() * jinfinadeck.walkDirection() * dh.vrSettings.movementSpeedMultiplier); vec3 = new Vec3(0.0D, 0.0D, d3); if (isFlyingOrSwimming) { - vec3 = vec3.xRot(vrplayer1.vrdata_world_pre.hmd.getPitch() * ((float) Math.PI / 180F)); + vec3 = vec3.xRot(toRadians(dh.vrPlayer.vrdata_world_pre.hmd.getPitch())); } - vec3 = vec3.yRot(-jinfinadeck.getYaw() * ((float) Math.PI / 180F) + this.dataholder.vrPlayer.vrdata_world_pre.rotation_radians); - } else if (this.dataholder.vrSettings.seated) { - int j = 0; - if (this.dataholder.vrSettings.seatedUseHMD) { - j = 1; - } + vec3 = vec3.yRot(toRadians(-jinfinadeck.getYaw()) + dh.vrPlayer.vrdata_world_pre.rotation_radians); + } else if (dh.vrSettings.seated) { + int j = dh.vrSettings.seatedUseHMD ? 1 : 0; if (isFlyingOrSwimming) { - vec3 = vec3.xRot(vrplayer1.vrdata_world_pre.getController(j).getPitch() * ((float) Math.PI / 180F)); + vec3 = vec3.xRot(toRadians(dh.vrPlayer.vrdata_world_pre.getController(j).getPitch())); } - vec3 = vec3.yRot(-vrplayer1.vrdata_world_pre.getController(j).getYaw() * ((float) Math.PI / 180F)); + vec3 = vec3.yRot(toRadians(-dh.vrPlayer.vrdata_world_pre.getController(j).getYaw())); } else { - VRSettings.FreeMove freeMoveType = !this.isPassenger() && this.getAbilities().flying && this.dataholder.vrSettings.vrFreeMoveFlyMode != VRSettings.FreeMove.AUTO ? this.dataholder.vrSettings.vrFreeMoveFlyMode : this.dataholder.vrSettings.vrFreeMoveMode; + FreeMove freeMoveType = !this.isPassenger() && this.getAbilities().flying && dh.vrSettings.vrFreeMoveFlyMode != FreeMove.AUTO ? dh.vrSettings.vrFreeMoveFlyMode : dh.vrSettings.vrFreeMoveMode; if (isFlyingOrSwimming) { - switch (freeMoveType) { - case CONTROLLER: - vec3 = vec3.xRot(vrplayer1.vrdata_world_pre.getController(1).getPitch() * ((float) Math.PI / 180F)); - break; - case HMD: - case RUN_IN_PLACE: - case ROOM: - vec3 = vec3.xRot(vrplayer1.vrdata_world_pre.hmd.getPitch() * ((float) Math.PI / 180F)); + switch (freeMoveType) + { + case CONTROLLER -> { vec3 = vec3.xRot(toRadians(dh.vrPlayer.vrdata_world_pre.getController(1).getPitch())); } + case HMD, RUN_IN_PLACE, ROOM -> { vec3 = vec3.xRot(toRadians(dh.vrPlayer.vrdata_world_pre.hmd.getPitch())); } } } - if (this.dataholder.jumpTracker.isjumping()) { - vec3 = vec3.yRot(-vrplayer1.vrdata_world_pre.hmd.getYaw() * ((float) Math.PI / 180F)); + if (dh.jumpTracker.isjumping()) { + vec3 = vec3.yRot(toRadians(-dh.vrPlayer.vrdata_world_pre.hmd.getYaw())); } else { - switch (freeMoveType) { - case CONTROLLER: - vec3 = vec3.yRot(-vrplayer1.vrdata_world_pre.getController(1).getYaw() * ((float) Math.PI / 180F)); - break; - - case HMD: - vec3 = vec3.yRot(-vrplayer1.vrdata_world_pre.hmd.getYaw() * ((float) Math.PI / 180F)); - break; - - case RUN_IN_PLACE: - vec3 = vec3.yRot((float) (-this.dataholder.runTracker.getYaw() * (double) ((float) Math.PI / 180F))); - vec3 = vec3.scale(this.dataholder.runTracker.getSpeed()); - - case ROOM: - vec3 = vec3.yRot((180.0F + this.dataholder.vrSettings.worldRotation) * ((float) Math.PI / 180F)); + switch (freeMoveType) + { + case CONTROLLER -> + { + vec3 = vec3.yRot(toRadians(-dh.vrPlayer.vrdata_world_pre.getController(1).getYaw())); + } + case HMD -> + { + vec3 = vec3.yRot(toRadians(-dh.vrPlayer.vrdata_world_pre.hmd.getYaw())); + } + case RUN_IN_PLACE -> + { + vec3 = vec3.yRot((float) -dh.runTracker.getYaw()); + vec3 = vec3.scale(dh.runTracker.getSpeed()); + vec3 = vec3.yRot(toRadians(180.0F + dh.vrSettings.worldRotation)); + } + case ROOM -> + { + vec3 = vec3.yRot(toRadians(180.0F + dh.vrSettings.worldRotation)); + } } } } @@ -428,7 +427,7 @@ public void moveRelative(float pAmount, Vec3 pRelative) { d5 = vec3.z; if (!this.getAbilities().flying && !this.wasTouchingWater) { - d7 = this.dataholder.vrSettings.inertiaFactor.getFactor(); + d7 = dh.vrSettings.inertiaFactor.getFactor(); } float f = 1.0F; @@ -451,11 +450,11 @@ public void moveRelative(float pAmount, Vec3 pRelative) { @Override public void die(DamageSource pCause) { super.die(pCause); - if (!VRState.vrRunning) { + if (!vrRunning) { return; } - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 2000); - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(1, 2000); + dh.vr.triggerHapticPulse(0, 2000); + dh.vr.triggerHapticPulse(1, 2000); } @Override @@ -470,7 +469,7 @@ public void setMovementTeleportTimer(int value) { @Override public int getMovementTeleportTimer() { - return movementTeleportTimer; + return this.movementTeleportTimer; } @Override @@ -484,37 +483,37 @@ public float getMuhJumpFactor() { } @Override - public void stepSound(BlockPos blockforNoise, Vec3 soundPos) { - BlockState blockstate = this.level().getBlockState(blockforNoise); - Block block = blockstate.getBlock(); - SoundType soundtype = block.getSoundType(blockstate); - BlockState blockstate1 = this.level().getBlockState(blockforNoise.above()); - - if (blockstate1.getBlock() == Blocks.SNOW) { - soundtype = Blocks.SNOW.getSoundType(blockstate1); + public void stepSound(BlockPos blockforNoise, double soundPosX, double soundPosY, double soundPosZ) { + BlockState bs = this.level().getBlockState(blockforNoise); + Block block = bs.getBlock(); + SoundType soundtype = block.getSoundType(bs); + BlockState bsup = this.level().getBlockState(blockforNoise.above()); + + if (bsup.getBlock() == Blocks.SNOW) { + soundtype = Blocks.SNOW.getSoundType(bsup); } - float f = soundtype.getVolume(); - float f1 = soundtype.getPitch(); - SoundEvent soundevent = soundtype.getStepSound(); + float volume = soundtype.getVolume(); + float pitch = soundtype.getPitch(); + SoundEvent soundIn = soundtype.getStepSound(); // TODO: liquid is deprecated if (!this.isSilent() && !block.defaultBlockState().liquid()) { - this.level().playSound((LocalPlayer) null, soundPos.x, soundPos.y, soundPos.z, soundevent, this.getSoundSource(), f, f1); + this.level().playSound(null, soundPosX, soundPosY, soundPosZ, soundIn, this.getSoundSource(), volume, pitch); } } @Override public boolean isClimbeyJumpEquipped() { - return this.getItemBySlot(EquipmentSlot.FEET) != null && ClientDataHolderVR.getInstance().jumpTracker.isBoots(this.getItemBySlot(EquipmentSlot.FEET)); + return this.getItemBySlot(EquipmentSlot.FEET) != null && dh.jumpTracker.isBoots(this.getItemBySlot(EquipmentSlot.FEET)); } @Override public boolean isClimbeyClimbEquipped() { - if (this.getMainHandItem() != null && ClientDataHolderVR.getInstance().climbTracker.isClaws(this.getMainHandItem())) { + if (this.getMainHandItem() != null && dh.climbTracker.isClaws(this.getMainHandItem())) { return true; } else { - return this.getOffhandItem() != null && ClientDataHolderVR.getInstance().climbTracker.isClaws(this.getOffhandItem()); + return this.getOffhandItem() != null && dh.climbTracker.isClaws(this.getOffhandItem()); } } @@ -526,14 +525,8 @@ public void releaseUsingItem() { @Override public void setItemInUseClient(ItemStack item, InteractionHand hand) { this.useItem = item; - - if (item != ItemStack.EMPTY) { - this.startedUsingItem = true; - this.usingItemHand = hand; - } else { - this.startedUsingItem = false; - this.usingItemHand = hand; - } + this.startedUsingItem = item != ItemStack.EMPTY; + this.usingItemHand = hand; } @Override diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java index 9a2fa4ad0..a9a8b57bd 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java @@ -1,35 +1,64 @@ package org.vivecraft.mixin.client_vr.renderer; +import org.vivecraft.client.VivecraftVRMod; +import org.vivecraft.client.Xevents; +import org.vivecraft.client.extensions.RenderTargetExtension; +import org.vivecraft.client.network.ClientNetworking; +import org.vivecraft.client.utils.Utils; +import org.vivecraft.client_vr.VRData.VRDevicePose; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; +import org.vivecraft.client_vr.extensions.LevelRendererExtension; +import org.vivecraft.client_vr.extensions.PlayerExtension; +import org.vivecraft.client_vr.gameplay.VRPlayer; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; +import org.vivecraft.client_vr.gameplay.trackers.BowTracker; +import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; +import org.vivecraft.client_vr.provider.ControllerType; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.render.VRWidgetHelper; +import org.vivecraft.client_vr.render.XRCamera; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; +import org.vivecraft.client_vr.settings.VRSettings.RenderPointerElement; +import org.vivecraft.client_vr.settings.VRSettings.ShaderGUIRender; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.mixin.client.blaze3d.RenderSystemAccessor; +import org.vivecraft.mod_compat_vr.ShadersHelper; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; + +import org.apache.commons.lang3.tuple.Triple; +import org.joml.Matrix3f; +import org.joml.Matrix4f; +import org.joml.Vector2f; +import org.joml.Vector3f; +import org.lwjgl.opengl.GL11C; import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import com.mojang.blaze3d.vertex.VertexFormat.Mode; -import com.mojang.math.Axis; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.multiplayer.ClientLevel; -import org.joml.Matrix3f; -import org.joml.Matrix4f; -import org.joml.Vector2f; -import org.joml.Vector3f; + import net.minecraft.Util; import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.*; -import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.tags.FluidTags; -import net.minecraft.util.Mth; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.LivingEntity; @@ -38,11 +67,22 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.Vec3; -import org.apache.commons.lang3.tuple.Triple; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL43C; + +import javax.annotation.CheckForNull; +import java.nio.file.Path; +import java.util.Calendar; + +import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.convertToVector3f; +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; +import static org.joml.RoundingMode.FLOOR; + +import static net.minecraft.client.Minecraft.ON_OSX; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -52,43 +92,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.mod_compat_vr.ShadersHelper; -import org.vivecraft.client_vr.MethodHolder; -import org.vivecraft.client.Xevents; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; -import org.vivecraft.client_vr.extensions.LevelRendererExtension; -import org.vivecraft.client_vr.extensions.PlayerExtension; -import org.vivecraft.client.extensions.RenderTargetExtension; -import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.VRData; -import org.vivecraft.client_vr.gameplay.VRPlayer; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.gameplay.screenhandlers.RadialHandler; -import org.vivecraft.client_vr.gameplay.trackers.BowTracker; -import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; -import org.vivecraft.mixin.client.blaze3d.RenderSystemAccessor; -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.render.XRCamera; -import org.vivecraft.client_vr.render.VRWidgetHelper; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.client.utils.Utils; -import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; - -import java.nio.file.Path; -import java.util.Calendar; @Mixin(GameRenderer.class) public abstract class GameRendererVRMixin implements ResourceManagerReloadListener, AutoCloseable, GameRendererExtension { - private static final ClientDataHolderVR DATA_HOLDER = ClientDataHolderVR.getInstance(); @Unique public float minClipDistance = 0.02F; @Unique @@ -165,10 +173,6 @@ public abstract class GameRendererVRMixin @Unique private PoseStack stack; - @Shadow - @Final - private Minecraft minecraft; - @Shadow private float renderDistance; @@ -226,158 +230,189 @@ public abstract class GameRendererVRMixin private Camera mainCamera; @Override - public double getRveY() { - return rveY; + public double getRveY() + { + return this.rveY; } @Override - public float inBlock() { - return inBlock; + public float inBlock() + { + return this.inBlock; } @Redirect(method = "", at = @At(value = "NEW", target = "net/minecraft/client/Camera")) - Camera replaceCamera() { + Camera replaceCamera() + { return new XRCamera(); } @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;level:Lnet/minecraft/client/multiplayer/ClientLevel;"), method = "pick") - public ClientLevel appendCheck(Minecraft instance) { - if (!VRState.vrRunning) { + public ClientLevel appendCheck(Minecraft instance) + { + if (!vrRunning) + { return instance.level; } - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render == null ? null : instance.level; + return dh.vrPlayer.vrdata_world_render == null ? null : instance.level; } @ModifyVariable(at = @At("STORE"), method = "pick(F)V", ordinal = 0) - public Vec3 rayTrace(Vec3 original) { - if (!VRState.vrRunning) { + public Vec3 rayTrace(Vec3 original) + { + if (!vrRunning) + { return original; } - this.minecraft.hitResult = GameRendererVRMixin.DATA_HOLDER.vrPlayer.rayTraceBlocksVR(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render, 0, this.minecraft.gameMode.getPickRange(), false); - this.crossVec = GameRendererVRMixin.DATA_HOLDER.vrPlayer.AimedPointAtDistance(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render, 0, this.minecraft.gameMode.getPickRange()); - return GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getPosition(); + mc.hitResult = dh.vrPlayer.rayTraceBlocksVR(dh.vrPlayer.vrdata_world_render, 0, mc.gameMode.getPickRange(), false); + this.crossVec = dh.vrPlayer.AimedPointAtDistance(dh.vrPlayer.vrdata_world_render, 0, mc.gameMode.getPickRange()); + return dh.vrPlayer.vrdata_world_render.getController(0).getPosition(); } @ModifyVariable(at = @At("STORE"), method = "pick(F)V", ordinal = 1) - public Vec3 vrVec31(Vec3 original) { - if (!VRState.vrRunning) { + public Vec3 vrVec31(Vec3 original) + { + if (!vrRunning) + { return original; } - return GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getDirection(); + return dh.vrPlayer.vrdata_world_render.getController(0).getDirection(); } //TODO Vivecraft add riding check in case your hand is somewhere inappropriate @Inject(at = @At("HEAD"), method = "tickFov", cancellable = true) - public void noFOVchangeInVR(CallbackInfo ci){ - if (!RenderPassType.isVanilla()) { - this.oldFov = this.fov = 1.0f; + public void noFOVchangeInVR(CallbackInfo ci) + { + if (!RenderPassType.isVanilla()) + { + this.oldFov = this.fov = 1.0F; ci.cancel(); } } @Inject(at = @At("HEAD"), method = "getFov(Lnet/minecraft/client/Camera;FZ)D", cancellable = true) - public void fov(Camera camera, float f, boolean bl, CallbackInfoReturnable info) { - if (this.minecraft.level == null || isInMenuRoom()) { // Vivecraft: using this on the main menu - info.setReturnValue(Double.valueOf(this.minecraft.options.fov().get())); + public void fov(Camera camera, float f, boolean bl, CallbackInfoReturnable info) + { + // Vivecraft: using this on the main menu + if (mc.level == null || this.isInMenuRoom()) + { + info.setReturnValue(Double.valueOf(mc.options.fov().get())); } } @Inject(at = @At("HEAD"), method = "getProjectionMatrix(D)Lorg/joml/Matrix4f;", cancellable = true) - public void projection(double d, CallbackInfoReturnable info) { - if (!VRState.vrRunning) { + public void projection(double d, CallbackInfoReturnable info) + { + if (!vrRunning) { return; } PoseStack posestack = new PoseStack(); - setupClipPlanes(); - if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.LEFT) { - posestack.mulPoseMatrix(GameRendererVRMixin.DATA_HOLDER.vrRenderer.eyeproj[0]); - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.RIGHT) { - posestack.mulPoseMatrix(GameRendererVRMixin.DATA_HOLDER.vrRenderer.eyeproj[1]); - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.THIRD) { - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY) { - posestack.mulPoseMatrix( - new Matrix4f().setPerspective(GameRendererVRMixin.DATA_HOLDER.vrSettings.mixedRealityFov * 0.01745329238474369F, - GameRendererVRMixin.DATA_HOLDER.vrSettings.mixedRealityAspectRatio, this.minClipDistance, - this.clipDistance)); - } else { - posestack.mulPoseMatrix( - new Matrix4f().setPerspective(GameRendererVRMixin.DATA_HOLDER.vrSettings.mixedRealityFov * 0.01745329238474369F, - (float) this.minecraft.getWindow().getScreenWidth() - / (float) this.minecraft.getWindow().getScreenHeight(), - this.minClipDistance, this.clipDistance)); + this.setupClipPlanes(); + Matrix4f view = posestack.last().pose(); + info.setReturnValue(switch (dh.currentPass) { + case LEFT -> { yield view.mul(dh.vrRenderer.eyeproj[0]); } + case RIGHT -> { yield view.mul(dh.vrRenderer.eyeproj[1]); } + case THIRD -> + { + this.thirdPassProjectionMatrix.set(view.perspective( + toRadians(dh.vrSettings.mixedRealityFov), + dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY ? + dh.vrSettings.mixedRealityAspectRatio : + (float) mc.getWindow().getScreenWidth() / (float) mc.getWindow().getScreenHeight(), + this.minClipDistance, + this.clipDistance + )); + yield view; } - this.thirdPassProjectionMatrix = new Matrix4f(posestack.last().pose()); - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.CAMERA) { - posestack.mulPoseMatrix(new Matrix4f().setPerspective(GameRendererVRMixin.DATA_HOLDER.vrSettings.handCameraFov * 0.01745329238474369F, - (float) GameRendererVRMixin.DATA_HOLDER.vrRenderer.cameraFramebuffer.viewWidth - / (float) GameRendererVRMixin.DATA_HOLDER.vrRenderer.cameraFramebuffer.viewHeight, - this.minClipDistance, this.clipDistance)); - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.SCOPEL - || GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.SCOPER) { - posestack.mulPoseMatrix(new Matrix4f().setPerspective(70f / 8f * 0.01745329238474369F, 1.0F, 0.05F, this.clipDistance)); - - } else { - if (this.zoom != 1.0F) { - posestack.translate((double) this.zoomX, (double) (-this.zoomY), 0.0D); - posestack.scale(this.zoom, this.zoom, 1.0F); + case CAMERA -> + { + yield view.perspective( + toRadians(dh.vrSettings.handCameraFov), + (float) dh.vrRenderer.cameraFramebuffer.viewWidth / (float) dh.vrRenderer.cameraFramebuffer.viewHeight, + this.minClipDistance, + this.clipDistance + ); } - posestack.mulPoseMatrix(new Matrix4f().setPerspective((float) d * 0.01745329238474369F, (float) this.minecraft.getWindow().getScreenWidth() - / (float) this.minecraft.getWindow().getScreenHeight(), 0.05F, this.clipDistance)); - } - info.setReturnValue(posestack.last().pose()); + case SCOPEL, SCOPER -> { yield view.perspective(toRadians(70f / 8f), 1.0F, 0.05F, this.clipDistance); } + default -> { + if (this.zoom != 1.0F) { + view.translate(this.zoomX, -this.zoomY, 0.0F); + posestack.scale(this.zoom, this.zoom, 1.0F); + } + yield view.perspective( + (float) toRadians(d), + (float) mc.getWindow().getScreenWidth() / (float) mc.getWindow().getScreenHeight(), + 0.05F, + this.clipDistance + ); + } + }); } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isWindowActive()Z"), method = "render") - public boolean focus(Minecraft instance) { - return VRState.vrRunning || instance.isWindowActive(); + public boolean focus(Minecraft instance) + { + return vrRunning || instance.isWindowActive(); } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;pauseGame(Z)V"), method = "render") - public void pause(Minecraft instance, boolean bl) { - if (!VRState.vrRunning || ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT) { + public void pause(Minecraft instance, boolean bl) + { + if (!vrRunning || dh.currentPass == RenderPass.LEFT) + { instance.pauseGame(bl); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;getMillis()J"), method = "render") - public long active() { - if (!VRState.vrRunning || ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT) { + public long active() + { + if (!vrRunning || dh.currentPass == RenderPass.LEFT) + { return Util.getMillis(); - } else { + } + else + { return this.lastActiveTime; } } @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;viewport(IIII)V", shift = Shift.AFTER), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V") - public void matrix(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) { - this.resetProjectionMatrix(this.getProjectionMatrix(minecraft.options.fov().get())); + public void matrix(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) + { + this.resetProjectionMatrix(this.getProjectionMatrix(mc.options.fov().get())); RenderSystem.getModelViewStack().setIdentity(); RenderSystem.applyModelViewMatrix(); } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V"), method = "render") - public PoseStack newStack(PoseStack poseStack) { + public PoseStack newStack(PoseStack poseStack) + { this.stack = poseStack; return poseStack; } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V", shift = Shift.AFTER), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V") - public void renderoverlay(float f, long l, boolean bl, CallbackInfo ci) { - if (VRState.vrRunning && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA) { + public void renderoverlay(float f, long l, boolean bl, CallbackInfo ci) + { + if (vrRunning && dh.currentPass != RenderPass.THIRD && dh.currentPass != RenderPass.CAMERA) + { this.renderFaceOverlay(f, this.stack); } } @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/GameRenderer;effectActive:Z"), method = "render") - public boolean effect(GameRenderer instance) { - return this.effectActive && ClientDataHolderVR.getInstance().currentPass != RenderPass.THIRD; + public boolean effect(GameRenderer instance) + { + return this.effectActive && dh.currentPass != RenderPass.THIRD; } @Inject(at = @At("HEAD"), method = "takeAutoScreenshot", cancellable = true) - public void noScreenshotInMenu(Path path, CallbackInfo ci) { - if (VRState.vrRunning && isInMenuRoom()) { + public void noScreenshotInMenu(Path path, CallbackInfo ci) + { + if (vrRunning && this.isInMenuRoom()) + { ci.cancel(); } } @@ -388,152 +423,179 @@ public void noScreenshotInMenu(Path path, CallbackInfo ci) { private boolean shouldDrawGui = false; @Override - public void setShouldDrawScreen(boolean shouldDrawScreen) { + public void setShouldDrawScreen(boolean shouldDrawScreen) + { this.shouldDrawScreen = shouldDrawScreen; } @Override - public void setShouldDrawGui(boolean shouldDrawGui) { + public void setShouldDrawGui(boolean shouldDrawGui) + { this.shouldDrawGui = shouldDrawGui; } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", shift = Shift.BEFORE, ordinal = 6), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V", cancellable = true) - public void mainMenu(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) { - if (RenderPassType.isVanilla()) { + public void mainMenu(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) + { + if (RenderPassType.isVanilla()) + { return; } - if (!renderWorldIn && shouldDrawScreen) { - shouldDrawScreen = false; + if (!renderWorldIn && this.shouldDrawScreen) + { + this.shouldDrawScreen = false; return; } - if (!renderWorldIn || this.minecraft.level == null || isInMenuRoom()) { - this.minecraft.getProfiler().push("MainMenu"); - GL11.glDisable(GL11.GL_STENCIL_TEST); + if (!renderWorldIn || mc.level == null || this.isInMenuRoom()) + { + mc.getProfiler().push("MainMenu"); + GL11C.glDisable(GL11C.GL_STENCIL_TEST); PoseStack pMatrixStack = new PoseStack(); - applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, pMatrixStack); + this.applyVRModelView(dh.currentPass, pMatrixStack); this.renderGuiLayer(partialTicks, true, pMatrixStack); - if (KeyboardHandler.Showing) { - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.physicalKeyboard) { + if (KeyboardHandler.isShowing()) { + if (dh.vrSettings.physicalKeyboard) { this.renderPhysicalKeyboard(partialTicks, pMatrixStack); } else { this.render2D(partialTicks, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, - KeyboardHandler.Rotation_room, DATA_HOLDER.vrSettings.menuAlwaysFollowFace && isInMenuRoom(), pMatrixStack); + KeyboardHandler.Rotation_room, dh.vrSettings.menuAlwaysFollowFace && this.isInMenuRoom(), pMatrixStack); } } - if ((GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - || GameRendererVRMixin.DATA_HOLDER.vrSettings.mixedRealityRenderHands) - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA) { + if ((dh.currentPass != RenderPass.THIRD || dh.vrSettings.mixedRealityRenderHands) && + dh.currentPass != RenderPass.CAMERA + ) + { this.renderVRHands(partialTicks, true, true, true, true, pMatrixStack); } } - this.minecraft.getProfiler().pop(); + mc.getProfiler().pop(); info.cancel(); } @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", shift = Shift.AFTER, ordinal = 6), method = "render(FJZ)V", ordinal = 0, argsOnly = true) - private boolean renderGui(boolean doRender) { + private boolean renderGui(boolean doRender) + { if (RenderPassType.isVanilla()) { return doRender; } - return shouldDrawGui; + return this.shouldDrawGui; } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderItemActivationAnimation(IIF)V"), method = "render(FJZ)V") - private void noItemActivationAnimationOnGUI(GameRenderer instance, int i, int j, float f) { + private void noItemActivationAnimationOnGUI(GameRenderer instance, int i, int j, float f) + { if (RenderPassType.isVanilla()) { - renderItemActivationAnimation(i, j, f); + this.renderItemActivationAnimation(i, j, f); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;render(Lnet/minecraft/client/gui/GuiGraphics;F)V"), method = "render(FJZ)V") - private void noGUIwithViewOnly(Gui instance, GuiGraphics guiGraphics, float f) { - if (RenderPassType.isVanilla() || !ClientDataHolderVR.viewonly) { + private void noGUIwithViewOnly(Gui instance, GuiGraphics guiGraphics, float f) + { + if (RenderPassType.isVanilla() || !dh.viewonly) + { instance.render(guiGraphics, f); } } @Inject(at = @At("HEAD"), method = "renderConfusionOverlay", cancellable = true) private void noConfusionOverlayOnGUI(GuiGraphics guiGraphics, float f, CallbackInfo ci) { - if (DATA_HOLDER.currentPass == RenderPass.GUI) { + if (dh.currentPass == RenderPass.GUI) + { ci.cancel(); } } @Redirect(method = "renderItemActivationAnimation", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;translate(FFF)V")) - private void noTranslateItem(PoseStack poseStack, float x, float y, float z) { + private void noTranslateItem(PoseStack poseStack, float x, float y, float z) + { if (RenderPassType.isVanilla()) { poseStack.translate(x, y, z); } } @Redirect(method = "renderItemActivationAnimation", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;scale(FFF)V")) - private void noScaleItem(PoseStack poseStack, float x, float y, float z) { - if (RenderPassType.isVanilla()) { + private void noScaleItem(PoseStack poseStack, float x, float y, float z) + { + if (RenderPassType.isVanilla()) + { poseStack.scale(x, y, z); } } @Inject(method = "renderItemActivationAnimation", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;scale(FFF)V"), locals = LocalCapture.CAPTURE_FAILHARD) - private void transformItem(int i, int j, float f, CallbackInfo ci, int k, float g, float h, float l, float m, float n, float o, float p, PoseStack posestack) { - if (!RenderPassType.isVanilla()) { - float sinN = Mth.sin(n) * 0.5F; - posestack.translate(0, 0, sinN - 1.0); - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.THIRD) { - sinN *= ClientDataHolderVR.getInstance().vrSettings.mixedRealityFov / 70.0; + private void transformItem(int i, int j, float f, CallbackInfo ci, int k, float g, float h, float l, float m, float n, float o, float p, PoseStack posestack) + { + if (!RenderPassType.isVanilla()) + { + float sinN = sin(n) * 0.5F; + posestack.last().pose().translate(0, 0, sinN - 1.0F); + if (dh.currentPass == RenderPass.THIRD) + { + sinN *= dh.vrSettings.mixedRealityFov / 70.0; } - applyVRModelView(ClientDataHolderVR.getInstance().currentPass, posestack); - applystereo(ClientDataHolderVR.getInstance().currentPass, posestack); + this.applyVRModelView(dh.currentPass, posestack); + this.applystereo(dh.currentPass, posestack); posestack.scale(sinN, sinN, sinN); - posestack.mulPose(Axis.YP.rotationDegrees(-ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getYaw())); - posestack.mulPose(Axis.XP.rotationDegrees(-ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getPitch())); + float angY = toRadians(-dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getYaw()); + float angX = toRadians(-dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPitch()); + posestack.last().pose() + .rotateY(angY) + .rotateX(angX); + posestack.last().normal() + .rotateY(angY) + .rotateX(angX); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;pick(F)V"), method = "renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V") - public void renderpick(GameRenderer g, float pPartialTicks) { + public void renderpick(GameRenderer g, float pPartialTicks) + { if (RenderPassType.isVanilla()) { g.pick(pPartialTicks); return; } - if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.LEFT) { + if (dh.currentPass == RenderPass.LEFT) { this.pick(pPartialTicks); - if (this.minecraft.hitResult != null && this.minecraft.hitResult.getType() != HitResult.Type.MISS) { - this.crossVec = this.minecraft.hitResult.getLocation(); + if (mc.hitResult != null && mc.hitResult.getType() != Type.MISS) { + this.crossVec = mc.hitResult.getLocation(); } - if (this.minecraft.screen == null) { - GameRendererVRMixin.DATA_HOLDER.teleportTracker.updateTeleportDestinations((GameRenderer) (Object) this, this.minecraft, - this.minecraft.player); + if (mc.screen == null) { + dh.teleportTracker.updateTeleportDestinations(); } } - this.cacheRVEPos((LivingEntity) this.minecraft.getCameraEntity()); + this.cacheRVEPos((LivingEntity) mc.getCameraEntity()); this.setupRVE(); this.setupOverlayStatus(pPartialTicks); } @Inject(at = @At("HEAD"), method = "bobHurt", cancellable = true) - public void removeBobHurt(PoseStack poseStack, float f, CallbackInfo ci) { + public void removeBobHurt(PoseStack poseStack, float f, CallbackInfo ci) + { if (!RenderPassType.isVanilla()) { ci.cancel(); } } @Inject(method = "bobView", at = @At("HEAD"), cancellable = true) - void cancelBobView(PoseStack matrixStack, float f, CallbackInfo ci) { + void cancelBobView(PoseStack matrixStack, float f, CallbackInfo ci) + { if (!RenderPassType.isVanilla()) { ci.cancel(); } } - @ModifyVariable(at = @At(value = "STORE"), method = "renderLevel") - public int reduceNauseaSpeed(int oldVal) { + @ModifyVariable(at = @At("STORE"), method = "renderLevel") + public int reduceNauseaSpeed(int oldVal) + { if (!RenderPassType.isVanilla()) { return oldVal / 5; } else { @@ -542,62 +604,67 @@ public int reduceNauseaSpeed(int oldVal) { } @ModifyVariable(at = @At(value = "STORE", ordinal = 1), ordinal = 3, method = "renderLevel") - public float reduceNauseaAffect(float oldVal) { + public float reduceNauseaAffect(float oldVal) + { if (!RenderPassType.isVanilla()) { // scales down the effect from (1,0.65) to (1,0.9) - return 1f - (1f - oldVal) * 0.25f; + return 1.0F - (1.0F - oldVal) * 0.25F; } else { return oldVal; } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V", ordinal = 1), method = "renderLevel") - public void noHandProfiler(ProfilerFiller instance, String s) { - GL11.glDisable(GL11.GL_STENCIL_TEST); - this.minecraft.getProfiler().popPush("ShadersEnd"); //TODO needed? + public void noHandProfiler(ProfilerFiller instance, String s) + { + GL11C.glDisable(GL11C.GL_STENCIL_TEST); + mc.getProfiler().popPush("ShadersEnd"); //TODO needed? } @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/GameRenderer;renderHand:Z"), method = "renderLevel") - public boolean noHandsVR(GameRenderer instance) { - return RenderPassType.isVanilla() && renderHand; + public boolean noHandsVR(GameRenderer instance) + { + return RenderPassType.isVanilla() && this.renderHand; } @Inject(at = @At(value = "TAIL", shift = Shift.BEFORE), method = "renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V") - public void restoreVE(float f, long j, PoseStack p, CallbackInfo i) { + public void restoreVE(float f, long j, PoseStack p, CallbackInfo i) + { if (RenderPassType.isVanilla()) { return; } - this.restoreRVEPos((LivingEntity) this.minecraft.getCameraEntity()); + this.restoreRVEPos((LivingEntity) mc.getCameraEntity()); } - private void setupOverlayStatus(float partialTicks) { + private void setupOverlayStatus(float partialTicks) + { this.inBlock = 0.0F; this.inwater = false; this.onfire = false; - if (!this.minecraft.player.isSpectator() && !this.isInMenuRoom() && this.minecraft.player.isAlive()) { - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition(); + if (!mc.player.isSpectator() && !this.isInMenuRoom() && mc.player.isAlive()) { + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); Triple triple = ((ItemInHandRendererExtension) this.itemInHandRenderer).getNearOpaqueBlock(vec3, (double) this.minClipDistance); - if (triple != null && !Xevents.renderBlockOverlay(this.minecraft.player, new PoseStack(), triple.getMiddle(), triple.getRight())) { + if (triple != null && !Xevents.renderBlockOverlay(mc.player, new PoseStack(), triple.getMiddle(), triple.getRight())) { this.inBlock = triple.getLeft(); } else { this.inBlock = 0.0F; } - this.inwater = this.minecraft.player.isEyeInFluid(FluidTags.WATER) && !Xevents.renderWaterOverlay(this.minecraft.player, new PoseStack()); - this.onfire = GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA && this.minecraft.player.isOnFire() && !Xevents.renderFireOverlay(this.minecraft.player, new PoseStack()); + this.inwater = mc.player.isEyeInFluid(FluidTags.WATER) && !Xevents.renderWaterOverlay(mc.player, new PoseStack()); + this.onfire = dh.currentPass != RenderPass.THIRD + && dh.currentPass != RenderPass.CAMERA && mc.player.isOnFire() && !Xevents.renderFireOverlay(mc.player, new PoseStack()); } } @Override - public void setupRVE() { + public void setupRVE() + { if (this.cached) { - VRData.VRDevicePose vrdata$vrdevicepose = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass); + VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass); Vec3 vec3 = vrdata$vrdevicepose.getPosition(); - LivingEntity livingentity = (LivingEntity) this.minecraft.getCameraEntity(); + LivingEntity livingentity = (LivingEntity) mc.getCameraEntity(); livingentity.setPosRaw(vec3.x, vec3.y, vec3.z); livingentity.xOld = vec3.x; livingentity.yOld = vec3.y; @@ -615,8 +682,9 @@ public void setupRVE() { } @Override - public void cacheRVEPos(LivingEntity e) { - if (this.minecraft.getCameraEntity() != null) { + public void cacheRVEPos(LivingEntity e) + { + if (mc.getCameraEntity() != null) { if (!this.cached) { this.rveX = e.getX(); this.rveY = e.getY(); @@ -637,41 +705,42 @@ public void cacheRVEPos(LivingEntity e) { } } - void renderMainMenuHand(int c, float partialTicks, boolean depthAlways, PoseStack poseStack) { - this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(mainCamera, partialTicks, false))); + void renderMainMenuHand(int c, float partialTicks, boolean depthAlways, PoseStack poseStack) + { + this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, partialTicks, false))); poseStack.pushPose(); poseStack.setIdentity(); RenderSystem.enableDepthTest(); RenderSystem.defaultBlendFunc(); - applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, poseStack); - SetupRenderingAtController(c, poseStack); + this.applyVRModelView(dh.currentPass, poseStack); + this.SetupRenderingAtController(c, poseStack); - if (this.minecraft.getOverlay() == null) { - this.minecraft.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); + if (mc.getOverlay() == null) { + mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); } Tesselator tesselator = Tesselator.getInstance(); if (depthAlways && c == 0) { - RenderSystem.depthFunc(519); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); } else { - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } Vec3i vec3i = new Vec3i(64, 64, 64); byte b0 = -1; Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); - Vec3 vec31 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(c).getDirection(); - Vec3 vec32 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(c) - .getCustomVector(new Vec3(0.0D, 1.0D, 0.0D)); + Vec3 vec31 = dh.vrPlayer.vrdata_world_render.getController(c).getDirection(); + Vec3 vec32 = dh.vrPlayer.vrdata_world_render.getController(c).getCustomVector(new Vec3(0.0D, 1.0D, 0.0D)); vec32 = new Vec3(0.0D, 1.0D, 0.0D); vec31 = new Vec3(0.0D, 0.0D, -1.0D); Vec3 vec33 = new Vec3(vec3.x - vec31.x * 0.18D, vec3.y - vec31.y * 0.18D, vec3.z - vec31.z * 0.18D); - if (this.minecraft.level != null) { - float f = (float) this.minecraft.level.getMaxLocalRawBrightness( - BlockPos.containing(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.hmd.getPosition())); + if (mc.level != null) { + float f = mc.level.getMaxLocalRawBrightness( + BlockPos.containing(dh.vrPlayer.vrdata_world_render.hmd.getPosition()) + ); int i = ShadersHelper.ShaderLight(); @@ -679,27 +748,31 @@ void renderMainMenuHand(int c, float partialTicks, boolean depthAlways, PoseStac f = (float) i; } - float f1 = f / (float) this.minecraft.level.getMaxLightLevel(); - vec3i = new Vec3i(Mth.floor(vec3i.getX() * f1), Mth.floor(vec3i.getY() * f1), - Mth.floor(vec3i.getZ() * f1)); + float f1 = f / (float) mc.level.getMaxLightLevel(); + vec3i = new Vec3i( + roundUsing(vec3i.getX() * f1, FLOOR), + roundUsing(vec3i.getY() * f1, FLOOR), + roundUsing(vec3i.getZ() * f1, FLOOR) + ); } RenderSystem.setShader(GameRenderer::getPositionColorShader); tesselator.getBuilder().begin(Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_NORMAL); this.renderBox(tesselator, vec3, vec33, -0.02F, 0.02F, -0.0125F, 0.0125F, vec32, vec3i, b0, poseStack); BufferUploader.drawWithShader(tesselator.getBuilder().end()); poseStack.popPose(); - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } private void renderVRHands(float partialTicks, boolean renderright, boolean renderleft, boolean menuhandright, - boolean menuhandleft, PoseStack poseStack) { - this.minecraft.getProfiler().push("hands"); + boolean menuhandleft, PoseStack poseStack) + { + mc.getProfiler().push("hands"); // backup projection matrix, not doing that breaks sodium water on 1.19.3 RenderSystem.backupProjectionMatrix(); if (renderright) { - this.minecraft.getItemRenderer(); - ClientDataHolderVR.ismainhand = true; + mc.getItemRenderer(); + dh.ismainhand = true; if (menuhandright) { this.renderMainMenuHand(0, partialTicks, false, poseStack); @@ -707,12 +780,12 @@ private void renderVRHands(float partialTicks, boolean renderright, boolean rend this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, partialTicks, true))); PoseStack posestack = new PoseStack(); posestack.last().pose().identity(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, posestack); + this.applyVRModelView(dh.currentPass, posestack); this.renderVRHand_Main(posestack, partialTicks); } - this.minecraft.getItemRenderer(); - ClientDataHolderVR.ismainhand = false; + mc.getItemRenderer(); + dh.ismainhand = false; } if (renderleft) { @@ -722,78 +795,81 @@ private void renderVRHands(float partialTicks, boolean renderright, boolean rend this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, partialTicks, true))); PoseStack posestack1 = new PoseStack(); posestack1.last().pose().identity(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, posestack1); + this.applyVRModelView(dh.currentPass, posestack1); this.renderVRHand_Offhand(partialTicks, true, posestack1); } } RenderSystem.restoreProjectionMatrix(); - this.minecraft.getProfiler().pop(); + mc.getProfiler().pop(); } @Override - public boolean isInWater() { - return inwater; + public boolean isInWater() + { + return this.inwater; } @Override - public boolean isInMenuRoom() { - return this.minecraft.level == null || - this.minecraft.screen instanceof WinScreen || - this.minecraft.screen instanceof ReceivingLevelScreen || - this.minecraft.screen instanceof ProgressScreen || - this.minecraft.screen instanceof GenericDirtMessageScreen || - ClientDataHolderVR.getInstance().integratedServerLaunchInProgress || - this.minecraft.getOverlay() != null; + public boolean isInMenuRoom() + { + return mc.level == null || + mc.screen instanceof WinScreen || + mc.screen instanceof ReceivingLevelScreen || + mc.screen instanceof ProgressScreen || + mc.screen instanceof GenericDirtMessageScreen || + dh.integratedServerLaunchInProgress || + mc.getOverlay() != null; } @Override - public boolean willBeInMenuRoom(Screen newScreen) { - return this.minecraft.level == null || - newScreen instanceof WinScreen || - newScreen instanceof ReceivingLevelScreen || - newScreen instanceof ProgressScreen || - newScreen instanceof GenericDirtMessageScreen || - ClientDataHolderVR.getInstance().integratedServerLaunchInProgress || - this.minecraft.getOverlay() != null; + public boolean willBeInMenuRoom(Screen newScreen) + { + return mc.level == null || + newScreen instanceof WinScreen || + newScreen instanceof ReceivingLevelScreen || + newScreen instanceof ProgressScreen || + newScreen instanceof GenericDirtMessageScreen || + dh.integratedServerLaunchInProgress || + mc.getOverlay() != null; } @Override - public Vec3 getControllerRenderPos(int c) { - ClientDataHolderVR dataholder = GameRendererVRMixin.DATA_HOLDER; - if (!dataholder.vrSettings.seated) { - return dataholder.vrPlayer.vrdata_world_render.getController(c).getPosition(); + public Vec3 getControllerRenderPos(int c) + { + if (!dh.vrSettings.seated) { + return dh.vrPlayer.vrdata_world_render.getController(c).getPosition(); } else { Vec3 vec3; - if (this.minecraft.getCameraEntity() != null && this.minecraft.level != null) { - Vec3 vec32 = dataholder.vrPlayer.vrdata_world_render.hmd.getDirection(); - vec32 = vec32.yRot((float) Math.toRadians(c == 0 ? -35.0D : 35.0D)); + if (mc.getCameraEntity() != null && mc.level != null) { + Vec3 vec32 = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); + vec32 = vec32.yRot(toRadians(c == 0 ? -35.0F : 35.0F)); vec32 = new Vec3(vec32.x, 0.0D, vec32.z); vec32 = vec32.normalize(); RenderPass renderpass = RenderPass.CENTER; - vec3 = dataholder.vrPlayer.vrdata_world_render.getEye(renderpass).getPosition().add( - vec32.x * 0.3D * (double) dataholder.vrPlayer.vrdata_world_render.worldScale, - -0.4D * (double) dataholder.vrPlayer.vrdata_world_render.worldScale, - vec32.z * 0.3D * (double) dataholder.vrPlayer.vrdata_world_render.worldScale); - - if (TelescopeTracker.isTelescope(minecraft.player.getUseItem())) { - if (c == 0 && minecraft.player.getUsedItemHand() == InteractionHand.MAIN_HAND) - vec3 = dataholder.vrPlayer.vrdata_world_render.eye0.getPosition() - .add(dataholder.vrPlayer.vrdata_world_render.hmd.getDirection() - .scale(0.2 * dataholder.vrPlayer.vrdata_world_render.worldScale)); - if (c == 1 && minecraft.player.getUsedItemHand() == InteractionHand.OFF_HAND) - vec3 = dataholder.vrPlayer.vrdata_world_render.eye1.getPosition() - .add(dataholder.vrPlayer.vrdata_world_render.hmd.getDirection() - .scale(0.2 * dataholder.vrPlayer.vrdata_world_render.worldScale)); + vec3 = dh.vrPlayer.vrdata_world_render.getEye(renderpass).getPosition().add( + vec32.x * 0.3D * (double) dh.vrPlayer.vrdata_world_render.worldScale, + -0.4D * (double) dh.vrPlayer.vrdata_world_render.worldScale, + vec32.z * 0.3D * (double) dh.vrPlayer.vrdata_world_render.worldScale); + + if (TelescopeTracker.isTelescope(mc.player.getUseItem())) { + if (c == 0 && mc.player.getUsedItemHand() == InteractionHand.MAIN_HAND) + vec3 = dh.vrPlayer.vrdata_world_render.eye0.getPosition() + .add(dh.vrPlayer.vrdata_world_render.hmd.getDirection() + .scale(0.2 * dh.vrPlayer.vrdata_world_render.worldScale)); + if (c == 1 && mc.player.getUsedItemHand() == InteractionHand.OFF_HAND) + vec3 = dh.vrPlayer.vrdata_world_render.eye1.getPosition() + .add(dh.vrPlayer.vrdata_world_render.hmd.getDirection() + .scale(0.2 * dh.vrPlayer.vrdata_world_render.worldScale)); } } else { - Vec3 vec31 = dataholder.vrPlayer.vrdata_world_render.hmd.getDirection(); - vec31 = vec31.yRot((float) Math.toRadians(c == 0 ? -35.0D : 35.0D)); + Vec3 vec31 = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); + vec31 = vec31.yRot(toRadians(c == 0 ? -35.0F : 35.0F)); vec31 = new Vec3(vec31.x, 0.0D, vec31.z); vec31 = vec31.normalize(); - vec3 = dataholder.vrPlayer.vrdata_world_render.hmd.getPosition().add(vec31.x * 0.3D, -0.4D, + vec3 = dh.vrPlayer.vrdata_world_render.hmd.getPosition().add(vec31.x * 0.3D, -0.4D, vec31.z * 0.3D); } @@ -801,14 +877,14 @@ public Vec3 getControllerRenderPos(int c) { } } - @Override + @Override @CheckForNull public Vec3 getCrossVec() { - return crossVec; + return this.crossVec; } @Override public void setupClipPlanes() { - this.renderDistance = (float) (this.minecraft.options.getEffectiveRenderDistance() * 16); + this.renderDistance = (float) (mc.options.getEffectiveRenderDistance() * 16); // if (Config.isFogOn()) { TODO // this.renderDistance *= 0.95F; @@ -830,8 +906,7 @@ public float getClipDistance() { @Override public void applyVRModelView(RenderPass currentPass, PoseStack poseStack) { - Matrix4f modelView = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getEye(currentPass) - .getMatrix().transposed().toMCMatrix(); + Matrix4f modelView = dh.vrPlayer.vrdata_world_render.getEye(currentPass).getMatrix(); poseStack.last().pose().mul(modelView); poseStack.last().normal().mul(new Matrix3f(modelView)); } @@ -853,28 +928,27 @@ public void renderCircle(Vec3 pos, float radius, int edges, int r, int g, int b, tesselator.getBuilder().vertex(pos.x, pos.y, pos.z).color(r, g, b, a).endVertex(); for (int i = 0; i < edges + 1; i++) { - float f = (float) i / (float) edges * (float) Math.PI * 2.0F; + float f = (float) i / (float) edges * (float) PI * 2.0F; if (side != 0 && side != 1) { if (side != 2 && side != 3) { if (side == 4 || side == 5) { float f5 = (float) pos.x; - float f7 = (float) pos.y + (float) Math.cos((double) f) * radius; - float f9 = (float) pos.z + (float) Math.sin((double) f) * radius; - tesselator.getBuilder().vertex((double) f5, (double) f7, (double) f9).color(r, g, b, a) - .endVertex(); + float f7 = (float) pos.y + cos(f) * radius; + float f9 = (float) pos.z + sin(f) * radius; + tesselator.getBuilder().vertex(f5, f7, f9).color(r, g, b, a).endVertex(); } } else { - float f4 = (float) pos.x + (float) Math.cos((double) f) * radius; - float f6 = (float) pos.y + (float) Math.sin((double) f) * radius; + float f4 = (float) pos.x + cos(f) * radius; + float f6 = (float) pos.y + sin(f) * radius; float f8 = (float) pos.z; - tesselator.getBuilder().vertex((double) f4, (double) f6, (double) f8).color(r, g, b, a).endVertex(); + tesselator.getBuilder().vertex(f4, f6, f8).color(r, g, b, a).endVertex(); } } else { - float f1 = (float) pos.x + (float) Math.cos((double) f) * radius; + float f1 = (float) pos.x + cos(f) * radius; float f2 = (float) pos.y; - float f3 = (float) pos.z + (float) Math.sin((double) f) * radius; - tesselator.getBuilder().vertex((double) f1, (double) f2, (double) f3).color(r, g, b, a).endVertex(); + float f3 = (float) pos.z + sin(f) * radius; + tesselator.getBuilder().vertex(f1, f2, f3).color(r, g, b, a).endVertex(); } } @@ -882,49 +956,48 @@ public void renderCircle(Vec3 pos, float radius, int edges, int r, int g, int b, } private void setupPolyRendering(boolean enable) { -// boolean flag = Config.isShaders(); TODO - boolean flag = false; + // boolean shadersMod = false; // Config.isShaders(); TODO + // boolean shadersModShadowPass = false; if (enable) { this.polyblendsrca = GlStateManager.BLEND.srcAlpha; this.polyblenddsta = GlStateManager.BLEND.dstAlpha; this.polyblendsrcrgb = GlStateManager.BLEND.srcRgb; this.polyblenddstrgb = GlStateManager.BLEND.dstRgb; - this.polyblend = GL43C.glIsEnabled(GL11.GL_BLEND); - this.polytex = true; - this.polylight = false; - this.polycull = true; + this.polyblend = GL11C.glIsEnabled(GL11C.GL_BLEND); + // this.polytex = GL11C.glIsEnabled(GL11C.GL_TEXTURE_2D); + // this.polylight = false; + this.polycull = GL11C.glIsEnabled(GL11C.GL_CULL_FACE); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); // GlStateManager._disableLighting(); RenderSystem.disableCull(); - if (flag) { -// this.prog = Shaders.activeProgram; TODO -// Shaders.useProgram(Shaders.ProgramTexturedLit); - } + // if (shadersMod) { + // this.prog = Shaders.activeProgram; TODO + // Shaders.useProgram(Shaders.ProgramTexturedLit); + // } } else { - RenderSystem.blendFuncSeparate(this.polyblendsrcrgb, this.polyblenddstrgb, this.polyblendsrca, - this.polyblenddsta); + RenderSystem.blendFuncSeparate(this.polyblendsrcrgb, this.polyblenddstrgb, this.polyblendsrca, this.polyblenddsta); if (!this.polyblend) { RenderSystem.disableBlend(); } - if (this.polytex) { - } + // if (this.polytex) { + // } - if (this.polylight) { + // if (this.polylight) { // GlStateManager._enableLighting(); - } + // } if (this.polycull) { RenderSystem.enableCull(); } -// if (flag && this.polytex) { -// Shaders.useProgram(this.prog); TODO -// } + // if (shadersMod && this.polytex) { + // Shaders.useProgram(this.prog); TODO + // } } } @@ -933,26 +1006,26 @@ public void drawScreen(float f, Screen screen, GuiGraphics guiGraphics) { PoseStack posestack = RenderSystem.getModelViewStack(); posestack.pushPose(); posestack.setIdentity(); - posestack.translate(0.0D, 0.0D, -2000.0D); + posestack.last().pose().translate(0.0F, 0.0F, -2000.0F); RenderSystem.applyModelViewMatrix(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, - GlStateManager.DestFactor.ONE); + RenderSystem.blendFuncSeparate( + SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE + ); screen.render(guiGraphics, 0, 0, f); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, - GlStateManager.DestFactor.ONE); + RenderSystem.blendFuncSeparate( + SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE + ); posestack.popPose(); RenderSystem.applyModelViewMatrix(); - this.minecraft.getMainRenderTarget().bindRead(); - ((RenderTargetExtension) this.minecraft.getMainRenderTarget()).genMipMaps(); - this.minecraft.getMainRenderTarget().unbindRead(); + mc.getMainRenderTarget().bindRead(); + ((RenderTargetExtension) mc.getMainRenderTarget()).genMipMaps(); + mc.getMainRenderTarget().unbindRead(); } @Override public boolean wasInWater() { - return wasinwater; + return this.wasinwater; } @Override @@ -967,42 +1040,42 @@ public boolean isInPortal() { @Override public Matrix4f getThirdPassProjectionMatrix() { - return thirdPassProjectionMatrix; + return this.thirdPassProjectionMatrix; } private void renderVRHand_Main(PoseStack matrix, float partialTicks) { matrix.pushPose(); this.SetupRenderingAtController(0, matrix); - ItemStack itemstack = this.minecraft.player.getMainHandItem(); - ItemStack itemstack1 = null; // this.minecraft.physicalGuiManager.getHeldItemOverride(); + ItemStack itemstack = mc.player.getMainHandItem(); + ItemStack itemstack1 = null; // mc.physicalGuiManager.getHeldItemOverride(); if (itemstack1 != null) { itemstack = itemstack1; } - if (GameRendererVRMixin.DATA_HOLDER.climbTracker.isClimbeyClimb() && itemstack.getItem() != Items.SHEARS) { - itemstack = itemstack1 == null ? this.minecraft.player.getOffhandItem() : itemstack1; + if (dh.climbTracker.isClimbeyClimb() && itemstack.getItem() != Items.SHEARS) { + itemstack = itemstack1 == null ? mc.player.getOffhandItem() : itemstack1; } - if (BowTracker.isHoldingBow(this.minecraft.player, InteractionHand.MAIN_HAND)) { + if (BowTracker.isHoldingBow(InteractionHand.MAIN_HAND)) { int i = 0; - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.reverseShootingEye) { + if (dh.vrSettings.reverseShootingEye) { i = 1; } - ItemStack itemstack2 = this.minecraft.player.getProjectile(this.minecraft.player.getMainHandItem()); + ItemStack itemstack2 = mc.player.getProjectile(mc.player.getMainHandItem()); - if (itemstack2 != ItemStack.EMPTY && !GameRendererVRMixin.DATA_HOLDER.bowTracker.isNotched()) { + if (itemstack2 != ItemStack.EMPTY && !dh.bowTracker.isNotched()) { itemstack = itemstack2; } else { itemstack = ItemStack.EMPTY; } - } else if (BowTracker.isHoldingBow(this.minecraft.player, InteractionHand.OFF_HAND) - && GameRendererVRMixin.DATA_HOLDER.bowTracker.isNotched()) { + } else if (BowTracker.isHoldingBow(InteractionHand.OFF_HAND) + && dh.bowTracker.isNotched()) { int j = 0; - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.reverseShootingEye) { + if (dh.vrSettings.reverseShootingEye) { j = 1; } @@ -1016,10 +1089,10 @@ private void renderVRHand_Main(PoseStack matrix, float partialTicks) { this.lightTexture.turnOnLightLayer(); MultiBufferSource.BufferSource multibuffersource$buffersource = this.renderBuffers.bufferSource(); - (this.itemInHandRenderer).renderArmWithItem(this.minecraft.player, partialTicks, - 0.0F, InteractionHand.MAIN_HAND, this.minecraft.player.getAttackAnim(partialTicks), itemstack, 0.0F, + (this.itemInHandRenderer).renderArmWithItem(mc.player, partialTicks, + 0.0F, InteractionHand.MAIN_HAND, mc.player.getAttackAnim(partialTicks), itemstack, 0.0F, matrix, multibuffersource$buffersource, - this.minecraft.getEntityRenderDispatcher().getPackedLightCoords(this.minecraft.player, partialTicks)); + mc.getEntityRenderDispatcher().getPackedLightCoords(mc.player, partialTicks)); multibuffersource$buffersource.endBatch(); this.lightTexture.turnOffLightLayer(); @@ -1032,36 +1105,36 @@ private void renderVRHand_Main(PoseStack matrix, float partialTicks) { } private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, PoseStack matrix) { - // boolean flag = Config.isShaders();TODO - boolean flag = false; - boolean flag1 = false; + // boolean shadersMod = Config.isShaders();TODO + boolean shadersMod = false; + boolean shadersModShadowPass = false; -// if (flag) { -// flag1 = Shaders.isShadowPass; +// if (shadersMod) { +// shadersModShadowPass = Shaders.isShadowPass; // } matrix.pushPose(); this.SetupRenderingAtController(1, matrix); - ItemStack itemstack = this.minecraft.player.getOffhandItem(); - ItemStack itemstack1 = null;// this.minecraft.physicalGuiManager.getOffhandOverride(); + ItemStack itemstack = mc.player.getOffhandItem(); + ItemStack itemstack1 = null;// mc.physicalGuiManager.getOffhandOverride(); if (itemstack1 != null) { itemstack = itemstack1; } - if (GameRendererVRMixin.DATA_HOLDER.climbTracker.isClimbeyClimb() + if (dh.climbTracker.isClimbeyClimb() && (itemstack == null || itemstack.getItem() != Items.SHEARS)) { - itemstack = this.minecraft.player.getMainHandItem(); + itemstack = mc.player.getMainHandItem(); } - if (BowTracker.isHoldingBow(this.minecraft.player, InteractionHand.MAIN_HAND)) { + if (BowTracker.isHoldingBow(InteractionHand.MAIN_HAND)) { int i = 1; - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.reverseShootingEye) { + if (dh.vrSettings.reverseShootingEye) { i = 0; } - itemstack = this.minecraft.player.getMainHandItem(); + itemstack = mc.player.getMainHandItem(); } if (OptifineHelper.isOptifineLoaded() && OptifineHelper.isShaderActive()) { @@ -1071,10 +1144,10 @@ private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, Po this.lightTexture.turnOnLightLayer(); MultiBufferSource.BufferSource multibuffersource$buffersource = this.renderBuffers.bufferSource(); - this.itemInHandRenderer.renderArmWithItem(this.minecraft.player, partialTicks, - 0.0F, InteractionHand.OFF_HAND, this.minecraft.player.getAttackAnim(partialTicks), itemstack, 0.0F, + this.itemInHandRenderer.renderArmWithItem(mc.player, partialTicks, + 0.0F, InteractionHand.OFF_HAND, mc.player.getAttackAnim(partialTicks), itemstack, 0.0F, matrix, multibuffersource$buffersource, - this.minecraft.getEntityRenderDispatcher().getPackedLightCoords(this.minecraft.player, partialTicks)); + mc.getEntityRenderDispatcher().getPackedLightCoords(mc.player, partialTicks)); multibuffersource$buffersource.endBatch(); this.lightTexture.turnOffLightLayer(); @@ -1088,7 +1161,7 @@ private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, Po if (renderTeleport) { matrix.pushPose(); matrix.setIdentity(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, matrix); + this.applyVRModelView(dh.currentPass, matrix); // net.optifine.shaders.Program program = Shaders.activeProgram; TODO // if (Config.isShaders()) { @@ -1096,32 +1169,34 @@ private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, Po // } RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - - if (ClientNetworking.isLimitedSurvivalTeleport() && !GameRendererVRMixin.DATA_HOLDER.vrPlayer.getFreeMove() - && this.minecraft.gameMode.hasMissTime() - && GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.arcAiming - && !GameRendererVRMixin.DATA_HOLDER.bowTracker.isActive(this.minecraft.player)) { + RenderSystem.blendFuncSeparate( + SourceFactor.SRC_ALPHA, + DestFactor.ONE_MINUS_SRC_ALPHA, + SourceFactor.ONE, + DestFactor.ONE_MINUS_SRC_ALPHA + ); + if (ClientNetworking.isLimitedSurvivalTeleport() && !dh.vrPlayer.getFreeMove() + && mc.gameMode.hasMissTime() + && dh.teleportTracker.vrMovementStyle.arcAiming + && !dh.bowTracker.isActive()) { matrix.pushPose(); this.SetupRenderingAtController(1, matrix); Vec3 vec3 = new Vec3(0.0D, 0.005D, 0.03D); float f1 = 0.03F; float f; - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.isAiming()) { - f = 2.0F * (float) ((double) GameRendererVRMixin.DATA_HOLDER.teleportTracker.getTeleportEnergy() - - 4.0D * GameRendererVRMixin.DATA_HOLDER.teleportTracker.movementTeleportDistance) / 100.0F * f1; + if (dh.teleportTracker.isAiming()) { + f = 2.0F * (float) ((double) dh.teleportTracker.getTeleportEnergy() + - 4.0D * dh.teleportTracker.movementTeleportDistance) / 100.0F * f1; } else { - f = 2.0F * GameRendererVRMixin.DATA_HOLDER.teleportTracker.getTeleportEnergy() / 100.0F * f1; + f = 2.0F * dh.teleportTracker.getTeleportEnergy() / 100.0F * f1; } if (f < 0.0F) { f = 0.0F; } RenderSystem.setShader(GameRenderer::getPositionColorShader); - this.minecraft.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); + mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); this.renderFlatQuad(vec3.add(0.0D, 0.05001D, 0.0D), f, f, 0.0F, this.tpLimitedColor.getX(), this.tpLimitedColor.getY(), this.tpLimitedColor.getZ(), 128, matrix); @@ -1130,11 +1205,11 @@ private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, Po matrix.popPose(); } - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.isAiming()) { + if (dh.teleportTracker.isAiming()) { RenderSystem.enableDepthTest(); - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.arcAiming) { - this.renderTeleportArc(GameRendererVRMixin.DATA_HOLDER.vrPlayer, matrix); + if (dh.teleportTracker.vrMovementStyle.arcAiming) { + this.renderTeleportArc(matrix); } } @@ -1149,28 +1224,22 @@ private void renderVRHand_Offhand(float partialTicks, boolean renderTeleport, Po } } - void render2D(float par1, RenderTarget framebuffer, Vec3 pos, org.vivecraft.common.utils.math.Matrix4f rot, - boolean depthAlways, PoseStack poseStack) { - if (!GameRendererVRMixin.DATA_HOLDER.bowTracker.isDrawing) { - boolean flag = this.isInMenuRoom(); + void render2D(float par1, RenderTarget framebuffer, Vec3 pos, Matrix4f rot, boolean depthAlways, PoseStack poseStack) { + if (!dh.bowTracker.isDrawing) { this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, par1, true))); poseStack.pushPose(); poseStack.setIdentity(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, poseStack); - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition(); - Vec3 vec31 = new Vec3(0.0D, 0.0D, 0.0D); + this.applyVRModelView(dh.currentPass, poseStack); + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); float f = GuiHandler.guiScale; - VRPlayer vrplayer = GameRendererVRMixin.DATA_HOLDER.vrPlayer; - Vec3 guipos = VRPlayer.room_to_world_pos(pos, GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render); - org.vivecraft.common.utils.math.Matrix4f matrix4f = org.vivecraft.common.utils.math.Matrix4f - .rotationY(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.rotation_radians); - org.vivecraft.common.utils.math.Matrix4f guirot = org.vivecraft.common.utils.math.Matrix4f.multiply(matrix4f, rot); - - poseStack.translate((float) (guipos.x - vec3.x), (float) (guipos.y - vec3.y), (float) (guipos.z - vec3.z)); - poseStack.mulPoseMatrix(guirot.toMCMatrix()); - poseStack.translate((float) vec31.x, (float) vec31.y, (float) vec31.z); - float f1 = f * GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.worldScale; + Vec3 guipos = VRPlayer.room_to_world_pos(pos, dh.vrPlayer.vrdata_world_render); + + poseStack.last().pose() + .translate((float) (guipos.x - vec3.x), (float) (guipos.y - vec3.y), (float) (guipos.z - vec3.z)) + .mul(rot) + .rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians) + .translate(0.0F, 0.0F, 0.0F); + float f1 = f * dh.vrPlayer.vrdata_world_render.worldScale; poseStack.scale(f1, f1, f1); framebuffer.bindRead(); @@ -1179,50 +1248,53 @@ void render2D(float par1, RenderTarget framebuffer, Vec3 pos, org.vivecraft.comm RenderSystem.setShaderTexture(0, framebuffer.getColorTextureId()); float[] color = new float[]{1, 1, 1, 1}; - if (!flag) { - if (this.minecraft.screen == null) { - color[3] = GameRendererVRMixin.DATA_HOLDER.vrSettings.hudOpacity; + if (!this.isInMenuRoom()) { + if (mc.screen == null) { + color[3] = dh.vrSettings.hudOpacity; } - if (this.minecraft.player != null && this.minecraft.player.isShiftKeyDown()) { + if (mc.player != null && mc.player.isShiftKeyDown()) { color[3] *= 0.75F; } RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE_MINUS_DST_ALPHA, - GlStateManager.DestFactor.ONE); + RenderSystem.blendFuncSeparate( + SourceFactor.SRC_ALPHA, + DestFactor.ONE_MINUS_SRC_ALPHA, + SourceFactor.ONE_MINUS_DST_ALPHA, + DestFactor.ONE + ); } else { RenderSystem.disableBlend(); } if (depthAlways) { - RenderSystem.depthFunc(519); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); } else { - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); - if (this.minecraft.level != null) { + if (mc.level != null) { if (((ItemInHandRendererExtension) this.itemInHandRenderer).isInsideOpaqueBlock(vec3)) { - vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.hmd.getPosition(); + vec3 = dh.vrPlayer.vrdata_world_render.hmd.getPosition(); } int i = ShadersHelper.ShaderLight(); - int j = Utils.getCombinedLightWithMin(this.minecraft.level, BlockPos.containing(vec3), i); - this.drawSizedQuadWithLightmap((float) this.minecraft.getWindow().getGuiScaledWidth(), - (float) this.minecraft.getWindow().getGuiScaledHeight(), 1.5F, j, color, + int j = Utils.getCombinedLightWithMin(mc.level, BlockPos.containing(vec3), i); + this.drawSizedQuadWithLightmap((float) mc.getWindow().getGuiScaledWidth(), + (float) mc.getWindow().getGuiScaledHeight(), 1.5F, j, color, poseStack.last().pose()); } else { - this.drawSizedQuad((float) this.minecraft.getWindow().getGuiScaledWidth(), - (float) this.minecraft.getWindow().getGuiScaledHeight(), 1.5F, color, poseStack.last().pose()); + this.drawSizedQuad((float) mc.getWindow().getGuiScaledWidth(), + (float) mc.getWindow().getGuiScaledHeight(), 1.5F, color, poseStack.last().pose()); } RenderSystem.defaultBlendFunc(); - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); RenderSystem.enableCull(); poseStack.popPose(); @@ -1230,31 +1302,23 @@ void render2D(float par1, RenderTarget framebuffer, Vec3 pos, org.vivecraft.comm } void renderPhysicalKeyboard(float partialTicks, PoseStack poseStack) { - if (!GameRendererVRMixin.DATA_HOLDER.bowTracker.isDrawing) { + if (!dh.bowTracker.isDrawing) { this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, partialTicks, true))); poseStack.pushPose(); poseStack.setIdentity(); // RenderSystem.enableRescaleNormal(); // Lighting.setupFor3DItems(); - this.minecraft.getProfiler().push("applyPhysicalKeyboardModelView"); - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition(); - VRPlayer vrplayer = GameRendererVRMixin.DATA_HOLDER.vrPlayer; - Vec3 guipos = VRPlayer.room_to_world_pos(KeyboardHandler.Pos_room, - GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render); - org.vivecraft.common.utils.math.Matrix4f matrix4f = org.vivecraft.common.utils.math.Matrix4f - .rotationY(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.rotation_radians); - org.vivecraft.common.utils.math.Matrix4f guirot = org.vivecraft.common.utils.math.Matrix4f.multiply(matrix4f, - KeyboardHandler.Rotation_room); - poseStack.mulPoseMatrix(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getMatrix().transposed().toMCMatrix()); - poseStack.translate((float) (guipos.x - vec3.x), (float) (guipos.y - vec3.y), (float) (guipos.z - vec3.z)); - // GlStateManager._multMatrix(guirot.transposed().toFloatBuffer()); - poseStack.mulPoseMatrix(guirot.toMCMatrix()); - float f = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.worldScale; + mc.getProfiler().push("applyPhysicalKeyboardModelView"); + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); + Vec3 guipos = VRPlayer.room_to_world_pos(KeyboardHandler.Pos_room, dh.vrPlayer.vrdata_world_render); + poseStack.last().pose() + .mul(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getMatrix()) + .translate((float) (guipos.x - vec3.x), (float) (guipos.y - vec3.y), (float) (guipos.z - vec3.z)) + .mul(new Matrix4f(KeyboardHandler.Rotation_room).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians)); + float f = dh.vrPlayer.vrdata_world_render.worldScale; poseStack.scale(f, f, f); - this.minecraft.getProfiler().pop(); + mc.getProfiler().pop(); KeyboardHandler.physicalKeyboard.render(poseStack); // Lighting.turnOff(); @@ -1264,165 +1328,188 @@ void renderPhysicalKeyboard(float partialTicks, PoseStack poseStack) { } } - private void renderGuiLayer(float par1, boolean depthAlways, PoseStack pMatrix) { - if (!GameRendererVRMixin.DATA_HOLDER.bowTracker.isDrawing) { - if (this.minecraft.screen != null || !this.minecraft.options.hideGui) { - if (!RadialHandler.isShowing()) { - minecraft.getProfiler().push("GuiLayer"); - // cache fog distance - float fogStart = RenderSystem.getShaderFogStart(); - - // remove nausea effect from projection matrix, for vanilla, nd posestack for iris - this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, par1, true))); - pMatrix.pushPose(); - pMatrix.setIdentity(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, pMatrix); - - boolean flag = this.isInMenuRoom(); - - // render the screen always on top in the menu room to prevent z fighting - depthAlways |= flag; - - PoseStack poseStack = RenderSystem.getModelViewStack(); - poseStack.pushPose(); - poseStack.setIdentity(); - RenderSystem.applyModelViewMatrix(); - - if (flag) { - pMatrix.pushPose(); - Vec3 eye = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition(); - pMatrix.translate((GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.origin.x - eye.x), - (GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.origin.y - eye.y), - (GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.origin.z - eye.z)); - - // remove world rotation or the room doesn't align with the screen - pMatrix.mulPose(Axis.YN.rotation(-GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.rotation_radians)); - - //System.out.println(eye + " eye"); - //System.out.println(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.origin + " world"); - - if (GameRendererVRMixin.DATA_HOLDER.menuWorldRenderer.isReady()) { - try { - this.renderTechjarsAwesomeMainMenuRoom(pMatrix); - } catch (Exception exception) { - System.out.println("Error rendering main menu world, unloading to prevent more errors"); - exception.printStackTrace(); - GameRendererVRMixin.DATA_HOLDER.menuWorldRenderer.destroy(); - } - } else { - this.renderJrbuddasAwesomeMainMenuRoomNew(pMatrix); - } - pMatrix.popPose(); - } + private void renderGuiLayer(float par1, boolean depthAlways, PoseStack poseStack) { + if (!dh.bowTracker.isDrawing && (mc.screen != null || !mc.options.hideGui) && !RadialHandler.isShowing()) + { + mc.getProfiler().push("GuiLayer"); + // cache fog distance + float fogStart = RenderSystem.getShaderFogStart(); - Vec3 vec31 = GuiHandler.applyGUIModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, pMatrix); - GuiHandler.guiFramebuffer.bindRead(); - RenderSystem.disableCull(); - RenderSystem.setShaderTexture(0, GuiHandler.guiFramebuffer.getColorTextureId()); + // remove nausea effect from projection matrix, for vanilla, nd posestack for iris + this.resetProjectionMatrix(this.getProjectionMatrix(this.getFov(this.mainCamera, par1, true))); + poseStack.pushPose(); + poseStack.setIdentity(); + this.applyVRModelView(dh.currentPass, poseStack); - float[] color = new float[]{1.0F, 1.0F, 1.0F, 1.0F}; - if (!flag) { - if (this.minecraft.screen == null) { - color[3] = GameRendererVRMixin.DATA_HOLDER.vrSettings.hudOpacity; - } else { - // disable fog for menus - RenderSystem.setShaderFogStart(Float.MAX_VALUE); - } + boolean flag = this.isInMenuRoom(); - if (this.minecraft.player != null && this.minecraft.player.isShiftKeyDown()) { - color[3] *= 0.75F; - } + // render the screen always on top in the menu room to prevent z fighting + depthAlways |= flag; - RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, - GlStateManager.SourceFactor.ONE_MINUS_DST_ALPHA, GlStateManager.DestFactor.ONE); - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.shaderGUIRender == VRSettings.ShaderGUIRender.BEFORE_TRANSLUCENT_SOLID && ShadersHelper.isShaderActive()) { - RenderSystem.disableBlend(); - } - } else { - // enable blend for overlay transition in menuworld to not be jarring - RenderSystem.enableBlend(); - } + PoseStack poseStack1 = RenderSystem.getModelViewStack(); + poseStack1.pushPose(); + poseStack1.setIdentity(); + RenderSystem.applyModelViewMatrix(); - if (depthAlways) { - RenderSystem.depthFunc(519); - } else { - RenderSystem.depthFunc(515); + if (flag) + { + poseStack.pushPose(); + Vec3 eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); + poseStack.last().pose() + .translate( + (float) (dh.vrPlayer.vrdata_world_render.origin.x - eye.x), + (float) (dh.vrPlayer.vrdata_world_render.origin.y - eye.y), + (float) (dh.vrPlayer.vrdata_world_render.origin.z - eye.z) + ) + // remove world rotation or the room doesn't align with the screen + .rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); + poseStack.last().normal().rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); + + //logger.info(eye + " eye"); + //logger.info(dh.vrPlayer.vrdata_world_render.origin + " world"); + + if (dh.menuWorldRenderer.isReady()) + { + try + { + this.renderTechjarsAwesomeMainMenuRoom(poseStack); + } catch (Exception exception) + { + logger.info("Error rendering main menu world, unloading to prevent more errors"); + exception.printStackTrace(); + dh.menuWorldRenderer.destroy(); } + } + else + { + this.renderJrbuddasAwesomeMainMenuRoomNew(poseStack); + } + poseStack.popPose(); + } - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); + Vec3 vec31 = GuiHandler.applyGUIModelView(dh.currentPass, poseStack); + GuiHandler.guiFramebuffer.bindRead(); + RenderSystem.disableCull(); + RenderSystem.setShaderTexture(0, GuiHandler.guiFramebuffer.getColorTextureId()); + + float[] color = new float[]{1.0F, 1.0F, 1.0F, 1.0F}; + if (!flag) + { + if (mc.screen == null) + { + color[3] = dh.vrSettings.hudOpacity; + } + else + { + // disable fog for menus + RenderSystem.setShaderFogStart(Float.MAX_VALUE); + } - // RenderSystem.disableLighting(); + if (mc.player != null && mc.player.isShiftKeyDown()) + { + color[3] *= 0.75F; + } - if (this.minecraft.level != null) { - if (((ItemInHandRendererExtension) this.itemInHandRenderer).isInsideOpaqueBlock(vec31)) { - vec31 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.hmd.getPosition(); - } + RenderSystem.enableBlend(); + RenderSystem.blendFuncSeparate( + SourceFactor.SRC_ALPHA, + DestFactor.ONE_MINUS_SRC_ALPHA, + SourceFactor.ONE_MINUS_DST_ALPHA, + DestFactor.ONE + ); + if (dh.vrSettings.shaderGUIRender == ShaderGUIRender.BEFORE_TRANSLUCENT_SOLID && + ShadersHelper.isShaderActive()) + { + RenderSystem.disableBlend(); + } + } + else + { + // enable blend for overlay transition in menuworld to not be jarring + RenderSystem.enableBlend(); + } - int i = ShadersHelper.ShaderLight(); - int j = Utils.getCombinedLightWithMin(this.minecraft.level, BlockPos.containing(vec31), i); - this.drawSizedQuadWithLightmap((float) this.minecraft.getWindow().getGuiScaledWidth(), - (float) this.minecraft.getWindow().getGuiScaledHeight(), 1.5F, j, color, - pMatrix.last().pose()); - } else { - this.drawSizedQuad((float) this.minecraft.getWindow().getGuiScaledWidth(), - (float) this.minecraft.getWindow().getGuiScaledHeight(), 1.5F, color, - pMatrix.last().pose()); - } + if (depthAlways) + { + RenderSystem.depthFunc(GL11C.GL_ALWAYS); + } + else + { + RenderSystem.depthFunc(GL11C.GL_LEQUAL); + } + + RenderSystem.depthMask(true); + RenderSystem.enableDepthTest(); - // RenderSystem.blendColor(1.0F, 1.0F, 1.0F, 1.0F); - // reset fog - RenderSystem.setShaderFogStart(fogStart); - RenderSystem.depthFunc(515); - RenderSystem.enableDepthTest(); - // RenderSystem.defaultAlphaFunc(); - RenderSystem.defaultBlendFunc(); - RenderSystem.enableCull(); - pMatrix.popPose(); - - poseStack.popPose(); - RenderSystem.applyModelViewMatrix(); - minecraft.getProfiler().pop(); + // RenderSystem.disableLighting(); + + if (mc.level != null) + { + if (((ItemInHandRendererExtension) this.itemInHandRenderer).isInsideOpaqueBlock(vec31)) + { + vec31 = dh.vrPlayer.vrdata_world_render.hmd.getPosition(); } + + int i = ShadersHelper.ShaderLight(); + int j = Utils.getCombinedLightWithMin(mc.level, BlockPos.containing(vec31), i); + this.drawSizedQuadWithLightmap((float) mc.getWindow().getGuiScaledWidth(), + (float) mc.getWindow().getGuiScaledHeight(), 1.5F, j, color, + poseStack.last().pose() + ); + } + else + { + this.drawSizedQuad((float) mc.getWindow().getGuiScaledWidth(), + (float) mc.getWindow().getGuiScaledHeight(), 1.5F, color, + poseStack.last().pose() + ); } + + // RenderSystem.blendColor(1.0F, 1.0F, 1.0F, 1.0F); + // reset fog + RenderSystem.setShaderFogStart(fogStart); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); + RenderSystem.enableDepthTest(); + // RenderSystem.defaultAlphaFunc(); + RenderSystem.defaultBlendFunc(); + RenderSystem.enableCull(); + poseStack.popPose(); + + poseStack1.popPose(); + RenderSystem.applyModelViewMatrix(); + mc.getProfiler().pop(); } } - public void SetupRenderingAtController(int controller, PoseStack matrix) { + public void SetupRenderingAtController(int controller, PoseStack matrix) + { Vec3 vec3 = this.getControllerRenderPos(controller); - vec3 = vec3.subtract(GameRendererVRMixin.DATA_HOLDER.vrPlayer.getVRDataWorld() - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition()); - matrix.translate((double) ((float) vec3.x), (double) ((float) vec3.y), (double) ((float) vec3.z)); - float sc = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.worldScale; - if (minecraft.level != null && TelescopeTracker.isTelescope(minecraft.player.getUseItem())) { - matrix.mulPoseMatrix(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.hmd.getMatrix().inverted() - .transposed().toMCMatrix()); - MethodHolder.rotateDegXp(matrix, 90); - matrix.translate(controller == 0 ? 0.075 * sc : -0.075 * sc, -0.025 * sc, 0.0325 * sc); + vec3 = vec3.subtract(dh.vrPlayer.getVRDataWorld() + .getEye(dh.currentPass).getPosition()); + matrix.last().pose().translate((float) vec3.x, (float) vec3.y, (float) vec3.z); + float sc = dh.vrPlayer.vrdata_world_render.worldScale; + if (mc.level != null && TelescopeTracker.isTelescope(mc.player.getUseItem())) { + matrix.last().pose() + .mul(dh.vrPlayer.vrdata_world_render.hmd.getMatrix()) + .rotateX(toRadians(90.0F)) + .translate(controller == 0 ? 0.075F * sc : -0.075F * sc, -0.025F * sc, 0.0325F * sc); + matrix.last().normal().rotateX(toRadians(90.0F)); } else { - matrix.mulPoseMatrix(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(controller) - .getMatrix().inverted().transposed().toMCMatrix()); + matrix.last().pose().mul(dh.vrPlayer.vrdata_world_render.getController(controller).getMatrix()); } matrix.scale(sc, sc, sc); } - public void renderFlatQuad(Vec3 pos, float width, float height, float yaw, int r, int g, int b, int a, - PoseStack poseStack) { + public void renderFlatQuad(Vec3 pos, float width, float height, float yaw, int r, int g, int b, int a, PoseStack poseStack) + { Tesselator tesselator = Tesselator.getInstance(); tesselator.getBuilder().begin(Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_NORMAL); - Vec3 vec3 = (new Vec3((double) (-width / 2.0F), 0.0D, (double) (height / 2.0F))) - .yRot((float) Math.toRadians((double) (-yaw))); - Vec3 vec31 = (new Vec3((double) (-width / 2.0F), 0.0D, (double) (-height / 2.0F))) - .yRot((float) Math.toRadians((double) (-yaw))); - Vec3 vec32 = (new Vec3((double) (width / 2.0F), 0.0D, (double) (-height / 2.0F))) - .yRot((float) Math.toRadians((double) (-yaw))); - Vec3 vec33 = (new Vec3((double) (width / 2.0F), 0.0D, (double) (height / 2.0F))) - .yRot((float) Math.toRadians((double) (-yaw))); + Vec3 vec3 = (new Vec3(-width / 2.0F, 0.0D, height / 2.0F)).yRot(toRadians(-yaw)); + Vec3 vec31 = new Vec3(-width / 2.0F, 0.0D, -height / 2.0F).yRot(toRadians(-yaw)); + Vec3 vec32 = new Vec3(width / 2.0F, 0.0D, -height / 2.0F).yRot(toRadians(-yaw)); + Vec3 vec33 = new Vec3(width / 2.0F, 0.0D, height / 2.0F).yRot(toRadians(-yaw)); Matrix4f mat = poseStack.last().pose(); tesselator.getBuilder().vertex(mat, (float) (pos.x + vec3.x), (float) pos.y, (float) (pos.z + vec3.z)) .color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); @@ -1436,8 +1523,10 @@ public void renderFlatQuad(Vec3 pos, float width, float height, float yaw, int r } - private void renderBox(Tesselator tes, Vec3 start, Vec3 end, float minX, float maxX, float minY, float maxY, - Vec3 up, Vec3i color, byte alpha, PoseStack poseStack) { + private void renderBox(Tesselator tes, Vec3 start, Vec3 end, float minX, float maxX, float minY, float maxY, Vec3 up, + Vec3i color, byte alpha, PoseStack poseStack + ) + { Vec3 vec3 = start.subtract(end).normalize(); Vec3 vec31 = vec3.cross(up); up = vec31.cross(vec3); @@ -1445,9 +1534,9 @@ private void renderBox(Tesselator tes, Vec3 start, Vec3 end, float minX, float m vec31 = vec31.scale((double) maxX); Vec3 vec33 = new Vec3(up.x * (double) minY, up.y * (double) minY, up.z * (double) minY); up = up.scale((double) maxY); - org.vivecraft.common.utils.lwjgl.Vector3f vector3f = Utils.convertToVector3f(vec3); - org.vivecraft.common.utils.lwjgl.Vector3f vector3f1 = Utils.convertToVector3f(up.normalize()); - org.vivecraft.common.utils.lwjgl.Vector3f vector3f2 = Utils.convertToVector3f(vec31.normalize()); + Vector3f vector3f = convertToVector3f(vec3); + Vector3f vector3f1 = convertToVector3f(up.normalize()); + Vector3f vector3f2 = convertToVector3f(vec31.normalize()); Vec3 vec34 = start.add(vec31.x + vec33.x, vec31.y + vec33.y, vec31.z + vec33.z); Vec3 vec35 = start.add(vec31.x + up.x, vec31.y + up.y, vec31.z + up.z); Vec3 vec36 = start.add(vec32.x + vec33.x, vec32.y + vec33.y, vec32.z + vec33.z); @@ -1533,63 +1622,59 @@ private void renderBox(Tesselator tes, Vec3 start, Vec3 end, float minX, float m } private void renderJrbuddasAwesomeMainMenuRoomNew(PoseStack pMatrixStack) { - int i = 4; - float f = 2.5F; - float f1 = 1.3F; - Vector2f afloat = GameRendererVRMixin.DATA_HOLDER.vr.getPlayAreaSize(); - if (afloat == null) - afloat = new Vector2f(2, 2); + int repeat = 4; + float height = 2.5F; + float oversize = 1.3F; + Vector2f area = dh.vr.getPlayAreaSize(); + if (area == null) + area = new Vector2f(2, 2); BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.depthFunc(519); - RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT, Minecraft.ON_OSX); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); - RenderSystem.setShaderColor(1, 1, 1, 1); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); pMatrixStack.pushPose(); - float f2 = afloat.x + f1; - float f3 = afloat.y + f1; - pMatrixStack.translate(-f2 / 2.0F, 0.0F, -f3 / 2.0F); + float width = area.x + oversize; + float length = area.y + oversize; + Matrix4f matrix4f = pMatrixStack.last().pose() + .translate(-width / 2.0F, 0.0F, -length / 2.0F); - Matrix4f matrix4f = pMatrixStack.last().pose(); bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); - float r, g, b, a; - r = g = b = 0.8f; - a = 1.0f; + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, 0.0F).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, length).uv(0.0F, repeat * length).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, length).uv(repeat * width, repeat * length).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, 0.0F).uv(repeat * width, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 1.0F, 0.0F).endVertex(); - bufferbuilder.vertex(matrix4f, 0, 0, 0).uv(0, 0).color(r, g, b, a).normal(0, 1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, 0, 0, f3).uv(0, i * f3).color(r, g, b, a).normal(0, 1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, f3).uv(i * f2, i * f3).color(r, g, b, a).normal(0, 1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, 0).uv(i * f2, 0).color(r, g, b, a).normal(0, 1, 0).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, length).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, 0.0F).uv(0.0F, repeat * length).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, 0.0F).uv(repeat * width, repeat * length).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, -1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, length).uv(repeat * width, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, -1.0F, 0.0F).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, f3).uv(0, 0).color(r, g, b, a).normal(0, -1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, 0).uv(0, i * f3).color(r, g, b, a).normal(0, -1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, 0).uv(i * f2, i * f3).color(r, g, b, a).normal(0, -1, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, f3).uv(i * f2, 0).color(r, g, b, a).normal(0, -1, 0).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, 0.0F).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, 0.0F).uv(0.0F, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, length).uv(repeat * length, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, length).uv(repeat * length, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(1.0F, 0.0F, 0.0F).endVertex(); - bufferbuilder.vertex(matrix4f, 0, 0, 0).uv(0, 0).color(r, g, b, a).normal(1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, 0).uv(0, i * f).color(r, g, b, a).normal(1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, f3).uv(i * f3, i * f).color(r, g, b, a).normal(1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, 0, 0, f3).uv(i * f3, 0).color(r, g, b, a).normal(1, 0, 0).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, 0.0F).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, length).uv(repeat * length, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, length).uv(repeat * length, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, 0.0F).uv(0.0F, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(-1.0F, 0.0F, 0.0F).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, 0).uv(0, 0).color(r, g, b, a).normal(-1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, f3).uv(i * f3, 0).color(r, g, b, a).normal(-1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, f3).uv(i * f3, i * f).color(r, g, b, a).normal(-1, 0, 0).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, 0).uv(0, i * f).color(r, g, b, a).normal(-1, 0, 0).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, 0.0F).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, 0.0F).uv(repeat * width, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, 0.0F).uv(repeat * width, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, 1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, 0.0F).uv(0.0F, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, 1.0F).endVertex(); - bufferbuilder.vertex(matrix4f, 0, 0, 0).uv(0, 0).color(r, g, b, a).normal(0, 0, 1).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, 0).uv(i * f2, 0).color(r, g, b, a).normal(0, 0, 1).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, 0).uv(i * f2, i * f).color(r, g, b, a).normal(0, 0, 1).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, 0).uv(0, i * f).color(r, g, b, a).normal(0, 0, 1).endVertex(); - - bufferbuilder.vertex(matrix4f, 0, 0, f3).uv(0, 0).color(r, g, b, a).normal(0, 0, -1).endVertex(); - bufferbuilder.vertex(matrix4f, 0, f, f3).uv(0, i * f).color(r, g, b, a).normal(0, 0, -1).endVertex(); - bufferbuilder.vertex(matrix4f, f2, f, f3).uv(i * f2, i * f).color(r, g, b, a).normal(0, 0, -1).endVertex(); - bufferbuilder.vertex(matrix4f, f2, 0, f3).uv(i * f2, 0).color(r, g, b, a).normal(0, 0, -1).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, 0.0F, length).uv(0.0F, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, 0.0F, height, length).uv(0.0F, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, height, length).uv(repeat * width, repeat * height).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, -1.0F).endVertex(); + bufferbuilder.vertex(matrix4f, width, 0.0F, length).uv(repeat * width, 0.0F).color(0.8F, 0.8F, 0.8F, 1.0F).normal(0.0F, 0.0F, -1.0F).endVertex(); BufferUploader.drawWithShader(bufferbuilder.end()); pMatrixStack.popPose(); @@ -1597,7 +1682,7 @@ private void renderJrbuddasAwesomeMainMenuRoomNew(PoseStack pMatrixStack) { } private void renderTechjarsAwesomeMainMenuRoom(PoseStack poseStack) { - RenderSystem.setShaderColor(1f,1f,1f,1f); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.enableDepthTest(); //RenderSystem.enableTexture(); @@ -1607,25 +1692,25 @@ private void renderTechjarsAwesomeMainMenuRoom(PoseStack poseStack) { poseStack.pushPose(); int tzOffset = Calendar.getInstance().get(Calendar.ZONE_OFFSET); - DATA_HOLDER.menuWorldRenderer.time = DATA_HOLDER.menuWorldRenderer.fastTime - ? (long)(DATA_HOLDER.menuWorldRenderer.ticks * 10L + 10 * minecraft.getFrameTime()) + dh.menuWorldRenderer.time = dh.menuWorldRenderer.fastTime + ? (long)(dh.menuWorldRenderer.ticks * 10L + 10 * mc.getFrameTime()) : (long)((System.currentTimeMillis() + tzOffset - 21600000) / 86400000D * 24000D); - DATA_HOLDER.menuWorldRenderer.fogRenderer.setupFogColor(); - RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT, Minecraft.ON_OSX); + dh.menuWorldRenderer.fogRenderer.setupFogColor(); + RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); - DATA_HOLDER.menuWorldRenderer.updateLightmap(); - DATA_HOLDER.menuWorldRenderer.render(poseStack); + dh.menuWorldRenderer.updateLightmap(); + dh.menuWorldRenderer.render(poseStack); - Vector2f area = DATA_HOLDER.vr.getPlayAreaSize(); + Vector2f area = dh.vr.getPlayAreaSize(); if (area != null) { poseStack.pushPose(); - float width = area.x;//(float)Math.ceil(area.x); - float length = area.y;//(float)Math.ceil(area.y); + float width = area.x;//(float)ceil(area.x); + float length = area.y;//(float)ceil(area.y); RenderSystem.setShader(GameRenderer::getPositionTexColorNormalShader); RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); - float sun = DATA_HOLDER.menuWorldRenderer.getSkyDarken(); + float sun = dh.menuWorldRenderer.getSkyDarken(); RenderSystem.setShaderColor(sun, sun, sun, 0.3f); @@ -1636,29 +1721,29 @@ private void renderTechjarsAwesomeMainMenuRoom(PoseStack poseStack) { bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR_NORMAL); poseStack.translate(-width / 2.0F, 0.0F, -length / 2.0F); bufferbuilder - .vertex(matrix4f, 0, 0.005f, 0) + .vertex(matrix4f, 0, 0.005F, 0) .uv(0, 0) - .color(1f,1f,1f,1f) + .color(1.0F, 1.0F, 1.0F, 1.0F) .normal(0, 1, 0).endVertex(); bufferbuilder - .vertex(matrix4f, 0, 0.005f, length) + .vertex(matrix4f, 0, 0.005F, length) .uv(0, 4 * length) - .color(1f,1f,1f,1f) + .color(1.0F, 1.0F, 1.0F, 1.0F) .normal(0, 1, 0).endVertex(); bufferbuilder - .vertex(matrix4f, width, 0.005f, length) + .vertex(matrix4f, width, 0.005F, length) .uv(4 * width, 4 * length) - .color(1f,1f,1f,1f) + .color(1.0F, 1.0F, 1.0F, 1.0F) .normal(0, 1, 0).endVertex(); bufferbuilder - .vertex(matrix4f, width, 0.005f, 0) + .vertex(matrix4f, width, 0.005F, 0) .uv(4 * width, 0) - .color(1f,1f,1f,1f) + .color(1.0F, 1.0F, 1.0F, 1.0F) .normal(0, 1, 0).endVertex(); BufferUploader.drawWithShader(bufferbuilder.end()); - RenderSystem.setShaderColor(1.0f,1.0f,1.0f,1.0f); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } @@ -1666,23 +1751,25 @@ private void renderTechjarsAwesomeMainMenuRoom(PoseStack poseStack) { RenderSystem.defaultBlendFunc(); } - public void renderVRFabulous(float partialTicks, LevelRenderer worldrendererin, boolean menuhandright, - boolean menuhandleft, PoseStack pMatrix) { - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.SCOPEL || ClientDataHolderVR.getInstance().currentPass == RenderPass.SCOPER) + public void renderVRFabulous(float partialTicks, LevelRenderer worldrendererin, boolean menuHandRight, boolean menuHandLeft, + PoseStack pMatrix + ) + { + if (dh.currentPass == RenderPass.SCOPEL || dh.currentPass == RenderPass.SCOPER) return; - this.minecraft.getProfiler().popPush("VR"); - this.renderCrosshairAtDepth(!ClientDataHolderVR.getInstance().vrSettings.useCrosshairOcclusion, pMatrix); - this.minecraft.getMainRenderTarget().unbindWrite(); - ((LevelRendererExtension) worldrendererin).getAlphaSortVROccludedFramebuffer().clear(Minecraft.ON_OSX); - ((LevelRendererExtension) worldrendererin).getAlphaSortVROccludedFramebuffer().copyDepthFrom(this.minecraft.getMainRenderTarget()); + mc.getProfiler().popPush("VR"); + this.renderCrosshairAtDepth(!dh.vrSettings.useCrosshairOcclusion, pMatrix); + mc.getMainRenderTarget().unbindWrite(); + ((LevelRendererExtension) worldrendererin).getAlphaSortVROccludedFramebuffer().clear(ON_OSX); + ((LevelRendererExtension) worldrendererin).getAlphaSortVROccludedFramebuffer().copyDepthFrom(mc.getMainRenderTarget()); ((LevelRendererExtension) worldrendererin).getAlphaSortVROccludedFramebuffer().bindWrite(true); if (this.shouldOccludeGui()) { this.renderGuiLayer(partialTicks, false, pMatrix); this.renderVrShadow(partialTicks, false, pMatrix); - if (KeyboardHandler.Showing) { - if (DATA_HOLDER.vrSettings.physicalKeyboard) { + if (KeyboardHandler.isShowing()) { + if (dh.vrSettings.physicalKeyboard) { this.renderPhysicalKeyboard(partialTicks, pMatrix); } else { this.render2D(partialTicks, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, @@ -1696,15 +1783,15 @@ public void renderVRFabulous(float partialTicks, LevelRenderer worldrendererin, } } - ((LevelRendererExtension) worldrendererin).getAlphaSortVRUnoccludedFramebuffer().clear(Minecraft.ON_OSX); + ((LevelRendererExtension) worldrendererin).getAlphaSortVRUnoccludedFramebuffer().clear(ON_OSX); ((LevelRendererExtension) worldrendererin).getAlphaSortVRUnoccludedFramebuffer().bindWrite(true); if (!this.shouldOccludeGui()) { this.renderGuiLayer(partialTicks, false, pMatrix); this.renderVrShadow(partialTicks, false, pMatrix); - if (KeyboardHandler.Showing) { - if (DATA_HOLDER.vrSettings.physicalKeyboard) { + if (KeyboardHandler.isShowing()) { + if (dh.vrSettings.physicalKeyboard) { this.renderPhysicalKeyboard(partialTicks, pMatrix); } else { this.render2D(partialTicks, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, @@ -1721,27 +1808,26 @@ public void renderVRFabulous(float partialTicks, LevelRenderer worldrendererin, this.renderVRSelfEffects(partialTicks); VRWidgetHelper.renderVRThirdPersonCamWidget(); VRWidgetHelper.renderVRHandheldCameraWidget(); - boolean flag = this.shouldRenderHands(); - this.renderVRHands(partialTicks, flag && menuhandright, flag && menuhandleft, true, true, pMatrix); - ((LevelRendererExtension) worldrendererin).getAlphaSortVRHandsFramebuffer().clear(Minecraft.ON_OSX); - ((LevelRendererExtension) worldrendererin).getAlphaSortVRHandsFramebuffer().copyDepthFrom(this.minecraft.getMainRenderTarget()); + boolean should = this.shouldRenderHands(); + this.renderVRHands(partialTicks, should && menuHandRight, should && menuHandLeft, true, true, pMatrix); + ((LevelRendererExtension) worldrendererin).getAlphaSortVRHandsFramebuffer().clear(ON_OSX); + ((LevelRendererExtension) worldrendererin).getAlphaSortVRHandsFramebuffer().copyDepthFrom(mc.getMainRenderTarget()); ((LevelRendererExtension) worldrendererin).getAlphaSortVRHandsFramebuffer().bindWrite(true); - this.renderVRHands(partialTicks, flag && !menuhandright, flag && !menuhandleft, false, false, pMatrix); + this.renderVRHands(partialTicks, should && !menuHandRight, should && !menuHandLeft, false, false, pMatrix); RenderSystem.defaultBlendFunc(); // RenderSystem.defaultAlphaFunc(); RenderSystem.setShaderColor(1, 1, 1, 1); // Lighting.turnBackOn(); // Lighting.turnOff(); - this.minecraft.getMainRenderTarget().bindWrite(true); + mc.getMainRenderTarget().bindWrite(true); } @Override - public void renderVrFast(float partialTicks, boolean secondpass, boolean menuright, boolean menuleft, - PoseStack pMatrix) { - if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.SCOPEL - || GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.SCOPER) + public void renderVrFast(float partialTicks, boolean secondpass, boolean menuright, boolean menuleft, PoseStack pMatrix) + { + if (dh.currentPass == RenderPass.SCOPEL || dh.currentPass == RenderPass.SCOPER) return; - this.minecraft.getProfiler().popPush("VR"); + mc.getProfiler().popPush("VR"); this.lightTexture.turnOffLightLayer(); if (secondpass) { @@ -1749,7 +1835,7 @@ public void renderVrFast(float partialTicks, boolean secondpass, boolean menurig } if (!secondpass) { - this.renderCrosshairAtDepth(!GameRendererVRMixin.DATA_HOLDER.vrSettings.useCrosshairOcclusion, pMatrix); + this.renderCrosshairAtDepth(!dh.vrSettings.useCrosshairOcclusion, pMatrix); } if (!secondpass) { @@ -1760,12 +1846,12 @@ public void renderVrFast(float partialTicks, boolean secondpass, boolean menurig VRWidgetHelper.renderVRHandheldCameraWidget(); } - if (secondpass && (Minecraft.getInstance().screen != null || !KeyboardHandler.Showing)) { + if (secondpass && (mc.screen != null || !KeyboardHandler.isShowing())) { this.renderGuiLayer(partialTicks, !this.shouldOccludeGui(), pMatrix); } - if (secondpass && KeyboardHandler.Showing) { - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.physicalKeyboard) { + if (secondpass && KeyboardHandler.isShowing()) { + if (dh.vrSettings.physicalKeyboard) { this.renderPhysicalKeyboard(partialTicks, pMatrix); } else { this.render2D(partialTicks, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, @@ -1778,12 +1864,11 @@ public void renderVrFast(float partialTicks, boolean secondpass, boolean menurig !this.shouldOccludeGui(), pMatrix); } // render hands in second pass when gui is open - boolean renderHandsSecond = RadialHandler.isShowing() || KeyboardHandler.Showing || Minecraft.getInstance().screen != null; + boolean renderHandsSecond = RadialHandler.isShowing() || KeyboardHandler.isShowing() || mc.screen != null; if (secondpass == renderHandsSecond) { // should render hands in second pass if menus are open, else in the first pass // only render the hands only once - this.renderVRHands(partialTicks, this.shouldRenderHands(), this.shouldRenderHands(), menuright, menuleft, - pMatrix); + this.renderVRHands(partialTicks, this.shouldRenderHands(), this.shouldRenderHands(), menuright, menuleft, pMatrix); } this.renderVRSelfEffects(partialTicks); } @@ -1857,8 +1942,10 @@ public void drawSizedQuad(float displayWidth, float displayHeight, float size) { this.drawSizedQuad(displayWidth, displayHeight, size, new float[]{1, 1, 1, 1}); } - public void drawSizedQuadWithLightmap(float displayWidth, float displayHeight, float size, int lighti, - float[] color, Matrix4f pMatrix) { + public void drawSizedQuadWithLightmap(float displayWidth, float displayHeight, float size, int lighti, float[] color, + Matrix4f pMatrix + ) + { RenderSystem.setShader(GameRenderer::getRendertypeEntityCutoutNoCullShader); float f = displayHeight / displayWidth; this.lightTexture.turnOnLightLayer(); @@ -1893,26 +1980,28 @@ public void drawSizedQuadWithLightmap(float displayWidth, float displayHeight, f } } - public void drawSizedQuadWithLightmap(float displayWidth, float displayHeight, float size, int lighti, - Matrix4f pMatrix) { + public void drawSizedQuadWithLightmap(float displayWidth, float displayHeight, float size, int lighti, Matrix4f pMatrix) { this.drawSizedQuadWithLightmap(displayWidth, displayHeight, size, lighti, new float[]{1, 1, 1, 1}, pMatrix); } - private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.showBeam - && GameRendererVRMixin.DATA_HOLDER.teleportTracker.isAiming() - && GameRendererVRMixin.DATA_HOLDER.teleportTracker.movementTeleportArcSteps > 1) { - this.minecraft.getProfiler().push("teleportArc"); + private void renderTeleportArc(PoseStack poseStack) { + if (dh.teleportTracker.vrMovementStyle.showBeam && dh.teleportTracker.isAiming() && + dh.teleportTracker.movementTeleportArcSteps > 1 + ) + { + mc.getProfiler().push("teleportArc"); // boolean flag = Config.isShaders(); boolean flag = false; + // boolean isShader = Config.isShaders(); + // boolean isShader = false; RenderSystem.enableCull(); RenderSystem.setShader(GameRenderer::getPositionColorShader); - this.minecraft.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); + mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); Tesselator tesselator = Tesselator.getInstance(); tesselator.getBuilder().begin(Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_NORMAL); - double d0 = GameRendererVRMixin.DATA_HOLDER.teleportTracker.lastTeleportArcDisplayOffset; - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.teleportTracker.getDestination(); + double d0 = dh.teleportTracker.lastTeleportArcDisplayOffset; + Vec3 vec3 = dh.teleportTracker.getDestination(); boolean flag1 = vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D; byte b0 = -1; Vec3i vec3i; @@ -1921,22 +2010,22 @@ private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { vec3i = new Vec3i(83, 75, 83); b0 = -128; } else { - if (ClientNetworking.isLimitedSurvivalTeleport() && !this.minecraft.player.getAbilities().mayfly) { + if (ClientNetworking.isLimitedSurvivalTeleport() && !mc.player.getAbilities().mayfly) { vec3i = this.tpLimitedColor; } else { vec3i = this.tpUnlimitedColor; } - d0 = GameRendererVRMixin.DATA_HOLDER.vrRenderer.getCurrentTimeSecs() - * (double) GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.textureScrollSpeed * 0.6D; - GameRendererVRMixin.DATA_HOLDER.teleportTracker.lastTeleportArcDisplayOffset = d0; + d0 = dh.vrRenderer.getCurrentTimeSecs() + * (double) dh.teleportTracker.vrMovementStyle.textureScrollSpeed * 0.6D; + dh.teleportTracker.lastTeleportArcDisplayOffset = d0; } - float f = GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.beamHalfWidth * 0.15F; - int i = GameRendererVRMixin.DATA_HOLDER.teleportTracker.movementTeleportArcSteps - 1; + float f = dh.teleportTracker.vrMovementStyle.beamHalfWidth * 0.15F; + int i = dh.teleportTracker.movementTeleportArcSteps - 1; - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.vrMovementStyle.beamGrow) { - i = (int) ((double) i * GameRendererVRMixin.DATA_HOLDER.teleportTracker.movementTeleportProgress); + if (dh.teleportTracker.vrMovementStyle.beamGrow) { + i = (int) ((double) i * dh.teleportTracker.movementTeleportProgress); } double d1 = 1.0D / (double) i; @@ -1944,13 +2033,13 @@ private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { for (int j = 0; j < i; ++j) { double d2 = (double) j / (double) i + d0 * d1; - int k = Mth.floor(d2); + int k = roundUsing(d2, FLOOR); d2 = d2 - (double) ((float) k); - Vec3 vec32 = GameRendererVRMixin.DATA_HOLDER.teleportTracker + Vec3 vec32 = dh.teleportTracker .getInterpolatedArcPosition((float) (d2 - d1 * (double) 0.4F)) - .subtract(this.minecraft.getCameraEntity().position()); - Vec3 vec33 = GameRendererVRMixin.DATA_HOLDER.teleportTracker.getInterpolatedArcPosition((float) d2) - .subtract(this.minecraft.getCameraEntity().position()); + .subtract(mc.getCameraEntity().position()); + Vec3 vec33 = dh.teleportTracker.getInterpolatedArcPosition((float) d2) + .subtract(mc.getCameraEntity().position()); float f2 = (float) d2 * 2.0F; this.renderBox(tesselator, vec32, vec33, -f, f, (-1.0F + f2) * f, (1.0F + f2) * f, vec31, vec3i, b0, poseStack); @@ -1959,8 +2048,8 @@ private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { tesselator.end(); RenderSystem.disableCull(); - if (flag1 && GameRendererVRMixin.DATA_HOLDER.teleportTracker.movementTeleportProgress >= 1.0D) { - Vec3 vec34 = (new Vec3(vec3.x, vec3.y, vec3.z)).subtract(this.minecraft.getCameraEntity().position()); + if (flag1 && dh.teleportTracker.movementTeleportProgress >= 1.0D) { + Vec3 vec34 = (new Vec3(vec3.x, vec3.y, vec3.z)).subtract(mc.getCameraEntity().position()); int l = 1; float f1 = 0.01F; double d4 = 0.0D; @@ -2049,7 +2138,7 @@ private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { (int) ((double) vec3i.getY() * 1.05D), (int) ((double) vec3i.getZ() * 1.05D), 64, poseStack); } - this.minecraft.getProfiler().pop(); + mc.getProfiler().pop(); RenderSystem.enableCull(); } } @@ -2057,11 +2146,8 @@ private void renderTeleportArc(VRPlayer vrPlayer, PoseStack poseStack) { @Override public void drawEyeStencil(boolean flag1) { - if (GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.SCOPEL - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.SCOPER) { - if ((GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.LEFT - || GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.RIGHT) - && GameRendererVRMixin.DATA_HOLDER.vrSettings.vrUseStencil) { + if (dh.currentPass != RenderPass.SCOPEL && dh.currentPass != RenderPass.SCOPER) { + if ((dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT) && dh.vrSettings.vrUseStencil) { // net.optifine.shaders.Program program = Shaders.activeProgram; // // if (shaders && Shaders.dfb != null) { @@ -2070,63 +2156,76 @@ public void drawEyeStencil(boolean flag1) { // // for (int i = 0; i < Shaders.usedDepthBuffers; ++i) { // GlStateManager._bindTexture(Shaders.dfb.depthTextures.get(i)); -// this.minecraft.vrRenderer.doStencil(false); +// mc.vrRenderer.doStencil(false); // } // // Shaders.useProgram(program); // } else { - GameRendererVRMixin.DATA_HOLDER.vrRenderer.doStencil(false); + dh.vrRenderer.doStencil(false); // } } else { - GL11.glDisable(GL11.GL_STENCIL_TEST); + GL11C.glDisable(GL11C.GL_STENCIL_TEST); } - } else { + } + else + { // No stencil for telescope - // GameRendererVRMixin.DATA_HOLDER.vrRenderer.doStencil(true); + // dh.vrRenderer.doStencil(true); } } - private void renderFaceOverlay(float par1, PoseStack pMatrix) { -// boolean flag = Config.isShaders(); - boolean flag = false; + private void renderFaceOverlay(float par1, PoseStack pMatrix) + { + // boolean shadersMod = Config.isShaders(); + // boolean shadersMod = false; -// if (flag) { TODO -// Shaders.beginFPOverlay(); -// } + // if (shadersMod) { TODO + // Shaders.beginFPOverlay(); + // } - if (this.inBlock > 0.0F) { + if (this.inBlock > 0.0F) + { this.renderFaceInBlock(); this.renderGuiLayer(par1, true, pMatrix); - if (KeyboardHandler.Showing) { - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.physicalKeyboard) { + if (KeyboardHandler.isShowing()) + { + if (dh.vrSettings.physicalKeyboard) + { this.renderPhysicalKeyboard(par1, pMatrix); - } else { - this.render2D(par1, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, - KeyboardHandler.Rotation_room, true, pMatrix); + } + else + { + this.render2D(par1, KeyboardHandler.Framebuffer, KeyboardHandler.Pos_room, KeyboardHandler.Rotation_room, + true, pMatrix + ); } } - if (RadialHandler.isShowing()) { - this.render2D(par1, RadialHandler.Framebuffer, RadialHandler.Pos_room, RadialHandler.Rotation_room, - true, pMatrix); + if (RadialHandler.isShowing()) + { + this.render2D(par1, RadialHandler.Framebuffer, RadialHandler.Pos_room, RadialHandler.Rotation_room, true, + pMatrix + ); } - if (this.inBlock >= 1.0F) { + if (this.inBlock >= 1.0F) + { this.renderVRHands(par1, true, true, true, true, pMatrix); } } -// if (flag) { TODO -// Shaders.endFPOverlay(); -// } + // if (shadersMod) { TODO + // Shaders.endFPOverlay(); + // } } - private void renderFaceInBlock() { + private void renderFaceInBlock() + { Tesselator tesselator = Tesselator.getInstance(); BufferBuilder bufferbuilder = tesselator.getBuilder(); RenderSystem.setShader(GameRenderer::getPositionShader); - RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, ((GameRendererExtension) this.minecraft.gameRenderer).inBlock()); + RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, ((GameRendererExtension) mc.gameRenderer).inBlock()); // orthographic matrix, (-1, -1) to (1, 1), near = 0.0, far 2.0 Matrix4f mat = new Matrix4f(); @@ -2136,7 +2235,7 @@ private void renderFaceInBlock() { mat.m33(1.0F); mat.m32(-1.0F); - RenderSystem.depthFunc(GL11.GL_ALWAYS); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); RenderSystem.depthMask(true); RenderSystem.enableBlend(); RenderSystem.disableCull(); @@ -2146,48 +2245,49 @@ private void renderFaceInBlock() { bufferbuilder.vertex(mat, 1.5F, 1.5F, 0.0F).endVertex(); bufferbuilder.vertex(mat, -1.5F, 1.5F, 0.0F).endVertex(); tesselator.end(); - RenderSystem.depthFunc(GL11.GL_LEQUAL); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } - public boolean shouldRenderCrosshair() { - if (ClientDataHolderVR.viewonly) { + public boolean shouldRenderCrosshair() + { + if (dh.viewonly) { return false; - } else if (this.minecraft.level == null) { + } else if (mc.level == null) { return false; - } else if (this.minecraft.screen != null) { + } else if (mc.screen != null) { return false; } else { - boolean flag = GameRendererVRMixin.DATA_HOLDER.vrSettings.renderInGameCrosshairMode == VRSettings.RenderPointerElement.ALWAYS - || (GameRendererVRMixin.DATA_HOLDER.vrSettings.renderInGameCrosshairMode == VRSettings.RenderPointerElement.WITH_HUD - && !this.minecraft.options.hideGui); + boolean flag = dh.vrSettings.renderInGameCrosshairMode == RenderPointerElement.ALWAYS + || (dh.vrSettings.renderInGameCrosshairMode == RenderPointerElement.WITH_HUD + && !mc.options.hideGui); if (!flag) { return false; - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.THIRD) { + } else if (dh.currentPass == RenderPass.THIRD) { return false; - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.SCOPEL - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.SCOPER) { - if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.CAMERA) { + } else if (dh.currentPass != RenderPass.SCOPEL + && dh.currentPass != RenderPass.SCOPER) { + if (dh.currentPass == RenderPass.CAMERA) { return false; - } else if (KeyboardHandler.Showing) { + } else if (KeyboardHandler.isShowing()) { return false; } else if (RadialHandler.isUsingController(ControllerType.RIGHT)) { return false; - } else if (GameRendererVRMixin.DATA_HOLDER.bowTracker.isNotched()) { + } else if (dh.bowTracker.isNotched()) { return false; - } else if (!GameRendererVRMixin.DATA_HOLDER.vr.getInputAction(VivecraftVRMod.INSTANCE.keyVRInteract) + } else if (!dh.vr.getInputAction(VivecraftVRMod.keyVRInteract) .isEnabledRaw(ControllerType.RIGHT) - && !VivecraftVRMod.INSTANCE.keyVRInteract.isDown(ControllerType.RIGHT)) { - if (!GameRendererVRMixin.DATA_HOLDER.vr.getInputAction(VivecraftVRMod.INSTANCE.keyClimbeyGrab) + && !VivecraftVRMod.keyVRInteract.isDown(ControllerType.RIGHT)) { + if (!dh.vr.getInputAction(VivecraftVRMod.keyClimbeyGrab) .isEnabledRaw(ControllerType.RIGHT) - && !VivecraftVRMod.INSTANCE.keyClimbeyGrab.isDown(ControllerType.RIGHT)) { - if (GameRendererVRMixin.DATA_HOLDER.teleportTracker.isAiming()) { + && !VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT)) { + if (dh.teleportTracker.isAiming()) { return false; - } else if (GameRendererVRMixin.DATA_HOLDER.climbTracker.isGrabbingLadder(0)) { + } else if (dh.climbTracker.isGrabbingLadder(0)) { return false; } else { - return !(GameRendererVRMixin.DATA_HOLDER.vrPlayer.worldScale > 15.0F); + return !(dh.vrPlayer.worldScale > 15.0F); } } else { return false; @@ -2202,53 +2302,73 @@ public boolean shouldRenderCrosshair() { } private void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseStack) { - if (this.shouldRenderCrosshair()) { - this.minecraft.getProfiler().push("crosshair"); + if (this.shouldRenderCrosshair()) + { + mc.getProfiler().push("crosshair"); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); Vec3 vec3 = this.crossVec; - Vec3 vec31 = vec3.subtract(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getPosition()); + Vec3 vec31 = vec3.subtract(dh.vrPlayer.vrdata_world_render.getController(0).getPosition()); float f = (float) vec31.length(); - float f1 = (float) ((double) (0.125F * GameRendererVRMixin.DATA_HOLDER.vrSettings.crosshairScale) - * Math.sqrt((double) GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.worldScale)); + float f1 = (float) ((double) (0.125F * dh.vrSettings.crosshairScale) + * sqrt((double) dh.vrPlayer.vrdata_world_render.worldScale)); vec3 = vec3.add(vec31.normalize().scale(-0.01D)); poseStack.pushPose(); poseStack.setIdentity(); - applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, poseStack); - - Vec3 vec32 = vec3.subtract(this.minecraft.getCameraEntity().position()); - poseStack.translate(vec32.x, vec32.y, vec32.z); - - if (this.minecraft.hitResult != null && this.minecraft.hitResult.getType() == HitResult.Type.BLOCK) { - BlockHitResult blockhitresult = (BlockHitResult) this.minecraft.hitResult; - - if (blockhitresult.getDirection() == Direction.DOWN) { - MethodHolder.rotateDeg(poseStack, - GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getYaw(), 0.0F, 1.0F, - 0.0F); - MethodHolder.rotateDeg(poseStack, -90.0F, 1.0F, 0.0F, 0.0F); - } else if (blockhitresult.getDirection() == Direction.EAST) { - MethodHolder.rotateDeg(poseStack, 90.0F, 0.0F, 1.0F, 0.0F); - } else if (blockhitresult.getDirection() != Direction.NORTH - && blockhitresult.getDirection() != Direction.SOUTH) { - if (blockhitresult.getDirection() == Direction.UP) { - MethodHolder.rotateDeg(poseStack, - -GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getYaw(), 0.0F, - 1.0F, 0.0F); - MethodHolder.rotateDeg(poseStack, -90.0F, 1.0F, 0.0F, 0.0F); - } else if (blockhitresult.getDirection() == Direction.WEST) { - MethodHolder.rotateDeg(poseStack, 90.0F, 0.0F, 1.0F, 0.0F); + this.applyVRModelView(dh.currentPass, poseStack); + + Vec3 vec32 = vec3.subtract(mc.getCameraEntity().position()); + poseStack.last().pose().translate((float) vec32.x, (float) vec32.y, (float) vec32.z); + + if (mc.hitResult instanceof BlockHitResult hit && mc.hitResult.getType() == Type.BLOCK) { + switch (hit.getDirection()) + { + case DOWN -> { + float ang1 = toRadians(dh.vrPlayer.vrdata_world_render.getController(0).getYaw()); + float ang2 = toRadians(-90.0F); + poseStack.last().pose().rotateY(ang1).rotateX(ang2); + poseStack.last().normal().rotateY(ang1).rotateX(ang2); + } + case UP -> + { + float ang1 = toRadians(-dh.vrPlayer.vrdata_world_render.getController(0).getYaw()); + float ang2 = toRadians(90.0F); + poseStack.last().pose().rotateY(ang1).rotateX(ang2); + poseStack.last().normal().rotateY(ang1).rotateX(ang2); + } + case WEST -> + { + float ang = toRadians(90.0F); + poseStack.last().pose().rotateY(ang); + poseStack.last().normal().rotateY(ang); + } + case EAST -> + { + float ang = toRadians(-90.0F); + poseStack.last().pose().rotateY(ang); + poseStack.last().normal().rotateY(ang); + } + case SOUTH -> + { + float ang = toRadians(180.0F); + poseStack.last().pose().rotateY(ang); + poseStack.last().normal().rotateY(ang); } } - } else { - MethodHolder.rotateDeg(poseStack, - -GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getYaw(), 0.0F, 1.0F, - 0.0F); - MethodHolder.rotateDeg(poseStack, - -GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getController(0).getPitch(), 1.0F, 0.0F, - 0.0F); + } + else + { + float ang1 = toRadians(-dh.vrPlayer.vrdata_world_render.getController(0).getYaw()); + float ang2 = toRadians(-dh.vrPlayer.vrdata_world_render.getController(0).getPitch()); + poseStack.last().pose() + .rotateY(ang1) + .rotateX(ang2); + poseStack.last().normal() + .rotateY(ang1) + .rotateX(ang2); } - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.crosshairScalesWithDistance) { + if (dh.vrSettings.crosshairScalesWithDistance) + { float f5 = 0.3F + 0.2F * f; f1 *= f5; } @@ -2258,24 +2378,23 @@ private void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseStack) { RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); // RenderSystem.disableLighting(); - RenderSystem.disableCull(); if (depthAlways) { - RenderSystem.depthFunc(519); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); } else { - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } - // boolean flag = Config.isShaders(); - boolean flag = false; + // boolean shadersMod = Config.isShaders(); + // boolean shadersMod = false; RenderSystem.enableBlend(); - RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, - GlStateManager.DestFactor.ZERO, GlStateManager.SourceFactor.ONE, - GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - int i = LevelRenderer.getLightColor(this.minecraft.level, BlockPos.containing(vec3)); + RenderSystem.blendFuncSeparate( + SourceFactor.ONE_MINUS_DST_COLOR, DestFactor.ZERO, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA + ); + int i = LevelRenderer.getLightColor(mc.level, BlockPos.containing(vec3)); float f2 = 1.0F; - if (this.minecraft.hitResult == null || this.minecraft.hitResult.getType() == HitResult.Type.MISS) { + if (mc.hitResult == null || mc.hitResult.getType() == Type.MISS) { f2 = 0.5F; } @@ -2301,21 +2420,20 @@ private void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseStack) { RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); - RenderSystem.enableCull(); - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); poseStack.popPose(); - this.minecraft.getProfiler().pop(); + mc.getProfiler().pop(); } } public boolean shouldOccludeGui() { - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getEye(GameRendererVRMixin.DATA_HOLDER.currentPass) + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass) .getPosition(); - if (GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA) { - return !this.isInMenuRoom() && this.minecraft.screen == null && !KeyboardHandler.Showing - && !RadialHandler.isShowing() && GameRendererVRMixin.DATA_HOLDER.vrSettings.hudOcclusion + if (dh.currentPass != RenderPass.THIRD + && dh.currentPass != RenderPass.CAMERA) { + return !this.isInMenuRoom() && mc.screen == null && !KeyboardHandler.isShowing() + && !RadialHandler.isShowing() && dh.vrSettings.hudOcclusion && !((ItemInHandRendererExtension) this.itemInHandRenderer).isInsideOpaqueBlock(vec3); } else { return true; @@ -2323,81 +2441,86 @@ public boolean shouldOccludeGui() { } private void renderVrShadow(float par1, boolean depthAlways, PoseStack poseStack) { - if (GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA) { - if (this.minecraft.player.isAlive()) { - if (!(((PlayerExtension) this.minecraft.player).getRoomYOffsetFromPose() < 0.0D)) { - if (this.minecraft.player.getVehicle() == null) { - this.minecraft.getProfiler().push("vr shadow"); - AABB aabb = this.minecraft.player.getBoundingBox(); - - if (GameRendererVRMixin.DATA_HOLDER.vrSettings.vrShowBlueCircleBuddy && aabb != null) { - - poseStack.pushPose(); - poseStack.setIdentity(); - RenderSystem.disableCull(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, poseStack); - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render - .getEye(GameRendererVRMixin.DATA_HOLDER.currentPass).getPosition(); - LocalPlayer localplayer = this.minecraft.player; - Vec3 vec31 = new Vec3(this.rvelastX + (this.rveX - this.rvelastX) * (double) par1, - this.rvelastY + (this.rveY - this.rvelastY) * (double) par1, - this.rvelastZ + (this.rveZ - this.rvelastZ) * (double) par1); - Vec3 vec32 = vec31.subtract(vec3).add(0.0D, 0.005D, 0.0D); - this.setupPolyRendering(true); - RenderSystem.enableDepthTest(); - - if (depthAlways) { - RenderSystem.depthFunc(519); - } else { - RenderSystem.depthFunc(515); - } - - RenderSystem.setShader(GameRenderer::getPositionColorShader); - this.minecraft.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); - RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); - this.renderFlatQuad(vec32, (float) (aabb.maxX - aabb.minX), (float) (aabb.maxZ - aabb.minZ), - 0.0F, 0, 0, 0, 64, poseStack); - RenderSystem.depthFunc(515); - this.setupPolyRendering(false); - poseStack.popPose(); - RenderSystem.enableCull(); - } - this.minecraft.getProfiler().pop(); - } + if (dh.currentPass != RenderPass.THIRD && dh.currentPass != RenderPass.CAMERA && mc.player.isAlive() && + !(((PlayerExtension) mc.player).getRoomYOffsetFromPose() < 0.0D) && + mc.player.getVehicle() == null + ) + { + mc.getProfiler().push("vr shadow"); + AABB aabb = mc.player.getBoundingBox(); + + if (dh.vrSettings.vrShowBlueCircleBuddy && aabb != null) + { + + poseStack.pushPose(); + poseStack.setIdentity(); + RenderSystem.disableCull(); + this.applyVRModelView(dh.currentPass, poseStack); + Vec3 vec3 = dh.vrPlayer.vrdata_world_render + .getEye(dh.currentPass).getPosition(); + Vec3 vec31 = new Vec3( + this.rvelastX + (this.rveX - this.rvelastX) * (double) par1, + this.rvelastY + (this.rveY - this.rvelastY) * (double) par1, + this.rvelastZ + (this.rveZ - this.rvelastZ) * (double) par1 + ); + Vec3 vec32 = vec31.subtract(vec3).add(0.0D, 0.005D, 0.0D); + this.setupPolyRendering(true); + RenderSystem.enableDepthTest(); + + if (depthAlways) + { + RenderSystem.depthFunc(GL11C.GL_ALWAYS); } + else + { + RenderSystem.depthFunc(GL11C.GL_LEQUAL); + } + + RenderSystem.setShader(GameRenderer::getPositionColorShader); + mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); + RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); + this.renderFlatQuad(vec32, (float) (aabb.maxX - aabb.minX), (float) (aabb.maxZ - aabb.minZ), + 0.0F, 0, 0, 0, 64, poseStack + ); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); + this.setupPolyRendering(false); + poseStack.popPose(); + RenderSystem.enableCull(); } + mc.getProfiler().pop(); } } - public boolean shouldRenderHands() { - if (GameRendererVRMixin.DATA_HOLDER.viewonly) { + public boolean shouldRenderHands() + { + if (dh.viewonly) { return false; - } else if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.THIRD) { - return GameRendererVRMixin.DATA_HOLDER.vrSettings.displayMirrorMode == VRSettings.MirrorMode.MIXED_REALITY; + } else if (dh.currentPass == RenderPass.THIRD) { + return dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY; } else { - return GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA; + return dh.currentPass != RenderPass.CAMERA; } } - private void renderVRSelfEffects(float par1) { - if (this.onfire && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.THIRD - && GameRendererVRMixin.DATA_HOLDER.currentPass != RenderPass.CAMERA) { + private void renderVRSelfEffects(float par1) + { + if (this.onfire && dh.currentPass != RenderPass.THIRD + && dh.currentPass != RenderPass.CAMERA) { this.renderFireInFirstPerson(); } this.renderItemActivationAnimation(0, 0, par1); } - private void renderFireInFirstPerson() { + private void renderFireInFirstPerson() + { PoseStack posestack = new PoseStack(); - this.applyVRModelView(GameRendererVRMixin.DATA_HOLDER.currentPass, posestack); - this.applystereo(GameRendererVRMixin.DATA_HOLDER.currentPass, posestack); + this.applyVRModelView(dh.currentPass, posestack); + this.applystereo(dh.currentPass, posestack); BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); - RenderSystem.depthFunc(519); + RenderSystem.depthFunc(GL11C.GL_ALWAYS); - if (GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.THIRD - || GameRendererVRMixin.DATA_HOLDER.currentPass == RenderPass.CAMERA) { - RenderSystem.depthFunc(515); + if (dh.currentPass == RenderPass.THIRD || dh.currentPass == RenderPass.CAMERA) { + RenderSystem.depthFunc(GL11C.GL_LEQUAL); } RenderSystem.enableBlend(); @@ -2418,21 +2541,20 @@ private void renderFireInFirstPerson() { float f4 = textureatlassprite.getV1(); float f5 = (f3 + f4) / 2.0F; float f6 = textureatlassprite.uvShrinkRatio(); - float f7 = Mth.lerp(f6, f, f2); - float f8 = Mth.lerp(f6, f1, f2); - float f9 = Mth.lerp(f6, f3, f5); - float f10 = Mth.lerp(f6, f4, f5); + float f7 = lerp(f, f2, f6); + float f8 = lerp(f1, f2, f6); + float f9 = lerp(f3, f5, f6); + float f10 = lerp(f4, f5, f6); float f11 = 1.0F; float f12 = 0.3F; - float f13 = (float) (GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getHeadPivot().y - - ((GameRendererExtension) this.minecraft.gameRenderer).getRveY()); + float f13 = (float) (dh.vrPlayer.vrdata_world_render.getHeadPivot().y + - ((GameRendererExtension) mc.gameRenderer).getRveY()); for (int i = 0; i < 4; ++i) { posestack.pushPose(); - posestack.mulPose(Axis.YP.rotationDegrees( - (float) i * 90.0F - GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getBodyYaw())); - posestack.translate(0.0D, (double) (-f13), 0.0D); - Matrix4f matrix4f = posestack.last().pose(); + float ang = toRadians(90.0F * i - dh.vrPlayer.vrdata_world_render.getBodyYaw()); + posestack.last().normal().rotateY(ang); + Matrix4f matrix4f = posestack.last().pose().rotateY(ang).translate(0.0F, -f13, 0.0F); bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); bufferbuilder.vertex(matrix4f, -f12, 0.0F, -f12).uv(f8, f10).color(1.0F, 1.0F, 1.0F, 0.9F).endVertex(); bufferbuilder.vertex(matrix4f, f12, 0.0F, -f12).uv(f7, f10).color(1.0F, 1.0F, 1.0F, 0.9F).endVertex(); @@ -2443,21 +2565,23 @@ private void renderFireInFirstPerson() { posestack.popPose(); } - RenderSystem.depthFunc(515); + RenderSystem.depthFunc(GL11C.GL_LEQUAL); RenderSystem.disableBlend(); } - public void applystereo(RenderPass currentPass, PoseStack matrix) { + public void applystereo(RenderPass currentPass, PoseStack matrix) + { if (currentPass == RenderPass.LEFT || currentPass == RenderPass.RIGHT) { - Vec3 vec3 = GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition() - .subtract(GameRendererVRMixin.DATA_HOLDER.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER) + Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition() + .subtract(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER) .getPosition()); - matrix.translate((double) ((float) (-vec3.x)), (double) ((float) (-vec3.y)), (double) ((float) (-vec3.z))); + matrix.last().pose().translate((float) -vec3.x, (float) -vec3.y, (float) -vec3.z); } } @Override - public void restoreRVEPos(LivingEntity e) { + public void restoreRVEPos(LivingEntity e) + { if (e != null) { e.setPosRaw(this.rveX, this.rveY, this.rveZ); e.xOld = this.rvelastX; @@ -2478,18 +2602,19 @@ public void restoreRVEPos(LivingEntity e) { } @Override - public void DrawScopeFB(PoseStack matrixStackIn, int i) { - if (ClientDataHolderVR.getInstance().currentPass != RenderPass.SCOPEL && ClientDataHolderVR.getInstance().currentPass != RenderPass.SCOPER) { + public void DrawScopeFB(PoseStack matrixStackIn, int i) + { + if (dh.currentPass != RenderPass.SCOPEL && dh.currentPass != RenderPass.SCOPER) { //this.lightTexture.turnOffLightLayer(); matrixStackIn.pushPose(); RenderSystem.enableDepthTest(); if (i == 0) { - ClientDataHolderVR.getInstance().vrRenderer.telescopeFramebufferR.bindRead(); - RenderSystem.setShaderTexture(0, ClientDataHolderVR.getInstance().vrRenderer.telescopeFramebufferR.getColorTextureId()); + dh.vrRenderer.telescopeFramebufferR.bindRead(); + RenderSystem.setShaderTexture(0, dh.vrRenderer.telescopeFramebufferR.getColorTextureId()); } else { - ClientDataHolderVR.getInstance().vrRenderer.telescopeFramebufferL.bindRead(); - RenderSystem.setShaderTexture(0, ClientDataHolderVR.getInstance().vrRenderer.telescopeFramebufferL.getColorTextureId()); + dh.vrRenderer.telescopeFramebufferL.bindRead(); + RenderSystem.setShaderTexture(0, dh.vrRenderer.telescopeFramebufferL.getColorTextureId()); } float scale = 0.0785F; @@ -2500,12 +2625,12 @@ public void DrawScopeFB(PoseStack matrixStackIn, int i) { RenderSystem.setShaderTexture(0, new ResourceLocation("textures/misc/spyglass_scope.png")); RenderSystem.enableBlend(); - matrixStackIn.translate(0.0D, 0.0D, 0.00001D); - int light = LevelRenderer.getLightColor(this.minecraft.level, BlockPos.containing(ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getController(i).getPosition())); + matrixStackIn.last().pose().translate(0.0F, 0.0F, 0.00001F); + int light = LevelRenderer.getLightColor(mc.level, BlockPos.containing(dh.vrPlayer.vrdata_world_render.getController(i).getPosition())); this.drawSizedQuadWithLightmap(720.0F, 720.0F, scale, light, matrixStackIn.last().pose()); matrixStackIn.popPose(); this.lightTexture.turnOnLightLayer(); } } -} \ No newline at end of file +} diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java index 425c2b528..a359a0e17 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java @@ -1,49 +1,53 @@ package org.vivecraft.mixin.client_vr.renderer; -import java.util.Optional; -import java.util.stream.Stream; - -import com.mojang.math.Axis; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.extensions.EntityRenderDispatcherVRExtension; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; +import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.render.VRArmRenderer; +import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; +import org.vivecraft.client_vr.render.VivecraftItemRendering; +import org.vivecraft.client_vr.render.VivecraftItemRendering.VivecraftItemTransformType; + +import org.apache.commons.lang3.tuple.Triple; + import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; + +import net.minecraft.client.Minecraft; import net.minecraft.client.player.AbstractClientPlayer; -import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.util.Mth; +import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.*; -import org.apache.commons.lang3.tuple.Triple; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemInHandRenderer; -import net.minecraft.core.BlockPos; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; + +import java.util.Optional; +import java.util.stream.Stream; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + +import static org.joml.Math.*; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.gameplay.trackers.BowTracker; -import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.render.VRArmRenderer; -import org.vivecraft.client_vr.render.VRFirstPersonArmSwing; -import org.vivecraft.client_vr.render.VivecraftItemRendering; -import org.vivecraft.client_vr.VRState; @Mixin(value = ItemInHandRenderer.class, priority = 999) public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExtension { @@ -54,7 +58,6 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt @Final @Shadow private Minecraft minecraft; - ClientDataHolderVR dh = ClientDataHolderVR.getInstance(); @Final @Shadow private EntityRenderDispatcher entityRenderDispatcher; @@ -88,16 +91,16 @@ public Triple getNearOpaqueBlock(Vec3 in, double di @Inject(at = @At("HEAD"), method = "renderPlayerArm", cancellable = true) public void overrideArm(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, float g, HumanoidArm humanoidArm, CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } - vrPlayerArm(poseStack, multiBufferSource, i, f, g, humanoidArm); + this.vrPlayerArm(poseStack, multiBufferSource, i, f, g, humanoidArm); ci.cancel(); } @Inject(at = @At("HEAD"), method = "renderArmWithItem", cancellable = true) public void overrideArmItem(AbstractClientPlayer abstractClientPlayer, float f, float g, InteractionHand interactionHand, float h, ItemStack itemStack, float i, PoseStack poseStack, MultiBufferSource multiBufferSource, int j, CallbackInfo ci) { - if (!VRState.vrRunning) { + if (!vrRunning) { return; } this.vrRenderArmWithItem(abstractClientPlayer, f, g, interactionHand, h, itemStack, i, poseStack, multiBufferSource, j); @@ -119,41 +122,28 @@ public void vrRenderArmWithItem(AbstractClientPlayer pPlayer, float pPartialTick HumanoidArm humanoidarm = mainHand ? pPlayer.getMainArm() : pPlayer.getMainArm().getOpposite(); pEquippedProgress = this.getEquipProgress(pHand, pPartialTicks); pMatrixStack.pushPose(); - boolean renderArm = true; - - if (dh.currentPass == RenderPass.THIRD && !dh.vrSettings.mixedRealityRenderHands) - { - renderArm = false; - } - if (dh.currentPass == RenderPass.CAMERA) - { - renderArm = false; - } - - if (BowTracker.isBow(pStack) && dh.bowTracker.isActive((LocalPlayer)pPlayer)) - { - renderArm = false; - } - - if (TelescopeTracker.isTelescope(pStack) && (pHand == InteractionHand.OFF_HAND && dh.currentPass == RenderPass.SCOPEL || pHand == InteractionHand.MAIN_HAND && dh.currentPass == RenderPass.SCOPER)) - { - renderArm = false; - } - - if (renderArm && !pPlayer.isInvisible()) + if (!(dh.bowTracker.isActive(pHand)) && !pPlayer.isInvisible() && switch (dh.currentPass) + { + case THIRD -> { yield dh.vrSettings.mixedRealityRenderHands; } + case CAMERA -> { yield false; } + case SCOPEL -> { yield !(TelescopeTracker.isTelescope(pStack) && !mainHand); } + case SCOPER -> { yield !(TelescopeTracker.isTelescope(pStack) && mainHand); } + default -> { yield true; } + } + ) { this.renderPlayerArm(pMatrixStack, pBuffer, pCombinedLight, pEquippedProgress, pSwingProgress, humanoidarm); } if (!pStack.isEmpty()) - { - pMatrixStack.pushPose(); + { + pMatrixStack.pushPose(); if (pPlayer.swingingArm == pHand) this.transformFirstPersonVR(pMatrixStack, humanoidarm, pSwingProgress); - VivecraftItemRendering.VivecraftItemTransformType rendertype = VivecraftItemRendering.getTransformType(pStack, pPlayer, itemRenderer); + VivecraftItemTransformType rendertype = VivecraftItemRendering.getTransformType(pStack, pPlayer, this.itemRenderer); boolean useLeftHandModelinLeftHand = false; @@ -170,28 +160,32 @@ public void vrRenderArmWithItem(AbstractClientPlayer pPlayer, float pPartialTick dh.isfphand = true; - if (rendertype == VivecraftItemRendering.VivecraftItemTransformType.Map) + if (rendertype == VivecraftItemTransformType.Map) { RenderSystem.disableCull(); this.renderMap(pMatrixStack, pBuffer, pCombinedLight, pStack); } - else if (rendertype == VivecraftItemRendering.VivecraftItemTransformType.Telescope) + else if (rendertype == VivecraftItemTransformType.Telescope) { if (dh.currentPass != RenderPass.SCOPEL && dh.currentPass != RenderPass.SCOPER) { pMatrixStack.pushPose(); pMatrixStack.scale(0.625F, 0.625F, 0.625F); - pMatrixStack.translate(mainHand ? -0.53D : -0.47D, -0.5D, -0.6D); - //pMatrixStack.mulPose(Axis.XP.rotationDegrees(180.0F)); - this.minecraft.getBlockRenderer().getModelRenderer().renderModel(pMatrixStack.last(), pBuffer.getBuffer(Sheets.solidBlockSheet()), (BlockState)null, this.minecraft.getModelManager().getModel(TelescopeTracker.scopeModel), 0.5F, 0.5F, 1.0F, pCombinedLight, OverlayTexture.NO_OVERLAY); + pMatrixStack.last().pose().translate(mainHand ? -0.53F : -0.47F, -0.5F, -0.6F); + //pMatrixStack.last().pose().rotateX(toRadians(180.0F)); + //pMatrixStack.last().normal().rotateX(toRadians(180.0F)); + this.minecraft.getBlockRenderer().getModelRenderer().renderModel(pMatrixStack.last(), pBuffer.getBuffer(Sheets.solidBlockSheet()), null, this.minecraft.getModelManager().getModel(TelescopeTracker.scopeModel), 0.5F, 0.5F, 1.0F, pCombinedLight, OverlayTexture.NO_OVERLAY); pMatrixStack.popPose(); } + float ang1 = toRadians(90.0F); + float ang2 = toRadians(180.0F); + pMatrixStack.pushPose(); - pMatrixStack.translate(mainHand ? -0.01875D : 0.01875D, 0.215D, -0.0626D); - pMatrixStack.mulPose(Axis.XP.rotationDegrees(90.0F)); - pMatrixStack.mulPose(Axis.YP.rotationDegrees(180.0F)); - pMatrixStack.mulPose(Axis.ZP.rotationDegrees(180.0F)); + pMatrixStack.last().pose() + .translate(mainHand ? -0.01875F : 0.01875F, 0.215F, -0.0626F) + .rotateXYZ(ang1, ang2, ang2); + pMatrixStack.last().normal().rotateXYZ(ang1, ang2, ang2); ((GameRendererExtension)this.minecraft.gameRenderer).DrawScopeFB(pMatrixStack, pHand == InteractionHand.MAIN_HAND ? 0 : 1); pMatrixStack.popPose(); } @@ -227,7 +221,7 @@ public void vrPlayerArm(PoseStack poseStack, MultiBufferSource multiBufferSource float h = flag ? 1.0F : -1.0F; AbstractClientPlayer abstractclientplayer = this.minecraft.player; RenderSystem.setShaderTexture(0, abstractclientplayer.getSkinTextureLocation()); - VRArmRenderer vrarmrenderer = ((EntityRenderDispatcherVRExtension)entityRenderDispatcher).getArmSkinMap().get(abstractclientplayer.getModelName()); + VRArmRenderer vrarmrenderer = ((EntityRenderDispatcherVRExtension)this.entityRenderDispatcher).getArmSkinMap().get(abstractclientplayer.getModelName()); poseStack.pushPose(); if (abstractclientplayer.swingingArm == InteractionHand.MAIN_HAND && flag) { @@ -239,7 +233,7 @@ public void vrPlayerArm(PoseStack poseStack, MultiBufferSource multiBufferSource } poseStack.scale(0.4f, 0.4F, 0.4F); - boolean slim = abstractclientplayer.getModelName().equals("slim"); + boolean slim = "slim".equals(abstractclientplayer.getModelName()); /* x offset: (arm x origin + arm x offset + arm x dimension * 0.5) / 16 @@ -251,10 +245,17 @@ public void vrPlayerArm(PoseStack poseStack, MultiBufferSource multiBufferSource x offset: (5 - 1 + 4*0.5) / 16 = 0.375 z offset: (-2 + 2 + 12) / 16 = 0.75 */ + float ang1 = toRadians(-90); + float ang2 = toRadians(180); + + poseStack.last().pose() + .translate((slim ? -0.34375F : -0.375F) * h, 0.0F, slim ? 0.78125F : 0.75F) + .rotateX(ang1) + .rotateY(ang2); + poseStack.last().normal() + .rotateX(ang1) + .rotateY(ang2); - poseStack.translate((slim ? -0.34375F : -0.375F) * h, 0.0F, slim ? 0.78125F : 0.75F); - poseStack.mulPose(Axis.XP.rotationDegrees(-90)); - poseStack.mulPose(Axis.YP.rotationDegrees(180)); if (flag) { vrarmrenderer.renderRightHand(poseStack, multiBufferSource, i, abstractclientplayer); } @@ -271,36 +272,44 @@ public void setSwingType(VRFirstPersonArmSwing interact) { private void transformFirstPersonVR(PoseStack matrixStackIn, HumanoidArm hand, float swingProgress) { if (swingProgress != 0.0F) { - switch (this.swingType) { - case Attack: - float f2 = Mth.sin((float)((double)(swingProgress * 3.0F) * Math.PI)); - if ((double)swingProgress > 0.5D) + switch (this.swingType) + { + case Attack -> + { + float f2 = sin((swingProgress * 3.0F) * (float)PI); + if (swingProgress > 0.5F) { - f2 = Mth.sin((float)((double)swingProgress * Math.PI + Math.PI)); + f2 = sin((swingProgress * (float)PI + (float)PI)); } - - matrixStackIn.translate(0.0D, 0.0D, (double)0.2F); - matrixStackIn.mulPose(Axis.XP.rotationDegrees(f2 * 30.0F)); - matrixStackIn.translate(0.0D, 0.0D, (double) - 0.2F); - break; - - case Interact: - float f1 = Mth.sin((float)((double)(swingProgress * 3.0F) * Math.PI)); - - if ((double)swingProgress > 0.5D) { - f1 = Mth.sin((float)((double)swingProgress * Math.PI + Math.PI)); + f2 *= 30.0F; + f2 = toRadians(f2); + matrixStackIn.last().pose() + .translate(0.0F, 0.0F, 0.2F) + .rotateX(f2) + .translate(0.0F, 0.0F, -0.2F); + matrixStackIn.last().normal().rotateX(f2); + } + case Interact -> + { + float f1 = sin((swingProgress * 3.0F) * (float)PI); + if (swingProgress > 0.5F) + { + f1 = sin(swingProgress * (float)PI + (float)PI); } - - matrixStackIn.mulPose(Axis.ZP.rotationDegrees((float)(hand == HumanoidArm.RIGHT ? -1 : 1) * f1 * 45.0F)); - break; - - case Use: - float f = Mth.sin((float)((double)(swingProgress * 2.0F) * Math.PI)); - - if ((double)swingProgress > 0.25D) { - f = Mth.sin((float) ((double) (swingProgress / 2.0F) * Math.PI + Math.PI)); + f1 *= hand == HumanoidArm.RIGHT ? -45.0F : 45.0F; + f1 = toRadians(f1); + matrixStackIn.last().pose().rotateZ(f1); + matrixStackIn.last().normal().rotateZ(f1); + } + case Use -> + { + float f = sin((swingProgress * 2.0F) * (float)PI); + if (swingProgress > 0.25F) + { + f = sin((swingProgress / 2.0F) * (float)PI + (float)PI); } - matrixStackIn.translate(0.0D, 0.0D, (double)(-(1.0F + f) * 0.1F)); + matrixStackIn.last().pose().translate(0.0F, 0.0F, -(1.0F + f) * 0.1F); + } } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java index 4090b4593..b182dce0f 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemPropertiesVRMixin.java @@ -1,25 +1,26 @@ package org.vivecraft.mixin.client_vr.renderer; -import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; + +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; -@Mixin(ItemProperties.class) +@Mixin(net.minecraft.client.renderer.item.ItemProperties.class) public class ItemPropertiesVRMixin { @Group(name = "disableGoatHornAnimation", min = 1, max = 1) @Inject(at = @At("HEAD"), method = "method_43611" // fabric , remap = false, cancellable = true, expect = 0) private static void noHornUseAnimFabric(ItemStack itemStack, ClientLevel clientLevel, LivingEntity livingEntity, int i, CallbackInfoReturnable cir){ - if (VRState.vrRunning && livingEntity == Minecraft.getInstance().player) { + if (vrRunning && livingEntity == mc.player) { cir.setReturnValue(0.0F); } } @@ -28,7 +29,7 @@ private static void noHornUseAnimFabric(ItemStack itemStack, ClientLevel clientL @Inject(at = @At("HEAD"), method = "m_234977_" // forge , remap = false, cancellable = true, expect = 0) private static void noHornUseAnimForge(ItemStack itemStack, ClientLevel clientLevel, LivingEntity livingEntity, int i, CallbackInfoReturnable cir){ - if (VRState.vrRunning && livingEntity == Minecraft.getInstance().player) { + if (vrRunning && livingEntity == mc.player) { cir.setReturnValue(0.0F); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java index 8b4b0fda5..00e151df9 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java @@ -1,40 +1,45 @@ package org.vivecraft.mixin.client_vr.renderer; -import net.minecraft.server.packs.resources.ResourceManager; -import org.joml.Matrix4f; -import org.spongepowered.asm.mixin.injection.*; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.mod_compat_vr.ShadersHelper; -import org.vivecraft.client_xr.render_pass.RenderPassManager; -import org.vivecraft.client_xr.render_pass.RenderPassType; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.extensions.LevelRendererExtension; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.settings.VRSettings.ShaderGUIRender; +import org.vivecraft.client_xr.render_pass.RenderPassManager; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.mod_compat_vr.ShadersHelper; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; + +import org.joml.Matrix4f; + import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.*; import net.minecraft.core.BlockPos; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.lighting.LevelLightEngine; -import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.settings.VRSettings; -import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; import javax.annotation.Nullable; +import static org.vivecraft.client_vr.VRState.*; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + // priority 999 to inject before iris, for the vrFast rendering @Mixin(value = LevelRenderer.class, priority = 999) public abstract class LevelRendererVRMixin implements ResourceManagerReloadListener, AutoCloseable, LevelRendererExtension { @@ -58,9 +63,6 @@ public abstract class LevelRendererVRMixin implements ResourceManagerReloadListe @Unique private Entity capturedEntity; - @Final - @Shadow - private Minecraft minecraft; @Shadow private ClientLevel level; @Shadow @@ -101,32 +103,32 @@ public Entity getRenderedEntity() { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 0), method = "renderSnowAndRain") public double rainX(double x) { - if (!RenderPassType.isVanilla() && (ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT || ClientDataHolderVR.getInstance().currentPass == RenderPass.RIGHT)) { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().x; + if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().x; } return x; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 1), method = "renderSnowAndRain") public double rainY(double y) { - if (!RenderPassType.isVanilla() && (ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT || ClientDataHolderVR.getInstance().currentPass == RenderPass.RIGHT)) { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().y; + if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().y; } return y; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 2), method = "renderSnowAndRain") public double rainZ(double z) { - if (!RenderPassType.isVanilla() && (ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT || ClientDataHolderVR.getInstance().currentPass == RenderPass.RIGHT)) { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().z; + if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().z; } return z; } @Inject(at = @At("TAIL"), method = "onResourceManagerReload") public void reinitVR(ResourceManager resourceManager, CallbackInfo ci) { - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("Resource Reload"); + if (vrInitialized) { + dh.vrRenderer.reinitFrameBuffers("Resource Reload"); } } @@ -136,14 +138,14 @@ public void reinitVR(ResourceManager resourceManager, CallbackInfo ci) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;pollLightUpdates()V"), method = "renderLevel") public void onePollLightUpdates(ClientLevel instance) { - if (RenderPassType.isVanilla() || ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT) { + if (RenderPassType.isVanilla() || dh.currentPass == RenderPass.LEFT) { instance.pollLightUpdates(); } } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"), method = "renderLevel") public int oneLightingUpdates(LevelLightEngine instance) { - if (RenderPassType.isVanilla() || ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT) { + if (RenderPassType.isVanilla() || dh.currentPass == RenderPass.LEFT) { instance.runLightUpdates(); } if (!RenderPassType.isVanilla()) { @@ -160,7 +162,7 @@ public int oneLightingUpdates(LevelLightEngine instance) { method = "renderLevel(Lcom/mojang/blaze3d/vertex/PoseStack;FJZLnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/GameRenderer;Lnet/minecraft/client/renderer/LightTexture;Lorg/joml/Matrix4f;)V ") public void stencil(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo info) { if (!RenderPassType.isVanilla()) { - this.minecraft.getProfiler().popPush("stencil"); + mc.getProfiler().popPush("stencil"); ((GameRendererExtension) gameRenderer).drawEyeStencil(false); } } @@ -178,17 +180,17 @@ public boolean noPlayerWhenSleeping(LivingEntity instance) { @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", ordinal = 0), method = "renderLevel") public Entity captureEntityRestoreLoc(Entity entity, PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer) { this.capturedEntity = entity; - if (!RenderPassType.isVanilla() && capturedEntity == camera.getEntity()) { - ((GameRendererExtension) gameRenderer).restoreRVEPos((LivingEntity) capturedEntity); + if (!RenderPassType.isVanilla() && this.capturedEntity == camera.getEntity()) { + ((GameRendererExtension) gameRenderer).restoreRVEPos((LivingEntity) this.capturedEntity); } - this.renderedEntity = capturedEntity; + this.renderedEntity = this.capturedEntity; return entity; } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", shift = Shift.AFTER), method = "renderLevel") public void restoreLoc2(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci) { - if (!RenderPassType.isVanilla() && capturedEntity == camera.getEntity()) { - ((GameRendererExtension) gameRenderer).cacheRVEPos((LivingEntity) capturedEntity); + if (!RenderPassType.isVanilla() && this.capturedEntity == camera.getEntity()) { + ((GameRendererExtension) gameRenderer).cacheRVEPos((LivingEntity) this.capturedEntity); ((GameRendererExtension) gameRenderer).setupRVE(); } this.renderedEntity = null; @@ -198,19 +200,16 @@ public void restoreLoc2(PoseStack poseStack, float f, long l, boolean bl, Camera public void interactOutline(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci) { if (!RenderPassType.isVanilla()) { this.level.getProfiler().popPush("interact outline"); - selR = selG = selB = 1f; - Vec3 vec3 = camera.getPosition(); - double d = vec3.x(); - double e = vec3.y(); - double g = vec3.z(); + this.selR = this.selG = this.selB = 1.0f; + net.minecraft.world.phys.Vec3 vec3 = camera.getPosition(); if (OptifineHelper.isOptifineLoaded() && OptifineHelper.isShaderActive()) { OptifineHelper.beginOutlineShader(); } for (int c = 0; c < 2; c++) { - if (ClientDataHolderVR.getInstance().interactTracker.isInteractActive(c) && (ClientDataHolderVR.getInstance().interactTracker.inBlockHit[c] != null || ClientDataHolderVR.getInstance().interactTracker.bukkit[c])) { - BlockPos blockpos = ClientDataHolderVR.getInstance().interactTracker.inBlockHit[c] != null ? ClientDataHolderVR.getInstance().interactTracker.inBlockHit[c].getBlockPos() : BlockPos.containing(ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getController(c).getPosition()); + if (dh.interactTracker.isInteractActive(c) && (dh.interactTracker.inBlockHit[c] != null || dh.interactTracker.bukkit[c])) { + BlockPos blockpos = dh.interactTracker.inBlockHit[c] != null ? dh.interactTracker.inBlockHit[c].getBlockPos() : BlockPos.containing(dh.vrPlayer.vrdata_world_render.getController(c).getPosition()); BlockState blockstate = this.level.getBlockState(blockpos); - this.renderHitOutline(poseStack, this.renderBuffers.bufferSource().getBuffer(RenderType.lines()), camera.getEntity(), d, e, g, blockpos, blockstate); + this.renderHitOutline(poseStack, this.renderBuffers.bufferSource().getBuffer(RenderType.lines()), camera.getEntity(), vec3.x, vec3.y, vec3.z, blockpos, blockstate); } } if (OptifineHelper.isOptifineLoaded() && OptifineHelper.isShaderActive()) { @@ -218,26 +217,26 @@ public void interactOutline(PoseStack poseStack, float f, long l, boolean bl, Ca OptifineHelper.endOutlineShader(); } // reset outline color - selR = selG = selB = 0f; + this.selR = this.selG = this.selB = 0.0f; } } @ModifyVariable(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;hitResult:Lnet/minecraft/world/phys/HitResult;", ordinal = 1), method = "renderLevel", ordinal = 0, argsOnly = true) public boolean noBlockoutlineOnInteract(boolean renderBlockOutline) { // don't draw the block outline when the interaction outline is active - return renderBlockOutline && (RenderPassType.isVanilla() || !(ClientDataHolderVR.getInstance().interactTracker.isInteractActive(0) && (ClientDataHolderVR.getInstance().interactTracker.inBlockHit[0] != null || ClientDataHolderVR.getInstance().interactTracker.bukkit[0]))); + return renderBlockOutline && (RenderPassType.isVanilla() || !(dh.interactTracker.isInteractActive(0) && (dh.interactTracker.inBlockHit[0] != null || dh.interactTracker.bukkit[0]))); } @Unique - private boolean menuHandleft; + private boolean menuHandLeft; @Unique - private boolean menuhandright; + private boolean menuHandRight; @Unique private boolean guiRendered = false; @Inject(at = @At("HEAD"), method = "renderLevel") public void resetGuiRendered(PoseStack poseStack, float f, long l, boolean bl, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f matrix4f, CallbackInfo ci) { - guiRendered = false; + this.guiRendered = false; } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;endBatch()V", ordinal = 0, shift = Shift.AFTER), method = "renderLevel") @@ -245,17 +244,17 @@ public void renderVrStuffPart1(PoseStack poseStack, float f, long l, boolean bl, if (RenderPassType.isVanilla()) { return; } - menuHandleft = ((GameRendererExtension) gameRenderer).isInMenuRoom() || this.minecraft.screen != null || KeyboardHandler.Showing; - menuhandright = menuHandleft || ClientDataHolderVR.getInstance().interactTracker.hotbar >= 0 && ClientDataHolderVR.getInstance().vrSettings.vrTouchHotbar; + this.menuHandLeft = ((GameRendererExtension) gameRenderer).isInMenuRoom() || mc.screen != null || KeyboardHandler.isShowing(); + this.menuHandRight = this.menuHandLeft || dh.interactTracker.hotbar >= 0 && dh.vrSettings.vrTouchHotbar; - if (transparencyChain != null) { - ((GameRendererExtension) gameRenderer).renderVRFabulous(f, (LevelRenderer) (Object) this, menuhandright, menuHandleft, poseStack); + if (this.transparencyChain != null) { + ((GameRendererExtension) gameRenderer).renderVRFabulous(f, (LevelRenderer) (Object) this, this.menuHandRight, this.menuHandLeft, poseStack); } else { - ((GameRendererExtension) gameRenderer).renderVrFast(f, false, menuhandright, menuHandleft, poseStack); - if (ShadersHelper.isShaderActive() && ClientDataHolderVR.getInstance().vrSettings.shaderGUIRender == VRSettings.ShaderGUIRender.BEFORE_TRANSLUCENT_SOLID) { + ((GameRendererExtension) gameRenderer).renderVrFast(f, false, this.menuHandRight, this.menuHandLeft, poseStack); + if (ShadersHelper.isShaderActive() && dh.vrSettings.shaderGUIRender == ShaderGUIRender.BEFORE_TRANSLUCENT_SOLID) { // shaders active, and render gui before translucents - ((GameRendererExtension) gameRenderer).renderVrFast(f, true, menuhandright, menuHandleft, poseStack); - guiRendered = true; + ((GameRendererExtension) gameRenderer).renderVrFast(f, true, this.menuHandRight, this.menuHandLeft, poseStack); + this.guiRendered = true; } } } @@ -267,10 +266,10 @@ public void renderVrStuffPart2(PoseStack poseStack, float f, long l, boolean bl, return; } - if (transparencyChain == null && (!ShadersHelper.isShaderActive() || ClientDataHolderVR.getInstance().vrSettings.shaderGUIRender == VRSettings.ShaderGUIRender.AFTER_TRANSLUCENT)) { + if (this.transparencyChain == null && (!ShadersHelper.isShaderActive() || dh.vrSettings.shaderGUIRender == ShaderGUIRender.AFTER_TRANSLUCENT)) { // no shaders, or shaders, and gui after translucents - ((GameRendererExtension) gameRenderer).renderVrFast(f, true, menuhandright, menuHandleft, poseStack); - guiRendered = true; + ((GameRendererExtension) gameRenderer).renderVrFast(f, true, this.menuHandRight, this.menuHandLeft, poseStack); + this.guiRendered = true; } } @@ -282,9 +281,9 @@ public void renderVrStuffFinal(PoseStack poseStack, float f, long l, boolean bl, return; } - if (!guiRendered && transparencyChain == null) { - ((GameRendererExtension) gameRenderer).renderVrFast(f, true, menuhandright, menuHandleft, poseStack); - guiRendered = true; + if (!this.guiRendered && this.transparencyChain == null) { + ((GameRendererExtension) gameRenderer).renderVrFast(f, true, this.menuHandRight, this.menuHandLeft, poseStack); + this.guiRendered = true; } } @@ -295,7 +294,7 @@ public void colorHitBox(PoseStack poseStack, VertexConsumer vertexConsumer, Voxe @Inject(at = @At("HEAD"), method = "levelEvent") public void shakeOnSound(int i, BlockPos blockPos, int j, CallbackInfo ci) { - boolean playerNearAndVR = VRState.vrRunning && this.minecraft.player != null && this.minecraft.player.isAlive() && this.minecraft.player.blockPosition().distSqr(blockPos) < 25.0D; + boolean playerNearAndVR = vrRunning && mc.player != null && mc.player.isAlive() && mc.player.blockPosition().distSqr(blockPos) < 25.0D; if (playerNearAndVR) { switch (i) { /* pre 1.19.4, they are now separate @@ -304,20 +303,20 @@ public void shakeOnSound(int i, BlockPos blockPos, int j, CallbackInfo ci) { 1013, // WOODEN_TRAPDOOR_CLOSE 1014, // FENCE_GATE_CLOSE 1036 // IRON_TRAPDOOR_CLOSE - -> ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 250); + -> VRState.dh.vr.triggerHapticPulse(0, 250); */ case 1019, // ZOMBIE_ATTACK_WOODEN_DOOR 1020, // ZOMBIE_ATTACK_IRON_DOOR 1021 // ZOMBIE_BREAK_WOODEN_DOOR -> { - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 750); - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(1, 750); + dh.vr.triggerHapticPulse(0, 750); + dh.vr.triggerHapticPulse(1, 750); } case 1030 -> // ANVIL_USE - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 500); + dh.vr.triggerHapticPulse(0, 500); case 1031 -> { // ANVIL_LAND - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 1250); - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(1, 1250); + dh.vr.triggerHapticPulse(0, 1250); + dh.vr.triggerHapticPulse(1, 1250); } } } @@ -325,20 +324,20 @@ public void shakeOnSound(int i, BlockPos blockPos, int j, CallbackInfo ci) { @Inject(at = @At("HEAD"), method = {"initOutline", "initTransparency"}) public void restorePostChain(CallbackInfo ci){ - if (VRState.vrInitialized) { - restoreVanillaPostChains(); - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("Outline/Transparency shaders Reloaded"); + if (vrInitialized) { + this.restoreVanillaPostChains(); + dh.vrRenderer.reinitFrameBuffers("Outline/Transparency shaders Reloaded"); } } @Inject(at = @At("TAIL"), method = "initOutline") public void captureOutlineChain(CallbackInfo ci){ - RenderPassManager.INSTANCE.vanillaOutlineChain = entityEffect; + RenderPassManager.INSTANCE.vanillaOutlineChain = this.entityEffect; } @Inject(at = @At("TAIL"), method = "initTransparency") public void captureTransparencyChain(CallbackInfo ci){ - RenderPassManager.INSTANCE.vanillaTransparencyChain = transparencyChain; + RenderPassManager.INSTANCE.vanillaTransparencyChain = this.transparencyChain; } @Inject(at = @At("TAIL"), method = "deinitTransparency") public void removeTransparencyChain(CallbackInfo ci){ @@ -353,14 +352,14 @@ public void removePostChains(CallbackInfo ci){ @Override public void restoreVanillaPostChains(){ - transparencyChain = RenderPassManager.INSTANCE.vanillaTransparencyChain; - - if (transparencyChain != null) { - this.translucentTarget = transparencyChain.getTempTarget("translucent"); - this.itemEntityTarget = transparencyChain.getTempTarget("itemEntity"); - this.particlesTarget = transparencyChain.getTempTarget("particles"); - this.weatherTarget = transparencyChain.getTempTarget("weather"); - this.cloudsTarget = transparencyChain.getTempTarget("clouds"); + this.transparencyChain = RenderPassManager.INSTANCE.vanillaTransparencyChain; + + if (this.transparencyChain != null) { + this.translucentTarget = this.transparencyChain.getTempTarget("translucent"); + this.itemEntityTarget = this.transparencyChain.getTempTarget("itemEntity"); + this.particlesTarget = this.transparencyChain.getTempTarget("particles"); + this.weatherTarget = this.transparencyChain.getTempTarget("weather"); + this.cloudsTarget = this.transparencyChain.getTempTarget("clouds"); } else { this.translucentTarget = null; this.itemEntityTarget = null; @@ -369,9 +368,9 @@ public void restoreVanillaPostChains(){ this.cloudsTarget = null; } - entityEffect = RenderPassManager.INSTANCE.vanillaOutlineChain; - if (entityEffect != null) { - this.entityTarget = entityEffect.getTempTarget("final"); + this.entityEffect = RenderPassManager.INSTANCE.vanillaOutlineChain; + if (this.entityEffect != null) { + this.entityTarget = this.entityEffect.getTempTarget("final"); } else { this.entityTarget = null; } @@ -415,16 +414,16 @@ public void setShaderGroup() { @Override public RenderTarget getAlphaSortVROccludedFramebuffer() { - return alphaSortVROccludedFramebuffer; + return this.alphaSortVROccludedFramebuffer; } @Override public RenderTarget getAlphaSortVRUnoccludedFramebuffer() { - return alphaSortVRUnoccludedFramebuffer; + return this.alphaSortVRUnoccludedFramebuffer; } @Override public RenderTarget getAlphaSortVRHandsFramebuffer() { - return alphaSortVRHandsFramebuffer; + return this.alphaSortVRHandsFramebuffer; } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java index 1f51cec3c..5bf1872a5 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java @@ -1,22 +1,25 @@ package org.vivecraft.mixin.client_vr.renderer; -import org.spongepowered.asm.mixin.Final; -import org.vivecraft.client_vr.VRState; import org.vivecraft.mixin.client.blaze3d.RenderSystemAccessor; + import net.minecraft.client.Camera; -import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.culling.Frustum; + +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.vivecraft.client_vr.VRState.vrRunning; + +import org.spongepowered.asm.mixin.Final; 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.At.Shift; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyConstant; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.concurrent.atomic.AtomicBoolean; - -@Mixin(LevelRenderer.class) +@Mixin(net.minecraft.client.renderer.LevelRenderer.class) public class NoSodiumLevelRendererVRMixin { @Shadow @@ -26,12 +29,12 @@ public class NoSodiumLevelRendererVRMixin { @Final private AtomicBoolean needsFrustumUpdate; - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;needsFullRenderChunkUpdate:Z", ordinal = 1, shift = At.Shift.AFTER), method = "setupRender(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/culling/Frustum;ZZ)V") + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;needsFullRenderChunkUpdate:Z", ordinal = 1, shift = Shift.AFTER), method = "setupRender(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/culling/Frustum;ZZ)V") public void alwaysUpdateCull(Camera camera, Frustum frustum, boolean bl, boolean bl2, CallbackInfo info) { - if (VRState.vrRunning) { + if (vrRunning) { this.needsFullRenderChunkUpdate = true; // if VR is on, always update the frustum, to fix flickering chunks between eyes - needsFrustumUpdate.set(true); + this.needsFrustumUpdate.set(true); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/PostChainVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/PostChainVRMixin.java index 37080aeb7..412c471a2 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/PostChainVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/PostChainVRMixin.java @@ -1,27 +1,29 @@ package org.vivecraft.mixin.client_vr.renderer; +import org.vivecraft.client.extensions.RenderTargetExtension; + import com.mojang.blaze3d.pipeline.RenderTarget; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.PostChain; + +import static net.minecraft.client.Minecraft.ON_OSX; + import org.spongepowered.asm.mixin.Final; 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.ModifyVariable; -import org.vivecraft.client.extensions.RenderTargetExtension; -@Mixin(PostChain.class) +@Mixin(net.minecraft.client.renderer.PostChain.class) public class PostChainVRMixin { @Shadow @Final private RenderTarget screenTarget; - @ModifyVariable(method = "addTempTarget", at = @At(value = "STORE"), ordinal = 0) + @ModifyVariable(method = "addTempTarget", at = @At("STORE"), ordinal = 0) private RenderTarget vrTarget(RenderTarget old) { - if (((RenderTargetExtension)screenTarget).getUseStencil()) { + if (((RenderTargetExtension) this.screenTarget).getUseStencil()) { ((RenderTargetExtension) old).setUseStencil(true); - old.resize(old.width, old.height, Minecraft.ON_OSX); + old.resize(old.width, old.height, ON_OSX); } return old; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndGatewayRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndGatewayRendererVRMixin.java index 4dbb7db18..1a5e43cf1 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndGatewayRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndGatewayRendererVRMixin.java @@ -1,46 +1,48 @@ package org.vivecraft.mixin.client_vr.renderer.blockentity; +import org.vivecraft.client_vr.render.VRShaders; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.VertexFormat; -import net.minecraft.client.renderer.RenderStateShard; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import net.minecraft.client.renderer.RenderStateShard.MultiTextureStateShard; +import net.minecraft.client.renderer.RenderStateShard.ShaderStateShard; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.blockentity.TheEndGatewayRenderer; +import net.minecraft.client.renderer.RenderType.CompositeState; import net.minecraft.client.renderer.blockentity.TheEndPortalRenderer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.render.VRShaders; -import org.vivecraft.client_xr.render_pass.RenderPassType; -@Mixin(TheEndGatewayRenderer.class) +@Mixin(net.minecraft.client.renderer.blockentity.TheEndGatewayRenderer.class) public class TheEndGatewayRendererVRMixin { @Unique - private static final RenderType END_GATEWAY_VR = - RenderType - .create( - "end_portal", - DefaultVertexFormat.POSITION, - VertexFormat.Mode.QUADS, - 256, - false, - false, - RenderType.CompositeState.builder() - .setShaderState(new RenderStateShard.ShaderStateShard(VRShaders::getRendertypeEndGatewayShaderVR)) - .setTextureState( - RenderStateShard - .MultiTextureStateShard - .builder() - .add(TheEndPortalRenderer.END_SKY_LOCATION, false, false) - .add(TheEndPortalRenderer.END_PORTAL_LOCATION, false, false) - .build()) - .createCompositeState(false)); + private static final RenderType END_GATEWAY_VR = RenderType.create( + "end_portal", + DefaultVertexFormat.POSITION, + Mode.QUADS, + 256, + false, + false, + CompositeState.builder() + .setShaderState(new ShaderStateShard(VRShaders::getRendertypeEndGatewayShaderVR)) + .setTextureState( + MultiTextureStateShard + .builder() + .add(TheEndPortalRenderer.END_SKY_LOCATION, false, false) + .add(TheEndPortalRenderer.END_PORTAL_LOCATION, false, false) + .build()) + .createCompositeState(false) + ); @Inject(at = @At("HEAD"), method = "renderType", cancellable = true) private void differentShaderInVR(CallbackInfoReturnable cir){ if (!RenderPassType.isVanilla()){ - cir.setReturnValue(END_GATEWAY_VR);; + cir.setReturnValue(END_GATEWAY_VR); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndPortalRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndPortalRendererVRMixin.java index 59bcb595e..8e08fbdc0 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndPortalRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/blockentity/TheEndPortalRendererVRMixin.java @@ -1,46 +1,49 @@ package org.vivecraft.mixin.client_vr.renderer.blockentity; +import org.vivecraft.client_vr.render.VRShaders; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.VertexFormat; -import net.minecraft.client.renderer.RenderStateShard; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; + +import net.minecraft.client.renderer.RenderStateShard.MultiTextureStateShard; +import net.minecraft.client.renderer.RenderStateShard.ShaderStateShard; import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderType.CompositeState; import net.minecraft.client.renderer.blockentity.TheEndPortalRenderer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.render.VRShaders; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Mixin(TheEndPortalRenderer.class) public class TheEndPortalRendererVRMixin { @Unique - private static final RenderType END_PORTAL_VR = - RenderType - .create( - "end_portal", - DefaultVertexFormat.POSITION, - VertexFormat.Mode.QUADS, - 256, - false, - false, - RenderType.CompositeState.builder() - .setShaderState(new RenderStateShard.ShaderStateShard(VRShaders::getRendertypeEndPortalShaderVR)) - .setTextureState( - RenderStateShard - .MultiTextureStateShard - .builder() - .add(TheEndPortalRenderer.END_SKY_LOCATION, false, false) - .add(TheEndPortalRenderer.END_PORTAL_LOCATION, false, false) - .build()) - .createCompositeState(false)); + private static final RenderType END_PORTAL_VR = RenderType.create( + "end_portal", + DefaultVertexFormat.POSITION, + Mode.QUADS, + 256, + false, + false, + CompositeState.builder() + .setShaderState(new ShaderStateShard(VRShaders::getRendertypeEndPortalShaderVR)) + .setTextureState( + MultiTextureStateShard + .builder() + .add(TheEndPortalRenderer.END_SKY_LOCATION, false, false) + .add(TheEndPortalRenderer.END_PORTAL_LOCATION, false, false) + .build()) + .createCompositeState(false) + ); @Inject(at = @At("HEAD"), method = "renderType", cancellable = true) private void differentShaderInVR(CallbackInfoReturnable cir){ if (!RenderPassType.isVanilla()){ - cir.setReturnValue(END_PORTAL_VR);; + cir.setReturnValue(END_PORTAL_VR); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java index 57122fb2a..4d538976b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java @@ -1,100 +1,103 @@ package org.vivecraft.mixin.client_vr.renderer.entity; -import com.mojang.math.Axis; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.EntityRenderDispatcherVRExtension; import org.vivecraft.client_vr.extensions.LevelRendererExtension; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_vr.render.VRArmRenderer; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import org.joml.Quaternionf; -import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.entity.EntityRendererProvider; + +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; + +import java.util.HashMap; +import java.util.Map; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_vr.render.VRArmRenderer; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import java.util.HashMap; -import java.util.Map; -@Mixin(EntityRenderDispatcher.class) -public abstract class EntityRenderDispatcherVRMixin implements ResourceManagerReloadListener, EntityRenderDispatcherVRExtension { +@Mixin(net.minecraft.client.renderer.entity.EntityRenderDispatcher.class) +public abstract class EntityRenderDispatcherVRMixin implements + net.minecraft.server.packs.resources.ResourceManagerReloadListener, + org.vivecraft.client_vr.extensions.EntityRenderDispatcherVRExtension +{ - @Unique - private VRArmRenderer armRenderer; @Unique public final Map armSkinMap = new HashMap<>(); @Shadow - public Camera camera; + public net.minecraft.client.Camera camera; @Shadow private Quaternionf cameraOrientation; @Inject(at = @At("HEAD"), method = "cameraOrientation", cancellable = true) public void cameraOrientation(CallbackInfoReturnable cir) { if (RenderPassType.isVanilla() || RenderPassType.isGuiOnly()) { - cir.setReturnValue(cameraOrientation); + cir.setReturnValue(this.cameraOrientation); } else { - Entity entity = ((LevelRendererExtension)Minecraft.getInstance().levelRenderer).getRenderedEntity(); + Entity entity = ((LevelRendererExtension)mc.levelRenderer).getRenderedEntity(); if (entity == null) { cir.setReturnValue(this.camera.rotation()); } else { - Vec3 vec3 = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.THIRD || ClientDataHolderVR.getInstance().currentPass == RenderPass.CAMERA) { - vec3 = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getPosition(); + Vec3 vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + if (dh.currentPass == RenderPass.THIRD || dh.currentPass == RenderPass.CAMERA) { + vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); } - Vec3 vec31 = entity.position().add(0.0D, (double)(entity.getBbHeight() / 2.0F), 0.0D).subtract(vec3).normalize(); + Vec3 vec31 = entity.position().add(0.0D, entity.getBbHeight() / 2.0F, 0.0D).subtract(vec3).normalize(); Quaternionf q = new Quaternionf(); - q.mul(Axis.YP.rotationDegrees((float) (-Math.toDegrees(Math.atan2(-vec31.x, vec31.z))))); - q.mul(Axis.XP.rotationDegrees((float) (-Math.toDegrees(Math.asin(vec31.y / vec31.length()))))); + q.mul(new Quaternionf().rotationY((float) -atan2(-vec31.x, vec31.z))); + q.mul(new Quaternionf().rotationX((float) -asin(vec31.y / vec31.length()))); cir.setReturnValue(q); } } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderers;createPlayerRenderers(Lnet/minecraft/client/renderer/entity/EntityRendererProvider$Context;)Ljava/util/Map;", shift = At.Shift.AFTER), + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderers;createPlayerRenderers(Lnet/minecraft/client/renderer/entity/EntityRendererProvider$Context;)Ljava/util/Map;", shift = Shift.AFTER), method = "onResourceManagerReload(Lnet/minecraft/server/packs/resources/ResourceManager;)V", locals = LocalCapture.CAPTURE_FAILEXCEPTION) - public void reload(ResourceManager resourceManager, CallbackInfo ci, EntityRendererProvider.Context context) { - this.armRenderer = new VRArmRenderer(context, false); - this.armSkinMap.put("default", this.armRenderer); + public void reload(ResourceManager resourceManager, CallbackInfo ci, Context context) { + this.armSkinMap.put("default", new VRArmRenderer(context, false)); this.armSkinMap.put("slim", new VRArmRenderer(context, true)); } @Override public Quaternionf getCameraOrientationOffset(float offset) { if (RenderPassType.isVanilla() || RenderPassType.isGuiOnly()) { - return cameraOrientation; + return this.cameraOrientation; } else { - Entity entity = ((LevelRendererExtension)Minecraft.getInstance().levelRenderer).getRenderedEntity(); + Entity entity = ((LevelRendererExtension)mc.levelRenderer).getRenderedEntity(); if (entity == null) { return this.camera.rotation(); } else { - Vec3 vec3 = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.THIRD || ClientDataHolderVR.getInstance().currentPass == RenderPass.CAMERA) { - vec3 = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getPosition(); + Vec3 vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + if (dh.currentPass == RenderPass.THIRD || dh.currentPass == RenderPass.CAMERA) { + vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); } - Vec3 vec31 = entity.position().add(0.0D, (double) (entity.getBbHeight() + offset), 0.0D).subtract(vec3).normalize(); - Quaternionf q = new Quaternionf(); - q.mul(Axis.YP.rotationDegrees((float) (-Math.toDegrees(Math.atan2(-vec31.x, vec31.z))))); - q.mul(Axis.XP.rotationDegrees((float) (-Math.toDegrees(Math.asin(vec31.y / vec31.length()))))); - return q; + Vec3 vec31 = entity.position().add(0.0D, entity.getBbHeight() + offset, 0.0D).subtract(vec3).normalize(); + return (new Quaternionf() + .mul(new Quaternionf().rotationY((float) -atan2(-vec31.x, vec31.z))) + .mul(new Quaternionf().rotationX((float) -asin(vec31.y / vec31.length()))) + ); } } } public Map getArmSkinMap() { - return armSkinMap; + return this.armSkinMap; } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRendererVRMixin.java index d214c372f..5008fdc5d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRendererVRMixin.java @@ -1,16 +1,18 @@ package org.vivecraft.mixin.client_vr.renderer.entity; import org.vivecraft.client_vr.extensions.EntityRenderDispatcherVRExtension; + import org.joml.Quaternionf; + import net.minecraft.client.renderer.entity.EntityRenderDispatcher; -import net.minecraft.client.renderer.entity.EntityRenderer; + import org.spongepowered.asm.mixin.Final; 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.Redirect; -@Mixin(EntityRenderer.class) +@Mixin(net.minecraft.client.renderer.entity.EntityRenderer.class) public class EntityRendererVRMixin { @Shadow @@ -19,6 +21,6 @@ public class EntityRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;cameraOrientation()Lorg/joml/Quaternionf;"), method = "renderNameTag") public Quaternionf cameraOffset(EntityRenderDispatcher instance) { - return ((EntityRenderDispatcherVRExtension)this.entityRenderDispatcher).getCameraOrientationOffset(0.5f); + return ((EntityRenderDispatcherVRExtension)this.entityRenderDispatcher).getCameraOrientationOffset(0.5F); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java index 158451b46..2e19b9db8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java @@ -1,66 +1,68 @@ package org.vivecraft.mixin.client_vr.renderer.entity; -import net.minecraft.client.renderer.entity.EntityRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_xr.render_pass.RenderPassType; + +import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.world.entity.projectile.FishingHook; -import org.spongepowered.asm.mixin.injection.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.FishingHookRenderer; import net.minecraft.world.item.FishingRodItem; import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; -@Mixin(FishingHookRenderer.class) -public abstract class FishingHookRendererVRMixin extends EntityRenderer { +@Mixin(net.minecraft.client.renderer.entity.FishingHookRenderer.class) +public abstract class FishingHookRendererVRMixin extends net.minecraft.client.renderer.entity.EntityRenderer { // dummy constructor - protected FishingHookRendererVRMixin(EntityRendererProvider.Context context) { + protected FishingHookRendererVRMixin(Context context) { super(context); } private Vec3 CachedHandPos; - @ModifyVariable(at = @At(value = "LOAD"), + @ModifyVariable(at = @At("LOAD"), method = "render(Lnet/minecraft/world/entity/projectile/FishingHook;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", index = 25) private double fishingLineStartX(double value, FishingHook fishingHook) { - if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == Minecraft.getInstance().player) { + if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == mc.player) { int j = 1; if (fishingHook.getPlayerOwner().getMainHandItem().getItem() instanceof FishingRodItem) { j = 0; } - Vec3 vec31 = ((GameRendererExtension) Minecraft.getInstance().gameRenderer).getControllerRenderPos(j); - Vec3 vec32 = ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getHand(j).getDirection(); - CachedHandPos = vec31.add(vec32.scale(0.47 * ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.worldScale)); - return CachedHandPos.x; + Vec3 vec31 = ((GameRendererExtension) mc.gameRenderer).getControllerRenderPos(j); + Vec3 vec32 = dh.vrPlayer.vrdata_world_render.getHand(j).getDirection(); + this.CachedHandPos = vec31.add(vec32.scale(0.47 * dh.vrPlayer.vrdata_world_render.worldScale)); + return this.CachedHandPos.x; } else { return value; } } - @ModifyVariable(at = @At(value = "LOAD"), + @ModifyVariable(at = @At("LOAD"), method = "render(Lnet/minecraft/world/entity/projectile/FishingHook;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", index = 27) private double fishingLineStartY(double value, FishingHook fishingHook) { - if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == Minecraft.getInstance().player) { - return CachedHandPos.y; + if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == mc.player) { + return this.CachedHandPos.y; } else { return value; } } - @ModifyVariable(at = @At(value = "LOAD"), + @ModifyVariable(at = @At("LOAD"), method = "render(Lnet/minecraft/world/entity/projectile/FishingHook;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", index = 29) private double fishingLineStartZ(double value, FishingHook fishingHook) { - if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == Minecraft.getInstance().player) { - return CachedHandPos.z; + if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == mc.player) { + return this.CachedHandPos.z; } else { return value; } } - @ModifyVariable(at = @At(value = "LOAD"), + @ModifyVariable(at = @At("LOAD"), method = "render(Lnet/minecraft/world/entity/projectile/FishingHook;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", index = 31) private float fishingLineStartOffset(float value, FishingHook fishingHook) { - if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == Minecraft.getInstance().player) { + if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == mc.player) { return 0.0F; } else { return value; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java index ab7bbb1bb..b29ce3e18 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java @@ -1,16 +1,19 @@ package org.vivecraft.mixin.client_vr.renderer.entity; -import org.vivecraft.client_vr.ClientDataHolderVR; -import net.minecraft.client.Minecraft; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.minecraft.client.renderer.entity.GuardianRenderer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + 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.Redirect; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Mixin(GuardianRenderer.class) public abstract class GuardianRendererVRMixin { @@ -20,8 +23,8 @@ public abstract class GuardianRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/GuardianRenderer;getPosition(Lnet/minecraft/world/entity/LivingEntity;DF)Lnet/minecraft/world/phys/Vec3;"), method = "render(Lnet/minecraft/world/entity/monster/Guardian;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V") public Vec3 changeEye(GuardianRenderer instance, LivingEntity livingEntity, double d, float f) { - if (!RenderPassType.isVanilla() && livingEntity == Minecraft.getInstance().getCameraEntity()) { - return ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().subtract(0.0D, 0.3D * (double) ClientDataHolderVR.getInstance().vrPlayer.worldScale, 0.0D); + if (!RenderPassType.isVanilla() && livingEntity == mc.getCameraEntity()) { + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().subtract(0.0D, 0.3D * (double) dh.vrPlayer.worldScale, 0.0D); } return this.getPosition(livingEntity, d, f); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java index b215da96d..c0fd19bcf 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java @@ -1,22 +1,24 @@ package org.vivecraft.mixin.client_vr.renderer.entity; -import org.vivecraft.client_vr.ClientDataHolderVR; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.MobRenderer; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.client_xr.render_pass.RenderPassType; -@Mixin(MobRenderer.class) + +@Mixin(net.minecraft.client.renderer.entity.MobRenderer.class) public class MobRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getRopeHoldPosition(F)Lnet/minecraft/world/phys/Vec3;"), method = "renderLeash") - public Vec3 leash(Entity instance, float f) { - if (!RenderPassType.isVanilla() && instance == Minecraft.getInstance().player) { - return ClientDataHolderVR.getInstance().vrPlayer.vrdata_world_render.getController(0).getPosition(); + public net.minecraft.world.phys.Vec3 leash(Entity instance, float f) { + if (!RenderPassType.isVanilla() && instance == mc.player) { + return dh.vrPlayer.vrdata_world_render.getController(0).getPosition(); } return instance.getRopeHoldPosition(f); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java index 6f95c9a6f..6c13b1bd0 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java @@ -1,23 +1,23 @@ package org.vivecraft.mixin.client_vr.tutorial; +import org.vivecraft.client.VivecraftVRMod; + import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.client.player.Input; import net.minecraft.client.tutorial.MovementTutorialStepInstance; import net.minecraft.network.chat.Component; + +import java.util.HashSet; +import java.util.Set; + +import static org.vivecraft.client_vr.VRState.*; + 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.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client.VivecraftVRMod; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.MCVR; - -import java.util.HashSet; -import java.util.Set; @Mixin(MovementTutorialStepInstance.class) public class MovementTutorialStepInstanceVRMixin { @@ -28,36 +28,36 @@ public class MovementTutorialStepInstanceVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V", ordinal = 0), index = 1, method = "tick") private Component alterMovementTitle(Component title) { - if (!VRState.vrRunning) { + if (!vrRunning) { return title; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { + if (!dh.vrSettings.seated) { // find the currently used movement binding - if (MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveStrafe).isActive()) { + if (dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveStrafe).isActive()) { // moveStrafe active - return Component.translatable("vivecraft.toasts.move1", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveStrafe).getLastOrigin())).withStyle(ChatFormatting.BOLD)); - } else if (MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveRotate).isActive()) { + return Component.translatable("vivecraft.toasts.move1", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveStrafe).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + } else if (dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveRotate).isActive()) { // moveRotate active - return Component.translatable("vivecraft.toasts.move1", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyFreeMoveRotate).getLastOrigin())).withStyle(ChatFormatting.BOLD)); - } else if (MCVR.get().getInputAction(Minecraft.getInstance().options.keyUp).isActive() || - MCVR.get().getInputAction(Minecraft.getInstance().options.keyDown).isActive() || - MCVR.get().getInputAction(Minecraft.getInstance().options.keyLeft).isActive() || - MCVR.get().getInputAction(Minecraft.getInstance().options.keyRight).isActive() + return Component.translatable("vivecraft.toasts.move1", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(VivecraftVRMod.keyFreeMoveRotate).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + } else if (dh.vr.getInputAction(mc.options.keyUp).isActive() || + dh.vr.getInputAction(mc.options.keyDown).isActive() || + dh.vr.getInputAction(mc.options.keyLeft).isActive() || + dh.vr.getInputAction(mc.options.keyRight).isActive() ) { // individual movement bindings Set buttons = new HashSet<>(); - if (MCVR.get().getInputAction(Minecraft.getInstance().options.keyUp).isActive()) { - buttons.add(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyUp).getLastOrigin())); + if (dh.vr.getInputAction(mc.options.keyUp).isActive()) { + buttons.add(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyUp).getLastOrigin())); } - if (MCVR.get().getInputAction(Minecraft.getInstance().options.keyDown).isActive()) { - buttons.add(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyDown).getLastOrigin())); + if (dh.vr.getInputAction(mc.options.keyDown).isActive()) { + buttons.add(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyDown).getLastOrigin())); } - if (MCVR.get().getInputAction(Minecraft.getInstance().options.keyLeft).isActive()) { - buttons.add(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyLeft).getLastOrigin())); + if (dh.vr.getInputAction(mc.options.keyLeft).isActive()) { + buttons.add(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyLeft).getLastOrigin())); } - if (MCVR.get().getInputAction(Minecraft.getInstance().options.keyRight).isActive()) { - buttons.add(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyRight).getLastOrigin())); + if (dh.vr.getInputAction(mc.options.keyRight).isActive()) { + buttons.add(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyRight).getLastOrigin())); } String[] stringArray = buttons.toArray(new String[0]); @@ -86,48 +86,50 @@ private Component alterMovementTitle(Component title) { ); default -> Component.literal(""); }; - } else if (MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTeleportFallback).isActive()) { + } else if (dh.vr.getInputAction(VivecraftVRMod.keyTeleportFallback).isActive()) { // teleport fallback - return Component.translatable("vivecraft.toasts.move1", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTeleportFallback).getLastOrigin())).withStyle(ChatFormatting.BOLD)); - } else if (MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTeleport).isActive()) { + return Component.translatable("vivecraft.toasts.move1", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(VivecraftVRMod.keyTeleportFallback).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + } else if (dh.vr.getInputAction(VivecraftVRMod.keyTeleport).isActive()) { // teleport - return Component.translatable("vivecraft.toasts.teleport", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(VivecraftVRMod.INSTANCE.keyTeleport).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + return Component.translatable("vivecraft.toasts.teleport", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(VivecraftVRMod.keyTeleport).getLastOrigin())).withStyle(ChatFormatting.BOLD)); } } return title; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V", ordinal = 0), index = 2, method = "tick") private Component alterMovementDescription(Component description) { - if (!VRState.vrRunning) { + if (!vrRunning) { return description; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated && MCVR.get().getInputAction(Minecraft.getInstance().options.keyJump).isActive()) { - return Component.translatable("tutorial.move.description", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyJump).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + if (!dh.vrSettings.seated && dh.vr.getInputAction(mc.options.keyJump).isActive()) { + return Component.translatable("tutorial.move.description", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyJump).getLastOrigin())).withStyle(ChatFormatting.BOLD)); } return description; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V", ordinal = 1), index = 2, method = "tick") private Component alterLookDescription(Component title) { - if (!VRState.vrRunning) { - return title; - } - - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { - return Component.translatable("vivecraft.toasts.point_controller", Component.translatable(ClientDataHolderVR.getInstance().vrSettings.reverseHands ? "vivecraft.toasts.point_controller.left" : "vivecraft.toasts.point_controller.right").withStyle(ChatFormatting.BOLD)); - } - return title; + return (!vrRunning || dh.vrSettings.seated ? + title : + Component.translatable( + "vivecraft.toasts.point_controller", + Component.translatable(dh.vrSettings.reverseHands ? + "vivecraft.toasts.point_controller.left" : + "vivecraft.toasts.point_controller.right" + ).withStyle(ChatFormatting.BOLD) + ) + ); } @Inject(at = @At("TAIL"), method = "onInput") private void addTeleport(Input input, CallbackInfo ci) { - moved |= VivecraftVRMod.INSTANCE.keyTeleport.isDown(); + this.moved |= VivecraftVRMod.keyTeleport.isDown(); } @Inject(at = @At("HEAD"), method = "onMouse", cancellable = true) private void onlyAfterMove(double d, double e, CallbackInfo ci) { - if (moveCompleted == -1) { + if (this.moveCompleted == -1) { ci.cancel(); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/OpenInventoryTutorialStepVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/OpenInventoryTutorialStepVRMixin.java index 73d1feb33..560af1773 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/OpenInventoryTutorialStepVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/OpenInventoryTutorialStepVRMixin.java @@ -1,25 +1,23 @@ package org.vivecraft.mixin.client_vr.tutorial; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.tutorial.OpenInventoryTutorialStep; import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.MCVR; -@Mixin(OpenInventoryTutorialStep.class) +@Mixin(net.minecraft.client.tutorial.OpenInventoryTutorialStep.class) public class OpenInventoryTutorialStepVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V"), index = 2, method = "tick") private Component alterDescription(Component component) { - if (!VRState.vrRunning) { + if (!vrRunning) { return component; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated && MCVR.get().getInputAction(Minecraft.getInstance().options.keyInventory).isActive()) { - return Component.translatable("tutorial.open_inventory.description", Component.literal(MCVR.get().getOriginName(MCVR.get().getInputAction(Minecraft.getInstance().options.keyInventory).getLastOrigin())).withStyle(ChatFormatting.BOLD)); + if (!dh.vrSettings.seated && dh.vr.getInputAction(mc.options.keyInventory).isActive()) { + return Component.translatable("tutorial.open_inventory.description", Component.literal(dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyInventory).getLastOrigin())).withStyle(ChatFormatting.BOLD)); } return component; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/PunchTreeTutorialStepInstanceVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/PunchTreeTutorialStepInstanceVRMixin.java index a3abec9b8..f263585f6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/PunchTreeTutorialStepInstanceVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/PunchTreeTutorialStepInstanceVRMixin.java @@ -2,20 +2,22 @@ import net.minecraft.client.tutorial.PunchTreeTutorialStepInstance; import net.minecraft.network.chat.Component; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; @Mixin(PunchTreeTutorialStepInstance.class) public class PunchTreeTutorialStepInstanceVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V"), index = 2, method = "tick") private Component alterDescription(Component component) { - if (!VRState.vrRunning) { + if (!vrRunning) { return component; } - if (!ClientDataHolderVR.getInstance().vrSettings.seated) { + if (!dh.vrSettings.seated) { return Component.translatable("tutorial.find_tree.description"); } return component; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/BoatMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/BoatMixin.java index 420f4413f..22520ba28 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/BoatMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/BoatMixin.java @@ -1,143 +1,162 @@ package org.vivecraft.mixin.client_vr.world; -import net.minecraft.client.Minecraft; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.Level; + +import static org.vivecraft.client_vr.VRState.*; + +import static org.joml.Math.*; + 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.At.Shift; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyConstant; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; //TODO needed? -@Mixin(Boat.class) -public abstract class BoatMixin extends Entity { - - @Shadow - private float deltaRotation; - @Shadow - private boolean inputLeft; - @Shadow - private boolean inputRight; - @Shadow - private boolean inputUp; - - @Shadow - public abstract void setPaddleState(boolean pLeft, boolean pRight); - - public BoatMixin(EntityType entityType, Level level) { - super(entityType, level); - } - - - - @ModifyConstant(constant = @Constant(floatValue = 1F, ordinal = 0), method = "controlBoat()V") - public float inputLeft(float f) { - Minecraft minecraft = Minecraft.getInstance(); - float f1 = minecraft.player.input.leftImpulse; - return f1; - } - - @ModifyConstant(constant = @Constant(floatValue = 1F, ordinal = 1), method = "controlBoat()V") - public float inputRight(float f) { - Minecraft minecraft = Minecraft.getInstance(); - float f1 = minecraft.player.input.leftImpulse; - return -f1; - } - - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/vehicle/Boat;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V", shift = At.Shift.BEFORE), method = "controlBoat", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) - public void roomscaleRowing(CallbackInfo ci, float f) { - if (!VRState.vrRunning) { - return; - } - - double mx, mz; - ClientDataHolderVR clientDataHolderVR = ClientDataHolderVR.getInstance(); - - if(this.inputUp && !clientDataHolderVR.vrSettings.seated){ - //controller-based - float yaw = clientDataHolderVR.vrPlayer.vrdata_world_pre.getController(1).getYaw(); - if(clientDataHolderVR.vrSettings.vehicleRotation){ - //tank controls - float end = this.getYRot() % 360; - float start = yaw; - float difference = Math.abs(end - start); - - if (difference > 180) - if (end > start) - start += 360; - else - end += 360; - - difference = end - start; - - f = 0; - - if (Math.abs(difference) < 30){ - f = 0.04f; - } - else if (Math.abs(difference) > 150) { - f = -0.005F; - } - else if(difference < 0){ - this.deltaRotation +=1; - f = 0.005f; - } else if(difference > 0) { - this.deltaRotation -=1; - f = 0.005f; - } - - mx = Math.sin(-this.getYRot()* 0.017453292F) * f; - mz = Math.cos(this.getYRot() * 0.017453292F) * f; - } else { - //point to move - mx = Math.sin(-yaw* 0.017453292F) * f; - mz = Math.cos(yaw * 0.017453292F) * f; - this.setYRot(yaw); - } - - - } else { - //roomscale or vanilla behavior - if(clientDataHolderVR.rowTracker.isRowing() && !clientDataHolderVR.vrSettings.seated){ - - this.deltaRotation += clientDataHolderVR.rowTracker.LOar / 1.5; - this.deltaRotation -= clientDataHolderVR.rowTracker.ROar / 1.5; - /* - this.deltaRotation += mc.rowTracker.forces[0] *50; - this.deltaRotation -= mc.rowTracker.forces[1] *50; - */ - - if (deltaRotation < 0) this.inputLeft = true; - if (deltaRotation > 0) this.inputRight = true; - - f = 0.06f * clientDataHolderVR.rowTracker.Foar; - if(f > 0) this.inputUp = true; - - /* - f=(float)(mc.rowTracker.forces[0] + mc.rowTracker.forces[1]); - if(f > 0.005) this.forwardInputDown = true; - */ - - mx= Math.sin(-this.getYRot() * 0.017453292F) * f; - mz= Math.cos(this.getYRot() * 0.017453292F) * f; - }else{ - //default boat (seated mode) - mx= Math.sin(-this.getYRot() * 0.017453292F) * f; - mz= Math.cos(this.getYRot() * 0.017453292F) * f; - } - } - this.setDeltaMovement(this.getDeltaMovement().x + mx, this.getDeltaMovement().y, this.getDeltaMovement().z + mz); - - this.setPaddleState(this.inputRight && !this.inputLeft || this.inputUp, this.inputLeft && !this.inputRight || this.inputUp); - ci.cancel(); - } +@Mixin(net.minecraft.world.entity.vehicle.Boat.class) +public abstract class BoatMixin extends net.minecraft.world.entity.Entity { + + @Shadow + private float deltaRotation; + @Shadow + private boolean inputLeft; + @Shadow + private boolean inputRight; + @Shadow + private boolean inputUp; + + @Shadow + public abstract void setPaddleState(boolean pLeft, boolean pRight); + + public BoatMixin(EntityType entityType, Level level) { + super(entityType, level); + } + + + + @ModifyConstant(constant = @Constant(floatValue = 1.0F, ordinal = 0), method = "controlBoat()V") + public float inputLeft(float f) { + float f1 = mc.player.input.leftImpulse; + return f1; + } + + @ModifyConstant(constant = @Constant(floatValue = 1.0F, ordinal = 1), method = "controlBoat()V") + public float inputRight(float f) { + float f1 = mc.player.input.leftImpulse; + return -f1; + } + + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/vehicle/Boat;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V", shift = Shift.BEFORE), method = "controlBoat", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) + public void roomscaleRowing(CallbackInfo ci, float f) { + if (!vrRunning) { return; } + + double mx, mz; + + if (this.inputUp && !dh.vrSettings.seated) + { + //controller-based + float yaw = dh.vrPlayer.vrdata_world_pre.getController(1).getYaw(); + if(dh.vrSettings.vehicleRotation) + { + //tank controls + float end = this.getYRot() % 360; + float start = yaw; + float difference = abs(end - start); + + if (difference > 180) + { + if (end > start) + { + start += 360; + } + else + { + end += 360; + } + } + + difference = end - start; + + if (abs(difference) < 30) + { + f = 0.04F; + } + else if (abs(difference) > 150) + { + f = -0.005F; + } + else if(difference < 0) + { + this.deltaRotation += 1; + f = 0.005F; + } + else if(difference > 0) + { + this.deltaRotation -= 1; + f = 0.005F; + } + else + { + f = 0; + } + + mx = sin(toRadians(-this.getYRot())) * f; + mz = cos(toRadians(this.getYRot())) * f; + } + else + { + //point to move + mx = sin(toRadians(-yaw)) * f; + mz = cos(toRadians(yaw)) * f; + this.setYRot(yaw); + } + } + else + { + //roomscale or vanilla behavior + if (dh.rowTracker.isRowing() && !dh.vrSettings.seated) + { + + this.deltaRotation += dh.rowTracker.LOar / 1.5F; + this.deltaRotation -= dh.rowTracker.ROar / 1.5F; + /* + this.deltaRotation += mc.rowTracker.forces[0] *50; + this.deltaRotation -= mc.rowTracker.forces[1] *50; + */ + + if (this.deltaRotation < 0) + { + this.inputLeft = true; + } + if (this.deltaRotation > 0) + { + this.inputRight = true; + } + + f = 0.06F * dh.rowTracker.FOar; + if (f > 0) + { + this.inputUp = true; + } + + /* + f=(float)(mc.rowTracker.forces[0] + mc.rowTracker.forces[1]); + if(f > 0.005) this.forwardInputDown = true; + */ + + } + mx= sin(toRadians(-this.getYRot())) * f; + mz= cos(toRadians(this.getYRot())) * f; + } + this.setDeltaMovement(this.getDeltaMovement().x + mx, this.getDeltaMovement().y, this.getDeltaMovement().z + mz); + + this.setPaddleState(this.inputRight && !this.inputLeft || this.inputUp, this.inputLeft && !this.inputRight || this.inputUp); + ci.cancel(); + } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/FishingHookVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/FishingHookVRMixin.java index 49e15b022..71cc0566d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/FishingHookVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/FishingHookVRMixin.java @@ -1,23 +1,24 @@ package org.vivecraft.mixin.client_vr.world; -import net.minecraft.world.entity.Entity; +import org.vivecraft.client_vr.provider.ControllerType; + import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.FishingRodItem; import net.minecraft.world.level.Level; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.provider.ControllerType; -import org.vivecraft.client_vr.provider.MCVR; -@Mixin(FishingHook.class) -public abstract class FishingHookVRMixin extends Entity { +@Mixin(net.minecraft.world.entity.projectile.FishingHook.class) +public abstract class FishingHookVRMixin extends net.minecraft.world.entity.Entity { @Shadow private boolean biting; @@ -33,28 +34,34 @@ public FishingHookVRMixin(EntityType entityType, Level level) { @Unique private boolean wasNibble = false; - @Inject(at = @At(value = "HEAD"), method = "tick") + @Inject(at = @At("HEAD"), method = "tick") private void fishhookFeedback(CallbackInfo ci){ - if (!VRState.vrRunning) { + if (!vrRunning) { return; } Player player = this.getPlayerOwner(); if (player != null && player.isLocalPlayer()) { - if (biting && !wasBiting) { + if (this.biting && !this.wasBiting) { // bite, big feedback - MCVR.get().triggerHapticPulse( - player.getMainHandItem().getItem() instanceof FishingRodItem ? ControllerType.RIGHT : ControllerType.LEFT, - 0.005F, 160.0F, 0.5F); - } else if (getDeltaMovement().y < -0.01 && !wasNibble) { + dh.vr.triggerHapticPulse( + player.getMainHandItem().getItem() instanceof FishingRodItem ? ControllerType.RIGHT : ControllerType.LEFT, + 0.005F, + 160.0F, + 0.5F + ); + } else if (this.getDeltaMovement().y < -0.01 && !this.wasNibble) { // nibble, small feedback - MCVR.get().triggerHapticPulse( - player.getMainHandItem().getItem() instanceof FishingRodItem ? ControllerType.RIGHT : ControllerType.LEFT, - 0.0005F, 160.0F, 0.05F); - wasNibble = true; + dh.vr.triggerHapticPulse( + player.getMainHandItem().getItem() instanceof FishingRodItem ? ControllerType.RIGHT : ControllerType.LEFT, + 0.0005F, + 160.0F, + 0.05F + ); + this.wasNibble = true; } } - wasBiting = biting; - wasNibble = wasNibble && getDeltaMovement().y < 0.0; + this.wasBiting = this.biting; + this.wasNibble = this.wasNibble && this.getDeltaMovement().y < 0.0; } -} \ No newline at end of file +} diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/ItemVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/ItemVRMixin.java index 1aaa4c832..502833518 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/ItemVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/ItemVRMixin.java @@ -3,21 +3,22 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -@Mixin(Item.class) +@Mixin(net.minecraft.world.item.Item.class) public class ItemVRMixin { - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;canEat(Z)Z", shift = At.Shift.BEFORE), method = "use", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;canEat(Z)Z", shift = Shift.BEFORE), method = "use", locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private void alwaysAllowEasterEggEating(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable> cir, ItemStack itemStack) { - if (itemStack.getHoverName().getString().equals("EAT ME")) { + if ("EAT ME".equals(itemStack.getHoverName().getString())) { player.startUsingItem(interactionHand); cir.setReturnValue(InteractionResultHolder.consume(itemStack)); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/PotionItemVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/PotionItemVRMixin.java index 1d2a6c126..06fa9a79a 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/PotionItemVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/PotionItemVRMixin.java @@ -3,22 +3,23 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.PotionItem; import net.minecraft.world.level.Level; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrInitialized; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(PotionItem.class) +@Mixin(net.minecraft.world.item.PotionItem.class) public class PotionItemVRMixin { @Inject(method = "finishUsingItem", at = @At("HEAD")) private void drinkEasterEgg(ItemStack itemStack, Level level, LivingEntity livingEntity, CallbackInfoReturnable cir){ - if (VRState.vrInitialized && livingEntity instanceof LocalPlayer && itemStack.getHoverName().getString().equals("DRINK ME")) { - ClientDataHolderVR.getInstance().vrPlayer.wfMode = -0.05; - ClientDataHolderVR.getInstance().vrPlayer.wfCount = 400; + if (vrInitialized && livingEntity instanceof LocalPlayer && "DRINK ME".equals(itemStack.getHoverName().getString())) { + dh.vrPlayer.wfMode = -0.05; + dh.vrPlayer.wfCount = 400; } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/player/PlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/player/PlayerVRMixin.java index 596a42fa7..96366eda1 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/player/PlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/player/PlayerVRMixin.java @@ -2,6 +2,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.AABB; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java index a488b0b3f..fef965c30 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java @@ -1,21 +1,21 @@ package org.vivecraft.mixin.client_vr.world.entity.projectile; -import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nullable; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(FireworkRocketEntity.class) +@Mixin(net.minecraft.world.entity.projectile.FireworkRocketEntity.class) public class FireworkRocketEntityVRMixin { @Shadow private @Nullable LivingEntity attachedToEntity; @@ -25,27 +25,27 @@ public class FireworkRocketEntityVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 1, method = "tick") private double modifyX(double x) { - if (attachedToEntity instanceof LocalPlayer localPlayer && attachedToEntity == Minecraft.getInstance().player && VRState.vrRunning) { - var controller = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getHand(!localPlayer.getOffhandItem().is(Items.FIREWORK_ROCKET) && localPlayer.getMainHandItem().is(Items.FIREWORK_ROCKET) ? 0 : 1); - handPos = controller.getPosition().add(controller.getDirection().scale(0.25)); - return handPos.x; + if (this.attachedToEntity instanceof LocalPlayer localPlayer && this.attachedToEntity == mc.player && vrRunning) { + var controller = dh.vrPlayer.getVRDataWorld().getHand(!localPlayer.getOffhandItem().is(Items.FIREWORK_ROCKET) && localPlayer.getMainHandItem().is(Items.FIREWORK_ROCKET) ? 0 : 1); + this.handPos = controller.getPosition().add(controller.getDirection().scale(0.25)); + return this.handPos.x; } return x; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 2, method = "tick") private double modifyY(double y) { - if (handPos != null) { - return handPos.y; + if (this.handPos != null) { + return this.handPos.y; } return y; } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 3, method = "tick") private double modifyZ(double z) { - if (handPos != null) { - z = handPos.z; - handPos = null; + if (this.handPos != null) { + z = this.handPos.z; + this.handPos = null; } return z; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/DoorBlockVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/DoorBlockVRMixin.java index bfdc682c4..ff3e220aa 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/DoorBlockVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/DoorBlockVRMixin.java @@ -1,24 +1,23 @@ package org.vivecraft.mixin.client_vr.world.level.block; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.DoorBlock; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(DoorBlock.class) +@Mixin(net.minecraft.world.level.block.DoorBlock.class) public class DoorBlockVRMixin { @Inject(at = @At("HEAD"), method = "playSound") public void hapticFeedbackOnClose(Entity entity, Level level, BlockPos blockPos, boolean opening, CallbackInfo ci) { - if (VRState.vrRunning && !opening && Minecraft.getInstance().player != null && Minecraft.getInstance().player.isAlive() && Minecraft.getInstance().player.blockPosition().distSqr(blockPos) < 25.0D) { - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 250); + if (vrRunning && !opening && mc.player != null && mc.player.isAlive() && mc.player.blockPosition().distSqr(blockPos) < 25.0D) { + dh.vr.triggerHapticPulse(0, 250); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/FenceGateBlockVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/FenceGateBlockVRMixin.java index 2fa6ca2cf..0751c747b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/FenceGateBlockVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/FenceGateBlockVRMixin.java @@ -1,38 +1,37 @@ package org.vivecraft.mixin.client_vr.world.level.block; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.FenceGateBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; 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; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(FenceGateBlock.class) +@Mixin(net.minecraft.world.level.block.FenceGateBlock.class) public class FenceGateBlockVRMixin { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;playSound(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/core/BlockPos;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FF)V"), method = "use", locals = LocalCapture.CAPTURE_FAILHARD) public void hapticFeedbackOnClose1(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult, CallbackInfoReturnable cir, boolean opening) { - if (VRState.vrRunning && !opening && Minecraft.getInstance().player != null && Minecraft.getInstance().player.isAlive() && Minecraft.getInstance().player.blockPosition().distSqr(blockPos) < 25.0D) { - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 250); + if (vrRunning && !opening && mc.player != null && mc.player.isAlive() && mc.player.blockPosition().distSqr(blockPos) < 25.0D) { + dh.vr.triggerHapticPulse(0, 250); } } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;playSound(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/core/BlockPos;Lnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FF)V"), method = "neighborChanged", locals = LocalCapture.CAPTURE_FAILHARD) public void hapticFeedbackOnClose2(BlockState blockState, Level level, BlockPos blockPos, Block block, BlockPos blockPos2, boolean bl, CallbackInfo ci, boolean opening) { - if (VRState.vrRunning && !opening && Minecraft.getInstance().player != null && Minecraft.getInstance().player.isAlive() && Minecraft.getInstance().player.blockPosition().distSqr(blockPos) < 25.0D) { - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 250); + if (vrRunning && !opening && mc.player != null && mc.player.isAlive() && mc.player.blockPosition().distSqr(blockPos) < 25.0D) { + dh.vr.triggerHapticPulse(0, 250); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/TrapDoorBlockVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/TrapDoorBlockVRMixin.java index 6c1c64a8b..94b9df5bf 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/TrapDoorBlockVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/level/block/TrapDoorBlockVRMixin.java @@ -1,24 +1,23 @@ package org.vivecraft.mixin.client_vr.world.level.block; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.TrapDoorBlock; + +import static org.vivecraft.client_vr.VRState.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -@Mixin(TrapDoorBlock.class) +@Mixin(net.minecraft.world.level.block.TrapDoorBlock.class) public class TrapDoorBlockVRMixin { @Inject(at = @At("HEAD"), method = "playSound") public void hapticFeedbackOnClose(Player player, Level level, BlockPos blockPos, boolean opening, CallbackInfo ci) { - if (VRState.vrRunning && !opening && Minecraft.getInstance().player != null && Minecraft.getInstance().player.isAlive() && Minecraft.getInstance().player.blockPosition().distSqr(blockPos) < 25.0D) { - ClientDataHolderVR.getInstance().vr.triggerHapticPulse(0, 250); + if (vrRunning && !opening && mc.player != null && mc.player.isAlive() && mc.player.blockPosition().distSqr(blockPos) < 25.0D) { + dh.vr.triggerHapticPulse(0, 250); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/server/ChunkMapAccessor.java b/common/src/main/java/org/vivecraft/mixin/server/ChunkMapAccessor.java index 4c9f48341..1755cc14c 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ChunkMapAccessor.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ChunkMapAccessor.java @@ -1,7 +1,9 @@ package org.vivecraft.mixin.server; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; + import net.minecraft.server.level.ChunkMap; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/common/src/main/java/org/vivecraft/mixin/server/MinecraftServerMixin.java b/common/src/main/java/org/vivecraft/mixin/server/MinecraftServerMixin.java index 0c1fc3011..d388e37cb 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/MinecraftServerMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/MinecraftServerMixin.java @@ -1,15 +1,17 @@ package org.vivecraft.mixin.server; -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; import org.vivecraft.server.MinecraftServerExt; import org.vivecraft.server.ServerVivePlayer; +import net.minecraft.server.MinecraftServer; + import java.util.HashMap; import java.util.Map; import java.util.UUID; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + @Mixin(MinecraftServer.class) public class MinecraftServerMixin implements MinecraftServerExt { diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java index b48ce1858..2b175d981 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java @@ -1,29 +1,33 @@ package org.vivecraft.mixin.server; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.PacketUtils; -import org.spongepowered.asm.mixin.Final; -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.vivecraft.server.AimFixHandler; import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; +import org.vivecraft.server.AimFixHandler; +import org.vivecraft.server.ServerNetworking; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.config.ServerConfig; import net.minecraft.network.Connection; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.PacketUtils; import net.minecraft.network.protocol.game.ServerGamePacketListener; import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.ServerPlayerConnection; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.config.ServerConfig; -import org.vivecraft.server.ServerNetworking; import static org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators.CLIMBING; +import org.spongepowered.asm.mixin.Final; +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; + @Mixin(ServerGamePacketListenerImpl.class) public abstract class ServerGamePacketListenerImplMixin implements ServerPlayerConnection, ServerGamePacketListener { @@ -42,7 +46,7 @@ public abstract class ServerGamePacketListenerImplMixin implements ServerPlayerC private int aboveGroundTickCount; @Inject(at = @At("TAIL"), method = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V") - public void init(MinecraftServer p_9770_, Connection p_9771_, ServerPlayer p_9772_, CallbackInfo info) { + public void init(MinecraftServer minecraftServer, Connection connection, ServerPlayer serverPlayer, CallbackInfo info) { // Vivecraft if (this.connection.channel != null && this.connection.channel.pipeline().get("packet_handler") != null) { //fake player fix this.connection.channel.pipeline().addBefore("packet_handler", "vr_aim_fix", @@ -57,12 +61,12 @@ public void afterTick(CallbackInfo info) { @Inject(at = @At("TAIL"), method = "handleCustomPayload(Lnet/minecraft/network/protocol/game/ServerboundCustomPayloadPacket;)V") public void handleVivecraftPackets(ServerboundCustomPayloadPacket pPacket, CallbackInfo info) { - var buffer = pPacket.getData(); - var channelID = pPacket.getIdentifier(); + FriendlyByteBuf buffer = pPacket.getData(); + ResourceLocation channelID = pPacket.getIdentifier(); if (channelID.equals(CommonNetworkHelper.CHANNEL)) { PacketUtils.ensureRunningOnSameThread(pPacket, this, this.player.serverLevel()); - CommonNetworkHelper.PacketDiscriminators packetDiscriminator = CommonNetworkHelper.PacketDiscriminators.values()[buffer.readByte()]; + PacketDiscriminators packetDiscriminator = PacketDiscriminators.values()[buffer.readByte()]; ServerNetworking.handlePacket(packetDiscriminator, buffer, (ServerGamePacketListenerImpl) (Object)this); if (packetDiscriminator == CLIMBING) { this.aboveGroundTickCount = 0; @@ -77,7 +81,7 @@ public void doLeaveMessage(Component component, CallbackInfo ci) { this.server.getPlayerList().broadcastSystemMessage(Component.literal(message.formatted(this.player.getName().getString())), false); } } - // remove player from vivepalyer list, when they leave + // remove player from viveplayer list, when they leave ServerVRPlayers.getPlayersWithVivecraft(this.server).remove(this.player.getUUID()); } } diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java index 419979e1c..b3203b647 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java @@ -1,12 +1,14 @@ package org.vivecraft.mixin.server; +import org.vivecraft.server.ServerUtil; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerLoginPacketListenerImpl; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.server.ServerUtil; @Mixin(ServerLoginPacketListenerImpl.class) public class ServerLoginPacketListenerImplMixin { diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java index dfad0c50e..f45e36c9f 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java @@ -1,22 +1,8 @@ package org.vivecraft.mixin.server; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.projectile.AbstractArrow; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import org.vivecraft.server.config.ServerConfig; import org.vivecraft.server.ServerVRPlayers; import org.vivecraft.server.ServerVivePlayer; +import org.vivecraft.server.config.ServerConfig; import com.mojang.authlib.GameProfile; @@ -24,12 +10,14 @@ import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.UseAnim; @@ -38,8 +26,21 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import static org.joml.Math.*; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + @Mixin(ServerPlayer.class) -public abstract class ServerPlayerMixin extends Player { +public abstract class ServerPlayerMixin extends net.minecraft.world.entity.player.Player { @Shadow @Final public MinecraftServer server; @Unique @@ -47,7 +48,7 @@ public abstract class ServerPlayerMixin extends Player { @Unique private boolean hasTabListName = false; @Unique - private Component tabListDisplayName = null; + private Component tabListDisplayName; public ServerPlayerMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile) { super(level, blockPos, f, gameProfile); @@ -55,7 +56,7 @@ public ServerPlayerMixin(Level level, BlockPos blockPos, float f, GameProfile ga @Inject(at = @At("TAIL"), method = "initInventoryMenu") public void menu(CallbackInfo ci) { - ServerVivePlayer serverviveplayer = getVivePlayer(); + ServerVivePlayer serverviveplayer = this.getVivePlayer(); if (ServerConfig.vrFun.get() && serverviveplayer != null && serverviveplayer.isVR() && this.random.nextInt(40) == 3) { ItemStack itemstack; if (this.random.nextInt(2) == 1) { @@ -80,18 +81,18 @@ public void tick(CallbackInfo info) { @Unique public void sweepAttack() { - ServerVivePlayer serverviveplayer = getVivePlayer(); + ServerVivePlayer serverviveplayer = this.getVivePlayer(); if (serverviveplayer != null && serverviveplayer.isVR()) { Vec3 vec3 = serverviveplayer.getControllerDir(0); - float f = (float) Math.toDegrees(Math.atan2(vec3.x, -vec3.z)); - double d0 = (double) (-Mth.sin(f * ((float) Math.PI / 180F))); - double d1 = (double) Mth.cos(f * ((float) Math.PI / 180F)); + float f = (float)atan2(vec3.x, -vec3.z); + float f0 = -sin(f); + float f1 = cos(f); Vec3 vec31 = serverviveplayer.getControllerPos(0, this); if (this.level() instanceof ServerLevel) { - ((ServerLevel) this.level()).sendParticles(ParticleTypes.SWEEP_ATTACK, vec31.x + d0, vec31.y, - vec31.z + d1, 0, d0, 0.0D, d1, 0.0D); + ((ServerLevel) this.level()).sendParticles(ParticleTypes.SWEEP_ATTACK, vec31.x + f0, vec31.y, + vec31.z + f1, 0, f0, 0.0D, f1, 0.0D); } } else { super.sweepAttack(); @@ -107,7 +108,7 @@ protected void triggerItemUseEffects(ItemStack pStack, int pCount) { if (pStack.getUseAnimation() == UseAnim.EAT) { this.addItemParticles(pStack, pCount); - this.playSound(this.getEatingSound(pStack), 0.5F + 0.5F * (float) this.random.nextInt(2), + this.playSound(this.getEatingSound(pStack), 0.5F + 0.5F * this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } } @@ -115,15 +116,15 @@ protected void triggerItemUseEffects(ItemStack pStack, int pCount) { @Unique private void addItemParticles(ItemStack stack, int count) { - ServerVivePlayer serverviveplayer = getVivePlayer(); + ServerVivePlayer serverviveplayer = this.getVivePlayer(); for (int i = 0; i < count; ++i) { Vec3 vec3 = new Vec3(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); - vec3 = vec3.xRot(-this.getXRot() * ((float) Math.PI / 180F)); - vec3 = vec3.yRot(-this.getYRot() * ((float) Math.PI / 180F)); + vec3 = vec3.xRot(toRadians(-this.getXRot())); + vec3 = vec3.yRot(toRadians(-this.getYRot())); double d0 = (double) (-this.random.nextFloat()) * 0.6D - 0.3D; Vec3 vec31 = new Vec3(((double) this.random.nextFloat() - 0.5D) * 0.3D, d0, 0.6D); - vec31 = vec31.xRot(-this.getXRot() * ((float) Math.PI / 180F)); - vec31 = vec31.yRot(-this.getYRot() * ((float) Math.PI / 180F)); + vec31 = vec31.xRot(toRadians(-this.getXRot())); + vec31 = vec31.yRot(toRadians(-this.getYRot())); vec31 = vec31.add(this.getX(), this.getEyeY(), this.getZ()); if (serverviveplayer != null && serverviveplayer.isVR()) { InteractionHand interactionhand = this.getUsedItemHand(); @@ -141,9 +142,8 @@ private void addItemParticles(ItemStack stack, int count) { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z", shift = Shift.BEFORE), method = "drop(Lnet/minecraft/world/item/ItemStack;ZZ)Lnet/minecraft/world/entity/item/ItemEntity;", locals = LocalCapture.CAPTURE_FAILHARD) - public void dropvive(ItemStack p_9085_, boolean dropAround, boolean includeName, CallbackInfoReturnable info, - ItemEntity itementity) { - ServerVivePlayer serverviveplayer = getVivePlayer(); + public void dropvive(ItemStack p_9085_, boolean dropAround, boolean includeName, CallbackInfoReturnable info, ItemEntity itementity) { + ServerVivePlayer serverviveplayer = this.getVivePlayer(); if (serverviveplayer != null && serverviveplayer.isVR() && !dropAround) { Vec3 vec3 = serverviveplayer.getControllerPos(0, this); Vec3 vec31 = serverviveplayer.getControllerDir(0); @@ -170,7 +170,7 @@ public void checkCanGetHurt(DamageSource damageSource, float f, CallbackInfoRetu // both entities are players, so need to check ServerVivePlayer otherVive = ServerVRPlayers.getVivePlayer(other); - ServerVivePlayer thisVive = getVivePlayer(); + ServerVivePlayer thisVive = this.getVivePlayer(); // create new object, if they are null, simplifies the checks if (otherVive == null) { @@ -185,33 +185,33 @@ public void checkCanGetHurt(DamageSource damageSource, float f, CallbackInfoRetu || (!thisVive.isVR() && otherVive.isVR() && otherVive.isSeated())) { // nonvr vs Seated if (!ServerConfig.pvpSEATEDVRvsNONVR.get()) { - server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs seat"), false); + this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs seat"), false); cir.setReturnValue(false); } } else if ((!otherVive.isVR() && thisVive.isVR() && !thisVive.isSeated()) || (!thisVive.isVR() && otherVive.isVR() && !otherVive.isSeated())) { // nonvr vs Standing if (!ServerConfig.pvpVRvsNONVR.get()) { - server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs stand"), false); + this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs stand"), false); cir.setReturnValue(false); } } else if ((otherVive.isVR() && otherVive.isSeated() && thisVive.isVR() && !thisVive.isSeated()) || (thisVive.isVR() && thisVive.isSeated() && otherVive.isVR() && !otherVive.isSeated())) { // Standing vs Seated if (!ServerConfig.pvpVRvsSEATEDVR.get()) { - server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs stand"), false); + this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs stand"), false); cir.setReturnValue(false); } } else if (otherVive.isVR() && !otherVive.isSeated() && thisVive.isVR() && !thisVive.isSeated()) { // Standing vs Standing if (!ServerConfig.pvpVRvsVR.get()) { - server.getPlayerList().broadcastSystemMessage(Component.literal("canceled stand vs stand"), false); + this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled stand vs stand"), false); cir.setReturnValue(false); } } else if (otherVive.isVR() && otherVive.isSeated() && thisVive.isVR() && thisVive.isSeated()){ // Seated vs Seated if (!ServerConfig.pvpSEATEDVRvsSEATEDVR.get()) { - server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs seat"), false); + this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs seat"), false); cir.setReturnValue(false); } } diff --git a/common/src/main/java/org/vivecraft/mixin/server/TrackedEntityAccessor.java b/common/src/main/java/org/vivecraft/mixin/server/TrackedEntityAccessor.java index 9e20b0b89..85af5edac 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/TrackedEntityAccessor.java +++ b/common/src/main/java/org/vivecraft/mixin/server/TrackedEntityAccessor.java @@ -1,11 +1,12 @@ package org.vivecraft.mixin.server; import net.minecraft.server.network.ServerPlayerConnection; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; import java.util.Set; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + @Mixin(targets = "net/minecraft/server/level/ChunkMap$TrackedEntity") public interface TrackedEntityAccessor { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/ai/goal/SwellGoalMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/ai/goal/SwellGoalMixin.java index 1f4d14ba3..23ec19551 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/ai/goal/SwellGoalMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/ai/goal/SwellGoalMixin.java @@ -1,25 +1,25 @@ package org.vivecraft.mixin.world.entity.ai.goal; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; +import org.vivecraft.server.config.ServerConfig; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.goal.SwellGoal; -import net.minecraft.world.entity.monster.Creeper; + import org.spongepowered.asm.mixin.Final; 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.CallbackInfoReturnable; -import org.vivecraft.server.config.ServerConfig; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; -@Mixin(SwellGoal.class) +@Mixin(net.minecraft.world.entity.ai.goal.SwellGoal.class) public class SwellGoalMixin { @Final @Shadow - private Creeper creeper; + private net.minecraft.world.entity.monster.Creeper creeper; @Inject(at = @At("HEAD"), method = "canUse", cancellable = true) public void vrSwellDistance(CallbackInfoReturnable cir) { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanFreezeWhenLookedAtMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanFreezeWhenLookedAtMixin.java index c36fb5da1..481befd72 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanFreezeWhenLookedAtMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanFreezeWhenLookedAtMixin.java @@ -1,19 +1,21 @@ package org.vivecraft.mixin.world.entity.monster; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.monster.EnderMan; -import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nullable; + import org.spongepowered.asm.mixin.Final; 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.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; -@Mixin(EnderMan.EndermanFreezeWhenLookedAt.class) +@Mixin(net.minecraft.world.entity.monster.EnderMan.EndermanFreezeWhenLookedAt.class) public class EndermanFreezeWhenLookedAtMixin { @Shadow @@ -21,7 +23,7 @@ public class EndermanFreezeWhenLookedAtMixin { private LivingEntity target; @Final @Shadow - private EnderMan enderman; + private net.minecraft.world.entity.monster.EnderMan enderman; @Inject(at = @At("HEAD"), method = "tick", cancellable = true) public void vrTick(CallbackInfo ci) { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java index 3075e35e7..043fb7f45 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java @@ -1,5 +1,8 @@ package org.vivecraft.mixin.world.entity.monster; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -12,12 +15,11 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; @Mixin(EnderMan.class) public abstract class EndermanMixin extends Monster { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractArrowMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractArrowMixin.java index dca7c218f..f85547f0d 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractArrowMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractArrowMixin.java @@ -1,5 +1,10 @@ package org.vivecraft.mixin.world.entity.projectile; +import org.vivecraft.common.utils.Utils; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; +import org.vivecraft.server.config.ServerConfig; + import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.protocol.game.ClientboundSoundPacket; @@ -8,32 +13,30 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.Vec3; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.common.utils.Utils; -import org.vivecraft.server.config.ServerConfig; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; - -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.projectile.AbstractArrow; -import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.level.Level; -import net.minecraft.world.phys.Vec3; @Mixin(AbstractArrow.class) public abstract class AbstractArrowMixin extends Entity { - protected AbstractArrowMixin(EntityType p_37248_, Level p_37249_) { - super(p_37248_, p_37249_); + protected AbstractArrowMixin(EntityType entityType, Level level) { + super(entityType, level); // TODO Auto-generated constructor stub } @@ -41,16 +44,16 @@ protected AbstractArrowMixin(EntityType p_37248_, Level p_ private double baseDamage; @Inject(at = @At("RETURN"), method = "(Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/level/Level;)V") - public void pickup(EntityType p_36717_, LivingEntity p_36718_, Level p_36719_, CallbackInfo info) { - if (p_36718_ instanceof ServerPlayer player) { + public void pickup(EntityType entityType, LivingEntity livingEntity, Level level, CallbackInfo info) { + if (livingEntity instanceof ServerPlayer player) { ServerVivePlayer serverviveplayer = ServerVRPlayers.getVivePlayer(player); if (serverviveplayer != null && serverviveplayer.isVR()) { - Vec3 vec3 = serverviveplayer.getControllerPos(serverviveplayer.activeHand, (Player) p_36718_); + Vec3 vec3 = serverviveplayer.getControllerPos(serverviveplayer.activeHand, (Player) livingEntity); Vec3 vec31 = serverviveplayer.getControllerDir(serverviveplayer.activeHand); if (!serverviveplayer.isSeated() && serverviveplayer.getDraw() > 0.0F) { - vec31 = serverviveplayer.getControllerPos(1, (Player) p_36718_).subtract(serverviveplayer.getControllerPos(0, (Player) p_36718_)).normalize(); - vec3 = serverviveplayer.getControllerPos(0, (Player) p_36718_); + vec31 = serverviveplayer.getControllerPos(1, (Player) livingEntity).subtract(serverviveplayer.getControllerPos(0, (Player) livingEntity)).normalize(); + vec3 = serverviveplayer.getControllerPos(0, (Player) livingEntity); } this.setPos(vec3.x + vec31.x, vec3.y + vec31.y, vec3.z + vec31.z); @@ -64,7 +67,7 @@ public void damageMultiplier(EntityHitResult entityHitResult, CallbackInfo ci) { ServerVivePlayer serverVivePlayer = ServerVRPlayers.getVivePlayer(owner); Vec3 hitpos; double multiplier = 1.0; - if ((hitpos = isHeadshot(entityHitResult)) != null) { + if ((hitpos = this.isHeadshot(entityHitResult)) != null) { if (serverVivePlayer != null && serverVivePlayer.isVR()) { if (serverVivePlayer.isSeated()) { multiplier = ServerConfig.bowSeatedHeadshotMultiplier.get(); @@ -90,19 +93,19 @@ public void damageMultiplier(EntityHitResult entityHitResult, CallbackInfo ci) { - this.getDeltaMovement().z, 0.1); // send sound effect - owner.connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(SoundEvents.ITEM_BREAK), SoundSource.PLAYERS, owner.getX(), owner.getY(), owner.getZ(), 0.7f, 0.5f, owner.level().random.nextLong())); + owner.connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(SoundEvents.ITEM_BREAK), SoundSource.PLAYERS, owner.getX(), owner.getY(), owner.getZ(), 0.7F, 0.5F, owner.level().random.nextLong())); } } // if headshots are disabled, still use the regular multiplier if (serverVivePlayer != null && serverVivePlayer.isVR()) { if (serverVivePlayer.isSeated()) { - multiplier = Math.max(multiplier, ServerConfig.bowSeatedMultiplier.get()); + multiplier = max(multiplier, ServerConfig.bowSeatedMultiplier.get()); } else { - multiplier = Math.max(multiplier, ServerConfig.bowStandingMultiplier.get()); + multiplier = max(multiplier, ServerConfig.bowStandingMultiplier.get()); } } - baseDamage *= multiplier; + this.baseDamage *= multiplier; } } diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractHurtingProjectileMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractHurtingProjectileMixin.java index 2fcd5fb45..e8d100a97 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractHurtingProjectileMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/AbstractHurtingProjectileMixin.java @@ -1,20 +1,21 @@ package org.vivecraft.mixin.world.entity.projectile; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.projectile.AbstractHurtingProjectile; -import net.minecraft.world.phys.Vec3; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; -@Mixin(AbstractHurtingProjectile.class) + +@Mixin(net.minecraft.world.entity.projectile.AbstractHurtingProjectile.class) public abstract class AbstractHurtingProjectileMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getLookAngle()Lnet/minecraft/world/phys/Vec3;"), method = "hurt(Lnet/minecraft/world/damagesource/DamageSource;F)Z") - public Vec3 hurtvive(Entity instance) { + public net.minecraft.world.phys.Vec3 hurtvive(Entity instance) { if (instance instanceof ServerPlayer player) { ServerVivePlayer serverviveplayer = ServerVRPlayers.getVivePlayer(player); if (serverviveplayer != null && serverviveplayer.isVR()) { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/FishingHookMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/FishingHookMixin.java index 40446f18c..77ecef660 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/FishingHookMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/FishingHookMixin.java @@ -1,15 +1,10 @@ package org.vivecraft.mixin.world.entity.projectile; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.Entity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.Redirect; import org.vivecraft.server.ServerVRPlayers; import org.vivecraft.server.ServerVivePlayer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FishingHook; @@ -17,49 +12,57 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import static org.joml.Math.*; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Redirect; + @Mixin(FishingHook.class) public abstract class FishingHookMixin extends Entity { - protected FishingHookMixin(EntityType p_37248_, Level p_37249_) { - super(p_37248_, p_37249_); + protected FishingHookMixin(EntityType entityType, Level level) { + super(entityType, level); // TODO Auto-generated constructor stub } @Unique - private ServerVivePlayer serverviveplayer = null; + private ServerVivePlayer serverviveplayer; @Unique private Vec3 controllerDir = null; @Unique private Vec3 controllerPos = null; - @ModifyVariable(at = @At(value = "STORE"), method = "(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", ordinal = 0) + @ModifyVariable(at = @At("STORE"), method = "(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", ordinal = 0) private float modifyXrot(float xRot, Player player) { - serverviveplayer = ServerVRPlayers.getVivePlayer((ServerPlayer) player); - if (serverviveplayer != null && serverviveplayer.isVR()) { - controllerDir = serverviveplayer.getControllerDir(serverviveplayer.activeHand); - controllerPos = serverviveplayer.getControllerPos(serverviveplayer.activeHand, player); - return -((float) Math.toDegrees(Math.asin(controllerDir.y / controllerDir.length()))); + this.serverviveplayer = ServerVRPlayers.getVivePlayer((ServerPlayer) player); + if (this.serverviveplayer != null && this.serverviveplayer.isVR()) { + this.controllerDir = this.serverviveplayer.getControllerDir(this.serverviveplayer.activeHand); + this.controllerPos = this.serverviveplayer.getControllerPos(this.serverviveplayer.activeHand, player); + return -((float) toDegrees(asin(this.controllerDir.y / this.controllerDir.length()))); } return xRot; } - @ModifyVariable(at = @At(value = "STORE"), method = "(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", ordinal = 1) + @ModifyVariable(at = @At("STORE"), method = "(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V", ordinal = 1) private float modifyYrot(float yRot) { - if (serverviveplayer != null && serverviveplayer.isVR()) { - return (float) Math.toDegrees(Math.atan2(-controllerDir.x, controllerDir.z)); + if (this.serverviveplayer != null && this.serverviveplayer.isVR()) { + return (float) toDegrees(atan2(-this.controllerDir.x, this.controllerDir.z)); } return yRot; } @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/projectile/FishingHook;moveTo(DDDFF)V"), method = "(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;II)V") private void modifyMoveTo(FishingHook instance, double x, double y, double z, float yRot, float xRot) { - if (serverviveplayer != null && serverviveplayer.isVR()) { - instance.moveTo(controllerPos.x + controllerDir.x * (double)0.6F, controllerPos.y + controllerDir.y * (double)0.6F, controllerPos.z + controllerDir.z * (double)0.6F, yRot, xRot); - controllerDir = null; - controllerPos = null; + if (this.serverviveplayer != null && this.serverviveplayer.isVR()) { + instance.moveTo(this.controllerPos.x + this.controllerDir.x * (double)0.6F, this.controllerPos.y + this.controllerDir.y * (double)0.6F, this.controllerPos.z + this.controllerDir.z * (double)0.6F, yRot, xRot); + this.controllerDir = null; + this.controllerPos = null; } else { this.moveTo(x, y, z, yRot, xRot); } - serverviveplayer = null; + this.serverviveplayer = null; } } \ No newline at end of file diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java index 33b827792..664256005 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java @@ -1,5 +1,8 @@ package org.vivecraft.mixin.world.entity.projectile; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; @@ -7,12 +10,13 @@ import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.ThrownTrident; import net.minecraft.world.phys.Vec3; + +import static org.joml.Math.*; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; @Mixin(Projectile.class) public class ProjectileMixin { @@ -39,7 +43,7 @@ public float pVelocity(float pVelocity, Entity pProjectile) { at = @At("HEAD"), ordinal = 0, argsOnly = true) public float pX(float pXIn, Entity pProjectile) { if (this.controllerDir != null) { - return -((float) Math.toDegrees(Math.asin(this.controllerDir.y / this.controllerDir.length()))); + return -((float) toDegrees(asin(this.controllerDir.y / this.controllerDir.length()))); } return pXIn; } @@ -48,7 +52,7 @@ public float pX(float pXIn, Entity pProjectile) { at = @At("HEAD"), ordinal = 1, argsOnly = true) public float pY(float pYIn, Entity pProjectile) { if (this.controllerDir != null) { - float toRet = (float) Math.toDegrees(Math.atan2(-this.controllerDir.x, this.controllerDir.z)); + float toRet = (float) toDegrees(atan2(-this.controllerDir.x, this.controllerDir.z)); this.controllerDir = null; return toRet; } diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java index 61b8e5745..30733793b 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java @@ -1,14 +1,10 @@ package org.vivecraft.mixin.world.entity.projectile; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.Entity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.vivecraft.server.ServerVRPlayers; import org.vivecraft.server.ServerVivePlayer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -17,6 +13,11 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + @Mixin(ThrowableProjectile.class) public abstract class ThrowableProjectileMixin extends Entity { diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrownTridentMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrownTridentMixin.java index 7e5a68880..84f721cb2 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrownTridentMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrownTridentMixin.java @@ -1,22 +1,21 @@ package org.vivecraft.mixin.world.entity.projectile; -import net.minecraft.server.level.ServerPlayer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; import org.vivecraft.server.ServerVRPlayers; import org.vivecraft.server.ServerVivePlayer; -import net.minecraft.world.entity.Entity; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.projectile.ThrownTrident; import net.minecraft.world.phys.Vec3; -@Mixin(ThrownTrident.class) +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(net.minecraft.world.entity.projectile.ThrownTrident.class) public class ThrownTridentMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getEyePosition()Lnet/minecraft/world/phys/Vec3;"), method = "tick()V") - public Vec3 tick(Entity entity) { + public Vec3 tick(net.minecraft.world.entity.Entity entity) { Vec3 vec3 = entity.getEyePosition(); if (entity instanceof ServerPlayer player) { ServerVivePlayer serverviveplayer = ServerVRPlayers.getVivePlayer(player); diff --git a/common/src/main/java/org/vivecraft/mixin/world/item/CrossbowItemMixin.java b/common/src/main/java/org/vivecraft/mixin/world/item/CrossbowItemMixin.java index 10e8fc9d4..b89f0b578 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/item/CrossbowItemMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/item/CrossbowItemMixin.java @@ -1,19 +1,22 @@ package org.vivecraft.mixin.world.item; +import org.vivecraft.server.ServerVRPlayers; +import org.vivecraft.server.ServerVivePlayer; + +import org.joml.Vector3f; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.phys.Vec3; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; +import static org.vivecraft.common.utils.Utils.up; -import net.minecraft.world.item.CrossbowItem; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.server.ServerVRPlayers; -import org.vivecraft.server.ServerVivePlayer; -import org.vivecraft.common.utils.math.Vector3; -@Mixin(CrossbowItem.class) + +@Mixin(net.minecraft.world.item.CrossbowItem.class) public class CrossbowItemMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getViewVector(F)Lnet/minecraft/world/phys/Vec3;"), @@ -24,7 +27,7 @@ private static Vec3 shoot(LivingEntity livingEntity, float v) { ServerVivePlayer serverviveplayer = ServerVRPlayers.getVivePlayer(player); if (serverviveplayer != null && serverviveplayer.isVR()) { vec3 = serverviveplayer.getControllerDir(serverviveplayer.activeHand); - serverviveplayer.getControllerVectorCustom(serverviveplayer.activeHand, new Vector3(0.0F, 1.0F, 0.0F)); + serverviveplayer.getControllerVectorCustom(serverviveplayer.activeHand, new Vector3f(up)); } } return vec3; diff --git a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java index 73291e1d1..6de9c1946 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java @@ -3,22 +3,24 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.JsonSyntaxException; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.ShapedRecipe; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -@Mixin(ShapedRecipe.class) +@Mixin(net.minecraft.world.item.crafting.ShapedRecipe.class) public class ShapedRecipeMixin { - @Inject(method = "itemFromJson", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/DefaultedRegistry;getOptional(Lnet/minecraft/resources/ResourceLocation;)Ljava/util/Optional;", shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) + @Inject(method = "itemFromJson", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/DefaultedRegistry;getOptional(Lnet/minecraft/resources/ResourceLocation;)Ljava/util/Optional;", shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) private static void getVivecraftVanillaItemInject(JsonObject jsonObject, CallbackInfoReturnable cir, String resourceLocation){ if (resourceLocation.startsWith("vivecraft")) { cir.setReturnValue(getVivecraftVanillaItem(jsonObject, resourceLocation)); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java index 6d924ba65..0ebd82e54 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java @@ -1,18 +1,19 @@ package org.vivecraft.mod_compat_vr.dynamicfps.mixin; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; @Pseudo @Mixin(targets = "dynamicfps.DynamicFPSMod") public class DynamicFPSModVRMixin { @Inject(at = @At("HEAD"), method = "checkForRender()Z", remap = false, cancellable = true) private static void alwaysRenderVR(CallbackInfoReturnable cir) { - if (VRState.vrRunning) { + if (vrRunning) { cir.setReturnValue(true); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSScreenVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSScreenVRMixin.java index d02448e04..aa4cad191 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSScreenVRMixin.java @@ -1,11 +1,13 @@ package org.vivecraft.mod_compat_vr.dynamicfps.mixin; import net.minecraft.client.gui.screens.Screen; + +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.VRState; @Mixin(Screen.class) public class DynamicFPSScreenVRMixin { @@ -13,7 +15,7 @@ public class DynamicFPSScreenVRMixin { @Inject(at = @At("HEAD"), method = "dynamicfps$rendersBackground", remap = false, cancellable = true, expect = 0) public void noOptimizeVR(CallbackInfoReturnable cir) { // please don't stop rendering the world when a screen is open - if (VRState.vrRunning) { + if (vrRunning) { cir.setReturnValue(false); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/IrisHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/IrisHelper.java index 59cbbf219..9587f5b0e 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/IrisHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/IrisHelper.java @@ -1,9 +1,10 @@ package org.vivecraft.mod_compat_vr.iris; +import org.vivecraft.client_xr.render_pass.RenderPassManager; + import net.coderbot.iris.Iris; import net.coderbot.iris.pipeline.WorldRenderingPipeline; import net.irisshaders.iris.api.v0.IrisApi; -import org.vivecraft.client_xr.render_pass.RenderPassManager; import java.io.IOException; diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/extensions/PipelineManagerExtension.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/extensions/PipelineManagerExtension.java index 1db4dc99d..c5a64fc0a 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/extensions/PipelineManagerExtension.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/extensions/PipelineManagerExtension.java @@ -1,8 +1,9 @@ package org.vivecraft.mod_compat_vr.iris.extensions; +import org.vivecraft.client_vr.render.RenderPass; + import net.coderbot.iris.pipeline.WorldRenderingPipeline; import net.coderbot.iris.shadows.ShadowRenderTargets; -import org.vivecraft.client_vr.render.RenderPass; public interface PipelineManagerExtension { diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisBeginFrameHack.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisBeginFrameHack.java index 6f1170fe1..edcba8ff1 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisBeginFrameHack.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisBeginFrameHack.java @@ -1,12 +1,14 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_xr.render_pass.RenderPassType; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(targets = { @@ -18,7 +20,7 @@ public class IrisBeginFrameHack { // only update the timer on the first RenderPass, so that it counts the time from all RenderPasses @Inject(method = "beginFrame", at = @At("HEAD"), cancellable = true, remap = false) private void cancelShadows(CallbackInfo ci) { - if (!RenderPassType.isVanilla() && !ClientDataHolderVR.getInstance().isFirstPass) { + if (!RenderPassType.isVanilla() && !dh.isFirstPass) { ci.cancel(); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixin.java index 613b8a432..288bda848 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixin.java @@ -1,5 +1,12 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassManager; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.client_xr.render_pass.WorldRenderPass; +import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; +import org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension; + import me.jellysquid.mods.sodium.client.gl.shader.GlProgram; import net.coderbot.iris.Iris; import net.coderbot.iris.compat.sodium.impl.shader_overrides.IrisChunkProgramOverrides; @@ -7,23 +14,19 @@ import net.coderbot.iris.compat.sodium.impl.shader_overrides.IrisTerrainPass; import net.coderbot.iris.pipeline.SodiumTerrainPipeline; import net.coderbot.iris.pipeline.WorldRenderingPipeline; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.EnumMap; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrInitialized; + import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassManager; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import org.vivecraft.client_xr.render_pass.WorldRenderPass; -import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; -import org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.EnumMap; @Pseudo @Mixin(IrisChunkProgramOverrides.class) @@ -38,9 +41,9 @@ public class IrisChunkProgramOverridesMixin implements IrisChunkProgramOverrides @Unique public void createAllPipelinesShadersSodiumProcessing(SodiumTerrainPipeline sodiumTerrainPipeline, Object chunkVertexType, Method createShadersMethod) throws InvocationTargetException, IllegalAccessException { - if (VRState.vrInitialized) { + if (vrInitialized) { WorldRenderPass current = RenderPassManager.wrp; - RenderPass currentPass = ClientDataHolderVR.getInstance().currentPass; + RenderPass currentPass = dh.currentPass; RenderPassManager.renderPassType = RenderPassType.WORLD_ONLY; for (RenderPass renderPass : RenderPass.values()) { @@ -65,7 +68,7 @@ public void createAllPipelinesShadersSodiumProcessing(SodiumTerrainPipeline sodi createShadersMethod.invoke(this, ((PipelineManagerExtension) Iris.getPipelineManager()).getVanillaPipeline().getSodiumTerrainPipeline(), chunkVertexType); if (current != null) { RenderPassManager.setWorldRenderPass(current); - ClientDataHolderVR.getInstance().currentPass = currentPass; + dh.currentPass = currentPass; } } else { createShadersMethod.invoke(this, sodiumTerrainPipeline, chunkVertexType); @@ -75,12 +78,12 @@ public void createAllPipelinesShadersSodiumProcessing(SodiumTerrainPipeline sodi @Redirect(method = "getProgramOverride", at = @At(value = "INVOKE", target = "Ljava/util/EnumMap;get(Ljava/lang/Object;)Ljava/lang/Object;"), remap = false) public Object getVRPipelineShaders(EnumMap> instance, Object key){ // return shader of the current RenderPass - return !RenderPassType.isVanilla() ? pipelinePrograms.get(ClientDataHolderVR.getInstance().currentPass).get((IrisTerrainPass)key) : instance.get((IrisTerrainPass)key); + return !RenderPassType.isVanilla() ? pipelinePrograms.get(dh.currentPass).get((IrisTerrainPass)key) : instance.get((IrisTerrainPass)key); } @Inject(method = "deleteShaders", at = @At("HEAD"), remap = false) public void deleteVRPipelineShaders(CallbackInfo ci){ - if (VRState.vrInitialized) { + if (vrInitialized) { for (EnumMap> map : pipelinePrograms.values()) { for (GlProgram program : map.values()) { if (program != null) { diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_11.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_11.java index aabb316c9..9ba5f24da 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_11.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_11.java @@ -1,16 +1,18 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; + import me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import net.coderbot.iris.compat.sodium.impl.shader_overrides.IrisChunkProgramOverrides; import net.coderbot.iris.pipeline.SodiumTerrainPipeline; + +import java.lang.reflect.InvocationTargetException; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; - -import java.lang.reflect.InvocationTargetException; @Pseudo @Mixin(IrisChunkProgramOverrides.class) diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_9.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_9.java index a0d645696..8c86b19f2 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_9.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisChunkProgramOverridesMixinSodium_0_4_9.java @@ -1,16 +1,18 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; + import me.jellysquid.mods.sodium.client.render.vertex.type.ChunkVertexType; import net.coderbot.iris.compat.sodium.impl.shader_overrides.IrisChunkProgramOverrides; import net.coderbot.iris.pipeline.SodiumTerrainPipeline; + +import java.lang.reflect.InvocationTargetException; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.mod_compat_vr.iris.extensions.IrisChunkProgramOverridesExtension; - -import java.lang.reflect.InvocationTargetException; @Pseudo @Mixin(IrisChunkProgramOverrides.class) diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisHandRendererVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisHandRendererVRMixin.java index 6723cbfe8..e9beb31eb 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisHandRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisHandRendererVRMixin.java @@ -1,16 +1,20 @@ package org.vivecraft.mod_compat_vr.iris.mixin; -import com.mojang.blaze3d.vertex.PoseStack; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.coderbot.iris.pipeline.HandRenderer; import net.coderbot.iris.pipeline.WorldRenderingPipeline; + +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Camera; import net.minecraft.client.renderer.GameRenderer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_xr.render_pass.RenderPassType; //TODO Move rendering to here @Pseudo diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisNewWorldRenderingPipelineVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisNewWorldRenderingPipelineVRMixin.java index a80bc5007..59735e137 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisNewWorldRenderingPipelineVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisNewWorldRenderingPipelineVRMixin.java @@ -1,11 +1,17 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension; + import net.coderbot.iris.Iris; import net.coderbot.iris.pipeline.ShadowRenderer; import net.coderbot.iris.pipeline.newshader.NewWorldRenderingPipeline; import net.coderbot.iris.shaderpack.PackShadowDirectives; import net.coderbot.iris.shaderpack.ProgramSet; import net.coderbot.iris.shadows.ShadowRenderTargets; + +import java.util.Objects; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; @@ -13,10 +19,6 @@ import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension; - -import java.util.Objects; @Pseudo @Mixin(NewWorldRenderingPipeline.class) diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java index 873fd10ff..0a511ec0f 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java @@ -1,33 +1,36 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassManager; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.client_xr.render_pass.WorldRenderPass; + import net.coderbot.iris.Iris; import net.coderbot.iris.pipeline.PipelineManager; import net.coderbot.iris.pipeline.WorldRenderingPipeline; import net.coderbot.iris.shaderpack.DimensionId; import net.coderbot.iris.shaderpack.materialmap.NamespacedId; import net.coderbot.iris.shadows.ShadowRenderTargets; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrInitialized; + import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Desc; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassManager; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import org.vivecraft.client_xr.render_pass.WorldRenderPass; -import org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; @Pseudo @Mixin(net.coderbot.iris.pipeline.PipelineManager.class) -public class IrisPipelineManagerVRMixin implements PipelineManagerExtension { +public class IrisPipelineManagerVRMixin implements org.vivecraft.mod_compat_vr.iris.extensions.PipelineManagerExtension { @Shadow(remap = false) private void resetTextureState(){} @@ -50,33 +53,33 @@ public void setShadowRenderTargets(ShadowRenderTargets targets) { private WorldRenderingPipeline vanillaPipeline; private Map vrPipelinesCurrentDimension; - private WorldRenderPass currentWorldRenderPass = null; - @Inject(method = "preparePipeline", at = @At(value = "INVOKE", target = "Ljava/util/function/Function;apply(Ljava/lang/Object;)Ljava/lang/Object;", shift = At.Shift.BEFORE), remap = false) + private WorldRenderPass currentWorldRenderPass; + @Inject(method = "preparePipeline", at = @At(value = "INVOKE", target = "Ljava/util/function/Function;apply(Ljava/lang/Object;)Ljava/lang/Object;", shift = Shift.BEFORE), remap = false) private void generateVanillaPipeline(CallbackInfoReturnable cir) { // this also runs on game startup, when the renderpassManager isn't initialized yet - if (VRState.vrInitialized && RenderPassManager.INSTANCE != null) { + if (vrInitialized && RenderPassManager.INSTANCE != null) { currentWorldRenderPass = RenderPassManager.wrp; - RenderPass currentRenderPass = ClientDataHolderVR.getInstance().currentPass; + RenderPass currentRenderPass = dh.currentPass; RenderPassManager.setVanillaRenderPass(); - ClientDataHolderVR.getInstance().currentPass = currentRenderPass; + dh.currentPass = currentRenderPass; } } @Group(name = "generateVRPipelines", min = 1, max = 1) - @Inject(target = @Desc(value = "preparePipeline", owner = PipelineManager.class, ret = WorldRenderingPipeline.class, args = DimensionId.class), at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", shift = At.Shift.AFTER), remap = false, expect = 0) + @Inject(target = @Desc(value = "preparePipeline", owner = PipelineManager.class, ret = WorldRenderingPipeline.class, args = DimensionId.class), at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", shift = Shift.AFTER), remap = false, expect = 0) private void generateVRPipelines164(DimensionId newDimension, CallbackInfoReturnable cir) { generateVRPipelines(newDimension); } @Group(name = "generateVRPipelines", min = 1, max = 1) - @Inject(target = @Desc(value = "preparePipeline", owner = PipelineManager.class, ret = WorldRenderingPipeline.class, args = NamespacedId.class), at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", shift = At.Shift.AFTER), remap = false, expect = 0) + @Inject(target = @Desc(value = "preparePipeline", owner = PipelineManager.class, ret = WorldRenderingPipeline.class, args = NamespacedId.class), at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", shift = Shift.AFTER), remap = false, expect = 0) private void generateVRPipelines165(NamespacedId newDimension, CallbackInfoReturnable cir) { generateVRPipelines(newDimension); } @Unique private void generateVRPipelines(Object newDimension) { - if (VRState.vrInitialized) { + if (vrInitialized) { vanillaPipeline = pipeline; if (!this.vrPipelinesPerDimension.containsKey(newDimension)) { vrPipelinesPerDimension.put(newDimension, new HashMap<>()); @@ -112,7 +115,7 @@ private void generateVRPipelines(Object newDimension) { // set to currently needed renderpass again if (currentWorldRenderPass != null) { RenderPassManager.setWorldRenderPass(currentWorldRenderPass); - } else if (ClientDataHolderVR.getInstance().currentPass == RenderPass.GUI) { + } else if (dh.currentPass == RenderPass.GUI) { RenderPassManager.setGUIRenderPass(); } else { RenderPassManager.setVanillaRenderPass(); @@ -121,8 +124,8 @@ private void generateVRPipelines(Object newDimension) { vrPipelinesCurrentDimension = vrPipelinesPerDimension.get(newDimension); if (!RenderPassType.isVanilla()) { - if (ClientDataHolderVR.getInstance().currentPass != null) { - pipeline = vrPipelinesCurrentDimension.get(ClientDataHolderVR.getInstance().currentPass); + if (dh.currentPass != RenderPass.VANILLA) { + pipeline = vrPipelinesCurrentDimension.get(dh.currentPass); } else { pipeline = vrPipelinesCurrentDimension.get(RenderPass.LEFT); } @@ -150,12 +153,12 @@ private void returnCurrentVRPipeline165(NamespacedId newDimension, CallbackInfoR @Unique private WorldRenderingPipeline getCurrentVRPipeline(Object key) { - return vrPipelinesPerDimension.get(key).get(ClientDataHolderVR.getInstance().currentPass); + return vrPipelinesPerDimension.get(key).get(dh.currentPass); } @Inject(method = "destroyPipeline", at = @At(value = "INVOKE", target = "Ljava/util/Map;clear()V"), remap = false) private void destroyVRPipelines(CallbackInfo ci) { - if (VRState.vrInitialized) { + if (vrInitialized) { vrPipelinesPerDimension.forEach((dimID, map) -> { map.forEach((renderPass, pipeline) -> { Iris.logger.info("Destroying VR pipeline {}", renderPass); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisProgramUniformsMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisProgramUniformsMixin.java index 1c7172165..83ffee861 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisProgramUniformsMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisProgramUniformsMixin.java @@ -1,14 +1,17 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.coderbot.iris.gl.program.ProgramUniforms; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(ProgramUniforms.class) @@ -21,14 +24,14 @@ public class IrisProgramUniformsMixin { // modify the frame counter on RenderPasChange, so perFrame Uniforms are recalculated - @ModifyVariable(method = "update", at = @At(value = "STORE"), remap = false) + @ModifyVariable(method = "update", at = @At("STORE"), remap = false) private int checkNewFrame(int currentFrame) { if (!RenderPassType.isVanilla()) { actualFrame = currentFrame; - if (lastFrame == currentFrame && lastPass != ClientDataHolderVR.getInstance().currentPass) { + if (lastFrame == currentFrame && lastPass != dh.currentPass) { currentFrame--; } - lastPass = ClientDataHolderVR.getInstance().currentPass; + lastPass = dh.currentPass; } return currentFrame; } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisRenderSystemVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisRenderSystemVRMixin.java index 251f44f9b..3bad2db9b 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisRenderSystemVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisRenderSystemVRMixin.java @@ -1,12 +1,14 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.coderbot.iris.gl.IrisRenderSystem; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(IrisRenderSystem.class) diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java index 4aeda2503..78037aef0 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java @@ -1,15 +1,20 @@ package org.vivecraft.mod_compat_vr.iris.mixin; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + +import org.joml.Matrix4f; + import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.world.phys.Vec3; -import org.joml.Matrix4f; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(targets = {"net.coderbot.iris.shadow.ShadowMatrices", "net.coderbot.iris.shadows.ShadowMatrices"}) @@ -35,11 +40,11 @@ private static void cacheInterval143(PoseStack target, float shadowIntervalSize, } // offset camera pos, to be in the equal grid as left eye, but with correct offset - @ModifyVariable( method = "snapModelViewToGrid", at = @At(value = "STORE"), ordinal = 1, remap = false) + @ModifyVariable( method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 1, remap = false) private static float modifyOffsetX(float original){ if (!RenderPassType.isVanilla()) { - currentPass = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getPosition(); - if (ClientDataHolderVR.getInstance().currentPass == RenderPass.LEFT) { + currentPass = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); + if (dh.currentPass == RenderPass.LEFT) { leftPass = currentPass; } return (float) (leftPass.x % cachedShadowIntervalSize - (leftPass.x - currentPass.x)); @@ -47,7 +52,7 @@ private static float modifyOffsetX(float original){ return original; } } - @ModifyVariable( method = "snapModelViewToGrid", at = @At(value = "STORE"), ordinal = 2, remap = false) + @ModifyVariable( method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 2, remap = false) private static float modifyOffsetY(float original){ if (!RenderPassType.isVanilla()) { return (float) (leftPass.y % cachedShadowIntervalSize - (leftPass.y - currentPass.y)); @@ -55,7 +60,7 @@ private static float modifyOffsetY(float original){ return original; } } - @ModifyVariable( method = "snapModelViewToGrid", at = @At(value = "STORE"), ordinal = 3, remap = false) + @ModifyVariable( method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 3, remap = false) private static float modifyOffsetZ(float original){ if (!RenderPassType.isVanilla()) { return (float) (leftPass.z % cachedShadowIntervalSize - (leftPass.z - currentPass.z)); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowRendererMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowRendererMixin.java index b5aa90b5a..5eac7d832 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowRendererMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowRendererMixin.java @@ -1,56 +1,63 @@ package org.vivecraft.mod_compat_vr.iris.mixin; -import com.mojang.blaze3d.vertex.PoseStack; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.coderbot.iris.mixin.LevelRendererAccessor; import net.coderbot.iris.pipeline.ShadowRenderer; + +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(ShadowRenderer.class) public class IrisShadowRendererMixin { @Inject(method = "renderPlayerEntity", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/mixin/LevelRendererAccessor;invokeRenderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", ordinal = 2)) - private void setRVE(LevelRendererAccessor par1, EntityRenderDispatcher par2, MultiBufferSource.BufferSource par3, PoseStack par4, float par5, Frustum par6, double par7, double par8, double par9, CallbackInfoReturnable cir) { + private void setRVE(LevelRendererAccessor par1, EntityRenderDispatcher par2, BufferSource par3, PoseStack par4, float par5, Frustum par6, double par7, double par8, double par9, CallbackInfoReturnable cir) { if (!RenderPassType.isVanilla()) { - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).restoreRVEPos(Minecraft.getInstance().player); + ((GameRendererExtension) mc.gameRenderer).restoreRVEPos(mc.player); } } - @Inject(method = "renderPlayerEntity", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/mixin/LevelRendererAccessor;invokeRenderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", ordinal = 2, shift = At.Shift.AFTER)) - private void resetRVE(LevelRendererAccessor par1, EntityRenderDispatcher par2, MultiBufferSource.BufferSource par3, PoseStack par4, float par5, Frustum par6, double par7, double par8, double par9, CallbackInfoReturnable cir) { + @Inject(method = "renderPlayerEntity", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/mixin/LevelRendererAccessor;invokeRenderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", ordinal = 2, shift = Shift.AFTER)) + private void resetRVE(LevelRendererAccessor par1, EntityRenderDispatcher par2, BufferSource par3, PoseStack par4, float par5, Frustum par6, double par7, double par8, double par9, CallbackInfoReturnable cir) { if (!RenderPassType.isVanilla()) { - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).cacheRVEPos(Minecraft.getInstance().player); - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).setupRVE(); + ((GameRendererExtension) mc.gameRenderer).cacheRVEPos(mc.player); + ((GameRendererExtension) mc.gameRenderer).setupRVE(); } } @Redirect(method = "renderEntities", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/mixin/LevelRendererAccessor;invokeRenderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V")) private void setRVE2(LevelRendererAccessor instance, Entity entity, double x, double y, double z, float f, PoseStack poseStack, MultiBufferSource multiBufferSource) { if (!RenderPassType.isVanilla()) { - if (entity == Minecraft.getInstance().getCameraEntity()) { - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).restoreRVEPos((LivingEntity) entity); + if (entity == mc.getCameraEntity()) { + ((GameRendererExtension) mc.gameRenderer).restoreRVEPos((LivingEntity) entity); } instance.invokeRenderEntity(entity, x, y, z, f, poseStack, multiBufferSource); - if (entity == Minecraft.getInstance().getCameraEntity()) { - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).cacheRVEPos((LivingEntity) entity); - ((GameRendererExtension) Minecraft.getInstance().gameRenderer).setupRVE(); + if (entity == mc.getCameraEntity()) { + ((GameRendererExtension) mc.gameRenderer).cacheRVEPos((LivingEntity) entity); + ((GameRendererExtension) mc.gameRenderer).setupRVE(); } } else { instance.invokeRenderEntity(entity, x, y, z, f, poseStack, multiBufferSource); @@ -61,7 +68,7 @@ private void setRVE2(LevelRendererAccessor instance, Entity entity, double x, do // cancel them here, or we would also cancel prepare shaders @Inject(method = "renderShadows", at = @At("HEAD"), cancellable = true) private void onlyOneShadow(LevelRendererAccessor par1, Camera par2, CallbackInfo ci) { - if (!RenderPassType.isVanilla() && !ClientDataHolderVR.getInstance().isFirstPass) { + if (!RenderPassType.isVanilla() && !dh.isFirstPass) { ci.cancel(); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java index 4f0ce7dc0..ddc139a57 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java @@ -1,17 +1,18 @@ package org.vivecraft.mod_compat_vr.optifine; -import net.minecraft.client.Minecraft; import net.minecraft.client.Options; -import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.ModelPart.Vertex; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.phys.Vec3; -import org.vivecraft.client_vr.settings.VRSettings; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.logger; + public class OptifineHelper { private static boolean checkedForOptifine = false; @@ -32,7 +33,7 @@ public class OptifineHelper { private static Class customColors; private static Method customColorsGetSkyColorMethod; - private static Method customColorsGetSkyColoEndMethod; + private static Method customColorsGetSkyColorEndMethod; private static Method customColorsGetUnderwaterColorMethod; private static Method customColorsGetUnderlavaColorMethod; private static Method customColorsGetFogColorMethod; @@ -57,10 +58,10 @@ public static boolean isOptifineLoaded() { // check for optifine with a class search try { Class.forName("net.optifine.Config"); - VRSettings.logger.info("Vivecraft: Optifine detected"); + logger.info("Optifine detected"); optifineLoaded = true; } catch (ClassNotFoundException ignore) { - VRSettings.logger.info("Vivecraft: Optifine not detected"); + logger.info("Optifine not detected"); optifineLoaded = false; } if (optifineLoaded) { @@ -167,7 +168,7 @@ public static boolean isAntialiasing() { public static void setRenderRegions(boolean active) { try { - optionsOfRenderRegions.set(Minecraft.getInstance().options, active); + optionsOfRenderRegions.set(mc.options, active); } catch (IllegalAccessException e) { e.printStackTrace(); } @@ -184,7 +185,7 @@ public static Vec3 getCustomSkyColor(Vec3 skyColor, BlockAndTintGetter blockAcce public static Vec3 getCustomSkyColorEnd(Vec3 skyColor) { try { - return (Vec3)customColorsGetSkyColoEndMethod.invoke(customColors, skyColor); + return (Vec3)customColorsGetSkyColorEndMethod.invoke(customColors, skyColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return skyColor; @@ -239,7 +240,7 @@ public static Vec3 getCustomFogColorNether(Vec3 fogColor) { public static double getCloudHeight() { try { - return (double)optionsOfCloudHeight.get(Minecraft.getInstance().options); + return (double)optionsOfCloudHeight.get(mc.options); } catch (IllegalAccessException e) { e.printStackTrace(); return 0; @@ -254,7 +255,7 @@ public static void markTextureAsActive(TextureAtlasSprite sprite) { } } - public static void copyRenderPositions(ModelPart.Vertex source, ModelPart.Vertex dest) { + public static void copyRenderPositions(Vertex source, Vertex dest) { if (vertexRenderPositions != null) { try { vertexRenderPositions.set(dest, vertexRenderPositions.get(source)); @@ -297,8 +298,8 @@ private static void init() { shadersEndEntitiesMethod = shaders.getMethod("endEntities"); // private methods - customColorsGetSkyColoEndMethod = customColors.getDeclaredMethod("getSkyColorEnd", Vec3.class); - customColorsGetSkyColoEndMethod.setAccessible(true); + customColorsGetSkyColorEndMethod = customColors.getDeclaredMethod("getSkyColorEnd", Vec3.class); + customColorsGetSkyColorEndMethod.setAccessible(true); customColorsGetFogColorMethod = customColors.getDeclaredMethod("getFogColor", Vec3.class, BlockAndTintGetter.class, double.class, double.class, double.class); customColorsGetFogColorMethod.setAccessible(true); customColorsGetFogColorEndMethod = customColors.getDeclaredMethod("getFogColorEnd", Vec3.class); @@ -307,20 +308,20 @@ private static void init() { customColorsGetFogColorNetherMethod.setAccessible(true); try { - vertexRenderPositions = ModelPart.Vertex.class.getField("renderPositions"); + vertexRenderPositions = Vertex.class.getField("renderPositions"); } catch (NoSuchFieldException e) { // this version doesn't have the entity render improvements vertexRenderPositions = null; } } catch (ClassNotFoundException e) { - VRSettings.logger.error("Optifine detected, but couldn't load class: {}", e.getMessage()); + logger.error("Optifine detected, but couldn't load class: {}", e.getMessage()); optifineLoaded = false; } catch (NoSuchMethodException e) { - VRSettings.logger.error("Optifine detected, but couldn't load Method: {}", e.getMessage()); + logger.error("Optifine detected, but couldn't load Method: {}", e.getMessage()); optifineLoaded = false; } catch (NoSuchFieldException e) { - VRSettings.logger.error("Optifine detected, but couldn't load Field: {}", e.getMessage()); + logger.error("Optifine detected, but couldn't load Field: {}", e.getMessage()); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java index 93699a74c..2f9c0ce8a 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java @@ -1,36 +1,41 @@ package org.vivecraft.mod_compat_vr.optifine.mixin; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Camera; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.mc; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; @Pseudo @Mixin(targets = "net.optifine.shaders.ShadersRender") public class ShadersRenderVRMixin { @Shadow - public static void updateActiveRenderInfo(Camera activeRenderInfo, Minecraft mc, float partialTicks){}; + public static void updateActiveRenderInfo(Camera activeRenderInfo, net.minecraft.client.Minecraft mc, float partialTicks){}; @Unique - private static Method setCameraShadow = null; + private static Method setCameraShadow; @Inject(at = @At("HEAD"), method = "renderHand0", remap = false, cancellable = true) private static void noTranslucentHandsInVR (CallbackInfo ci){ @@ -48,7 +53,7 @@ private static void noSolidHandsInVR (CallbackInfo ci){ @Inject(at = @At(value = "INVOKE",target = "Lnet/minecraft/client/Minecraft;getInstance()Lnet/minecraft/client/Minecraft;", remap = true), method = "renderShadowMap", remap = false, cancellable = true) private static void shadowsOnlyOnce(GameRenderer gameRenderer, Camera activeRenderInfo, int pass, float partialTicks, long finishTimeNano, CallbackInfo ci){ - if (!RenderPassType.isVanilla() && ClientDataHolderVR.getInstance().currentPass != RenderPass.LEFT) { + if (!RenderPassType.isVanilla() && dh.currentPass != RenderPass.LEFT) { if (setCameraShadow == null) { try { setCameraShadow = Class.forName("net.optifine.shaders.Shaders").getMethod("setCameraShadow", PoseStack.class, Camera.class, float.class); @@ -58,7 +63,7 @@ private static void shadowsOnlyOnce(GameRenderer gameRenderer, Camera activeRend } } try { - updateActiveRenderInfo(activeRenderInfo, Minecraft.getInstance(), partialTicks); + updateActiveRenderInfo(activeRenderInfo, mc, partialTicks); setCameraShadow.invoke(null, new PoseStack(), activeRenderInfo, partialTicks); } catch (IllegalAccessException | InvocationTargetException ignored) { } @@ -66,14 +71,14 @@ private static void shadowsOnlyOnce(GameRenderer gameRenderer, Camera activeRend } } - @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = At.Shift.BEFORE), ordinal = 0, method = "renderShadowMap", remap = false) + @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = Shift.BEFORE), ordinal = 0, method = "renderShadowMap", remap = false) private static Entity fixPlayerPos(Entity entity, GameRenderer gameRenderer, Camera activeRenderInfo){ if (!RenderPassType.isVanilla() && entity == activeRenderInfo.entity) { ((GameRendererExtension)gameRenderer).restoreRVEPos((LivingEntity)entity); } return entity; } - @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = At.Shift.AFTER), ordinal = 0, method = "renderShadowMap", remap = false) + @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = Shift.AFTER), ordinal = 0, method = "renderShadowMap", remap = false) private static Entity restorePlayerPos(Entity entity, GameRenderer gameRenderer, Camera activeRenderInfo){ if (!RenderPassType.isVanilla() && entity == activeRenderInfo.entity) { ((GameRendererExtension)gameRenderer).cacheRVEPos((LivingEntity)entity); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java index c87f6762a..8afcb7690 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java @@ -1,17 +1,25 @@ package org.vivecraft.mod_compat_vr.optifine.mixin; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Camera; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo @Mixin(targets = "net.optifine.shaders.Shaders") @@ -27,15 +35,15 @@ private static Vec3 positionCameraForShadows(Camera camera){ if (RenderPassType.isVanilla()) { return camera.getPosition(); } else { - return ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); } } - @ModifyVariable(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack$Pose;pose()Lorg/joml/Matrix4f;", shift = At.Shift.AFTER, remap = true), method = "setCameraShadow", remap = false) + @ModifyVariable(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack$Pose;pose()Lorg/joml/Matrix4f;", shift = Shift.AFTER, remap = true), method = "setCameraShadow", remap = false) private static PoseStack offsetShadow(PoseStack shadowModelViewMat){ if (!RenderPassType.isVanilla()) { - Vec3 offset = ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(ClientDataHolderVR.getInstance().currentPass).getPosition().subtract(ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition()); - shadowModelViewMat.translate((float) offset.x, (float) offset.y, (float) offset.z); + Vec3 offset = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition().subtract(dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition()); + shadowModelViewMat.last().pose().translate((float) offset.x, (float) offset.y, (float) offset.z); } return shadowModelViewMat; } @@ -45,7 +53,7 @@ private static double sameX(Entity entity) { if (RenderPassType.isVanilla()) { return entity.getX(); } else { - return ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().x; + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().x; } } @@ -54,7 +62,7 @@ private static double sameZ(Entity entity) { if (RenderPassType.isVanilla()) { return entity.getZ(); } else { - return ClientDataHolderVR.getInstance().vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().z; + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().z; } } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/pehkui/PehkuiHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/pehkui/PehkuiHelper.java index eccdd063c..9689575d8 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/pehkui/PehkuiHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/pehkui/PehkuiHelper.java @@ -1,8 +1,9 @@ package org.vivecraft.mod_compat_vr.pehkui; -import net.minecraft.world.entity.Entity; import virtuoel.pehkui.util.ScaleUtils; +import net.minecraft.world.entity.Entity; + public class PehkuiHelper { public static float getPlayerScale(Entity player, float tickDelta) { return ScaleUtils.getEyeHeightScale(player, tickDelta); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/physicsmod/mixin/OptionsScreenMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/physicsmod/mixin/OptionsScreenMixin.java index 074c5ff50..9dc61762b 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/physicsmod/mixin/OptionsScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/physicsmod/mixin/OptionsScreenMixin.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/rei/mixin/reiTextFieldWidgetMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/rei/mixin/reiTextFieldWidgetMixin.java index 4b7e0bb46..0584194a6 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/rei/mixin/reiTextFieldWidgetMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/rei/mixin/reiTextFieldWidgetMixin.java @@ -1,13 +1,15 @@ package org.vivecraft.mod_compat_vr.rei.mixin; +import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; @Pseudo @Mixin(targets = {"me.shedaniel.rei.impl.client.gui.widget.basewidgets.TextFieldWidget"}) @@ -15,7 +17,7 @@ public class reiTextFieldWidgetMixin { @Inject(method = "setFocused(Z)V", at = @At("HEAD")) private void openKeyboard(boolean focused, CallbackInfo ci) { - if (VRState.vrRunning && !ClientDataHolderVR.getInstance().vrSettings.seated) { + if (vrRunning && !dh.vrSettings.seated) { KeyboardHandler.setOverlayShowing(focused); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/ResolutionControlHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/ResolutionControlHelper.java index 964100829..63316bcc3 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/ResolutionControlHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/ResolutionControlHelper.java @@ -1,8 +1,9 @@ package org.vivecraft.mod_compat_vr.resolutioncontrol; +import org.vivecraft.client.Xplat; + import io.github.ultimateboomer.resolutioncontrol.util.Config; import io.github.ultimateboomer.resolutioncontrol.util.DynamicResolutionHandler; -import org.vivecraft.client.Xplat; public class ResolutionControlHelper { diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/mixin/ResolutionControlModMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/mixin/ResolutionControlModMixin.java index 97482947c..e3f09f42d 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/mixin/ResolutionControlModMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/resolutioncontrol/mixin/ResolutionControlModMixin.java @@ -1,16 +1,19 @@ package org.vivecraft.mod_compat_vr.resolutioncontrol.mixin; +import org.vivecraft.client_xr.render_pass.RenderPassType; +import org.vivecraft.client_xr.render_pass.WorldRenderPass; + import io.github.ultimateboomer.resolutioncontrol.ResolutionControlMod; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrRunning; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; 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; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; -import org.vivecraft.client_xr.render_pass.RenderPassType; -import org.vivecraft.client_xr.render_pass.WorldRenderPass; @Pseudo @Mixin(ResolutionControlMod.class) @@ -26,21 +29,21 @@ private void dontResizeGUI(boolean shouldScale, CallbackInfo ci) { @Inject(at = @At("HEAD"), method = "updateFramebufferSize", remap = false) private void resizeVRBuffers(CallbackInfo ci) { - if (VRState.vrRunning) { - ClientDataHolderVR.getInstance().vrRenderer.resizeFrameBuffers(""); + if (vrRunning) { + dh.vrRenderer.resizeFrameBuffers(""); } } @Inject(at = @At("HEAD"), method = "getCurrentWidth", remap = false, cancellable = true) public void getVRWidth(CallbackInfoReturnable cir) { - if (VRState.vrRunning) { + if (vrRunning) { cir.setReturnValue(WorldRenderPass.stereoXR.target.width); } } @Inject(at = @At("HEAD"), method = "getCurrentHeight", remap = false, cancellable = true) public void getVRHeight(CallbackInfoReturnable cir) { - if (VRState.vrRunning) { + if (vrRunning) { cir.setReturnValue(WorldRenderPass.stereoXR.target.height); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java index 816677511..7a048c3be 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java @@ -1,11 +1,13 @@ package org.vivecraft.mod_compat_vr.sodium; +import org.vivecraft.client.Xplat; + import it.unimi.dsi.fastutil.longs.LongArrayFIFOQueue; import me.jellysquid.mods.sodium.client.SodiumClientMod; import me.jellysquid.mods.sodium.client.render.texture.SpriteUtil; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; import org.lwjgl.opengl.GL32C; -import org.vivecraft.client.Xplat; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; public class SodiumHelper { static final LongArrayFIFOQueue fences = new LongArrayFIFOQueue(); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/FabricSodiumGameOptionPagesVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/FabricSodiumGameOptionPagesVRMixin.java index 828209c54..402e5c6f9 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/FabricSodiumGameOptionPagesVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/FabricSodiumGameOptionPagesVRMixin.java @@ -1,15 +1,18 @@ package org.vivecraft.mod_compat_vr.sodium.mixin; -import org.vivecraft.client_vr.ClientDataHolderVR; import me.jellysquid.mods.sodium.client.gui.SodiumGameOptionPages; + import net.minecraft.client.GraphicsStatus; import net.minecraft.client.Options; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrInitialized; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.VRState; @Pseudo @Mixin(SodiumGameOptionPages.class) @@ -17,8 +20,8 @@ public class FabricSodiumGameOptionPagesVRMixin { @Inject(at = @At("HEAD"), method = "lambda$quality$23", remap = false) private static void initframe(Options opts, GraphicsStatus value, CallbackInfo ci) { - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("gfx setting change"); + if (vrInitialized) { + dh.vrRenderer.reinitFrameBuffers("gfx setting change"); } } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/ForgeSodiumGameOptionPagesVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/ForgeSodiumGameOptionPagesVRMixin.java index 052f56fe1..7ad8c4ead 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/ForgeSodiumGameOptionPagesVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/ForgeSodiumGameOptionPagesVRMixin.java @@ -1,15 +1,18 @@ package org.vivecraft.mod_compat_vr.sodium.mixin; import me.jellysquid.mods.sodium.client.gui.SodiumGameOptionPages; + import net.minecraft.client.GraphicsStatus; import net.minecraft.client.Options; + +import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.client_vr.VRState.vrInitialized; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.VRState; @Pseudo @Mixin(SodiumGameOptionPages.class) @@ -17,8 +20,8 @@ public class ForgeSodiumGameOptionPagesVRMixin { @Inject(at = @At("HEAD"), method = "lambda$quality$23", remap = false) private static void initframe(Options opts, GraphicsStatus value, CallbackInfo ci) { - if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vrRenderer.reinitFrameBuffers("gfx setting change"); + if (vrInitialized) { + dh.vrRenderer.reinitFrameBuffers("gfx setting change"); } } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/RenderSectionManagerVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/RenderSectionManagerVRMixin.java index 5583eec08..5d20251a0 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/RenderSectionManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/RenderSectionManagerVRMixin.java @@ -2,6 +2,7 @@ import me.jellysquid.mods.sodium.client.render.chunk.RenderSectionManager; import me.jellysquid.mods.sodium.client.render.chunk.lists.ChunkRenderList; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/SodiumWorldRendererVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/SodiumWorldRendererVRMixin.java index fc26bda8f..27fd9ba2b 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/SodiumWorldRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/mixin/SodiumWorldRendererVRMixin.java @@ -1,11 +1,13 @@ package org.vivecraft.mod_compat_vr.sodium.mixin; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Pseudo diff --git a/common/src/main/java/org/vivecraft/server/AimFixHandler.java b/common/src/main/java/org/vivecraft/server/AimFixHandler.java index 1dae32793..7de441616 100644 --- a/common/src/main/java/org/vivecraft/server/AimFixHandler.java +++ b/common/src/main/java/org/vivecraft/server/AimFixHandler.java @@ -1,8 +1,11 @@ package org.vivecraft.server; +import org.vivecraft.server.config.ServerConfig; + import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.util.ReferenceCountUtil; + import net.minecraft.network.Connection; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; @@ -12,7 +15,10 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.phys.Vec3; -import org.vivecraft.server.config.ServerConfig; + +import static org.vivecraft.common.utils.Utils.logger; + +import static org.joml.Math.*; public class AimFixHandler extends ChannelInboundHandlerAdapter { @@ -55,14 +61,14 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { serverplayer.xo = aimPos.x; serverplayer.yo = aimPos.y; serverplayer.zo = aimPos.z; - serverplayer.setXRot((float)Math.toDegrees(Math.asin(-dir.y))); - serverplayer.setYRot((float)Math.toDegrees(Math.atan2(-dir.x, dir.z))); + serverplayer.setXRot((float)toDegrees(asin(-dir.y))); + serverplayer.setYRot((float)toDegrees(atan2(-dir.x, dir.z))); serverplayer.xRotO = serverplayer.getXRot(); serverplayer.yRotO = serverplayer.yHeadRotO = serverplayer.yHeadRot = serverplayer.getYRot(); serverplayer.eyeHeight = 0.0001F; serverviveplayer.offset = position.subtract(aimPos); if (ServerConfig.debug.get()) { - System.out.println("AimFix " + aimPos.x + " " + aimPos.y + " " + aimPos.z + " " + (float) Math.toDegrees(Math.asin(-dir.y)) + " " + (float) Math.toDegrees(Math.atan2(-dir.x, dir.z))); + logger.info("AimFix " + aimPos.x + " " + aimPos.y + " " + aimPos.z + " " + (float) toDegrees(asin(-dir.y)) + " " + (float) toDegrees(atan2(-dir.x, dir.z))); } } @@ -73,7 +79,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { { ((Packet)msg).handle(this.netManager.getPacketListener()); } - catch (RunningOnDifferentThreadException runningondifferentthreadexception) + catch (RunningOnDifferentThreadException ignored) { } } @@ -86,7 +92,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { if ((aimPos != null && !serverplayer.position().equals(aimPos)) || (aimPos == null && !serverplayer.position().equals(position))) { position = serverplayer.position(); if (ServerConfig.debug.get()) { - System.out.println("AimFix moved Player to " + position.x + " " + position.y + " " + position.z); + logger.info("AimFix moved Player to {}", position); } } diff --git a/common/src/main/java/org/vivecraft/server/ServerNetworking.java b/common/src/main/java/org/vivecraft/server/ServerNetworking.java index b14b43aa5..49c93db00 100644 --- a/common/src/main/java/org/vivecraft/server/ServerNetworking.java +++ b/common/src/main/java/org/vivecraft/server/ServerNetworking.java @@ -1,7 +1,14 @@ package org.vivecraft.server; -import com.mojang.logging.LogUtils; +import org.vivecraft.common.CommonDataHolder; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; +import org.vivecraft.common.network.VRPlayerState; +import org.vivecraft.mixin.server.ChunkMapAccessor; +import org.vivecraft.server.config.ServerConfig; + import io.netty.buffer.Unpooled; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; @@ -12,32 +19,31 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; -import org.slf4j.Logger; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.common.network.VrPlayerState; -import org.vivecraft.common.CommonDataHolder; -import org.vivecraft.mixin.server.ChunkMapAccessor; -import org.vivecraft.server.config.ServerConfig; import java.util.*; -public class ServerNetworking { +import static org.vivecraft.common.utils.Utils.logger; +import static org.vivecraft.server.ServerVRPlayers.getVivePlayer; - // temporarily stores the packets from legacy clients to assemble a complete VrPlayerState - private final static Map> legacyDataMap = new HashMap<>(); +import static org.joml.Math.*; - private static final Logger LOGGER = LogUtils.getLogger(); +public class ServerNetworking { - public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetID, FriendlyByteBuf buffer, ServerGamePacketListenerImpl listener) { - var playerEntity = listener.player; - ServerVivePlayer vivePlayer = ServerVRPlayers.getVivePlayer(playerEntity); + // temporarily stores the packets from legacy clients to assemble a complete VRPlayerState + private static final Map> legacyDataMap = new HashMap<>(); - if (vivePlayer == null && packetID != CommonNetworkHelper.PacketDiscriminators.VERSION) { + public static void handlePacket(PacketDiscriminators packetID, FriendlyByteBuf buffer, ServerGamePacketListenerImpl listener) { + ServerPlayer playerEntity = listener.player; + ServerVivePlayer vivePlayer = getVivePlayer(playerEntity); + + if (vivePlayer == null && packetID != PacketDiscriminators.VERSION) + { return; } switch (packetID) { - case VERSION: + case VERSION -> + { // Vivecraft client connected, send server settings vivePlayer = new ServerVivePlayer(playerEntity); @@ -48,39 +54,49 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI String[] parts = new String(stringBytes).split("\\n"); String clientVivecraftVersion = parts[0]; - if (ServerConfig.debug.get()) { - LOGGER.info("Vivecraft: player '{}' joined with {}", listener.player.getName().getString(), clientVivecraftVersion); + if (ServerConfig.debug.get()) + { + logger.info("player '{}' joined with {}", listener.player.getName().getString(), clientVivecraftVersion); } - if (parts.length >= 3) { + if (parts.length >= 3) + { // has versions int clientMaxVersion = Integer.parseInt(parts[1]); int clientMinVersion = Integer.parseInt(parts[2]); // check if client supports a supported version if (CommonNetworkHelper.MIN_SUPPORTED_NETWORK_VERSION <= clientMaxVersion - && clientMinVersion <= CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION) { - vivePlayer.networkVersion = Math.min(clientMaxVersion, CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION); - if (ServerConfig.debug.get()) { - LOGGER.info("{} networking supported, using version {}", listener.player.getName().getString(), vivePlayer.networkVersion); + && clientMinVersion <= CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION) + { + vivePlayer.networkVersion = min(clientMaxVersion, CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION); + if (ServerConfig.debug.get()) + { + logger.info("{} networking supported, using version {}", listener.player.getName().getString(), vivePlayer.networkVersion); } - } else { + } + else + { // unsupported version, send notification, and disregard listener.player.sendSystemMessage(Component.literal("Unsupported vivecraft version, VR features will not work")); - if (ServerConfig.debug.get()) { - LOGGER.info("{} networking not supported. client range [{},{}], server range [{},{}]", - listener.player.getName().getString(), - clientMinVersion, - clientMaxVersion, - CommonNetworkHelper.MIN_SUPPORTED_NETWORK_VERSION, - CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION); + if (ServerConfig.debug.get()) + { + logger.info("{} networking not supported. client range [{},{}], server range [{},{}]", + listener.player.getName().getString(), + clientMinVersion, + clientMaxVersion, + CommonNetworkHelper.MIN_SUPPORTED_NETWORK_VERSION, + CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION); } return; } - } else { + } + else + { // client didn't send a version, so it's a legacy client vivePlayer.networkVersion = -1; - if (ServerConfig.debug.get()) { - LOGGER.info("{} using legacy networking", listener.player.getName().getString()); + if (ServerConfig.debug.get()) + { + logger.info("{} using legacy networking", listener.player.getName().getString()); } } @@ -88,120 +104,118 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI ServerVRPlayers.getPlayersWithVivecraft(listener.player.server).put(playerEntity.getUUID(), vivePlayer); - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.VERSION, CommonDataHolder.getInstance().versionIdentifier)); - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.REQUESTDATA, new byte[0])); + listener.send(getVivecraftServerPacket(PacketDiscriminators.VERSION, CommonDataHolder.getInstance().versionIdentifier)); + listener.send(getVivecraftServerPacket(PacketDiscriminators.REQUESTDATA, new byte[0])); - if (ServerConfig.climbeyEnabled.get()) { + if (ServerConfig.climbeyEnabled.get()) + { listener.send(getClimbeyServerPacket()); } - if (ServerConfig.teleportEnabled.get()) { - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.TELEPORT, new byte[0])); + if (ServerConfig.teleportEnabled.get()) + { + listener.send(getVivecraftServerPacket(PacketDiscriminators.TELEPORT, new byte[0])); } - if (ServerConfig.teleportLimitedSurvival.get()) { + if (ServerConfig.teleportLimitedSurvival.get()) + { FriendlyByteBuf byteBuf = new FriendlyByteBuf(Unpooled.buffer()); byteBuf.writeUtf("limitedTeleport"); - byteBuf.writeUtf(""+true); + byteBuf.writeUtf(String.valueOf(true)); byteBuf.writeUtf("teleportLimitUp"); - byteBuf.writeUtf(""+ ServerConfig.teleportUpLimit.get()); + byteBuf.writeUtf(String.valueOf(ServerConfig.teleportUpLimit.get())); byteBuf.writeUtf("teleportLimitDown"); - byteBuf.writeUtf(""+ ServerConfig.teleportDownLimit.get()); + byteBuf.writeUtf(String.valueOf(ServerConfig.teleportDownLimit.get())); byteBuf.writeUtf("teleportLimitHoriz"); - byteBuf.writeUtf(""+ ServerConfig.teleportHorizontalLimit.get()); + byteBuf.writeUtf(String.valueOf(ServerConfig.teleportHorizontalLimit.get())); - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.SETTING_OVERRIDE, byteBuf.readByteArray())); + listener.send(getVivecraftServerPacket(PacketDiscriminators.SETTING_OVERRIDE, byteBuf.readByteArray())); } - if (ServerConfig.worldscaleLimited.get()) { + if (ServerConfig.worldscaleLimited.get()) + { FriendlyByteBuf byteBuf = new FriendlyByteBuf(Unpooled.buffer()); byteBuf.writeUtf("worldScale.min"); - byteBuf.writeUtf(""+ ServerConfig.worldscaleMin.get()); + byteBuf.writeUtf(String.valueOf(ServerConfig.worldscaleMin.get())); byteBuf.writeUtf("worldScale.max"); - byteBuf.writeUtf(""+ ServerConfig.worldscaleMax.get()); + byteBuf.writeUtf(String.valueOf(ServerConfig.worldscaleMax.get())); - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.SETTING_OVERRIDE, byteBuf.readByteArray())); + listener.send(getVivecraftServerPacket(PacketDiscriminators.SETTING_OVERRIDE, byteBuf.readByteArray())); } - if (ServerConfig.crawlingEnabled.get()) { - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.CRAWL, new byte[0])); + if (ServerConfig.crawlingEnabled.get()) + { + listener.send(getVivecraftServerPacket(PacketDiscriminators.CRAWL, new byte[0])); } // send if hotswitching is allowed - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.VR_SWITCHING, new byte[]{(byte)(ServerConfig.vrSwitchingEnabled.get() && !ServerConfig.vr_only.get() ? 1 : 0)})); + listener.send(getVivecraftServerPacket(PacketDiscriminators.VR_SWITCHING, new byte[]{(byte)(ServerConfig.vrSwitchingEnabled.get() && !ServerConfig.vr_only.get() ? 1 : 0)})); - listener.send(getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators.NETWORK_VERSION, new byte[]{(byte)vivePlayer.networkVersion})); + listener.send(getVivecraftServerPacket(PacketDiscriminators.NETWORK_VERSION, new byte[]{(byte)vivePlayer.networkVersion})); break; - case IS_VR_ACTIVE: - if (vivePlayer.isVR() == buffer.readBoolean()) { - break; - } - vivePlayer.setVR(!vivePlayer.isVR()); - if (!vivePlayer.isVR()) { - for (var trackingPlayer : ServerNetworking.getTrackingPlayers(playerEntity)) { - if (!ServerVRPlayers.getPlayersWithVivecraft(listener.player.server).containsKey(trackingPlayer.getPlayer().getUUID()) || trackingPlayer.getPlayer() == playerEntity) { - continue; + } + case IS_VR_ACTIVE -> + { + if (vivePlayer.isVR() != buffer.readBoolean()) + { + vivePlayer.setVR(!vivePlayer.isVR()); + if (!vivePlayer.isVR()) + { + for (ServerPlayerConnection trackingPlayer : getTrackingPlayers(playerEntity)) + { + if (!ServerVRPlayers.getPlayersWithVivecraft(listener.player.server).containsKey(trackingPlayer.getPlayer().getUUID()) || trackingPlayer.getPlayer() == playerEntity) + { + continue; + } + trackingPlayer.send(createVRActivePlayerPacket(false, playerEntity.getUUID())); } - trackingPlayer.send(createVRActivePlayerPacket(false, playerEntity.getUUID())); } } - break; + } - case DRAW: - vivePlayer.draw = buffer.readFloat(); - break; + case DRAW -> vivePlayer.draw = buffer.readFloat(); - case VR_PLAYER_STATE: - vivePlayer.vrPlayerState = VrPlayerState.deserialize(buffer); + case VR_PLAYER_STATE -> vivePlayer.vrPlayerState = VRPlayerState.deserialize(buffer); - case MOVEMODE: - case REQUESTDATA: - default: - break; - - case WORLDSCALE: - vivePlayer.worldScale = buffer.readFloat(); - break; - case HEIGHT: - vivePlayer.heightScale = buffer.readFloat(); - break; - - case TELEPORT: + case WORLDSCALE -> vivePlayer.worldScale = buffer.readFloat(); + case HEIGHT -> vivePlayer.heightScale = buffer.readFloat(); + case TELEPORT -> + { float f = buffer.readFloat(); float f1 = buffer.readFloat(); float f2 = buffer.readFloat(); playerEntity.absMoveTo(f, f1, f2, playerEntity.getYRot(), playerEntity.getXRot()); - break; - - case CLIMBING: - playerEntity.fallDistance = 0.0F; - break; - case ACTIVEHAND: + } + case CLIMBING -> playerEntity.fallDistance = 0.0F; + case ACTIVEHAND -> + { vivePlayer.activeHand = buffer.readByte(); - if (vivePlayer.isSeated()) { + if (vivePlayer.isSeated()) + { vivePlayer.activeHand = 0; } + } - break; - - case CRAWL: + case CRAWL-> + { vivePlayer.crawling = buffer.readByte() != 0; - if (vivePlayer.crawling) { + if (vivePlayer.crawling) + { playerEntity.setPose(Pose.SWIMMING); } - break; + } // legacy support - case CONTROLLER0DATA: - case CONTROLLER1DATA: - case HEADDATA: - Map playerData; - if ((playerData = legacyDataMap.get(playerEntity.getUUID())) == null) { + case CONTROLLER0DATA, CONTROLLER1DATA, HEADDATA -> + { + Map playerData; + if ((playerData = legacyDataMap.get(playerEntity.getUUID())) == null) + { playerData = new HashMap<>(); legacyDataMap.put(playerEntity.getUUID(), playerData); } @@ -209,15 +223,16 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI buffer.retain(); playerData.put(packetID, buffer); - if (playerData.size() == 3) { - FriendlyByteBuf controller0Data = playerData.get(CommonNetworkHelper.PacketDiscriminators.CONTROLLER0DATA); + if (playerData.size() == 3) + { + FriendlyByteBuf controller0Data = playerData.get(PacketDiscriminators.CONTROLLER0DATA); controller0Data.resetReaderIndex().readByte(); - FriendlyByteBuf controller1Data = playerData.get(CommonNetworkHelper.PacketDiscriminators.CONTROLLER1DATA); + FriendlyByteBuf controller1Data = playerData.get(PacketDiscriminators.CONTROLLER1DATA); controller1Data.resetReaderIndex().readByte(); - FriendlyByteBuf headData = playerData.get(CommonNetworkHelper.PacketDiscriminators.HEADDATA); + FriendlyByteBuf headData = playerData.get(PacketDiscriminators.HEADDATA); headData.resetReaderIndex().readByte(); - vivePlayer.vrPlayerState = new VrPlayerState( + vivePlayer.vrPlayerState = new VRPlayerState( headData.readBoolean(), // isSeated org.vivecraft.common.network.Pose.deserialize(headData), // head pose controller0Data.readBoolean(), // reverseHands 0 @@ -230,7 +245,7 @@ public static void handlePacket(CommonNetworkHelper.PacketDiscriminators packetI controller1Data.release(); legacyDataMap.remove(playerEntity.getUUID()); } - break; + } } } @@ -243,15 +258,15 @@ public static Set getTrackingPlayers(Entity entity) { public static ClientboundCustomPayloadPacket createVRActivePlayerPacket(boolean vrActive, UUID playerID) { var buffer = new FriendlyByteBuf(Unpooled.buffer()); - buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.IS_VR_ACTIVE.ordinal()); + buffer.writeByte(PacketDiscriminators.IS_VR_ACTIVE.ordinal()); buffer.writeBoolean(vrActive); buffer.writeUUID(playerID); return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); } - public static ClientboundCustomPayloadPacket createUberPacket(Player player, VrPlayerState vrPlayerState, float worldScale, float heightScale) { + public static ClientboundCustomPayloadPacket createUberPacket(Player player, VRPlayerState vrPlayerState, float worldScale, float heightScale) { var buffer = new FriendlyByteBuf(Unpooled.buffer()); - buffer.writeByte(CommonNetworkHelper.PacketDiscriminators.UBERPACKET.ordinal()); + buffer.writeByte(PacketDiscriminators.UBERPACKET.ordinal()); buffer.writeUUID(player.getUUID()); vrPlayerState.serialize(buffer); buffer.writeFloat(worldScale); @@ -259,7 +274,7 @@ public static ClientboundCustomPayloadPacket createUberPacket(Player player, VrP return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); } - public static ClientboundCustomPayloadPacket getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators command, byte[] payload) { + public static ClientboundCustomPayloadPacket getVivecraftServerPacket(PacketDiscriminators command, byte[] payload) { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeBytes(payload); @@ -268,7 +283,7 @@ public static ClientboundCustomPayloadPacket getVivecraftServerPacket(CommonNetw public static ClientboundCustomPayloadPacket getClimbeyServerPacket() { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); - friendlybytebuf.writeByte(CommonNetworkHelper.PacketDiscriminators.CLIMBING.ordinal()); + friendlybytebuf.writeByte(PacketDiscriminators.CLIMBING.ordinal()); friendlybytebuf.writeBoolean(true); if (!"DISABLED".equals(ServerConfig.climbeyBlockmode.get())) { if ("WHITELIST".equals(ServerConfig.climbeyBlockmode.get())) { @@ -286,7 +301,7 @@ public static ClientboundCustomPayloadPacket getClimbeyServerPacket() { return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, friendlybytebuf); } - public static ClientboundCustomPayloadPacket getVivecraftServerPacket(CommonNetworkHelper.PacketDiscriminators command, String payload) { + public static ClientboundCustomPayloadPacket getVivecraftServerPacket(PacketDiscriminators command, String payload) { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeUtf(payload); diff --git a/common/src/main/java/org/vivecraft/server/ServerUtil.java b/common/src/main/java/org/vivecraft/server/ServerUtil.java index c011bdfed..0c963eeed 100644 --- a/common/src/main/java/org/vivecraft/server/ServerUtil.java +++ b/common/src/main/java/org/vivecraft/server/ServerUtil.java @@ -1,14 +1,16 @@ package org.vivecraft.server; +import org.vivecraft.client.utils.UpdateChecker; +import org.vivecraft.server.config.ConfigBuilder.ConfigValue; +import org.vivecraft.server.config.ServerConfig; + import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.*; + import net.minecraft.commands.Commands; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerPlayer; -import org.vivecraft.client.utils.UpdateChecker; -import org.vivecraft.server.config.ConfigBuilder; -import org.vivecraft.server.config.ServerConfig; import java.util.List; import java.util.concurrent.Executors; @@ -133,7 +135,7 @@ public static void registerCommands(CommandDispatcher> listConfig = setting; + ConfigValue> listConfig = setting; dispatcher.register(Commands.literal("vivecraft-server-config") .requires(source -> source.hasPermission(4)).then( Commands.literal(setting.getPath()).then( diff --git a/common/src/main/java/org/vivecraft/server/ServerVRPlayers.java b/common/src/main/java/org/vivecraft/server/ServerVRPlayers.java index b2c6fae8c..74776f2e5 100644 --- a/common/src/main/java/org/vivecraft/server/ServerVRPlayers.java +++ b/common/src/main/java/org/vivecraft/server/ServerVRPlayers.java @@ -17,10 +17,7 @@ public static boolean isVRPlayer(ServerPlayer player) { return false; } ServerVivePlayer serverviveplayer = getVivePlayer(player); - if (serverviveplayer == null) { - return false; - } - return serverviveplayer.isVR(); + return serverviveplayer != null && serverviveplayer.isVR(); } public static void overridePose(ServerPlayer player) { diff --git a/common/src/main/java/org/vivecraft/server/ServerVivePlayer.java b/common/src/main/java/org/vivecraft/server/ServerVivePlayer.java index 75bbda55b..aa9b18d17 100644 --- a/common/src/main/java/org/vivecraft/server/ServerVivePlayer.java +++ b/common/src/main/java/org/vivecraft/server/ServerVivePlayer.java @@ -1,17 +1,25 @@ package org.vivecraft.server; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.Pose; +import org.vivecraft.common.network.VRPlayerState; + +import org.joml.Vector3f; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.Vec3; -import org.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.common.network.VrPlayerState; -import org.vivecraft.common.utils.math.Vector3; import javax.annotation.Nullable; +import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.forward; + +import static org.joml.Math.*; + public class ServerVivePlayer { @Nullable - public VrPlayerState vrPlayerState; + public VRPlayerState vrPlayerState; public float draw; public float worldScale = 1.0F; public float heightScale = 1.0F; @@ -20,8 +28,6 @@ public class ServerVivePlayer { private boolean isVR = false; public Vec3 offset = new Vec3(0.0D, 0.0D, 0.0D); public ServerPlayer player; - final Vector3 forward = new Vector3(0.0F, 0.0F, -1.0F); - public int networkVersion = CommonNetworkHelper.MAX_SUPPORTED_NETWORK_VERSION; public ServerVivePlayer(ServerPlayer player) { @@ -32,29 +38,26 @@ public float getDraw() { return this.draw; } - public Vec3 getControllerVectorCustom(int controller, Vector3 direction) { - if (this.isSeated()) { - controller = 0; - } - - var controllerPose = controller == 0 ? this.vrPlayerState.controller0() : this.vrPlayerState.controller1(); + public Vec3 getControllerVectorCustom(int controller, Vector3f direction) { + Pose controllerPose = (controller == 0 || this.isSeated() ? + this.vrPlayerState.controller0() : + this.vrPlayerState.controller1() + ); - if (controllerPose != null) { - Vector3 vector3 = controllerPose.orientation().multiply(direction); - return new Vec3(vector3.getX(), vector3.getY(), vector3.getZ()); - } else { - return this.player.getLookAngle(); - } + return (controllerPose != null ? + convertToVec3(controllerPose.orientation().transformUnit(direction, new Vector3f())) : + this.player.getLookAngle() + ); } public Vec3 getControllerDir(int controller) { - return this.getControllerVectorCustom(controller, this.forward); + return this.getControllerVectorCustom(controller, new Vector3f(forward)); } public Vec3 getHMDDir() { if (this.vrPlayerState != null) { - Vector3 vector3 = this.vrPlayerState.hmd().orientation().multiply(this.forward); - return new Vec3(vector3.getX(), vector3.getY(), vector3.getZ()); + Vector3f vector3 = this.vrPlayerState.hmd().orientation().transformUnit(new Vector3f(forward), new Vector3f()); + return new Vec3(vector3.x, vector3.y, vector3.z); } return this.player.getLookAngle(); } @@ -72,7 +75,7 @@ public Vec3 getControllerPos(int c, Player player, boolean realPosition) { // TODO: What the fuck is this nonsense? if (this.isSeated() && !realPosition) { Vec3 vec3 = this.getHMDDir(); - vec3 = vec3.yRot((float) Math.toRadians(c == 0 ? -35.0D : 35.0D)); + vec3 = vec3.yRot(toRadians(c == 0 ? -35.0F : 35.0F)); vec3 = new Vec3(vec3.x, 0.0D, vec3.z); vec3 = vec3.normalize(); return this.getHMDPos(player).add(vec3.x * 0.3D * (double) this.worldScale, -0.4D * (double) this.worldScale, vec3.z * 0.3D * (double) this.worldScale); @@ -99,9 +102,6 @@ public void setVR(boolean vr) { } public boolean isSeated() { - if (this.vrPlayerState == null) { - return false; - } - return this.vrPlayerState.seated(); + return this.vrPlayerState != null && this.vrPlayerState.seated(); } } diff --git a/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java b/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java index 8599e0121..0d8a799a0 100644 --- a/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java +++ b/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java @@ -3,6 +3,7 @@ import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.Config; import com.electronwill.nightconfig.core.ConfigSpec; +import com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener; import java.util.*; import java.util.function.Predicate; @@ -64,7 +65,7 @@ private void addDefaultValueComment(List path, double defaultValue, doub * corrects the attached config, with the built spec * @param listener listener to send correction to */ - public void correct(ConfigSpec.CorrectionListener listener) { + public void correct(CorrectionListener listener) { spec.correct(config, listener); } diff --git a/common/src/main/java/org/vivecraft/server/config/ServerConfig.java b/common/src/main/java/org/vivecraft/server/config/ServerConfig.java index b4cfb128c..e9fadec83 100644 --- a/common/src/main/java/org/vivecraft/server/config/ServerConfig.java +++ b/common/src/main/java/org/vivecraft/server/config/ServerConfig.java @@ -1,74 +1,80 @@ package org.vivecraft.server.config; +import org.vivecraft.client.Xplat; +import org.vivecraft.server.config.ConfigBuilder.*; + import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.Config; import com.electronwill.nightconfig.core.ConfigSpec; +import com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener; import com.electronwill.nightconfig.core.file.CommentedFileConfig; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; -import org.vivecraft.client.Xplat; -import org.vivecraft.server.config.ConfigBuilder; -import java.util.*; +import java.util.Arrays; +import java.util.List; + +import static org.vivecraft.common.utils.Utils.logger; public class ServerConfig { // config keys - public static ConfigBuilder.BooleanValue debug; - public static ConfigBuilder.BooleanValue checkForUpdate; - public static ConfigBuilder.BooleanValue vr_only; - public static ConfigBuilder.BooleanValue vive_only; - public static ConfigBuilder.BooleanValue allow_op; - public static ConfigBuilder.DoubleValue messageKickDelay; - public static ConfigBuilder.BooleanValue vrFun; - - public static ConfigBuilder.BooleanValue messagesEnabled; - public static ConfigBuilder.StringValue messagesWelcomeVR; - public static ConfigBuilder.StringValue messagesWelcomeNonVR; - public static ConfigBuilder.StringValue messagesWelcomeSeated; - public static ConfigBuilder.StringValue messagesWelcomeVanilla; - public static ConfigBuilder.StringValue messagesLeaveMessage; - public static ConfigBuilder.StringValue messagesKickViveOnly; - public static ConfigBuilder.StringValue messagesKickVROnly; - - public static ConfigBuilder.DoubleValue creeperSwellDistance; - public static ConfigBuilder.DoubleValue bowStandingMultiplier; - public static ConfigBuilder.DoubleValue bowSeatedMultiplier; - public static ConfigBuilder.DoubleValue bowStandingHeadshotMultiplier; - public static ConfigBuilder.DoubleValue bowSeatedHeadshotMultiplier; - public static ConfigBuilder.DoubleValue bowVanillaHeadshotMultiplier; - - public static ConfigBuilder.BooleanValue pvpVRvsVR; - public static ConfigBuilder.BooleanValue pvpSEATEDVRvsSEATEDVR; - public static ConfigBuilder.BooleanValue pvpVRvsNONVR; - public static ConfigBuilder.BooleanValue pvpSEATEDVRvsNONVR; - public static ConfigBuilder.BooleanValue pvpVRvsSEATEDVR; - - public static ConfigBuilder.BooleanValue climbeyEnabled; - public static ConfigBuilder.ConfigValue climbeyBlockmode; - public static ConfigBuilder.ConfigValue> climbeyBlocklist; - - public static ConfigBuilder.BooleanValue crawlingEnabled; - - public static ConfigBuilder.BooleanValue teleportEnabled; - public static ConfigBuilder.BooleanValue teleportLimitedSurvival; - public static ConfigBuilder.IntValue teleportUpLimit; - public static ConfigBuilder.IntValue teleportDownLimit; - public static ConfigBuilder.IntValue teleportHorizontalLimit; - - public static ConfigBuilder.BooleanValue worldscaleLimited; - public static ConfigBuilder.DoubleValue worldscaleMax; - public static ConfigBuilder.DoubleValue worldscaleMin; - - public static ConfigBuilder.BooleanValue vrSwitchingEnabled; + public static BooleanValue debug; + public static BooleanValue checkForUpdate; + public static BooleanValue vr_only; + public static BooleanValue vive_only; + public static BooleanValue allow_op; + public static DoubleValue messageKickDelay; + public static BooleanValue vrFun; + + public static BooleanValue messagesEnabled; + public static StringValue messagesWelcomeVR; + public static StringValue messagesWelcomeNonVR; + public static StringValue messagesWelcomeSeated; + public static StringValue messagesWelcomeVanilla; + public static StringValue messagesLeaveMessage; + public static StringValue messagesKickViveOnly; + public static StringValue messagesKickVROnly; + + public static DoubleValue creeperSwellDistance; + public static DoubleValue bowStandingMultiplier; + public static DoubleValue bowSeatedMultiplier; + public static DoubleValue bowStandingHeadshotMultiplier; + public static DoubleValue bowSeatedHeadshotMultiplier; + public static DoubleValue bowVanillaHeadshotMultiplier; + + public static BooleanValue pvpVRvsVR; + public static BooleanValue pvpSEATEDVRvsSEATEDVR; + public static BooleanValue pvpVRvsNONVR; + public static BooleanValue pvpSEATEDVRvsNONVR; + public static BooleanValue pvpVRvsSEATEDVR; + + public static BooleanValue climbeyEnabled; + public static ConfigValue climbeyBlockmode; + public static ConfigValue> climbeyBlocklist; + + public static BooleanValue crawlingEnabled; + + public static BooleanValue teleportEnabled; + public static BooleanValue teleportLimitedSurvival; + public static IntValue teleportUpLimit; + public static IntValue teleportDownLimit; + public static IntValue teleportHorizontalLimit; + + public static BooleanValue worldscaleLimited; + public static DoubleValue worldscaleMax; + public static DoubleValue worldscaleMin; + + public static BooleanValue vrSwitchingEnabled; private static CommentedFileConfig config; private static ConfigBuilder builder; - public static List getConfigValues(){ + public static List getConfigValues(){ return builder.getConfigValues(); } - public static void init(ConfigSpec.CorrectionListener listener){ + public static void init(CorrectionListener listener){ Config.setInsertionOrderPreserved(true); config = CommentedFileConfig .builder(Xplat.getConfigPath("vivecraft-server-config.toml")) @@ -82,7 +88,7 @@ public static void init(ConfigSpec.CorrectionListener listener){ if (listener == null) { listener = (action, path, incorrectValue, correctedValue) -> { if (incorrectValue != null) { - System.out.println("Corrected " + String.join(".", path) + ": was " + incorrectValue + ", is now " + correctedValue); + logger.warn("Corrected " + String.join(".", path) + ": was " + incorrectValue + ", is now " + correctedValue); } }; } @@ -92,7 +98,7 @@ public static void init(ConfigSpec.CorrectionListener listener){ config.save(); } - private static void fixConfig(CommentedConfig config, ConfigSpec.CorrectionListener listener) { + private static void fixConfig(CommentedConfig config, CorrectionListener listener) { builder = new ConfigBuilder(config, new ConfigSpec()); @@ -238,7 +244,7 @@ private static void fixConfig(CommentedConfig config, ConfigSpec.CorrectionListe climbeyBlocklist = builder .push("blocklist") .comment("The list of block names for use with include/exclude block mode.") - .defineList(Arrays.asList("white_wool","dirt","grass_block"), (s) -> s instanceof String && BuiltInRegistries.BLOCK.containsKey(new ResourceLocation((String) s))); + .defineList(Arrays.asList("white_wool","dirt","grass_block"), (s) -> s instanceof String str && BuiltInRegistries.BLOCK.containsKey(new ResourceLocation(str))); // end climbey builder.pop(); diff --git a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json index c02f1d8cc..baa652f75 100644 --- a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json index 6dbb6e48e..a3915d702 100644 --- a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json index c98b933d5..2000fc686 100644 --- a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ @@ -143,6 +143,16 @@ "path" : "/user/hand/right/pose/raw" } ], + "skeleton" : [ + { + "output": "/actions/global/in/lefthandbones", + "path": "/user/hand/left/input/skeleton/left" + }, + { + "output": "/actions/global/in/righthandbones", + "path": "/user/hand/right/input/skeleton/right" + } + ], "sources" : [ { "inputs" : { diff --git a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json index e85babc11..58f26ba2e 100644 --- a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ @@ -143,6 +143,16 @@ "path" : "/user/hand/right/pose/raw" } ], + "skeleton" : [ + { + "output": "/actions/global/in/lefthandbones", + "path": "/user/hand/left/input/skeleton/left" + }, + { + "output": "/actions/global/in/righthandbones", + "path": "/user/hand/right/input/skeleton/right" + } + ], "sources" : [ { "inputs" : { diff --git a/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json b/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json index dd53c089b..69a66d78c 100644 --- a/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json index d1fcbb79a..ea74235ac 100644 --- a/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json b/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json index ed67ae355..30b6445a3 100644 --- a/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json @@ -1,6 +1,6 @@ { "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings": { "/actions/mixedreality": { "haptics": [ diff --git a/common/src/main/resources/assets/vivecraft/input/vive_defaults.json b/common/src/main/resources/assets/vivecraft/input/vive_defaults.json index 32af34e0e..44afd8a81 100644 --- a/common/src/main/resources/assets/vivecraft/input/vive_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/vive_defaults.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json index b6a0cbee6..2221977b5 100644 --- a/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json b/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json index 7769b6f43..7d1f7b5af 100644 --- a/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json index 36d941134..6f35c7bcb 100644 --- a/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json @@ -1,7 +1,7 @@ { "action_manifest_version" : 0, "alias_info" : {}, - "app_key" : "org.jrbudda.vivecraft.steamvrinput", + "app_key" : "org.vivecraft.mcvr", "bindings" : { "/actions/contextual" : { "chords" : [ diff --git a/common/src/main/resources/assets/vivecraft/lang/en_us.json b/common/src/main/resources/assets/vivecraft/lang/en_us.json index 136d3accf..d5d636486 100644 --- a/common/src/main/resources/assets/vivecraft/lang/en_us.json +++ b/common/src/main/resources/assets/vivecraft/lang/en_us.json @@ -26,6 +26,16 @@ "vivecraft.key.toggleHandheldCam": "Toggle Camera", "vivecraft.key.quickHandheldCam": "Quick Camera", "vivecraft.key.trackpadTouch": "Trackpad Touch", + "vivecraft.key.mainThumb": "Main Thumb", + "vivecraft.key.mainIndex": "Main Index", + "vivecraft.key.mainMiddle": "Main Middle", + "vivecraft.key.mainRing": "Main Ring", + "vivecraft.key.mainLittle": "Main Pinky", + "vivecraft.key.offThumb": "Off Thumb", + "vivecraft.key.offIndex": "Off Index", + "vivecraft.key.offMiddle": "Off Middle", + "vivecraft.key.offRing": "Off Ring", + "vivecraft.key.offLittle": "Off Pinky", "vivecraft.key.vrInteract": "Contextual Interact", "vivecraft.key.guiLeftClick": "Left Click", "vivecraft.key.guiRightClick": "Right Click", @@ -58,6 +68,7 @@ "vivecraft.options.screen.freemove": "Free Move Settings", "vivecraft.options.screen.gui": "HUD and GUI Settings", "vivecraft.options.screen.menuworld": "Menu World Settings", + "vivecraft.options.screen.touch_hotbar": "Touch Hotbar Settings", "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", "vivecraft.options.screen.quickcommands": "Quick Commands", "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", @@ -67,6 +78,8 @@ "vivecraft.options.screen.standing": "Standing Locomotion Settings", "vivecraft.options.screen.teleport": "Teleport Settings", "vivecraft.options.screen.controls": "Controller Settings", + "vivecraft.options.screen.controls.skeletal_input": "Gesture Settings", + "vivecraft.options.screen.controls.skeletal_input.finger_displays": "Finger Displays", "_comment4": "Buttons that lead to the screen", "vivecraft.options.screen.main.button": "VR Settings...", "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", @@ -76,9 +89,12 @@ "vivecraft.options.screen.standing.button": "Locomotion Settings...", "vivecraft.options.screen.roomscale.button": "Interaction Settings...", "vivecraft.options.screen.controls.button": "Controller Settings...", + "vivecraft.options.screen.controls.skeletal_input.button": "Gesture Settings...", + "vivecraft.options.screen.controls.skeletal_input.finger_displays.button": "Finger Displays...", "vivecraft.options.screen.radialmenu.button": "Radial Menu...", "vivecraft.options.screen.seated.button": "Seated Settings...", "vivecraft.options.screen.menuworld.button": "Menu World Settings...", + "vivecraft.options.screen.touch_hotbar.button": "Touch Hotbar Settings...", "vivecraft.options.screen.teleport.button": "Teleport Settings...", "vivecraft.options.screen.freemove.button": "Free Move Settings...", "_comment5": "Option names", @@ -126,7 +142,7 @@ "vivecraft.options.WORLD_SCALE": "World Scale", "vivecraft.options.WORLD_ROTATION": "World Rotation", "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", - "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Enabled", + "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar", "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", "vivecraft.options.MONO_FOV": "Undistorted FOV", @@ -153,6 +169,9 @@ "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", + "vivecraft.options.SKELETAL_INPUT": "Skeletal Input", + "vivecraft.options.FINGER_COUNT": "Finger Count", + "vivecraft.options.FINGER_VIEW": "Finger View", "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", @@ -212,7 +231,15 @@ "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "If enabled allow you to touch the hotbar with your main hand to select an item.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Allows you to touch the hotbar with your hand opposite the HUD to select an item.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_R.tooltip": "Changes the red color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_G.tooltip": "Changes the green color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_B.tooltip": "Changes the blue color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_A.tooltip": "Changes the opacity of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_R.tooltip": "Changes the red color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_G.tooltip": "Changes the green color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_B.tooltip": "Changes the blue color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_A.tooltip": "Changes the opacity of the Off Hand slot selection indicator.", "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", @@ -239,6 +266,38 @@ "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", + "vivecraft.options.SKELETAL_INPUT.tooltip": "Enable or disable Skeletal Input\n OFF: Finger gestures ignored.\n ON: Finger gestures detected.\n\n This setting doesn't affect the VR arm position or inputs.\n%s", + "vivecraft.options.SKELETAL_INPUT.tooltip.controller": "\n%s controller tracking: %s", + "vivecraft.options.SKELETAL_INPUT.tooltip.0": "Estimated Skeletal Tracking\nYour controller reported the lowest accuracy tracking.\n The controller likely lacks dedicated gesture sensors\n and may provide poor gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.1": "Partial Skeletal Tracking\nYour controller reported the minimum recommended tracking.\n The controller likely has dedicated gesture sensors\n to provide accurate gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.2": "Full Skeletal Tracking\nYour controller reported the highest accuracy tracking.\n The controller likely has dedicated sensors for each joint\n to provide the most accurate gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.unknown": "Unknown Skeletal Tracking\nYour controller reported an unknown tracking level.\nPlease record and report the following tracking level:\n%d", + "vivecraft.options.SKELETAL_INPUT.tooltip.unsupported": "Unsupported VR System\n Skeletal Input has only been tested on OpenVR.", + "vivecraft.options.SKELETAL_INPUT.tooltip.nonvr": "VR is Disabled!\n The Skeletal Tracking Level of your hardware\n may be presented here\n only when VR is active!", + "vivecraft.options.MAIN_THUMB_THRESHOLD.tooltip": "The Main Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_INDEX_THRESHOLD.tooltip": "The Main Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_MIDDLE_THRESHOLD.tooltip": "The Main Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_RING_THRESHOLD.tooltip": "The Main Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", + "vivecraft.options.MAIN_LITTLE_THRESHOLD.tooltip": "The Main Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_THUMB_THRESHOLD.tooltip": "The Off Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_INDEX_THRESHOLD.tooltip": "The Off Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_MIDDLE_THRESHOLD.tooltip": "The Off Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_RING_THRESHOLD.tooltip": "The Off Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", + "vivecraft.options.OFF_LITTLE_THRESHOLD.tooltip": "The Off Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Thumb.\n Default: 5", + "vivecraft.options.MAIN_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Index finger.\n Default: 4", + "vivecraft.options.MAIN_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Middle finger.\n Default: 3", + "vivecraft.options.MAIN_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Ring finger.\n Default: 2", + "vivecraft.options.MAIN_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Pinky finger.\n Default: 1", + "vivecraft.options.OFF_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Thumb.\n Default: 6", + "vivecraft.options.OFF_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Index finger.\n Default: 7", + "vivecraft.options.OFF_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Middle finger.\n Default: 8", + "vivecraft.options.OFF_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Ring finger.\n Default: 9", + "vivecraft.options.OFF_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Pinky finger.\n Default: Off Hand", + "vivecraft.options.FINGER_COUNT.extension": "Extension", + "vivecraft.options.FINGER_COUNT.curl": "Curl", + "vivecraft.options.FINGER_COUNT.tooltip": " Extension: Count the fingers above the extension threshold.\n Curl: Count the fingers below the extension threshold.", + "vivecraft.options.FINGER_VIEW.tooltip": "Render finger indicators on the player hand.\n When Skeletal Input is OFF, a static hand gesture will be used.", "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit the number of blocks you can teleport below you.", "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit the number of blocks you can teleport above you.", "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit the number of blocks you can teleport sideways you.", @@ -284,6 +343,14 @@ "vivecraft.options.hudlock.hand": "Hand", "vivecraft.options.hudlock.head": "Head", "vivecraft.options.hudlock.wrist": "Wrist", + "vivecraft.options.PLAYER_STATUS": "Player Status", + "vivecraft.options.playerstatus.none": "None", + "vivecraft.options.playerstatus.entity": "Entity", + "vivecraft.options.playerstatus.icon": "Icon", + "vivecraft.options.playerstatus.both": "Both", + "vivecraft.options.ENTITY_STATUS": "Entity Status", + "vivecraft.options.entitystatus.always": "Always", + "vivecraft.options.entitystatus.sometimes": "Not Walking", "vivecraft.options.renderpointerelement.always": "Always", "vivecraft.options.renderpointerelement.withhud": "With HUD", "vivecraft.options.renderpointerelement.never": "Never", @@ -311,7 +378,10 @@ "vivecraft.options.keyboard.pointer": "Pointer", "vivecraft.options.bowmode.vanilla": "Vanilla", "vivecraft.options.teleportlimit": "%d Blocks", + "vivecraft.options.offhand": "Off Hand", "vivecraft.options.teleport": "Teleport", + "vivecraft.options.teleport.style": "Teleport style (RCTRL-M): %s", + "vivecraft.options.teleport.style.unknown": "Unknown teleport style requested: %s", "vivecraft.options.freemove": "Free Move", "vivecraft.options.menuworld.both": "Official & Custom", "vivecraft.options.menuworld.custom": "Custom Only", diff --git a/common/src/main/resources/assets/vivecraft/vivecraft.vrmanifest b/common/src/main/resources/assets/vivecraft/vivecraft.vrmanifest index b50366d8c..331523975 100644 --- a/common/src/main/resources/assets/vivecraft/vivecraft.vrmanifest +++ b/common/src/main/resources/assets/vivecraft/vivecraft.vrmanifest @@ -2,7 +2,7 @@ "source": "builtin", "applications": [ { - "app_key": "org.jrbudda.vivecraft.steamvrinput", + "app_key": "org.vivecraft.mcvr", "image_path": "https://i1.wp.com/www.vivecraft.org/wp-content/uploads/2016/07/wesYwME.png", "launch_type": "url", "url": "steam://launch/", diff --git a/fabric/build.gradle b/fabric/build.gradle index 56f51496f..c683a1749 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -73,6 +73,9 @@ dependencies { include(implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-macos")) include(implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-windows")) + // MixinExtras + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.2.0-rc.4"))) + } processResources { diff --git a/fabric/src/main/java/org/vivecraft/client/fabric/XeventsImpl.java b/fabric/src/main/java/org/vivecraft/client/fabric/XeventsImpl.java index fcfd70d16..e6d39cde5 100644 --- a/fabric/src/main/java/org/vivecraft/client/fabric/XeventsImpl.java +++ b/fabric/src/main/java/org/vivecraft/client/fabric/XeventsImpl.java @@ -1,6 +1,7 @@ package org.vivecraft.client.fabric; import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.state.BlockState; diff --git a/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java b/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java index ae8ad8c95..db82d5ea7 100644 --- a/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java +++ b/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java @@ -1,23 +1,28 @@ package org.vivecraft.client.fabric; -import com.mojang.blaze3d.pipeline.RenderTarget; +import org.vivecraft.fabric.mixin.world.level.biome.BiomeAccessor; + import net.fabricmc.api.EnvType; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.Minecraft; + +import com.mojang.blaze3d.pipeline.RenderTarget; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; import net.minecraft.tags.FluidTags; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.ClimateSettings; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.FluidState; -import org.vivecraft.fabric.mixin.world.level.biome.BiomeAccessor; import java.nio.file.Path; +import static org.vivecraft.client_vr.VRState.mc; + public class XplatImpl { public static boolean isModLoaded(String name) { @@ -74,19 +79,19 @@ public static TextureAtlasSprite[] getFluidTextures(BlockAndTintGetter level, Bl // return vanilla textures if (fluidStateIn.is(FluidTags.LAVA)) { return new TextureAtlasSprite[]{ - Minecraft.getInstance().getModelManager().getBlockModelShaper().getBlockModel(Blocks.LAVA.defaultBlockState()).getParticleIcon(), + mc.getModelManager().getBlockModelShaper().getBlockModel(Blocks.LAVA.defaultBlockState()).getParticleIcon(), ModelBakery.LAVA_FLOW.sprite() }; } else { return new TextureAtlasSprite[]{ - Minecraft.getInstance().getModelManager().getBlockModelShaper().getBlockModel(Blocks.WATER.defaultBlockState()).getParticleIcon(), + mc.getModelManager().getBlockModelShaper().getBlockModel(Blocks.WATER.defaultBlockState()).getParticleIcon(), ModelBakery.WATER_FLOW.sprite() }; } } } - public static Biome.ClimateSettings getBiomeClimateSettings(Biome biome){ + public static ClimateSettings getBiomeClimateSettings(Biome biome){ return ((BiomeAccessor)(Object)biome).getClimateSettings(); } diff --git a/fabric/src/main/java/org/vivecraft/fabric/VivecraftMod.java b/fabric/src/main/java/org/vivecraft/fabric/VivecraftMod.java index 2a50bfb85..c0c76ed3b 100644 --- a/fabric/src/main/java/org/vivecraft/fabric/VivecraftMod.java +++ b/fabric/src/main/java/org/vivecraft/fabric/VivecraftMod.java @@ -1,9 +1,10 @@ package org.vivecraft.fabric; +import org.vivecraft.server.ServerUtil; +import org.vivecraft.server.config.ServerConfig; + import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; -import org.vivecraft.server.config.ServerConfig; -import org.vivecraft.server.ServerUtil; public class VivecraftMod implements ModInitializer { @Override diff --git a/fabric/src/main/java/org/vivecraft/fabric/mixin/FabricGameRendererVRMixin.java b/fabric/src/main/java/org/vivecraft/fabric/mixin/FabricGameRendererVRMixin.java index 23ed70337..f6d3e3014 100644 --- a/fabric/src/main/java/org/vivecraft/fabric/mixin/FabricGameRendererVRMixin.java +++ b/fabric/src/main/java/org/vivecraft/fabric/mixin/FabricGameRendererVRMixin.java @@ -1,14 +1,19 @@ package org.vivecraft.fabric.mixin; -import com.mojang.blaze3d.vertex.PoseStack; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import org.joml.Quaternionf; + +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.renderer.GameRenderer; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Mixin(GameRenderer.class) public class FabricGameRendererVRMixin { @@ -25,7 +30,7 @@ public void removeMulposeY(PoseStack s, Quaternionf quaternion) { if (RenderPassType.isVanilla()) { s.mulPose(quaternion); } else { - ((GameRendererExtension) this).applyVRModelView(ClientDataHolderVR.getInstance().currentPass, s); + ((GameRendererExtension) this).applyVRModelView(dh.currentPass, s); } } diff --git a/fabric/src/main/java/org/vivecraft/fabric/mixin/client/resources/model/FabricModelBakeryMixin.java b/fabric/src/main/java/org/vivecraft/fabric/mixin/client/resources/model/FabricModelBakeryMixin.java index c5dfce436..41fd344b2 100644 --- a/fabric/src/main/java/org/vivecraft/fabric/mixin/client/resources/model/FabricModelBakeryMixin.java +++ b/fabric/src/main/java/org/vivecraft/fabric/mixin/client/resources/model/FabricModelBakeryMixin.java @@ -1,19 +1,22 @@ package org.vivecraft.fabric.mixin.client.resources.model; +import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; +import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; + import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.util.profiling.ProfilerFiller; + +import java.util.Map; + +import static org.vivecraft.client_vr.VRState.dh; + 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.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; -import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; - -import java.util.Map; @Mixin(ModelBakery.class) public abstract class FabricModelBakeryMixin { @@ -22,8 +25,8 @@ public abstract class FabricModelBakeryMixin { @Inject(method = "", at = @At(value = "CONSTANT", args = "stringValue=special")) private void loadModels(BlockColors blockColors, ProfilerFiller profilerFiller, Map map, Map map2, CallbackInfo ci) { this.loadTopLevel(TelescopeTracker.scopeModel); - this.loadTopLevel(ClientDataHolderVR.thirdPersonCameraModel); - this.loadTopLevel(ClientDataHolderVR.thirdPersonCameraDisplayModel); + this.loadTopLevel(dh.thirdPersonCameraModel); + this.loadTopLevel(dh.thirdPersonCameraDisplayModel); this.loadTopLevel(CameraTracker.cameraModel); this.loadTopLevel(CameraTracker.cameraDisplayModel); } diff --git a/fabric/src/main/java/org/vivecraft/fabric/mixin/screenhandler/client/FabricClientNetworkingVRMixin.java b/fabric/src/main/java/org/vivecraft/fabric/mixin/screenhandler/client/FabricClientNetworkingVRMixin.java index 5b23ee65d..cb89a74aa 100644 --- a/fabric/src/main/java/org/vivecraft/fabric/mixin/screenhandler/client/FabricClientNetworkingVRMixin.java +++ b/fabric/src/main/java/org/vivecraft/fabric/mixin/screenhandler/client/FabricClientNetworkingVRMixin.java @@ -1,14 +1,17 @@ package org.vivecraft.fabric.mixin.screenhandler.client; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; + import net.fabricmc.fabric.impl.screenhandler.client.ClientNetworking; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; @Mixin(ClientNetworking.class) public class FabricClientNetworkingVRMixin { diff --git a/fabric/src/main/java/org/vivecraft/fabric/mixin/world/level/biome/BiomeAccessor.java b/fabric/src/main/java/org/vivecraft/fabric/mixin/world/level/biome/BiomeAccessor.java index 9c174d052..20ff216a1 100644 --- a/fabric/src/main/java/org/vivecraft/fabric/mixin/world/level/biome/BiomeAccessor.java +++ b/fabric/src/main/java/org/vivecraft/fabric/mixin/world/level/biome/BiomeAccessor.java @@ -1,11 +1,13 @@ package org.vivecraft.fabric.mixin.world.level.biome; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.ClimateSettings; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(Biome.class) public interface BiomeAccessor{ @Accessor("climateSettings") - Biome.ClimateSettings getClimateSettings(); + ClimateSettings getClimateSettings(); } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 7111a4c31..b55a9b3ff 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -7,6 +7,7 @@ "description": "The VR mod for any loader!", "icon": "vivecraft_icon.png", "authors": [ + "NicBOMB", "fayer3", "Ferri_Arnus", "IMS", diff --git a/forge/build.gradle b/forge/build.gradle index 80d331439..cc53c1ae6 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -60,6 +60,9 @@ dependencies { bundle ("org.lwjgl:lwjgl-openvr:3.3.1:natives-linux") { transitive = false } bundle ("org.lwjgl:lwjgl-openvr:3.3.1:natives-macos") { transitive = false } bundle ("org.lwjgl:lwjgl-openvr:3.3.1:natives-windows") { transitive = false } + + // MixinExtras + implementation(include("io.github.llamalad7:mixinextras-forge:0.2.0-rc.4")) } processResources { diff --git a/forge/src/main/java/org/vivecraft/client/forge/XeventsImpl.java b/forge/src/main/java/org/vivecraft/client/forge/XeventsImpl.java index 126ecdaa0..f65857bad 100644 --- a/forge/src/main/java/org/vivecraft/client/forge/XeventsImpl.java +++ b/forge/src/main/java/org/vivecraft/client/forge/XeventsImpl.java @@ -1,17 +1,19 @@ package org.vivecraft.client.forge; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.event.RenderBlockScreenEffectEvent.OverlayType; +import net.minecraftforge.event.ForgeEventFactory; + import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.client.event.RenderBlockScreenEffectEvent; -import net.minecraftforge.event.ForgeEventFactory; public class XeventsImpl { public static boolean renderBlockOverlay(Player player, PoseStack mat, BlockState state, BlockPos pos) { - return ForgeHooksClient.renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.BLOCK, state, pos); + return ForgeHooksClient.renderBlockOverlay(player, mat, OverlayType.BLOCK, state, pos); } public static boolean renderWaterOverlay(Player player, PoseStack mat) { diff --git a/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java b/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java index c940809f7..f8afdc1c8 100644 --- a/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java +++ b/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java @@ -1,18 +1,21 @@ package org.vivecraft.client.forge; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.fml.loading.FMLEnvironment; +import net.minecraftforge.fml.loading.FMLLoader; +import net.minecraftforge.fml.loading.FMLPaths; +import net.minecraftforge.fml.util.ObfuscationReflectionHelper; + import com.mojang.blaze3d.pipeline.RenderTarget; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.Biome.ClimateSettings; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.material.FluidState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.fml.loading.FMLLoader; -import net.minecraftforge.fml.loading.FMLPaths; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import java.nio.file.Path; @@ -69,7 +72,7 @@ public static TextureAtlasSprite[] getFluidTextures(BlockAndTintGetter level, Bl return ForgeHooksClient.getFluidSprites(level, pos, fluidStateIn); } - public static Biome.ClimateSettings getBiomeClimateSettings(Biome biome){ + public static ClimateSettings getBiomeClimateSettings(Biome biome){ return biome.getModifiedClimateSettings(); } diff --git a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java index c53e4f82b..45960b7a3 100644 --- a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java +++ b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java @@ -1,8 +1,9 @@ package org.vivecraft.forge; -import net.minecraftforge.fml.common.Mod; import org.vivecraft.server.config.ServerConfig; +import net.minecraftforge.fml.common.Mod; + @Mod(Vivecraft.MODID) public class Vivecraft { public static final String MODID = "vivecraft"; diff --git a/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java b/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java index 97aadd60b..5810ab0ee 100644 --- a/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java +++ b/forge/src/main/java/org/vivecraft/forge/event/ClientEvents.java @@ -1,20 +1,23 @@ package org.vivecraft.forge.event; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.ModelEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; -@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.ModelEvent.RegisterAdditional; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; + +import static org.vivecraft.client_vr.VRState.dh; + +@EventBusSubscriber(value = Dist.CLIENT, bus = Bus.MOD) public class ClientEvents { @SubscribeEvent - public static void registerModels(ModelEvent.RegisterAdditional event) { + public static void registerModels(RegisterAdditional event) { event.register(TelescopeTracker.scopeModel); - event.register(ClientDataHolderVR.thirdPersonCameraModel); - event.register(ClientDataHolderVR.thirdPersonCameraDisplayModel); + event.register(dh.thirdPersonCameraModel); + event.register(dh.thirdPersonCameraDisplayModel); event.register(CameraTracker.cameraModel); event.register(CameraTracker.cameraDisplayModel); } diff --git a/forge/src/main/java/org/vivecraft/forge/event/CommonEvents.java b/forge/src/main/java/org/vivecraft/forge/event/CommonEvents.java index 6e4743e14..de367252e 100644 --- a/forge/src/main/java/org/vivecraft/forge/event/CommonEvents.java +++ b/forge/src/main/java/org/vivecraft/forge/event/CommonEvents.java @@ -1,11 +1,13 @@ package org.vivecraft.forge.event; +import org.vivecraft.server.ServerUtil; + import net.minecraftforge.event.RegisterCommandsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import org.vivecraft.server.ServerUtil; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE) +@EventBusSubscriber(bus = Bus.FORGE) public class CommonEvents { @SubscribeEvent public static void registerCommands(RegisterCommandsEvent event) { diff --git a/forge/src/main/java/org/vivecraft/forge/mixin/ForgeGameRendererVRMixin.java b/forge/src/main/java/org/vivecraft/forge/mixin/ForgeGameRendererVRMixin.java index 4874b05f6..1b2a71688 100644 --- a/forge/src/main/java/org/vivecraft/forge/mixin/ForgeGameRendererVRMixin.java +++ b/forge/src/main/java/org/vivecraft/forge/mixin/ForgeGameRendererVRMixin.java @@ -1,30 +1,35 @@ package org.vivecraft.forge.mixin; -import com.mojang.blaze3d.vertex.PoseStack; +import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.render.RenderPass; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import org.joml.Quaternionf; + +import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Camera; import net.minecraft.client.renderer.GameRenderer; + +import static org.vivecraft.client_vr.VRState.dh; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import org.vivecraft.client_vr.ClientDataHolderVR; -import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.render.RenderPass; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Mixin(GameRenderer.class) public class ForgeGameRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Camera;setAnglesInternal(FF)V", remap = false), method = "renderLevel") public void forgeInternal(Camera camera, float yaw, float pitch) { - if (RenderPassType.isVanilla() || ClientDataHolderVR.getInstance().currentPass != RenderPass.LEFT && ClientDataHolderVR.getInstance().currentPass != RenderPass.RIGHT) { + if (RenderPassType.isVanilla() || dh.currentPass != RenderPass.LEFT && dh.currentPass != RenderPass.RIGHT) { camera.setAnglesInternal(yaw, pitch); } } @Redirect(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lorg/joml/Quaternionf;)V", ordinal = 2), method = "renderLevel") public void forgeMulposZ(PoseStack poseStack, Quaternionf quaternion) { - if (RenderPassType.isVanilla() || ClientDataHolderVR.getInstance().currentPass != RenderPass.LEFT && ClientDataHolderVR.getInstance().currentPass != RenderPass.RIGHT) { + if (RenderPassType.isVanilla() || dh.currentPass != RenderPass.LEFT && dh.currentPass != RenderPass.RIGHT) { poseStack.mulPose(quaternion); } } @@ -41,7 +46,7 @@ public void removeMulposeY(PoseStack s, Quaternionf quaternion) { if (RenderPassType.isVanilla()) { s.mulPose(quaternion); } else { - ((GameRendererExtension) this).applyVRModelView(ClientDataHolderVR.getInstance().currentPass, s); + ((GameRendererExtension) this).applyVRModelView(dh.currentPass, s); } } diff --git a/forge/src/main/java/org/vivecraft/forge/mixin/ForgeIngameGuiVRMixin.java b/forge/src/main/java/org/vivecraft/forge/mixin/ForgeIngameGuiVRMixin.java index c279a1ed9..15241d959 100644 --- a/forge/src/main/java/org/vivecraft/forge/mixin/ForgeIngameGuiVRMixin.java +++ b/forge/src/main/java/org/vivecraft/forge/mixin/ForgeIngameGuiVRMixin.java @@ -1,17 +1,20 @@ package org.vivecraft.forge.mixin; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.gui.GuiGraphics; +import org.vivecraft.client_vr.extensions.GuiExtension; +import org.vivecraft.client_xr.render_pass.RenderPassType; + import net.minecraftforge.client.gui.overlay.ForgeGui; import net.minecraftforge.client.gui.overlay.NamedGuiOverlay; import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; + +import net.minecraft.client.KeyMapping; +import net.minecraft.client.gui.GuiGraphics; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.vivecraft.client_vr.extensions.GuiExtension; -import org.vivecraft.client_xr.render_pass.RenderPassType; @Mixin(ForgeGui.class) public abstract class ForgeIngameGuiVRMixin{ diff --git a/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java b/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java index e3133bcab..f0ae9fbc6 100644 --- a/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java +++ b/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java @@ -1,19 +1,21 @@ package org.vivecraft.forge.mixin.network; -import net.minecraftforge.network.NetworkEvent; -import net.minecraftforge.network.PlayMessages; +import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; + +import net.minecraftforge.network.NetworkEvent.Context; +import net.minecraftforge.network.PlayMessages.OpenContainer; + +import java.util.function.Supplier; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; - -import java.util.function.Supplier; -@Mixin(PlayMessages.OpenContainer.class) +@Mixin(OpenContainer.class) public class ForgeOpenContainerVRMixin { @Inject(at = @At("HEAD"), method = "handle", remap = false) - private static void markScreenActiveForge(PlayMessages.OpenContainer msg, Supplier ctx, CallbackInfo ci) { + private static void markScreenActiveForge(OpenContainer msg, Supplier ctx, CallbackInfo ci) { GuiHandler.guiAppearOverBlockActive = true; } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 4900ce5a7..ab48790f0 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -8,7 +8,7 @@ modId = "vivecraft" version = "${version}" displayName = "Vivecraft" logoFile="vivecraft_icon.png" -authors = "fayer3, Ferri_Arnus, IMS, jrbudda, minecraft player" +authors = "NicBOMB, fayer3, Ferri_Arnus, IMS, jrbudda, minecraft player" displayTest="IGNORE_SERVER_VERSION" description = ''' The VR mod for any loader! diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 From 5c965fc78b8e78cd891f7602820f2ccc0e00097d Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Fri, 29 Sep 2023 15:35:48 -0700 Subject: [PATCH 02/12] cleanup code --- .../org/vivecraft/client/VRPlayersClient.java | 8 +- .../client/render/VRPlayerModel_WithArms.java | 7 +- .../java/org/vivecraft/client_vr/VRData.java | 28 +- .../extensions/FrustumExtension.java | 4 +- .../gameplay/trackers/BowTracker.java | 3 +- .../gameplay/trackers/RowTracker.java | 1 - .../gameplay/trackers/TeleportTracker.java | 7 +- .../client_vr/menuworlds/FakeBlockAccess.java | 16 +- .../vivecraft/client_vr/provider/MCVR.java | 3 +- .../provider/openvr_lwjgl/MCOpenVR.java | 96 +- .../openvr_lwjgl/OpenVRStereoRenderer.java | 56 +- .../control/VRInputActionSet.java | 16 +- .../render/VivecraftItemRendering.java | 5 +- .../vivecraft/client_vr/render/XRCamera.java | 13 +- .../render/helpers/RenderHelper.java | 2 +- .../client_vr/render/helpers/VRArmHelper.java | 3 - .../render/helpers/VREffectsHelper.java | 1 - .../render/helpers/VRPassHelper.java | 2 +- .../render/helpers/VRWidgetHelper.java | 1 - .../client_vr/settings/OptionEnum.java | 16 +- .../client/blaze3d/RenderSystemAccessor.java | 4 +- .../client/blaze3d/RenderTargetMixin.java | 1 + .../client/gui/screens/TitleScreenMixin.java | 4 +- .../mixin/client_vr/MinecraftVRMixin.java | 89 +- .../gui/screens/OptionsScreenVRMixin.java | 11 +- .../client_vr/player/LocalPlayerVRMixin.java | 1 + .../renderer/ItemInHandRendererVRMixin.java | 2 +- .../entity/EntityRenderDispatcherVRMixin.java | 1 + .../MovementTutorialStepInstanceVRMixin.java | 24 +- .../main/resources/architectury.common.json | 2 +- .../assets/minecraft/atlases/blocks.json | 62 +- .../minecraft/shaders/core/fovreduction.json | 184 +- .../minecraft/shaders/core/lanczos.json | 58 +- .../minecraft/shaders/core/mixedreality.json | 142 +- .../core/rendertype_end_gateway_vr.json | 94 +- .../core/rendertype_end_portal_vr.json | 94 +- .../shaders/post/vrtransparency.json | 186 +- .../shaders/program/vrtransparency.json | 156 +- .../assets/vivecraft/blockstates/bag.json | 26 +- .../vivecraft/blockstates/camcorder.json | 8 +- .../blockstates/camcorder_display.json | 8 +- .../assets/vivecraft/blockstates/camera.json | 8 +- .../vivecraft/blockstates/camera_display.json | 8 +- .../vivecraft/blockstates/mini_crafting.json | 8 +- .../vivecraft/blockstates/telescope.json | 8 +- .../vivecraft/blockstates/trashbin.json | 8 +- .../vivecraft/input/cosmos_defaults.json | 704 ++++---- .../input/cosmos_defaults_reversed.json | 704 ++++---- .../vivecraft/input/knuckles_defaults.json | 868 ++++----- .../input/knuckles_defaults_reversed.json | 868 ++++----- .../vivecraft/input/oculus_defaults.json | 692 ++++---- .../input/oculus_defaults_reversed.json | 692 ++++---- .../vivecraft/input/tracker_defaults.json | 40 +- .../assets/vivecraft/input/vive_defaults.json | 716 ++++---- .../input/vive_defaults_reversed.json | 716 ++++---- .../assets/vivecraft/input/wmr_defaults.json | 788 ++++----- .../input/wmr_defaults_reversed.json | 788 ++++----- .../assets/vivecraft/lang/de_de.json | 882 +++++----- .../assets/vivecraft/lang/en_ca.json | 760 ++++---- .../assets/vivecraft/lang/en_gb.json | 760 ++++---- .../assets/vivecraft/lang/en_us.json | 1022 +++++------ .../assets/vivecraft/lang/es_es.json | 760 ++++---- .../assets/vivecraft/lang/fr_fr.json | 760 ++++---- .../assets/vivecraft/lang/nl_nl.json | 760 ++++---- .../assets/vivecraft/lang/pl_pl.json | 760 ++++---- .../assets/vivecraft/lang/ru_ru.json | 760 ++++---- .../assets/vivecraft/lang/zh_cn.json | 760 ++++---- .../assets/vivecraft/models/bag.json | 1330 +++++++------- .../assets/vivecraft/models/bag_closed.json | 1566 ++++++++--------- .../assets/vivecraft/models/bag_gold.json | 1330 +++++++------- .../vivecraft/models/bag_gold_closed.json | 1566 ++++++++--------- .../assets/vivecraft/models/camcorder.json | 1032 +++++------ .../vivecraft/models/camcorder_display.json | 66 +- .../assets/vivecraft/models/camera.json | 514 +++--- .../vivecraft/models/camera_display.json | 60 +- .../models/item/spyglass_in_hand.json | 150 +- .../vivecraft/models/mini_crafting.json | 74 +- .../assets/vivecraft/models/telescope.json | 332 ++-- .../assets/vivecraft/models/trashbin.json | 332 ++-- .../data/vivecraft/recipes/climbclaws.json | 36 +- .../data/vivecraft/recipes/jumpboots.json | 36 +- .../data/vivecraft/tags/blocks/climbable.json | 8 +- .../data/vivecraft/tags/blocks/crops.json | 8 +- .../vivecraft/tags/blocks/music_blocks.json | 8 +- .../data/vivecraft/tags/items/arrows.json | 8 +- .../data/vivecraft/tags/items/brushes.json | 8 +- .../data/vivecraft/tags/items/compasses.json | 18 +- .../data/vivecraft/tags/items/crossbows.json | 8 +- .../vivecraft/tags/items/fishing_rods.json | 18 +- .../vivecraft/tags/items/food_sticks.json | 10 +- .../data/vivecraft/tags/items/hoes.json | 98 +- .../data/vivecraft/tags/items/maps.json | 8 +- .../data/vivecraft/tags/items/scythes.json | 126 +- .../data/vivecraft/tags/items/shields.json | 16 +- .../data/vivecraft/tags/items/spears.json | 24 +- .../data/vivecraft/tags/items/swords.json | 58 +- .../data/vivecraft/tags/items/telescope.json | 8 +- .../vivecraft/tags/items/throw_items.json | 14 +- .../data/vivecraft/tags/items/tools.json | 150 +- .../vivecraft.dynamicfps.mixins.json | 18 +- .../vivecraft.fabric.sodium.mixins.json | 16 +- .../vivecraft.forge.sodium.mixins.json | 16 +- .../main/resources/vivecraft.iris.mixins.json | 40 +- .../src/main/resources/vivecraft.mixins.json | 178 +- .../resources/vivecraft.optifine.mixins.json | 24 +- .../vivecraft.physicsmod.mixins.json | 16 +- .../main/resources/vivecraft.rei.mixins.json | 16 +- .../vivecraft.resolutioncontrol.mixins.json | 16 +- .../resources/vivecraft.sodium.mixins.json | 18 +- fabric/src/main/resources/fabric.mod.json | 114 +- .../resources/vivecraft.fabric.mixins.json | 22 +- .../java/org/vivecraft/forge/Vivecraft.java | 3 +- forge/src/main/resources/pack.mcmeta | 8 +- .../resources/vivecraft.forge.mixins.json | 12 +- 114 files changed, 13365 insertions(+), 13217 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java index df5000db8..72857ec87 100644 --- a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java +++ b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java @@ -125,9 +125,7 @@ public void tick() { if (vec3.length() < (double) 1.0E-4F) { vec3.set(playermodelcontroller$rotinfo.headRot); } - } - else - { + } else { convertToVector3f(player.getLookAngle(), vec3); } @@ -138,9 +136,7 @@ public void tick() { playermodelcontroller$rotinfo.Headpos.add( (float) player_pos.x(), (float) player_pos.y(), (float) player_pos.z(), vec31 ); - } - else - { + } else { convertToVector3f(player.getEyePosition(1.0F), vec31); } Particle particle = mc.particleEngine.createParticle(ParticleTypes.FIREWORK, vec31.x + (player.isShiftKeyDown() ? -vec3.x * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.y - (double) (player.isShiftKeyDown() ? 1.0F : 0.8F) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, vec31.z + (player.isShiftKeyDown() ? -vec3.z * 3.0D : 0.0D) + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.02F, -vec3.x + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F, ((double) this.rand.nextFloat() - (double) 0.05F) * (double) 0.05F, -vec3.z + ((double) this.rand.nextFloat() - 0.5D) * (double) 0.01F); diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java index 11e5b7daa..cadaa4091 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java @@ -13,7 +13,6 @@ import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.phys.Vec3; import org.joml.Vector3f; import org.vivecraft.client.VRPlayersClient; import org.vivecraft.client.VRPlayersClient.RotInfo; @@ -106,7 +105,8 @@ public static MeshDefinition createMesh(CubeDeformation p_170826_, boolean p_170 } - @Override @Nonnull + @Override + @Nonnull protected Iterable bodyParts() { return ImmutableList.of(this.body, this.leftHand, this.rightHand, this.leftShoulder, this.rightShoulder, this.leftShoulder_sleeve, this.rightShoulder_sleeve, this.rightLeg, this.leftLeg, this.hat, this.leftPants, this.rightPants, this.leftSleeve, this.rightSleeve, this.jacket); } @@ -215,7 +215,8 @@ public void setAllVisible(boolean pVisible) { this.leftHand.visible = pVisible; } - @Override @Nonnull + @Override + @Nonnull protected ModelPart getArm(HumanoidArm pSide) { return pSide == HumanoidArm.LEFT ? this.leftHand : this.rightHand; } diff --git a/common/src/main/java/org/vivecraft/client_vr/VRData.java b/common/src/main/java/org/vivecraft/client_vr/VRData.java index aac77e2c7..7a731a465 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRData.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRData.java @@ -153,13 +153,27 @@ public Vec3 getHeadRear() { public VRDevicePose getEye(RenderPass pass) { return switch (pass) { - case LEFT -> { yield this.eye0; } - case RIGHT -> { yield this.eye1; } - case THIRD -> { yield this.c2; } - case SCOPER -> { yield this.t0; } - case SCOPEL -> { yield this.t1; } - case CAMERA -> { yield this.cam; } - default -> { yield this.hmd; } + case LEFT -> { + yield this.eye0; + } + case RIGHT -> { + yield this.eye1; + } + case THIRD -> { + yield this.c2; + } + case SCOPER -> { + yield this.t0; + } + case SCOPEL -> { + yield this.t1; + } + case CAMERA -> { + yield this.cam; + } + default -> { + yield this.hmd; + } }; } diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java index 6c41b11e1..74826717c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/FrustumExtension.java @@ -4,7 +4,7 @@ public interface FrustumExtension { - public void vivecraft$setCameraPosition(double var1, double var3, double var5); + void vivecraft$setCameraPosition(double var1, double var3, double var5); - public boolean vivecraft$isBoundingBoxInFrustum(AABB var1); + boolean vivecraft$isBoundingBoxInFrustum(AABB var1); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java index 5631a8f3b..b1859e9e9 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java @@ -20,7 +20,8 @@ import javax.annotation.Nullable; import java.nio.ByteBuffer; -import static org.joml.Math.*; +import static org.joml.Math.acos; +import static org.joml.Math.toDegrees; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; import static org.vivecraft.common.utils.Utils.convertToVector3f; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java index 7b1006836..8c92d6332 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java @@ -4,7 +4,6 @@ import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.phys.Vec3; import org.joml.Quaternionf; -import org.joml.Vector3d; import org.joml.Vector3f; import static org.joml.Math.*; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java index 86ef3799d..d3da7f49c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java @@ -247,14 +247,9 @@ private void updateTeleportArc() { for (int j = this.movementTeleportArcSteps; j < i && !((float) (j * 4) > this.teleportEnergy); ++j) { Vec3 vec35 = new Vec3(vec34.x + vec33.x, vec34.y + vec33.y, vec34.z + vec33.z); - boolean water = ( - dh.vrSettings.seated ? - ((GameRendererExtension) mc.gameRenderer).vivecraft$isInWater() : - !mc.level.getFluidState(BlockPos.containing(vec3)).isEmpty() - ); BlockHitResult blockhitresult = mc.level.clip(new ClipContext( - vec34, vec35, ClipContext.Block.COLLIDER, water ? Fluid.ANY : Fluid.ANY, mc.player + vec34, vec35, ClipContext.Block.COLLIDER, Fluid.ANY, mc.player )); if (blockhitresult != null && blockhitresult.getType() != Type.MISS) { diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java index ce654d0eb..c05227a18 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java @@ -250,10 +250,18 @@ public float getShade(Direction face, boolean shade) { return flag ? 0.9F : 1.0F; } else { return switch (face) { - case DOWN -> { yield flag ? 0.9F : 0.5F; } - case UP -> { yield flag ? 0.9F : 1.0F; } - case NORTH, SOUTH -> { yield 0.8F; } - case WEST, EAST -> { yield 0.6F; } + case DOWN -> { + yield flag ? 0.9F : 0.5F; + } + case UP -> { + yield flag ? 0.9F : 1.0F; + } + case NORTH, SOUTH -> { + yield 0.8F; + } + case WEST, EAST -> { + yield 0.6F; + } }; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index 38a345a24..dda70fd9d 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -200,7 +200,7 @@ public Vector3f getCenterEyePosition() { } public Vec3 getEyePosition(RenderPass eye) { - Vector3f vector3 = switch(eye){ + Vector3f vector3 = switch (eye) { case LEFT -> { yield this.hmdPose.mul0(this.hmdPoseLeftEye, new Matrix4f()).getTranslation(new Vector3f()); } @@ -210,7 +210,6 @@ public Vec3 getEyePosition(RenderPass eye) { default -> { yield this.hmdPose.getTranslation(new Vector3f()); } - }; if (dh.vrSettings.seated || dh.vrSettings.allowStandingOriginOffset) { diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index 8ca124a0b..bd2360945 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -125,28 +125,72 @@ public static MCOpenVR get() { static String getInputErrorName(int code) { return switch (code) { - case EVRInputError_VRInputError_None -> { yield "None"; } - case EVRInputError_VRInputError_NameNotFound -> { yield "NameNotFound"; } - case EVRInputError_VRInputError_WrongType -> { yield "WrongType"; } - case EVRInputError_VRInputError_InvalidHandle -> { yield "InvalidHandle"; } - case EVRInputError_VRInputError_InvalidParam -> { yield "InvalidParam"; } - case EVRInputError_VRInputError_NoSteam -> { yield "NoSteam"; } - case EVRInputError_VRInputError_MaxCapacityReached -> { yield "MaxCapacityReached"; } - case EVRInputError_VRInputError_IPCError -> { yield "IPCError"; } - case EVRInputError_VRInputError_NoActiveActionSet -> { yield "NoActiveActionSet"; } - case EVRInputError_VRInputError_InvalidDevice -> { yield "InvalidDevice"; } - case EVRInputError_VRInputError_InvalidSkeleton -> { yield "InvalidSkeleton"; } - case EVRInputError_VRInputError_InvalidBoneCount -> { yield "InvalidBoneCount"; } - case EVRInputError_VRInputError_InvalidCompressedData -> { yield "InvalidCompressedData"; } - case EVRInputError_VRInputError_NoData -> { yield "NoData"; } - case EVRInputError_VRInputError_BufferTooSmall -> { yield "BufferTooSmall"; } - case EVRInputError_VRInputError_MismatchedActionManifest -> { yield "MismatchedActionManifest"; } - case EVRInputError_VRInputError_MissingSkeletonData -> { yield "MissingSkeletonData"; } - case EVRInputError_VRInputError_InvalidBoneIndex -> { yield "InvalidBoneIndex"; } - case EVRInputError_VRInputError_InvalidPriority -> { yield "InvalidPriority"; } - case EVRInputError_VRInputError_PermissionDenied -> { yield "PermissionDenied"; } - case EVRInputError_VRInputError_InvalidRenderModel -> { yield "InvalidRenderModel"; } - default -> { yield "Unknown"; } + case EVRInputError_VRInputError_None -> { + yield "None"; + } + case EVRInputError_VRInputError_NameNotFound -> { + yield "NameNotFound"; + } + case EVRInputError_VRInputError_WrongType -> { + yield "WrongType"; + } + case EVRInputError_VRInputError_InvalidHandle -> { + yield "InvalidHandle"; + } + case EVRInputError_VRInputError_InvalidParam -> { + yield "InvalidParam"; + } + case EVRInputError_VRInputError_NoSteam -> { + yield "NoSteam"; + } + case EVRInputError_VRInputError_MaxCapacityReached -> { + yield "MaxCapacityReached"; + } + case EVRInputError_VRInputError_IPCError -> { + yield "IPCError"; + } + case EVRInputError_VRInputError_NoActiveActionSet -> { + yield "NoActiveActionSet"; + } + case EVRInputError_VRInputError_InvalidDevice -> { + yield "InvalidDevice"; + } + case EVRInputError_VRInputError_InvalidSkeleton -> { + yield "InvalidSkeleton"; + } + case EVRInputError_VRInputError_InvalidBoneCount -> { + yield "InvalidBoneCount"; + } + case EVRInputError_VRInputError_InvalidCompressedData -> { + yield "InvalidCompressedData"; + } + case EVRInputError_VRInputError_NoData -> { + yield "NoData"; + } + case EVRInputError_VRInputError_BufferTooSmall -> { + yield "BufferTooSmall"; + } + case EVRInputError_VRInputError_MismatchedActionManifest -> { + yield "MismatchedActionManifest"; + } + case EVRInputError_VRInputError_MissingSkeletonData -> { + yield "MissingSkeletonData"; + } + case EVRInputError_VRInputError_InvalidBoneIndex -> { + yield "InvalidBoneIndex"; + } + case EVRInputError_VRInputError_InvalidPriority -> { + yield "InvalidPriority"; + } + case EVRInputError_VRInputError_PermissionDenied -> { + yield "PermissionDenied"; + } + case EVRInputError_VRInputError_InvalidRenderModel -> { + yield "InvalidRenderModel"; + } + default -> { + yield "Unknown"; + } }; } @@ -955,8 +999,12 @@ private void processVREvents() { EVREventType_VREvent_TrackedDeviceDeactivated, EVREventType_VREvent_TrackedDeviceUpdated, EVREventType_VREvent_TrackedDeviceRoleChanged, - EVREventType_VREvent_ModelSkinSettingsHaveChanged -> { this.getXforms = true; } - case EVREventType_VREvent_Quit -> { mc.stop(); } + EVREventType_VREvent_ModelSkinSettingsHaveChanged -> { + this.getXforms = true; + } + case EVREventType_VREvent_Quit -> { + mc.stop(); + } } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java index 64399a608..570be1884 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRStereoRenderer.java @@ -123,20 +123,48 @@ public void endFrame() throws RenderConfigException { public static String getCompositorError(int code) { return switch (code) { - case EVRCompositorError_VRCompositorError_None -> { yield "None"; } - case EVRCompositorError_VRCompositorError_RequestFailed -> { yield "RequestFailed"; } - case EVRCompositorError_VRCompositorError_IncompatibleVersion -> { yield "IncompatibleVersion"; } - case EVRCompositorError_VRCompositorError_DoNotHaveFocus -> { yield "DoesNotHaveFocus"; } - case EVRCompositorError_VRCompositorError_InvalidTexture -> { yield "InvalidTexture"; } - case EVRCompositorError_VRCompositorError_IsNotSceneApplication -> { yield "IsNotSceneApplication"; } - case EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice -> { yield "TextureIsOnWrongDevice"; } - case EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat -> { yield "TextureUsesUnsupportedFormat"; } - case EVRCompositorError_VRCompositorError_SharedTexturesNotSupported -> { yield "SharedTexturesNotSupported"; } - case EVRCompositorError_VRCompositorError_IndexOutOfRange -> { yield "IndexOutOfRange"; } - case EVRCompositorError_VRCompositorError_AlreadySubmitted -> { yield "AlreadySubmitted"; } - case EVRCompositorError_VRCompositorError_InvalidBounds -> { yield "InvalidBounds"; } - case EVRCompositorError_VRCompositorError_AlreadySet -> { yield "AlreadySet"; } - default -> { yield "Unknown"; } + case EVRCompositorError_VRCompositorError_None -> { + yield "None"; + } + case EVRCompositorError_VRCompositorError_RequestFailed -> { + yield "RequestFailed"; + } + case EVRCompositorError_VRCompositorError_IncompatibleVersion -> { + yield "IncompatibleVersion"; + } + case EVRCompositorError_VRCompositorError_DoNotHaveFocus -> { + yield "DoesNotHaveFocus"; + } + case EVRCompositorError_VRCompositorError_InvalidTexture -> { + yield "InvalidTexture"; + } + case EVRCompositorError_VRCompositorError_IsNotSceneApplication -> { + yield "IsNotSceneApplication"; + } + case EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice -> { + yield "TextureIsOnWrongDevice"; + } + case EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat -> { + yield "TextureUsesUnsupportedFormat"; + } + case EVRCompositorError_VRCompositorError_SharedTexturesNotSupported -> { + yield "SharedTexturesNotSupported"; + } + case EVRCompositorError_VRCompositorError_IndexOutOfRange -> { + yield "IndexOutOfRange"; + } + case EVRCompositorError_VRCompositorError_AlreadySubmitted -> { + yield "AlreadySubmitted"; + } + case EVRCompositorError_VRCompositorError_InvalidBounds -> { + yield "InvalidBounds"; + } + case EVRCompositorError_VRCompositorError_AlreadySet -> { + yield "AlreadySet"; + } + default -> { + yield "Unknown"; + } }; } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java index 4740b7818..bc2138b37 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/VRInputActionSet.java @@ -27,10 +27,18 @@ public enum VRInputActionSet { public static VRInputActionSet fromKeyBinding(KeyMapping keyMapping) { return switch (keyMapping.getCategory()) { - case "vivecraft.key.category.gui" -> { yield GUI; } - case "vivecraft.key.category.climbey" -> { yield CONTEXTUAL; } - case "vivecraft.key.category.keyboard" -> { yield KEYBOARD; } - default -> { yield VivecraftVRMod.isModBinding(keyMapping) ? MOD : INGAME; } + case "vivecraft.key.category.gui" -> { + yield GUI; + } + case "vivecraft.key.category.climbey" -> { + yield CONTEXTUAL; + } + case "vivecraft.key.category.keyboard" -> { + yield KEYBOARD; + } + default -> { + yield VivecraftVRMod.isModBinding(keyMapping) ? MOD : INGAME; + } }; } } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java index 29116b5f6..3a32c74a7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java @@ -114,7 +114,7 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac Quaternionf rotation = new Quaternionf().rotationY(0.0F).rotateX(toRadians(-110.0F + gunAngle)); Quaternionf preRotation = new Quaternionf().rotationY(0.0F); - switch (rendertype){ + switch (rendertype) { case Bow_Seated -> { translateY -= 0.1F; translateZ += 0.1F; @@ -358,7 +358,8 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac translateY = 0.0F; translateX = 0.0F; } - case Item, Block_Item, Sword -> {} + case Item, Block_Item, Sword -> { + } default -> { rotation.rotationZ(toRadians(180.0F)); rotation.rotateX(toRadians(-135.0F)); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java index d10dc6387..d87549fe8 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java @@ -4,7 +4,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.material.FogType; import net.minecraft.world.phys.Vec3; -import org.joml.Quaternionf; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; import org.vivecraft.client_xr.render_pass.RenderPassType; @@ -47,9 +46,15 @@ public boolean isDetached() { return (RenderPassType.isVanilla() ? super.isDetached() : switch (dh.currentPass) { - case THIRD -> { yield dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON; } - case CAMERA -> { yield true; } - default -> { yield dh.vrSettings.shouldRenderSelf; } + case THIRD -> { + yield dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON; + } + case CAMERA -> { + yield true; + } + default -> { + yield dh.vrSettings.shouldRenderSelf; + } } ); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java index 80fd64599..96599f7a7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java @@ -139,7 +139,7 @@ public static void renderCircle(Vec3 pos, float radius, int edges, int r, int g, for (int i = 0; i < edges + 1; i++) { float startAngle = (float) i / (float) edges * (float) PI * 2.0F; - switch(side) { + switch (side) { case 0, 1 -> { //y float x = (float) pos.x + (float) Math.cos(startAngle) * radius; float y = (float) pos.y; diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java index f9bdc8a1b..e6070ec79 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java @@ -8,20 +8,17 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat.Mode; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.MultiBufferSource.BufferSource; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; import org.lwjgl.opengl.GL11C; import org.vivecraft.client.network.ClientNetworking; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.gameplay.trackers.BowTracker; import org.vivecraft.client_vr.render.RenderPass; diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java index 91d455386..37a40bece 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java @@ -59,7 +59,6 @@ import static net.minecraft.client.Minecraft.ON_OSX; import static org.joml.Math.*; -import static org.joml.Math.lerp; import static org.vivecraft.client.utils.Utils.message; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java index f324085c1..0b0552f20 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java @@ -133,7 +133,7 @@ public static void renderSingleView(RenderPass eye, float partialTicks, long nan if (hurtTimer > 0.0F) { // hurt flash hurtTimer = hurtTimer / mc.player.hurtDuration; - hurtTimer = fma(sin((float)pow(hurtTimer, 4) * (float)PI), 0.5F, healthPercent); + hurtTimer = fma(sin((float) pow(hurtTimer, 4) * (float) PI), 0.5F, healthPercent); red = hurtTimer; } else if (dh.vrSettings.low_health_indicator) { // red due to low health red = healthPercent * abs(sin((2.5F * time) / (1.0F - healthPercent + 0.1F))); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java index 91f445138..629577113 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java @@ -18,7 +18,6 @@ import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.phys.Vec3; import org.vivecraft.client_vr.extensions.GameRendererExtension; -import org.vivecraft.client_vr.extensions.ItemInHandRendererExtension; import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.settings.VRHotkeys; diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java b/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java index cc08fab0d..58cdc0504 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/OptionEnum.java @@ -7,10 +7,18 @@ public interface OptionEnum> { default String getLangKey() { return switch (name().toLowerCase()) { - case "yes" -> { yield LangHelper.YES_KEY; } - case "no" -> { yield LangHelper.NO_KEY; } - case "on" -> { yield LangHelper.ON_KEY; } - case "off" -> { yield LangHelper.OFF_KEY; } + case "yes" -> { + yield LangHelper.YES_KEY; + } + case "no" -> { + yield LangHelper.NO_KEY; + } + case "on" -> { + yield LangHelper.ON_KEY; + } + case "off" -> { + yield LangHelper.OFF_KEY; + } default -> { Class cls = getClass(); yield "vivecraft.options." + (cls.isAnonymousClass() ? cls.getSuperclass() : cls).getSimpleName().toLowerCase() + "." + name().toLowerCase().replace("_", ""); diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java index 67eb6809d..12cf55c1e 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderSystemAccessor.java @@ -10,12 +10,12 @@ public interface RenderSystemAccessor { // needs remap because of forge @Accessor - public static int[] getShaderTextures() { + static int[] getShaderTextures() { return null; } @Accessor - public static Vector3f[] getShaderLightDirections() { + static Vector3f[] getShaderLightDirections() { return null; } } diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java index 5c458686d..df96e8fff 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java @@ -106,6 +106,7 @@ public String toString() { return this.vivecraft$useStencil ? GL30C.GL_DEPTH_STENCIL_ATTACHMENT : attachment; } + @Override public void vivecraft$blitToScreen(ShaderInstance instance, int left, int width, int height, int top, boolean disableBlend, float xCropFactor, float yCropFactor, boolean keepAspect) { RenderSystem.assertOnGameThreadOrInit(); if (!RenderSystem.isInInitPhase()) { diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java index 8b9bcf92b..fc6cd70d6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java @@ -54,7 +54,7 @@ protected TitleScreenMixin(Component component) { .size(56, 20) .pos(this.width / 2 + 104, this.height / 4 + 72) .build(); - vivecraft$vrModeButton.visible = dh.vrSettings.vrToggleButtonEnabled; + this.vivecraft$vrModeButton.visible = dh.vrSettings.vrToggleButtonEnabled; this.addRenderableWidget(this.vivecraft$vrModeButton); @@ -72,7 +72,7 @@ protected TitleScreenMixin(Component component) { public void vivecraft$renderToolTip(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo ci) { this.vivecraft$updateButton.visible = UpdateChecker.hasUpdate; - if (vivecraft$vrModeButton.visible && this.vivecraft$vrModeButton.isMouseOver(i, j)) { + if (this.vivecraft$vrModeButton.visible && this.vivecraft$vrModeButton.isMouseOver(i, j)) { guiGraphics.renderTooltip(this.font, this.font.split(Component.translatable("vivecraft.options.VR_MODE.tooltip"), max(this.width / 2 - 43, 170)), i, j); } if (vrInitialized && !vrRunning) { diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 5b16cbc29..1afeaef8d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -11,7 +11,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexSorting; import net.minecraft.ChatFormatting; -import net.minecraft.client.Timer; import net.minecraft.client.*; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; @@ -85,11 +84,13 @@ import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.CompletableFuture; import static net.minecraft.client.Minecraft.ON_OSX; -import static org.lwjgl.glfw.GLFW.*; +import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_DISABLED; +import static org.lwjgl.glfw.GLFW.GLFW_CURSOR_NORMAL; import static org.objectweb.asm.Opcodes.PUTFIELD; import static org.objectweb.asm.Opcodes.PUTSTATIC; import static org.vivecraft.client.utils.Utils.*; @@ -174,7 +175,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { target = "Lnet/minecraft/client/Minecraft;instance:Lnet/minecraft/client/Minecraft;" ) ) - private void vivecraft$captureMinecraftInstance(Minecraft value, Operation original){ + private void vivecraft$captureMinecraftInstance(Minecraft value, Operation original) { original.call(mc = value); // Assign early to ensure subsequent accesses are safe. } @@ -186,7 +187,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { target = "Lnet/minecraft/client/Minecraft;mainRenderTarget:Lcom/mojang/blaze3d/pipeline/RenderTarget;" ) ) - private void vivecraft$captureMainRenderTarget(Minecraft instance, RenderTarget value, Operation original){ + private void vivecraft$captureMainRenderTarget(Minecraft instance, RenderTarget value, Operation original) { RenderPassManager.INSTANCE = new RenderPassManager((MainTarget) value); original.call(instance, value); } @@ -257,7 +258,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (vrEnabled) { initializeVR(); } else if (vrInitialized) { - vivecraft$switchVRState(false); + this.vivecraft$switchVRState(false); destroyVR(true); } if (!vrInitialized) { @@ -265,7 +266,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } boolean vrActive = !dh.vrSettings.vrHotswitchingEnabled || dh.vr.isActive(); if (vrRunning != vrActive && (ClientNetworking.serverAllowsVrSwitching || instance.player == null)) { - vivecraft$switchVRState(vrActive); + this.vivecraft$switchVRState(vrActive); } if (vrRunning) { ++dh.frameIndex; @@ -343,7 +344,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V", ordinal = 4, shift = At.Shift.AFTER), method = "runTick", locals = LocalCapture.CAPTURE_FAILHARD) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V", ordinal = 4, shift = Shift.AFTER), method = "runTick", locals = LocalCapture.CAPTURE_FAILHARD) public void vivecraft$renderVRPasses(boolean renderLevel, CallbackInfo ci, long nanoTime) { if (vrRunning) { @@ -403,12 +404,24 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { dh.currentPass = renderpass; switch (renderpass) { - case LEFT, RIGHT -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.stereoXR); } - case CENTER -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.center); } - case THIRD -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.mixedReality); } - case SCOPEL -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.leftTelescope); } - case SCOPER -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.rightTelescope); } - case CAMERA -> { RenderPassManager.setWorldRenderPass(WorldRenderPass.camera); } + case LEFT, RIGHT -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.stereoXR); + } + case CENTER -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.center); + } + case THIRD -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.mixedReality); + } + case SCOPEL -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.leftTelescope); + } + case SCOPER -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.rightTelescope); + } + case CAMERA -> { + RenderPassManager.setWorldRenderPass(WorldRenderPass.camera); + } } this.profiler.push("Eye:" + renderpass); @@ -420,10 +433,18 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (dh.grabScreenShot && switch (renderpass) { - case CAMERA, CENTER -> { yield list.contains(renderpass); } - case LEFT -> { yield dh.vrSettings.displayMirrorLeftEye; } - case RIGHT -> { yield !dh.vrSettings.displayMirrorLeftEye; } - default -> { yield false; } + case CAMERA, CENTER -> { + yield list.contains(renderpass); + } + case LEFT -> { + yield dh.vrSettings.displayMirrorLeftEye; + } + case RIGHT -> { + yield !dh.vrSettings.displayMirrorLeftEye; + } + default -> { + yield false; + } } ) { instance.mainRenderTarget.unbindWrite(); @@ -509,12 +530,20 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;rightClickDelay:I", shift = Shift.AFTER, opcode = PUTFIELD), method = "startUseItem()V") public void vivecraft$breakDelay(CallbackInfo info) { if (vrRunning) { - switch (dh.vrSettings.rightclickDelay) { - case SLOW -> { this.rightClickDelay = 6; } - case SLOWER -> { this.rightClickDelay = 8; } - case SLOWEST -> { this.rightClickDelay = 10; } - default -> { this.rightClickDelay = 4; } - } + this.rightClickDelay = switch (dh.vrSettings.rightclickDelay) { + case SLOW -> { + yield 6; + } + case SLOWER -> { + yield 8; + } + case SLOWEST -> { + yield 10; + } + default -> { + yield 4; + } + }; } } @@ -902,9 +931,15 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { left = width; // setup for eye1 yield dh.vrRenderer.framebufferEye1; } - case FIRST_PERSON -> { yield dh.vrRenderer.framebufferUndistorted; } - case THIRD_PERSON -> { yield dh.vrRenderer.framebufferMR; } - case GUI -> { yield GuiHandler.guiFramebuffer; } + case FIRST_PERSON -> { + yield dh.vrRenderer.framebufferUndistorted; + } + case THIRD_PERSON -> { + yield dh.vrRenderer.framebufferMR; + } + case GUI -> { + yield GuiHandler.guiFramebuffer; + } case OFF -> { if (dh.vr.isHMDTracking()) { this.vivecraft$notifyMirror("Mirror is OFF", true, 1000); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java index 8cb7e1f64..e37fc8136 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/OptionsScreenVRMixin.java @@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -50,22 +51,22 @@ protected OptionsScreenVRMixin(Component component) { } @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;I)Lnet/minecraft/client/gui/layouts/LayoutElement;"), locals = LocalCapture.CAPTURE_FAILHARD) - private void vivecraft$addVivecraftSettingsLeft(CallbackInfo ci, GridLayout gridLayout, GridLayout.RowHelper rowHelper) { + private void vivecraft$addVivecraftSettingsLeft(CallbackInfo ci, GridLayout gridLayout, RowHelper rowHelper) { if (dh.vrSettings.vrSettingsButtonEnabled && dh.vrSettings.vrSettingsButtonPositionLeft) { this.vivecraft$addVivecraftButton(rowHelper); } } - @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;I)Lnet/minecraft/client/gui/layouts/LayoutElement;", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) - private void vivecraft$addVivecraftSettingsRight(CallbackInfo ci, GridLayout gridLayout, GridLayout.RowHelper rowHelper) { + @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/GridLayout$RowHelper;addChild(Lnet/minecraft/client/gui/layouts/LayoutElement;I)Lnet/minecraft/client/gui/layouts/LayoutElement;", shift = Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) + private void vivecraft$addVivecraftSettingsRight(CallbackInfo ci, GridLayout gridLayout, RowHelper rowHelper) { if (dh.vrSettings.vrSettingsButtonEnabled && !dh.vrSettings.vrSettingsButtonPositionLeft) { this.vivecraft$addVivecraftButton(rowHelper); } } @Unique - private void vivecraft$addVivecraftButton(GridLayout.RowHelper rowHelper) { - rowHelper.addChild(new Button.Builder(Component.translatable("vivecraft.options.screen.main.button"), (p) -> + private void vivecraft$addVivecraftButton(RowHelper rowHelper) { + rowHelper.addChild(new Builder(Component.translatable("vivecraft.options.screen.main.button"), (p) -> { mc.options.save(); mc.setScreen(new GuiMainVRSettings(this)); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java index e4e530811..47fdbef02 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java @@ -81,6 +81,7 @@ public LocalPlayerVRMixin(ClientLevel clientLevel, GameProfile gameProfile) { @Shadow protected abstract void updateAutoJump(float f, float g); + @Override @Shadow public abstract void swing(InteractionHand interactionHand); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java index 27b74651c..85d3f26b8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java @@ -129,7 +129,7 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt dh.isfphand = true; - switch (rendertype){ + switch (rendertype) { case Map -> { RenderSystem.disableCull(); this.renderMap(pMatrixStack, pBuffer, pCombinedLight, pStack); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java index ec537edbc..7190f8098 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java @@ -95,6 +95,7 @@ public abstract class EntityRenderDispatcherVRMixin implements } } + @Override public Map vivecraft$getArmSkinMap() { return this.vivecraft$armSkinMap; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java index 5e90de262..c5b693913 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java @@ -99,22 +99,24 @@ public class MovementTutorialStepInstanceVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V", ordinal = 0), index = 2, method = "tick") private Component vivecraft$alterMovementDescription(Component description) { - return (!vrRunning || dh.vrSettings.seated || !dh.vr.getInputAction(mc.options.keyJump).isActive() ? - description : - Component.translatable( - "tutorial.move.description", - Component.literal( - dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyJump).getLastOrigin()) - ).withStyle(ChatFormatting.BOLD) - ) + return ( + !vrRunning || dh.vrSettings.seated || !dh.vr.getInputAction(mc.options.keyJump).isActive() ? + description : + Component.translatable( + "tutorial.move.description", + Component.literal( + dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyJump).getLastOrigin()) + ).withStyle(ChatFormatting.BOLD) + ) ); } @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/toasts/TutorialToast;(Lnet/minecraft/client/gui/components/toasts/TutorialToast$Icons;Lnet/minecraft/network/chat/Component;Lnet/minecraft/network/chat/Component;Z)V", ordinal = 1), index = 2, method = "tick") private Component vivecraft$alterLookDescription(Component title) { - return (!vrRunning || dh.vrSettings.seated ? - title : - Component.translatable( + return ( + !vrRunning || dh.vrSettings.seated ? + title : + Component.translatable( "vivecraft.toasts.point_controller", Component.translatable( dh.vrSettings.reverseHands ? diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json index c0f05a2db..b8a76e3d2 100644 --- a/common/src/main/resources/architectury.common.json +++ b/common/src/main/resources/architectury.common.json @@ -1,3 +1,3 @@ { - "accessWidener": "vivecraft.accesswidener" + "accessWidener": "vivecraft.accesswidener" } diff --git a/common/src/main/resources/assets/minecraft/atlases/blocks.json b/common/src/main/resources/assets/minecraft/atlases/blocks.json index 4f4308239..01a6d0ff2 100644 --- a/common/src/main/resources/assets/minecraft/atlases/blocks.json +++ b/common/src/main/resources/assets/minecraft/atlases/blocks.json @@ -1,33 +1,33 @@ { - "sources": [ - { - "type": "directory", - "source": "blocks", - "prefix": "blocks/" - }, - { - "type": "single", - "resource": "vivecraft:black_hmd" - }, - { - "type": "single", - "resource": "vivecraft:gold_hmd" - }, - { - "type": "single", - "resource": "vivecraft:diamond_hmd" - }, - { - "type": "single", - "resource": "vivecraft:black" - }, - { - "type": "single", - "resource": "vivecraft:white" - }, - { - "type": "single", - "resource": "vivecraft:transparent" - } - ] + "sources": [ + { + "type": "directory", + "source": "blocks", + "prefix": "blocks/" + }, + { + "type": "single", + "resource": "vivecraft:black_hmd" + }, + { + "type": "single", + "resource": "vivecraft:gold_hmd" + }, + { + "type": "single", + "resource": "vivecraft:diamond_hmd" + }, + { + "type": "single", + "resource": "vivecraft:black" + }, + { + "type": "single", + "resource": "vivecraft:white" + }, + { + "type": "single", + "resource": "vivecraft:transparent" + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/fovreduction.json b/common/src/main/resources/assets/minecraft/shaders/core/fovreduction.json index 33388afdb..43d8eb296 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/fovreduction.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/fovreduction.json @@ -1,95 +1,95 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "fovreduction", + "fragment": "fovreduction", + "attributes": ["Position", "UV0"], + "samplers": [ + { + "name": "Sampler0" + } + ], + "uniforms": [ + { + "name": "ModelViewMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] }, - "vertex": "fovreduction", - "fragment": "fovreduction", - "attributes": ["Position", "UV0"], - "samplers": [ - { - "name": "Sampler0" - } - ], - "uniforms": [ - { - "name": "ModelViewMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "ProjMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "circle_radius", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "circle_offset", - "type": "float", - "count": 1, - "values": [0.1] - }, - { - "name": "border", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "water", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "portal", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "pumpkin", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "portaltime", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "redalpha", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "bluealpha", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "blackalpha", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "eye", - "type": "int", - "count": 1, - "values": [1] - } - ] + { + "name": "ProjMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "circle_radius", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "circle_offset", + "type": "float", + "count": 1, + "values": [0.1] + }, + { + "name": "border", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "water", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "portal", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "pumpkin", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "portaltime", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "redalpha", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "bluealpha", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "blackalpha", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "eye", + "type": "int", + "count": 1, + "values": [1] + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/lanczos.json b/common/src/main/resources/assets/minecraft/shaders/core/lanczos.json index 5071650e3..1475f40e8 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/lanczos.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/lanczos.json @@ -1,32 +1,32 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "lanczos", + "fragment": "lanczos", + "attributes": ["Position", "UV0"], + "samplers": [ + { + "name": "Sampler0" }, - "vertex": "lanczos", - "fragment": "lanczos", - "attributes": ["Position", "UV0"], - "samplers": [ - { - "name": "Sampler0" - }, - { - "name": "Sampler1" - } - ], - "uniforms": [ - { - "name": "texelWidthOffset", - "type": "float", - "count": 1, - "values": [1.0] - }, - { - "name": "texelHeightOffset", - "type": "float", - "count": 1, - "values": [1.0] - } - ] + { + "name": "Sampler1" + } + ], + "uniforms": [ + { + "name": "texelWidthOffset", + "type": "float", + "count": 1, + "values": [1.0] + }, + { + "name": "texelHeightOffset", + "type": "float", + "count": 1, + "values": [1.0] + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json index add311377..a4ad6369e 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json @@ -1,74 +1,74 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "passthrough", + "fragment": "mixedreality", + "attributes": ["Position", "UV0"], + "samplers": [ + { + "name": "Sampler0" }, - "vertex": "passthrough", - "fragment": "mixedreality", - "attributes": ["Position", "UV0"], - "samplers": [ - { - "name": "Sampler0" - }, - { - "name": "Sampler1" - } - ], - "uniforms": [ - { - "name": "projectionMatrix", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "viewMatrix", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "resolution", - "type": "float", - "count": 2, - "values": [1.0, 1.0] - }, - { - "name": "position", - "type": "float", - "count": 2, - "values": [1.0, 1.0] - }, - { - "name": "hmdViewPosition", - "type": "float", - "count": 3, - "values": [1.0, 1.0, 1.0] - }, - { - "name": "hmdPlaneNormal", - "type": "float", - "count": 3, - "values": [1.0, 1.0, 1.0] - }, - { - "name": "keyColor", - "type": "float", - "count": 3, - "values": [1.0, 1.0, 1.0] - }, - { - "name": "pass", - "type": "int", - "count": 1, - "values": [1] - }, - { - "name": "alphaMode", - "type": "int", - "count": 1, - "values": [1] - } - ] + { + "name": "Sampler1" + } + ], + "uniforms": [ + { + "name": "projectionMatrix", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "viewMatrix", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "resolution", + "type": "float", + "count": 2, + "values": [1.0, 1.0] + }, + { + "name": "position", + "type": "float", + "count": 2, + "values": [1.0, 1.0] + }, + { + "name": "hmdViewPosition", + "type": "float", + "count": 3, + "values": [1.0, 1.0, 1.0] + }, + { + "name": "hmdPlaneNormal", + "type": "float", + "count": 3, + "values": [1.0, 1.0, 1.0] + }, + { + "name": "keyColor", + "type": "float", + "count": 3, + "values": [1.0, 1.0, 1.0] + }, + { + "name": "pass", + "type": "int", + "count": 1, + "values": [1] + }, + { + "name": "alphaMode", + "type": "int", + "count": 1, + "values": [1] + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_gateway_vr.json b/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_gateway_vr.json index d68724f57..15b6541d6 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_gateway_vr.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_gateway_vr.json @@ -1,50 +1,50 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "rendertype_end_portal_vr", + "fragment": "rendertype_end_portal_vr", + "attributes": [], + "samplers": [ + { + "name": "Sampler0" }, - "vertex": "rendertype_end_portal_vr", - "fragment": "rendertype_end_portal_vr", - "attributes": [], - "samplers": [ - { - "name": "Sampler0" - }, - { - "name": "Sampler1" - } - ], - "uniforms": [ - { - "name": "ModelViewMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "ProjMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "IViewRotMat", - "type": "matrix3x3", - "count": 9, - "values": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "GameTime", - "type": "float", - "count": 1, - "values": [0.0] - }, - { - "name": "EndPortalLayers", - "type": "int", - "count": 1, - "values": [16] - } - ] + { + "name": "Sampler1" + } + ], + "uniforms": [ + { + "name": "ModelViewMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "ProjMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "IViewRotMat", + "type": "matrix3x3", + "count": 9, + "values": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "GameTime", + "type": "float", + "count": 1, + "values": [0.0] + }, + { + "name": "EndPortalLayers", + "type": "int", + "count": 1, + "values": [16] + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_portal_vr.json b/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_portal_vr.json index 7afa90ade..edec87990 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_portal_vr.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/rendertype_end_portal_vr.json @@ -1,50 +1,50 @@ { - "blend": { - "func": "add", - "srcrgb": "srcalpha", - "dstrgb": "1-srcalpha" + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "rendertype_end_portal_vr", + "fragment": "rendertype_end_portal_vr", + "attributes": [], + "samplers": [ + { + "name": "Sampler0" }, - "vertex": "rendertype_end_portal_vr", - "fragment": "rendertype_end_portal_vr", - "attributes": [], - "samplers": [ - { - "name": "Sampler0" - }, - { - "name": "Sampler1" - } - ], - "uniforms": [ - { - "name": "ModelViewMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "ProjMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "IViewRotMat", - "type": "matrix3x3", - "count": 9, - "values": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "GameTime", - "type": "float", - "count": 1, - "values": [0.0] - }, - { - "name": "EndPortalLayers", - "type": "int", - "count": 1, - "values": [15] - } - ] + { + "name": "Sampler1" + } + ], + "uniforms": [ + { + "name": "ModelViewMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "ProjMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "IViewRotMat", + "type": "matrix3x3", + "count": 9, + "values": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "GameTime", + "type": "float", + "count": 1, + "values": [0.0] + }, + { + "name": "EndPortalLayers", + "type": "int", + "count": 1, + "values": [15] + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/post/vrtransparency.json b/common/src/main/resources/assets/minecraft/shaders/post/vrtransparency.json index a76cad9d6..bcd34d9b5 100644 --- a/common/src/main/resources/assets/minecraft/shaders/post/vrtransparency.json +++ b/common/src/main/resources/assets/minecraft/shaders/post/vrtransparency.json @@ -1,96 +1,96 @@ { - "targets": [ - "water", - "translucent", - "itemEntity", - "particles", - "clouds", - "weather", - "vroccluded", - "vrunoccluded", - "vrhands", - "final" - ], - "passes": [ - { - "name": "vrtransparency", - "intarget": "minecraft:main", - "outtarget": "final", - "auxtargets": [ - { - "name": "DiffuseDepthSampler", - "id": "minecraft:main:depth" - }, - { - "name": "TranslucentSampler", - "id": "translucent" - }, - { - "name": "TranslucentDepthSampler", - "id": "translucent:depth" - }, - { - "name": "ItemEntitySampler", - "id": "itemEntity" - }, - { - "name": "ItemEntityDepthSampler", - "id": "itemEntity:depth" - }, - { - "name": "ParticlesSampler", - "id": "particles" - }, - { - "name": "ParticlesDepthSampler", - "id": "particles:depth" - }, - { - "name": "CloudsSampler", - "id": "clouds" - }, - { - "name": "CloudsDepthSampler", - "id": "clouds:depth" - }, - { - "name": "WeatherSampler", - "id": "weather" - }, - { - "name": "WeatherDepthSampler", - "id": "weather:depth" - }, - { - "name": "VrOccludedSampler", - "id": "vroccluded" - }, - { - "name": "VrOccludedDepthSampler", - "id": "vroccluded:depth" - }, - { - "name": "VrUnoccludedSampler", - "id": "vrunoccluded" - }, - { - "name": "VrUnoccludedDepthSampler", - "id": "vrunoccluded:depth" - }, - { - "name": "VrHandsSampler", - "id": "vrhands" - }, - { - "name": "VrHandsDepthSampler", - "id": "vrhands:depth" - } - ] - }, - { - "name": "blit", - "intarget": "final", - "outtarget": "minecraft:main" + "targets": [ + "water", + "translucent", + "itemEntity", + "particles", + "clouds", + "weather", + "vroccluded", + "vrunoccluded", + "vrhands", + "final" + ], + "passes": [ + { + "name": "vrtransparency", + "intarget": "minecraft:main", + "outtarget": "final", + "auxtargets": [ + { + "name": "DiffuseDepthSampler", + "id": "minecraft:main:depth" + }, + { + "name": "TranslucentSampler", + "id": "translucent" + }, + { + "name": "TranslucentDepthSampler", + "id": "translucent:depth" + }, + { + "name": "ItemEntitySampler", + "id": "itemEntity" + }, + { + "name": "ItemEntityDepthSampler", + "id": "itemEntity:depth" + }, + { + "name": "ParticlesSampler", + "id": "particles" + }, + { + "name": "ParticlesDepthSampler", + "id": "particles:depth" + }, + { + "name": "CloudsSampler", + "id": "clouds" + }, + { + "name": "CloudsDepthSampler", + "id": "clouds:depth" + }, + { + "name": "WeatherSampler", + "id": "weather" + }, + { + "name": "WeatherDepthSampler", + "id": "weather:depth" + }, + { + "name": "VrOccludedSampler", + "id": "vroccluded" + }, + { + "name": "VrOccludedDepthSampler", + "id": "vroccluded:depth" + }, + { + "name": "VrUnoccludedSampler", + "id": "vrunoccluded" + }, + { + "name": "VrUnoccludedDepthSampler", + "id": "vrunoccluded:depth" + }, + { + "name": "VrHandsSampler", + "id": "vrhands" + }, + { + "name": "VrHandsDepthSampler", + "id": "vrhands:depth" } - ] + ] + }, + { + "name": "blit", + "intarget": "final", + "outtarget": "minecraft:main" + } + ] } diff --git a/common/src/main/resources/assets/minecraft/shaders/program/vrtransparency.json b/common/src/main/resources/assets/minecraft/shaders/program/vrtransparency.json index 5ab287ee8..e210230d9 100644 --- a/common/src/main/resources/assets/minecraft/shaders/program/vrtransparency.json +++ b/common/src/main/resources/assets/minecraft/shaders/program/vrtransparency.json @@ -1,80 +1,80 @@ { - "blend": { - "func": "add", - "srcrgb": "one", - "dstrgb": "zero" - }, - "vertex": "screenquad", - "fragment": "vrtransparency", - "attributes": ["Position"], - "samplers": [ - { - "name": "DiffuseSampler" - }, - { - "name": "DiffuseDepthSampler" - }, - { - "name": "TranslucentSampler" - }, - { - "name": "TranslucentDepthSampler" - }, - { - "name": "ItemEntitySampler" - }, - { - "name": "ItemEntityDepthSampler" - }, - { - "name": "ParticlesSampler" - }, - { - "name": "ParticlesDepthSampler" - }, - { - "name": "CloudsSampler" - }, - { - "name": "CloudsDepthSampler" - }, - { - "name": "WeatherSampler" - }, - { - "name": "WeatherDepthSampler" - }, - { - "name": "VrOccludedSampler" - }, - { - "name": "VrOccludedDepthSampler" - }, - { - "name": "VrUnoccludedSampler" - }, - { - "name": "VrUnoccludedDepthSampler" - }, - { - "name": "VrHandsSampler" - }, - { - "name": "VrHandsDepthSampler" - } - ], - "uniforms": [ - { - "name": "ProjMat", - "type": "matrix4x4", - "count": 16, - "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] - }, - { - "name": "OutSize", - "type": "float", - "count": 2, - "values": [1.0, 1.0] - } - ] + "blend": { + "func": "add", + "srcrgb": "one", + "dstrgb": "zero" + }, + "vertex": "screenquad", + "fragment": "vrtransparency", + "attributes": ["Position"], + "samplers": [ + { + "name": "DiffuseSampler" + }, + { + "name": "DiffuseDepthSampler" + }, + { + "name": "TranslucentSampler" + }, + { + "name": "TranslucentDepthSampler" + }, + { + "name": "ItemEntitySampler" + }, + { + "name": "ItemEntityDepthSampler" + }, + { + "name": "ParticlesSampler" + }, + { + "name": "ParticlesDepthSampler" + }, + { + "name": "CloudsSampler" + }, + { + "name": "CloudsDepthSampler" + }, + { + "name": "WeatherSampler" + }, + { + "name": "WeatherDepthSampler" + }, + { + "name": "VrOccludedSampler" + }, + { + "name": "VrOccludedDepthSampler" + }, + { + "name": "VrUnoccludedSampler" + }, + { + "name": "VrUnoccludedDepthSampler" + }, + { + "name": "VrHandsSampler" + }, + { + "name": "VrHandsDepthSampler" + } + ], + "uniforms": [ + { + "name": "ProjMat", + "type": "matrix4x4", + "count": 16, + "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] + }, + { + "name": "OutSize", + "type": "float", + "count": 2, + "values": [1.0, 1.0] + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/bag.json b/common/src/main/resources/assets/vivecraft/blockstates/bag.json index ee501dbf4..d6ce3fb35 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/bag.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/bag.json @@ -1,16 +1,16 @@ { - "variants": { - "type=normal": { - "model": "vivecraft:bag" - }, - "type=gold": { - "model": "vivecraft:bag_gold" - }, - "type=closed": { - "model": "vivecraft:bag_closed" - }, - "type=gold_closed": { - "model": "vivecraft:bag_gold_closed" - } + "variants": { + "type=normal": { + "model": "vivecraft:bag" + }, + "type=gold": { + "model": "vivecraft:bag_gold" + }, + "type=closed": { + "model": "vivecraft:bag_closed" + }, + "type=gold_closed": { + "model": "vivecraft:bag_gold_closed" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/camcorder.json b/common/src/main/resources/assets/vivecraft/blockstates/camcorder.json index 2e0a05d8c..938c09003 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/camcorder.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/camcorder.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:camcorder" - } + "variants": { + "": { + "model": "vivecraft:camcorder" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/camcorder_display.json b/common/src/main/resources/assets/vivecraft/blockstates/camcorder_display.json index feba6939b..6496a113d 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/camcorder_display.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/camcorder_display.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:camcorder_display" - } + "variants": { + "": { + "model": "vivecraft:camcorder_display" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/camera.json b/common/src/main/resources/assets/vivecraft/blockstates/camera.json index 16a2fdede..e185b66f9 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/camera.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/camera.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:camera" - } + "variants": { + "": { + "model": "vivecraft:camera" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/camera_display.json b/common/src/main/resources/assets/vivecraft/blockstates/camera_display.json index 9467de346..4573b8dd9 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/camera_display.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/camera_display.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:camera_display" - } + "variants": { + "": { + "model": "vivecraft:camera_display" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/mini_crafting.json b/common/src/main/resources/assets/vivecraft/blockstates/mini_crafting.json index 823c50c63..26c31e032 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/mini_crafting.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/mini_crafting.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:mini_crafting" - } + "variants": { + "": { + "model": "vivecraft:mini_crafting" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/telescope.json b/common/src/main/resources/assets/vivecraft/blockstates/telescope.json index f6042baaf..f42f4e5e0 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/telescope.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/telescope.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:telescope" - } + "variants": { + "": { + "model": "vivecraft:telescope" } + } } diff --git a/common/src/main/resources/assets/vivecraft/blockstates/trashbin.json b/common/src/main/resources/assets/vivecraft/blockstates/trashbin.json index 2e04d0985..e30769949 100644 --- a/common/src/main/resources/assets/vivecraft/blockstates/trashbin.json +++ b/common/src/main/resources/assets/vivecraft/blockstates/trashbin.json @@ -1,7 +1,7 @@ { - "variants": { - "": { - "model": "vivecraft:trashbin" - } + "variants": { + "": { + "model": "vivecraft:trashbin" } + } } diff --git a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json index 8bf4cc1b9..6b3bcb7d1 100644 --- a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults.json @@ -1,360 +1,360 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/left/input/y" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/left/input/x" - } - ] + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/right/input/joystick" - } - ] + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - } - }, - "mode": "button", - "path": "/user/hand/left/input/bumper" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "button", - "path": "/user/hand/right/input/bumper" - } - ] + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/left/input/y" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/left/input/x" } + ] }, - "category": "steamvr_input", - "controller_type": "vive_cosmos_controller", - "description": "", - "name": "Vive Cosmos Defaults", - "options": {}, - "simulated_actions": [] + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/right/input/joystick" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + } + }, + "mode": "button", + "path": "/user/hand/left/input/bumper" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "button", + "path": "/user/hand/right/input/bumper" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "vive_cosmos_controller", + "description": "", + "name": "Vive Cosmos Defaults", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json index 129125b5f..4f645dfe3 100644 --- a/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/cosmos_defaults_reversed.json @@ -1,360 +1,360 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - } - ] + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/a" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/left/input/joystick" - } - ] + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/left/input/y" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "path": "/user/hand/left/input/x" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - } - }, - "mode": "button", - "path": "/user/hand/right/input/bumper" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "button", - "path": "/user/hand/left/input/bumper" - } - ] + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" } + ] }, - "category": "steamvr_input", - "controller_type": "vive_cosmos_controller", - "description": "", - "name": "Vive Cosmos Defaults (Reversed Hands)", - "options": {}, - "simulated_actions": [] + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/a" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/left/input/joystick" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/left/input/y" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "path": "/user/hand/left/input/x" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + } + }, + "mode": "button", + "path": "/user/hand/right/input/bumper" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "button", + "path": "/user/hand/left/input/bumper" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "vive_cosmos_controller", + "description": "", + "name": "Vive Cosmos Defaults (Reversed Hands)", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json index 1639cea2e..e4c5cec86 100644 --- a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults.json @@ -1,443 +1,443 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/a", "click"], - ["/user/hand/right/input/a", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "grab", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "grab", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/a" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force", - "haptic_amplitude": "0" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force", - "haptic_amplitude": "0" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/a", "click"], + ["/user/hand/right/input/a", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "grab", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "grab", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/a" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "skeleton": [ - { - "output": "/actions/global/in/lefthandbones", - "path": "/user/hand/left/input/skeleton/left" - }, - { - "output": "/actions/global/in/righthandbones", - "path": "/user/hand/right/input/skeleton/right" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/left/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/left/input/a" - } - ] + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/a" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force", + "haptic_amplitude": "0" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force", + "haptic_amplitude": "0" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "path": "/user/hand/right/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.5" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - }, - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.5" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - } - ] + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "skeleton": [ + { + "output": "/actions/global/in/lefthandbones", + "path": "/user/hand/left/input/skeleton/left" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - } - ] + { + "output": "/actions/global/in/righthandbones", + "path": "/user/hand/right/input/skeleton/right" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/left/input/b" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/left/input/a" } + ] }, - "category": "steamvr_input", - "controller_type": "knuckles", - "description": "", - "name": "Index Controller Defaults", - "options": {}, - "simulated_actions": [] + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "path": "/user/hand/right/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.5" + }, + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/right/input/trackpad" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + }, + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.5" + }, + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + } + ] + }, + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "knuckles", + "description": "", + "name": "Index Controller Defaults", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json index 07d6d7299..cf34ed077 100644 --- a/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/knuckles_defaults_reversed.json @@ -1,443 +1,443 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/a", "click"], - ["/user/hand/right/input/a", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "grab", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "grab", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/a" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force", - "haptic_amplitude": "0" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "grab": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force", - "haptic_amplitude": "0" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/a", "click"], + ["/user/hand/right/input/a", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "grab", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "grab", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/a" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "skeleton": [ - { - "output": "/actions/global/in/lefthandbones", - "path": "/user/hand/left/input/skeleton/left" - }, - { - "output": "/actions/global/in/righthandbones", - "path": "/user/hand/right/input/skeleton/right" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - } - ] + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/a" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force", + "haptic_amplitude": "0" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "grab": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force", + "haptic_amplitude": "0" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "path": "/user/hand/left/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.5" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/left/input/trackpad" - } - ] + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - }, - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/thumbstick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/left/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.85", - "click_deactivate_threshold": "0.35", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.5" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "button", - "path": "/user/hand/left/input/a" - } - ] + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "skeleton": [ + { + "output": "/actions/global/in/lefthandbones", + "path": "/user/hand/left/input/skeleton/left" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "parameters": { - "click_activate_threshold": "0.6", - "click_deactivate_threshold": "0.2", - "force_input": "force" - }, - "path": "/user/hand/right/input/grip" - } - ] + { + "output": "/actions/global/in/righthandbones", + "path": "/user/hand/right/input/skeleton/right" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" } + ] }, - "category": "steamvr_input", - "controller_type": "knuckles", - "description": "", - "name": "Index Controller Defaults (Reversed Hands)", - "options": {}, - "simulated_actions": [] + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "path": "/user/hand/left/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.5" + }, + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/left/input/trackpad" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + }, + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/thumbstick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/left/input/b" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.85", + "click_deactivate_threshold": "0.35", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.5" + }, + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "button", + "path": "/user/hand/left/input/a" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "parameters": { + "click_activate_threshold": "0.6", + "click_deactivate_threshold": "0.2", + "force_input": "force" + }, + "path": "/user/hand/right/input/grip" + } + ] + }, + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "knuckles", + "description": "", + "name": "Index Controller Defaults (Reversed Hands)", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json b/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json index cbe1ac102..c4c4377be 100644 --- a/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/oculus_defaults.json @@ -1,354 +1,354 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/left/input/y" + }, + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/left/input/x" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/left/input/y" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/left/input/x" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/right/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - }, - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "toggle_button", - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/left/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/right/input/joystick" } + ] }, - "category": "steamvr_input", - "controller_type": "oculus_touch", - "description": "", - "name": "Oculus Touch Defaults", - "options": {}, - "simulated_actions": [] + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + }, + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "toggle_button", + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/left/input/trigger" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "oculus_touch", + "description": "", + "name": "Oculus Touch Defaults", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json index e281d8313..59d371280 100644 --- a/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/oculus_defaults_reversed.json @@ -1,354 +1,354 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/right/input/b" + }, + { + "inputs": { + "click": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "button", + "path": "/user/hand/right/input/a" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/right/input/b" - }, - { - "inputs": { - "click": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "button", - "path": "/user/hand/right/input/a" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/a" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/left/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/left/input/y" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "button", - "path": "/user/hand/left/input/x" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.jump" - }, - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "toggle_button", - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/a" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/left/input/joystick" } + ] }, - "category": "steamvr_input", - "controller_type": "oculus_touch", - "description": "", - "name": "Oculus Touch Defaults (Reversed Hands)", - "options": {}, - "simulated_actions": [] + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/left/input/y" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "button", + "path": "/user/hand/left/input/x" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.jump" + }, + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "toggle_button", + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "oculus_touch", + "description": "", + "name": "Oculus Touch Defaults (Reversed Hands)", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json b/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json index c3083eca7..3d10c399f 100644 --- a/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/tracker_defaults.json @@ -1,23 +1,23 @@ { - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/mixedreality": { - "haptics": [ - ], - "poses": [ - { - "output": "/actions/mixedreality/in/externalcamera", - "path": "/user/camera/pose/raw" - } - ], - "sources": [ - ] + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/mixedreality": { + "haptics": [ + ], + "poses": [ + { + "output": "/actions/mixedreality/in/externalcamera", + "path": "/user/camera/pose/raw" } - }, - "controller_type": "vive_tracker_camera", - "description": "", - "name": "Tracker for Camera", - "options": {}, - "simulated_actions": [] + ], + "sources": [ + ] + } + }, + "controller_type": "vive_tracker_camera", + "description": "", + "name": "Tracker for Camera", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/vive_defaults.json b/common/src/main/resources/assets/vivecraft/input/vive_defaults.json index 268fc063b..a60eaecc6 100644 --- a/common/src/main/resources/assets/vivecraft/input/vive_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/vive_defaults.json @@ -1,367 +1,367 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/left/input/application_menu" + }, + { + "inputs": { + "north": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/right/input/trackpad" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/left/input/trigger" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/left/input/application_menu" - }, - { - "inputs": { - "north": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "north": { + "output": "/actions/ingame/in/key.jump" + }, + "south": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "north": { - "output": "/actions/ingame/in/key.jump" - }, - "south": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/right/input/application_menu" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "south": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/right/input/application_menu" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "south": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" } + ] }, - "category": "steamvr_input", - "controller_type": "vive_controller", - "description": "", - "name": "Vive Controller Defaults", - "options": {}, - "simulated_actions": [] + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "vive_controller", + "description": "", + "name": "Vive Controller Defaults", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json index 133a49ab9..991ce6c54 100644 --- a/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/vive_defaults_reversed.json @@ -1,367 +1,367 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/right/input/application_menu" + }, + { + "inputs": { + "north": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/left/input/trackpad" + } + ] + }, + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/right/input/trigger" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/right/input/application_menu" - }, - { - "inputs": { - "north": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - } - ] + { + "inputs": { + "north": { + "output": "/actions/ingame/in/key.jump" + }, + "south": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/left/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "north": { - "output": "/actions/ingame/in/key.jump" - }, - "south": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/left/input/application_menu" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "south": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/left/input/application_menu" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "south": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" } + ] }, - "category": "steamvr_input", - "controller_type": "vive_controller", - "description": "", - "name": "Vive Controller Defaults (Reversed Hands)", - "options": {}, - "simulated_actions": [] + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "vive_controller", + "description": "", + "name": "Vive Controller Defaults (Reversed Hands)", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json b/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json index 1d20f9901..d99336a48 100644 --- a/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json +++ b/common/src/main/resources/assets/vivecraft/input/wmr_defaults.json @@ -1,403 +1,403 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/left/input/application_menu" + }, + { + "inputs": { + "north": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/left/input/application_menu" - }, - { - "inputs": { - "north": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/right/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "north": { - "output": "/actions/ingame/in/key.jump" - }, - "south": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/right/input/application_menu" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "south": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "parameters": { - "deadzone_pct": "20" - }, - "path": "/user/hand/left/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "parameters": { - "deadzone_pct": "20" - }, - "path": "/user/hand/right/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trackpad" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/right/input/trackpad" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/right/input/joystick" } + ] }, - "category": "steamvr_input", - "controller_type": "holographic_controller", - "description": "", - "name": "Windows Mixed Reality Defaults", - "options": {}, - "simulated_actions": [] + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "north": { + "output": "/actions/ingame/in/key.jump" + }, + "south": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/right/input/application_menu" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "south": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "parameters": { + "deadzone_pct": "20" + }, + "path": "/user/hand/left/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "parameters": { + "deadzone_pct": "20" + }, + "path": "/user/hand/right/input/joystick" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "holographic_controller", + "description": "", + "name": "Windows Mixed Reality Defaults", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json b/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json index 11da94f25..2ae4fa3d9 100644 --- a/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json +++ b/common/src/main/resources/assets/vivecraft/input/wmr_defaults_reversed.json @@ -1,403 +1,403 @@ { - "action_manifest_version": 0, - "alias_info": {}, - "app_key": "org.vivecraft.mcvr", - "bindings": { - "/actions/contextual": { - "chords": [ - { - "inputs": [ - ["/user/hand/left/input/grip", "click"], - ["/user/hand/right/input/grip", "click"] - ], - "output": "/actions/contextual/in/vivecraft.key.climbeyjump" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": {}, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.climbeygrab" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/contextual/in/vivecraft.key.vrinteract" - } - }, - "parameters": { - "haptic_amplitude": "0" - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + "action_manifest_version": 0, + "alias_info": {}, + "app_key": "org.vivecraft.mcvr", + "bindings": { + "/actions/contextual": { + "chords": [ + { + "inputs": [ + ["/user/hand/left/input/grip", "click"], + ["/user/hand/right/input/grip", "click"] + ], + "output": "/actions/contextual/in/vivecraft.key.climbeyjump" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": {}, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.climbeygrab" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/contextual/in/vivecraft.key.vrinteract" + } + }, + "parameters": { + "haptic_amplitude": "0" + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/global": { + "haptics": [ + { + "output": "/actions/global/out/lefthaptic", + "path": "/user/hand/left/output/haptic" + }, + { + "output": "/actions/global/out/righthaptic", + "path": "/user/hand/right/output/haptic" + } + ], + "poses": [ + { + "output": "/actions/global/in/lefthand", + "path": "/user/hand/left/pose/raw" + }, + { + "output": "/actions/global/in/righthand", + "path": "/user/hand/right/pose/raw" + } + ], + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/global/in/vivecraft.key.ingamemenubutton" + }, + "long": { + "output": "/actions/global/in/vivecraft.key.togglekeyboard" + } + }, + "mode": "button", + "path": "/user/hand/right/input/application_menu" + }, + { + "inputs": { + "north": { + "output": "/actions/global/in/key.inventory" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" + } + ] + }, + "/actions/gui": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guishift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" }, - "/actions/global": { - "haptics": [ - { - "output": "/actions/global/out/lefthaptic", - "path": "/user/hand/left/output/haptic" - }, - { - "output": "/actions/global/out/righthaptic", - "path": "/user/hand/right/output/haptic" - } - ], - "poses": [ - { - "output": "/actions/global/in/lefthand", - "path": "/user/hand/left/pose/raw" - }, - { - "output": "/actions/global/in/righthand", - "path": "/user/hand/right/pose/raw" - } - ], - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/global/in/vivecraft.key.ingamemenubutton" - }, - "long": { - "output": "/actions/global/in/vivecraft.key.togglekeyboard" - } - }, - "mode": "button", - "path": "/user/hand/right/input/application_menu" - }, - { - "inputs": { - "north": { - "output": "/actions/global/in/key.inventory" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guimiddleclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" }, - "/actions/gui": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guishift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guimiddleclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guileftclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/gui/in/vivecraft.key.guirightclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "parameters": { - "discrete_scroll_trackpad_slideandhold_enabled": "false" - }, - "mode": "scroll", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "scroll": { - "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" - } - }, - "mode": "scroll", - "parameters": { - "scroll_mode": "discrete" - }, - "path": "/user/hand/left/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guileftclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" }, - "/actions/ingame": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarprev" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "pull": { - "output": "/actions/ingame/in/vivecraft.key.teleportfallback" - } - }, - "mode": "trigger", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "north": { - "output": "/actions/ingame/in/key.jump" - }, - "south": { - "output": "/actions/ingame/in/key.sneak" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/right/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.hotbarnext" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.radialmenu" - } - }, - "mode": "button", - "path": "/user/hand/left/input/application_menu" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/key.attack" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "south": { - "output": "/actions/ingame/in/key.use" - } - }, - "mode": "dpad", - "parameters": { - "sub_mode": "click" - }, - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "click": { - "output": "/actions/ingame/in/vivecraft.key.teleport" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" - } - }, - "mode": "joystick", - "parameters": { - "deadzone_pct": "20" - }, - "path": "/user/hand/right/input/joystick" - }, - { - "inputs": { - "position": { - "output": "/actions/ingame/in/vivecraft.key.rotateaxis" - } - }, - "mode": "joystick", - "parameters": { - "deadzone_pct": "20" - }, - "path": "/user/hand/left/input/joystick" - } - ] + { + "inputs": { + "click": { + "output": "/actions/gui/in/vivecraft.key.guirightclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trackpad" }, - "/actions/keyboard": { - "sources": [ - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/left/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" - } - }, - "mode": "button", - "path": "/user/hand/right/input/grip" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/left/input/trigger" - }, - { - "inputs": { - "click": { - "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" - } - }, - "mode": "button", - "path": "/user/hand/right/input/trigger" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "parameters": { + "discrete_scroll_trackpad_slideandhold_enabled": "false" + }, + "mode": "scroll", + "path": "/user/hand/left/input/trackpad" }, - "/actions/technical": { - "sources": [ - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/left/input/trackpad" - }, - { - "inputs": { - "touch": { - "output": "/actions/technical/in/vivecraft.key.trackpadtouch" - } - }, - "mode": "trackpad", - "path": "/user/hand/right/input/trackpad" - } - ] + { + "inputs": { + "scroll": { + "output": "/actions/gui/in/vivecraft.key.guiscrollaxis" + } + }, + "mode": "scroll", + "parameters": { + "scroll_mode": "discrete" + }, + "path": "/user/hand/left/input/joystick" } + ] }, - "category": "steamvr_input", - "controller_type": "holographic_controller", - "description": "", - "name": "Windows Mixed Reality Defaults (Reversed Hands)", - "options": {}, - "simulated_actions": [] + "/actions/ingame": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarprev" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "pull": { + "output": "/actions/ingame/in/vivecraft.key.teleportfallback" + } + }, + "mode": "trigger", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "north": { + "output": "/actions/ingame/in/key.jump" + }, + "south": { + "output": "/actions/ingame/in/key.sneak" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/right/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.hotbarnext" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.radialmenu" + } + }, + "mode": "button", + "path": "/user/hand/left/input/application_menu" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/key.attack" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "south": { + "output": "/actions/ingame/in/key.use" + } + }, + "mode": "dpad", + "parameters": { + "sub_mode": "click" + }, + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "click": { + "output": "/actions/ingame/in/vivecraft.key.teleport" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.freemovestrafe" + } + }, + "mode": "joystick", + "parameters": { + "deadzone_pct": "20" + }, + "path": "/user/hand/right/input/joystick" + }, + { + "inputs": { + "position": { + "output": "/actions/ingame/in/vivecraft.key.rotateaxis" + } + }, + "mode": "joystick", + "parameters": { + "deadzone_pct": "20" + }, + "path": "/user/hand/left/input/joystick" + } + ] + }, + "/actions/keyboard": { + "sources": [ + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/left/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardshift" + } + }, + "mode": "button", + "path": "/user/hand/right/input/grip" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/left/input/trigger" + }, + { + "inputs": { + "click": { + "output": "/actions/keyboard/in/vivecraft.key.keyboardclick" + } + }, + "mode": "button", + "path": "/user/hand/right/input/trigger" + } + ] + }, + "/actions/technical": { + "sources": [ + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/left/input/trackpad" + }, + { + "inputs": { + "touch": { + "output": "/actions/technical/in/vivecraft.key.trackpadtouch" + } + }, + "mode": "trackpad", + "path": "/user/hand/right/input/trackpad" + } + ] + } + }, + "category": "steamvr_input", + "controller_type": "holographic_controller", + "description": "", + "name": "Windows Mixed Reality Defaults (Reversed Hands)", + "options": {}, + "simulated_actions": [] } diff --git a/common/src/main/resources/assets/vivecraft/lang/de_de.json b/common/src/main/resources/assets/vivecraft/lang/de_de.json index 586fb7ca4..62429eeef 100644 --- a/common/src/main/resources/assets/vivecraft/lang/de_de.json +++ b/common/src/main/resources/assets/vivecraft/lang/de_de.json @@ -1,446 +1,446 @@ { - "_comment0": "Contributors: McRobin, acul009, 3tes, Unluckymichell, SamyPro, Kerberus, Philuu, nodscher, Irgendj0, BobaTheFATT, N1ghtTheF0x, Schnakos, zJanny, kingabut, LuckCrafter, PixelBrushArt, fayer3", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Hotbar weiter", - "vivecraft.key.hotbarPrev": "Hotbar zurück", - "vivecraft.key.hotbarScroll": "Hotbar Scrollen", - "vivecraft.key.hotbarSwipeX": "Hotbar Wischen (Links/Rechts)", - "vivecraft.key.hotbarSwipeY": "Hotbar Wischen (Hoch/Runter)", - "vivecraft.key.rotateLeft": "Nach Links Drehen", - "vivecraft.key.rotateRight": "Nach Rechts Drehen", - "vivecraft.key.rotateAxis": "Nur Drehen", - "vivecraft.key.rotateFree": "Freies Drehen", - "vivecraft.key.walkabout": "Rundgang", - "vivecraft.key.teleport": "Teleportation", - "vivecraft.key.teleportFallback": "Forwärts gehen, wenn die Teleportation deaktiviert ist", - "vivecraft.key.freeMoveRotate": "Bewegen/Drehen", - "vivecraft.key.freeMoveStrafe": "Nur Bewegen", - "vivecraft.key.toggleMovement": "Bewegungsart umschalten", - "vivecraft.key.quickTorch": "Fackel Auswählen", - "vivecraft.key.ingameMenuButton": "Spielmenü", - "vivecraft.key.exportWorld": "Menü-Welt Exportieren", - "vivecraft.key.radialMenu": "Kreismenü öffnen", - "vivecraft.key.swapMirrorView": "Zuschaueransicht Wechseln", - "vivecraft.key.toggleKeyboard": "Tastatur Zeigen/Verstecken", - "vivecraft.key.moveThirdPersonCam": "Außenansicht Bewegen", - "vivecraft.key.togglePlayerList": "Spielerliste Anzeigen", - "vivecraft.key.toggleHandheldCam": "Kamera Umschalten", - "vivecraft.key.quickHandheldCam": "Schnell Kamera", - "vivecraft.key.trackpadTouch": "Trackpad Berühren", - "vivecraft.key.vrInteract": "Kontextbasierte Interaktion", - "vivecraft.key.guiLeftClick": "Links Klick", - "vivecraft.key.guiRightClick": "Rechts Klick", - "vivecraft.key.guiMiddleClick": "Mausrad Klick", - "vivecraft.key.guiShift": "Umschalt", - "vivecraft.key.guiCtrl": "Strg", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "nach oben scrollen", - "vivecraft.key.guiScrollDown": "nach unten scrollen", - "vivecraft.key.guiScrollAxis": "Scrollen", - "vivecraft.key.keyboardClick": "Klick", - "vivecraft.key.keyboardShift": "Umschalt", - "vivecraft.key.climbeyGrab": "Kletterausrüstung", - "vivecraft.key.climbeyJump": "Sprung-Schuhe", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "Benutzeroberfläche", - "vivecraft.key.category.climbey": "Kletter Bewegung", - "vivecraft.key.category.keyboard": "Tastatur", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "Im-Spiel", - "vivecraft.actionset.gui": "Benutzeroberfläche", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "modifiziert", - "vivecraft.actionset.contextual": "Kontextbasiert", - "vivecraft.actionset.keyboard": "Tastatur", - "vivecraft.actionset.mixedReality": "Gemischte Realität", - "vivecraft.actionset.technical": "Technisch", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "VR Einstellungen", - "vivecraft.options.screen.freemove": "Freie Bewegungseinstellungen", - "vivecraft.options.screen.gui": "Benutzeroberflächen Einstellungen", - "vivecraft.options.screen.menuworld": "Menü-Welt Einstellungen", - "vivecraft.options.screen.guiother": "Chat/Fadenkreuz Einstellungen", - "vivecraft.options.screen.quickcommands": "Schnelle Befehle", - "vivecraft.options.screen.radialmenu": "Kreismenu Konfiguration", - "vivecraft.options.screen.stereorendering": "Stereo Renderer Einstellungen", - "vivecraft.options.screen.roomscale": "Raumskala Interaktion Einstellungen", - "vivecraft.options.screen.seated": "Sitzeinstellungen", - "vivecraft.options.screen.standing": "Stehende Fortbewegungseinstellungen", - "vivecraft.options.screen.teleport": "Teleportationseinstellungen", - "vivecraft.options.screen.controls": "Controller-Einstellungen", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR Einstellungen...", - "vivecraft.options.screen.gui.button": "Benutzeroberflächen Einst...", - "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", - "vivecraft.options.screen.quickcommands.button": "Schnelle Befehle...", - "vivecraft.options.screen.guiother.button": "Chat/Fadenkreuz Einst...", - "vivecraft.options.screen.standing.button": "Fortbewegungs-Einst...", - "vivecraft.options.screen.roomscale.button": "Interaktionseinstellungen...", - "vivecraft.options.screen.controls.button": "Controller-Einstellungen...", - "vivecraft.options.screen.radialmenu.button": "Kreismenü...", - "vivecraft.options.screen.seated.button": "Sitzeinstellungen", - "vivecraft.options.screen.menuworld.button": "Menü-Welt Einstellungen...", - "vivecraft.options.screen.teleport.button": "Teleporteinstellungen...", - "vivecraft.options.screen.freemove.button": "Freie Bewegungseinst...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Kopf-HUD Größe", - "vivecraft.options.HUD_DISTANCE": "Kopf-HUD Entfernung", - "vivecraft.options.HUD_LOCK_TO": "HUD Position", - "vivecraft.options.HUD_OPACITY": "HUD Deckkraft", - "vivecraft.options.HUD_HIDE": "HUD verstecken (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Hintergrund", - "vivecraft.options.HUD_OCCLUSION": "HUD-Verdeckung", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Hauptmenü Folgen", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Fadenkreuz-Verdeckung", - "vivecraft.options.CROSSHAIR_SCALE": "Fadenkreuzgröße", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menü Fadenkreuzgröße", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Fadenkreuz anzeigen", - "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Benachrichtigung", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Benachrichtigungston", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Fadenkreuzskalierung", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Blockumriss anzeigen", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Tastatur immer öffnen", - "vivecraft.options.RADIAL_MODE_HOLD": "Kreismenü Modus", - "vivecraft.options.PHYSICAL_KEYBOARD": "Tastaturtyp", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Tastaturgröße", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Über Block erscheinen", - "vivecraft.options.FSAA": "Lanczos-Skalierer", - "vivecraft.options.MIRROR_DISPLAY": "Spiegel", - "vivecraft.options.MIRROR_EYE": "Gespiegeltes Auge", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Knopf Farbe", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Hände anzeigen", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Unverzerrter Durchgang", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Maske", - "vivecraft.options.MIXED_REALITY_FOV": "Außenansicht FOV", - "vivecraft.options.WALK_UP_BLOCKS": "Blöcke Hochlaufen", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Bewegungs Multiplikator", - "vivecraft.options.INERTIA_FACTOR": "Spieler-Trägheit", - "vivecraft.options.SIMULATE_FALLING": "Fallsimulierung", - "vivecraft.options.WEAPON_COLLISION": "Waffenkollision", - "vivecraft.options.ALLOW_CRAWLING": "Raumskala Krabbeln", - "vivecraft.options.LIMIT_TELEPORT": "Limitiere im Überlebensmodus", - "vivecraft.options.REVERSE_HANDS": "Hände vertauschen", - "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS": "Rohe Gegenstand Position", - "vivecraft.options.STENCIL_ON": "Augenschablone nutzen", - "vivecraft.options.BCB_ON": "Körperposition Anzeigen", - "vivecraft.options.WORLD_SCALE": "Welt Skalierung", - "vivecraft.options.WORLD_ROTATION": "Welt Rotation", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotations-Inkrement", - "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Aktiviert", - "vivecraft.options.PLAY_MODE_SEATED": "Spielmodus", - "vivecraft.options.RENDER_SCALEFACTOR": "Auflösung", - "vivecraft.options.MONO_FOV": "Unverzerrtes FOV", - "vivecraft.options.REALISTIC_JUMP": "Raumskala Springen", - "vivecraft.options.REALISTIC_SNEAK": "Raumskala Schleichen", - "vivecraft.options.PHYSICAL_GUI": "Physikalisches GUIs", - "vivecraft.options.REALISTIC_CLIMB": "Raumskala Klettern", - "vivecraft.options.REALISTIC_SWIM": "Raumskala Schwimmen", - "vivecraft.options.REALISTIC_ROW": "Raumskala Rudern", - "vivecraft.options.WALK_MULTIPLIER": "Lauf Multiplikator", - "vivecraft.options.FREEMOVE_MODE": "Frei Bewegen", - "vivecraft.options.VEHICLE_ROTATION": "Vehikel Rotation", - "vivecraft.options.RESET_ORIGIN": "Ursprung Zurücksetzen", - "vivecraft.options.X_SENSITIVITY": "Rotations Geschwindigkeit", - "vivecraft.options.Y_SENSITIVITY": "Y-Sensitivität", - "vivecraft.options.KEYHOLE": "Schlüsselloch", - "vivecraft.options.FOV_REDUCTION": "FOV Komfort Reduzierung", - "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduzierungs Größe", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduzierungs Versatz", - "vivecraft.options.SEATED_HMD": "Vorwärts Richtung", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD folgt", - "vivecraft.options.BACKPACK_SWITCH": "Rucksack Wechsel", - "vivecraft.options.ANALOG_MOVEMENT": "Analoge Bewegung", - "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Schwellenwert", - "vivecraft.options.BOW_MODE": "Raumskala Bogen Modus", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limit nach unten", - "vivecraft.options.TELEPORT_UP_LIMIT": "Limit nach oben", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distanz Limit", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Erlaube Ursprungs Versatz", - "vivecraft.options.SEATED_FREE_MOVE": "Bewegungs Art", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Erzwinge Freies Bewegen", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Zeige Erweiterte Tasten", - "vivecraft.options.MENU_WORLD_SELECTION": "Welten", - "vivecraft.options.HRTF_SELECTION": "Raumklang (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Externe Kamera neu laden", - "vivecraft.options.RIGHT_CLICK_DELAY": "Rechtsklick Wiederholung", - "vivecraft.options.ANIMAL_TOUCHING": "Tier Berührungen", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Kamera FOV", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Kamera Auflösung", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Zeige Kameramodell", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Tastatur Aussehen", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Die Relative Größe vom HUD im Sichtfeld.\nDie Einheiten sind relativ, nicht in Grad oder einem Bruchteil von FOV.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Abstand, den das schwebende HUD vom Körper weg angezeigt wird.\nDie relative Größe des HUDs bleibt dadurch unverändert.\nDer Abstand wird in Metern angegeben (wird aber nicht durch Blöcke versperrt).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Gibt an, in welcher Ausrichtung das HUD gesperrt ist.\n Hand: Das HUD erscheint direkt über der nicht Dominanten Hand.\n Kopf: Das HUD wird immer geradeaus im Sichtfeld erscheinen.\n Handgelenk: Das HUD erscheint an der Innenseite des Handgelenks. Es erscheint, wenn man es betrachtet.", - "vivecraft.options.HUD_OPACITY.tooltip": "Wie transparent das HUD und die UI im Spiel gezeichnet wird.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Gibt an, ob die GUI-Menüs im Spiel einen halbtransparenten Hintergrund haben oder nicht.\n An: Halbtransparenter Hintergrund bei In-Game-Menüs.\n Aus: Kein Hintergrund bei In-Game-Menüs.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Gibt an, ob das HUD durch nähere Objekte verdeckt wird.\n An: Das HUD wird von näher liegenden Objekten verdeckt. Kann in beengten Umgebungen vollständig verborgen werden!\n Aus: Das HUD ist immer sichtbar. Probleme mit der Stereotiefe können bemerkbar sein.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Gibt an, wann das Hauptmenü Ihrer Blickrichtung folgt.\n Sitzt: Das Hauptmenü folgt nur im sitzenden Modus.\n Immer: Das Hauptmenü wird immer folgen.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Legt die Größe des Fadenkreuzes im Spiel fest.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Legt die Größe des Fadenkreuzes im Menü fest.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Stellen Sie den Anzeigemodus des Fadenkreuzes im Spiel ein.\n Immer: Das Fadenkreuz wird immer angezeigt, auch wenn das HUD deaktiviert ist.\n Mit HUD: Das Fadenkreuz wird nur angezeigt, wenn das HUD aktiviert ist.\n Nie: Das Fadenkreuz wird nie eingeblendet.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Legt fest, was passiert, wenn Sie eine Chat-Nachricht erhalten.\n Keine: Gar nichts!\n Haptisch: Puls am linken Controller.\n Ton: Spielt den Chat-Benachrichtigungston ab.\n Beides: Sowohl haptisch als auch akustisch.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Legt den Chat-Benachrichtigungston fest.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Bestimmt, wie sich das Fadenkreuz mit der Entfernung verändert.\n An: Das Fadenkreuz wird in der Entfernung größer, um aus Ihrer Sicht gleich groß zu bleiben.\n Aus: Das Fadenkreuz wird in der Welt immer gleich groß sein und mit der Entfernung schrumpfen.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Legt den Anzeigemodus der Blockumrisse im Spiel fest.\n Immer: Der Blockumriss wird immer angezeigt, auch wenn das HUD deaktiviert ist.\n Mit HUD: Der Blockumriss wird nur angezeigt, wenn das HUD aktiviert ist.\n Nie: Der Blockumriss wird nie angezeigt.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Wenn deaktiviert, wird die Tastatur nur geöffnet, wenn Sie auf ein Textfeld klicken oder wenn ein Textfeld den Fokus nicht verlieren kann.\n\nWenn aktiviert, öffnet sich die Tastatur automatisch, sobald ein Textfeld den Fokus erhält. Wenn sie aktiviert ist, wird sie in unerwünschten Situationen mit Mods geöffnet.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Verhalten des Kreismenüs beim Drücken der Taste.\n Halten: Kreismenü-Taste halten, über Auswahl schweben und loslassen.\n Drücken: Kreismenü-Taste drücken, Knöpfe anklicken, Kreismenü-Taste erneut drücken um zu schließen.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Welche Art von VR-Tastatur zum Tippen verwendet werden soll.\n Physisch: Eine Tastatur, auf der Sie wie auf einer echten Tastatur tippen können.\n Zeiger: Eine Tastatur, die Sie verwenden können, indem Sie mit dem Fadenkreuz des Controllers von einen der beiden Controller zeigen und drücken.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Wie groß die physische Tastatur im Verhältnis zu ihrer Basisgröße sein sollte.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Wenn aktiviert, wird die GUI für Blöcke (wie Truhen und Öfen) über dem Block platziert. Andernfalls befindet sie sich an der üblichen Position.", - "vivecraft.options.FSAA.tooltip": "Verwendet eine ausgeklügeltere Methode zur Neuabtastung des Spiels, bevor es an das HMD geschickt wird. Funktioniert am besten bei hohen Render-Skalierungen.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Spiegelt das Bild auf dem HMD in ein separates Desktop-Fenster.\nKann auf Aus, Einzel- oder Dual-HMD-Ansicht, unverzerrte 1. Person-, unverzerrte 3. Person- und Mixed Reality eingestellt werden. Die unverzerrten und gemischten Realitätsansichten haben einen Leistungspreis.", - "vivecraft.options.MIRROR_EYE.tooltip": "Welches Auge in den Modi Ausschnitt und Einzel verwendet werden soll.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Die Farbe, die auf die \"transparenten\" Bereiche der Ansicht der Mixed Reality gezeichnet wird. Andere Farben im Spiel werden daran gehindert, dies abzugleichen, damit es keine Verwirrung verursacht.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Geben Sie die Mixed Reality ansicht wieder. Schaltet nur das Rendern der tatsächlichen Handmodelle um, Items werden weiterhin gerendert.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Wähle zwischen einem 4-Fenster-Layout im Unity-Stil oder einem 2-Fenster-Layout nebeneinander.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Einfügen einer unverzerrten Ansicht im 4-Fenster-Layout Erfordert einen zusätzlichen Render-Pass. Andernfalls wird die HMD-Ansicht verwendet.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "Im Unity-Layout, wenn ja, wird eine Graustufen-Alpha-Maske in den oberen rechten Quadranten gezeichnet (wie Unity), die zur Maskierung der Vordergrundebene verwendet wird. Andernfalls wird der Vordergrund mit der Schlüsselfarbe gezeichnet, damit er mit dem Farbschlüssel-Effekt verwendet werden kann.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "Das für den Mixed-Reality-Spiegelmodus verwendete FOV.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Ermöglicht es Ihnen, die Fähigkeit einzustellen, Blöcke hochzugehen, ohne springen zu müssen. Tastenkombination: Strg+B\n§cWARNUNG: Kann Anti-Cheat-Warnungen auslösen, wenn auf einem Multiplayer-Server!\n Aus: (Standard) Sie müssen Blöcke hochspringen.\n An: Sie können einzelne Blöcke hochspringen. Kann bei einigen die durch die Fortbewegung verursachte Simulatorkrankheit verringern.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Legt einen Multiplikator fest, der eine langsamere Bewegung als die Standardeinstellung ermöglicht. Dies kann dazu beitragen, die durch die Fortbewegung induzierte Simulatorkrankheit zu reduzieren.\n§cWARNUNG: Kann Anti-Cheat-Warnungen auslösen, wenn auf einem Mehrspieler-Server!\nStandardeinstellung ist die standard Minecraft-Bewegungs Geschwindigkeit (1.0).", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Legt die Bewegungsträgheit des Spielers im Einzelspielermodus fest. Geringere Trägheit bedeutet schnellere Beschleunigung, höhere Trägheit langsamere Beschleunigung. Hohe Trägheit kann bei manchen die Reisekrankheit verringern, aber Vorsicht vor Klippenrändern!\n Normal: (Standard) Standard-Minecraft-Spielerbewegung.\n Automan < Normal < Viel < Noch mehr. Beeinflusst derzeit keine Lava-, Wasser- oder Sprungbewegungen.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Wenn aktiviert, fällt der Spieler im Teleportmodus auf den Boden, wenn er über einem leeren Raum steht. Erlaubt auch Springen.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Ermöglicht das Treffen von Blöcken und Entities im Raumskala.\nIst Automatisch bei Survival eingeschaltet und bei Creative ausgeschaltet.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Wenn diese Option aktiviert ist, kann sich der Spieler unter dem Block ducken.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "Wenn aktiviert, hat der Bogen-Teleporter im Überlebensmodus Einschränkungen. Er wird nicht in der Lage sein, seitlich an Blöcken hochzuspringen, er wird Hunger verbrauchen, und er wird einen Energieriegel haben, der sich mit der Zeit wieder auffüllt.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Tauschen Sie die linke/rechte Hand als dominant.\n An: Links dominant\n Aus: Rechts-dominant\n\nUm die Tastenbelegung zu vertauschen, starten Sie das Spiel neu und stellen Sie sicher, dass die Standardbindungen in SteamVR ausgewählt sind.", - "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip": "Bestimmt wie gehaltene Gegenstände transformiert werden.\n An: Benutzt unveränderte 3. Person transformationen.\n Aus: Benutzt adaptierte 1. Person transformationen\n\n3. Person transformationen können besser für Mod Gegenstände funktionieren.", - "vivecraft.options.STENCIL_ON.tooltip": "Bereiche des Bildschirms außerhalb des FOV ausblenden.\nVerbessert die Leistung.", - "vivecraft.options.BCB_ON.tooltip": "Zeigt Ihre Körperposition als quadratischen Schatten auf dem Boden an.\nDies ist Ihr quadratischer Schatten Kumpel™.\nVerlieren Sie Ihren quadratischen Schatten Kumpel nicht.", - "vivecraft.options.WORLD_SCALE.tooltip": "Skaliert den Spieler in der Welt.\nÜber eins macht Sie größer\nUnd darunter macht es sie kleiner\nUnd die, die Ihnen Ihre Mutter gibt\nmachen überhaupt nichts.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Fügt Ihrem HMD eine zusätzliche Rotation hinzu.\nNützlicher an einer Taste gebunden oder mit den Pfeiltasten verändert.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Wie viele Grad bei der Drehung der Welt gedreht werden müssen.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Wenn aktiviert, können Sie die Hotbar mit der Haupthand berühren, um ein Item auszuwählen.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Stehender oder sitzender Spielmodus.\nStehen ist bei weitem überlegen.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Die interne Rendering-Skala des Spiels, relativ zum nativen HMD-Display. Höhere Werte verbessern die visuelle Qualität auf Kosten der Leistung.", - "vivecraft.options.MONO_FOV.tooltip": "Das für den unverzerrten Spiegelmodus verwendete FOV.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "Wenn eingeschaltet, springt Ihr Spieler sobald Sie im wirklichen Leben springen. Aktiviert auch Jump Boots.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Wenn eingeschaltet , wird sich Ihr Spieler sobald Sie sich im wirklichen Leben ducken, auch schleichen.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Wenn sie eingeschaltet ist, werden GUIs durch interaktionsfähige 3D-Modelle ersetzt.\nWenn die Rucksackverfolgung aktiviert ist, bringt ein Griff auf den Rücken den Inventarbeutel zum Vorschein.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Wenn eingeschaltet, erlauben Sie das Besteigen von Leitern und Ranken, indem Sie diese berühren. Ermöglicht auch das Besteigen von Krallen.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Falls eingeschaltet, erlauben Sie das Schwimmen durch Brustschwimm-Bewegung mit den Controllern.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Ruder, Ruder, Ruder dein Boot... wie verrückt mit den Armen .", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multipliziert Ihre Position im Raum mit einem Faktor.\nErlaubt Ihnen, mehr herumzulaufen, kann aber Bewegungsübelkeit verursachen.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "Die Quelle für die Frei Bewegen-Richtung.\n\n Controller: Richtung des nicht dominanten Controllers.\n HMD: Blickrichtung des Headsets.\n Run-In-Place: Die Neigung basiert auf dem Schwingen der Controller. Pitch ist Ihr Headset.\n Raum: Die Neigung ist relativ zu Ihrem VR-Raum nach vorne. Neigung: Die Neigung ist basiert auf Ihr Headset. Dieser Modus ist am besten nur für 180 Setups geeignet.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Wenn man in einem Vehikel fährt, dreht sich die Welt, während sich das Vehikel dreht. Kann verwirrend sein.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Stellen Sie die Füße des Spielers in der Welt auf 1,62 m unter die aktuelle HMD-Position zurück. Für nicht-absolute Trackingsysteme oder sitzendes Spiel.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Geschwindigkeit, mit der sich die Ansicht dreht, wenn sie auf den Rand des Schlüssellochs gedrückt wird.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertikale Geschwindigkeit des Fadenkreuzes bezogen auf die Maus.", - "vivecraft.options.KEYHOLE.tooltip": "Die Anzahl der Grad links und rechts von der Mitte, um die sich die Ansicht zu drehen beginnt.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Verkleinert das Sichtfeld während der Bewegung. Kann bei Bewegungsübelkeit helfen.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Die endgültige Größe der FOV-Reduktion.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontaler Versatz des Zentrums der FOV-Reduktion für Nicht-Standard HMDs.", - "vivecraft.options.SEATED_HMD.tooltip": "Die Richtung, in die die Vorwärts-Taste (W) geht.\nHMD-Blickrichtung oder die Richtung des Fadenkreuzes.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Die Richtung, in die der HUD platziert werden soll.\nHMD-Blickrichtung oder die Richtung des Fadenkreuzes.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Wenn eingeschaltet, können Sie mit dem rechten Controller hinter den Kopf greifen und zum ersten Hotbar-Slot oder zurück zum vorherigen Slot wechseln. Wenn Sie dasselbe mit dem linken Controller tun, vertauschen Sie die Items zwischen linke und rechte Hand.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Die Laufgeschwindigkeit wird durch die Achse des Controller-Buttons bestimmt, wenn der gebundene Button eine variable Achse hat.\n\nFür eine vollständige analoge Steuerung ist es besser, \"Nur Bewegen\" oder \"Bewegen/Drehen\" zu verwenden.", - "vivecraft.options.AUTO_SPRINT.tooltip": "Bei Verwendung von Freemove wird Sprint automatisch aktiviert, wenn die Achse den konfigurierten Schwellenwert erreicht.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Der Achsenschwellenwert, bei dem automatisch Sprinten aktiviert wird.", - "vivecraft.options.BOW_MODE.tooltip": "Legt fest, wann Bogenschießen im Raumskala verwendet werden soll\n Aus: Niemals.\n Vanilla: Nur für den Vanilla-Bogen, keine Mod-Items.\n An: Immer für jeden Gegenstand, der die Aktion \"Bogen\" verwendet.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Begrenzt die die Anzahl der Blöcke, die Sie unter sich teleportieren können.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Begrenzt Sie die Anzahl der Blöcke, die Sie über sich teleportieren können.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Begrenzt Sie die Anzahl der Blöcke, die Sie seitwärts teleportieren können.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Ermöglicht die Verwendung der Schaltfläche \"Standard Zurücksetzen\" im Stehen für diejenigen, die physisch sitzend spielen möchten, während sie Bewegungsverfolgte Controller verwenden.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Welche Fortbewegungsart im Sitzen verwendet werden soll.\n\n Teleportieren: Zum Aktivieren eine beliebige Richtung drücken.\n Freie Bewegung: WASD-Bewegung wie Vanilla Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Erzwingt die Verwendung des Fallback Forwärts Bewegung-Bindungs (standardmäßig linker Auslöser). Für weitere Bewegungsoptionen bearbeiten Sie die SteamVR-Controller-Bindungen.\n\nBeachten Sie, dass dadurch die Teleportbindung deaktiviert wird.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Blendet zusätzliche SteamVR-Bindungen für Climbey, Tastatur und Mixed Reality ein.\n\nErfordert einen Neustart, um effekt zu nehmen", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Welche Menüwelten beim Start geladen werden sollen.\n\nWenn keine benutzerdefinierten Welten gefunden werden, werden trotzdem offizielle Welten verwendet.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF-Profil zur Verwendung für positionelles 3D-Audio. Die Qualität kann je nach Gerät und Treiber variieren.\n\n Aus: HRTF explizit deaktivieren.\n Voreinstellung: Verwenden Sie das Standard-HRTF-Profil.\n Andere: Verwenden Sie ein spezifisches HRTF-Profil.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Lädt die Kamerakonfiguration aus ExternalCamera.cfg neu", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Die Anzahl der Spielticks zwischen \"Rechtsklicks\", während Sie die Taste gedrückt halten.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Wenn aktiviert, wird beim Berühren eines passiven Mobs (Tiere) ohne Waffe ein Rechtsklick (Interaktion) ausgeführt, anstatt anzugreifen.\nAusschalten für Schweineschellen, Josh.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV der handgeführten Screenshot-Kamera.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Auflösung der Handheld-Screenshot-Kamera, für die Aufnahme von Screenshots, die viel größer als die normale Render-Auflösung sind.\nKann nicht verwendet werden, wenn Shader aktiviert sind.\n§cWARNUNG: Wenn Sie diesen Wert sehr hoch einstellen, kann der Computer schmelzen!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Zeige das Modell einer Kamera (nur in HMD Ansicht) um anzuzeigen wo sich die Mixed Reality oder 3. Person Kamera derzeit befindet. Die Kamera kann auch durch das halten der Interaktionstaste bewegt werden.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Voreinstellung des Farbschemas für die physische Tastatur. Das Aussehen kann durch das Bearbeiten der keyboardtheme.txt im Spielverzeichnis angepasst werden. Beim öffnen der Tastatur wird diese Datei neu geladen, um Echtzeitänderungen anzuzeigen.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "Ich kann nichts sehen", - "vivecraft.options.yes": "Ja", - "vivecraft.options.no": "Nein", - "vivecraft.options.weaponcollision.auto": "Automatisch", - "vivecraft.options.default": "Standard", - "vivecraft.options.opaque": "Undurchsichtig", - "vivecraft.options.mirrormode.off": "OFF (Schnell)", - "vivecraft.options.mirrormode.dual": "Doppel (Schnell)", - "vivecraft.options.mirrormode.single": "Einzeln (Schnell)", - "vivecraft.options.mirrormode.firstperson": "1. Person (Langsam)", - "vivecraft.options.mirrormode.thirdperson": "3. Person (Langsam)", - "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (Langsam)", - "vivecraft.options.mirrormode.cropped": "Ausschnitt (Schnell)", - "vivecraft.options.mirrormode.gui": "2D Benutzeroberfäche", - "vivecraft.options.left": "Links", - "vivecraft.options.right": "Rechts", - "vivecraft.options.color.black": "Schwarz", - "vivecraft.options.color.red": "Rot", - "vivecraft.options.color.yellow": "Gelb", - "vivecraft.options.color.green": "Grün", - "vivecraft.options.color.cyan": "Türkis", - "vivecraft.options.color.blue": "Blau", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Seite-an-Seite", - "vivecraft.options.hudlock.hand": "Hand", - "vivecraft.options.hudlock.head": "Kopf", - "vivecraft.options.hudlock.wrist": "Handgelenk", - "vivecraft.options.renderpointerelement.always": "Immer", - "vivecraft.options.renderpointerelement.withhud": "Mit HUD", - "vivecraft.options.renderpointerelement.never": "Nie", - "vivecraft.options.chatnotifications.none": "Keine", - "vivecraft.options.chatnotifications.haptic": "Haptisch", - "vivecraft.options.chatnotifications.sound": "Sound", - "vivecraft.options.chatnotifications.both": "Beide", - "vivecraft.options.always": "Immer", - "vivecraft.options.seated": "Sitzend", - "vivecraft.options.standing": "Stehend", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normal", - "vivecraft.options.inertiafactor.large": "Viel", - "vivecraft.options.inertiafactor.massive": "Noch mehr", - "vivecraft.options.smooth": "Glatt", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Fadenkreuz", - "vivecraft.options.freemove.controller": "Controller", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Run-In-Place", - "vivecraft.options.freemove.room": "Raum", - "vivecraft.options.hold": "Halten", - "vivecraft.options.press": "Drücken", - "vivecraft.options.keyboard.physical": "Physisch", - "vivecraft.options.keyboard.pointer": "Zeiger", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blöcke", - "vivecraft.options.teleport": "Teleportation", - "vivecraft.options.freemove": "Frei bewegen", - "vivecraft.options.menuworld.both": "Von Benutzer & Offiziell", - "vivecraft.options.menuworld.custom": "Nur von Benutzer", - "vivecraft.options.menuworld.official": "Nur Offiziell", - "vivecraft.options.menuworld.none": "Keine", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Langsam", - "vivecraft.options.rightclickdelay.slower": "Langsamer", - "vivecraft.options.rightclickdelay.slowest": "Am langsamsten", - "vivecraft.options.keyboardtheme.default": "Weiß", - "vivecraft.options.keyboardtheme.red": "Rot", - "vivecraft.options.keyboardtheme.green": "Grün", - "vivecraft.options.keyboardtheme.blue": "Blau", - "vivecraft.options.keyboardtheme.black": "Leere", - "vivecraft.options.keyboardtheme.grass": "Gras Block", - "vivecraft.options.keyboardtheme.bees": "Bumblebee", - "vivecraft.options.keyboardtheme.aesthetic": "§bħbs§bt§bh§be§bt§bi§bs§bc§bh", - "vivecraft.options.keyboardtheme.dose": "Medizin", - "vivecraft.options.keyboardtheme.custom": "Benutzerdefiniert", - "_comment12": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Löschen", - "vivecraft.gui.loaddefaults": "Standard Laden", - "vivecraft.gui.menuworld.refresh": "Menü Welt Neu Laden", - "vivecraft.gui.menuworld.loadnew": "Lade Neue Menü Welt", - "vivecraft.gui.radialmenu.mainset": "Haupt-Set", - "vivecraft.gui.radialmenu.alternateset": "Alternativ-Set", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Befehle", - "vivecraft.gui.overlay": "Overlay", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Bildschirmfoto", - "vivecraft.gui.calibrateheight": "Höhe Kalibrieren", - "vivecraft.gui.alignkatwalk": "KAT WALK Ausrichten", - "vivecraft.gui.movethirdpersoncam": "Bewege 3. Kamera", - "vivecraft.gui.social": "Sozial", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Sprung-Schuhe", - "vivecraft.item.climbclaws": "Kletterkrallen", - "vivecraft.item.telescope": "Auge des Weitsehers", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Das Umschalten in den Sitzmodus deaktiviert die Controller-Eingabe. Fortfahren?", - "vivecraft.messages.radialmenubind.1": "Stelle sicher das 'Kreismenü öffnen' gebunden ist.", - "vivecraft.messages.radialmenubind.2": "Drücken Sie (Tastatur Shift) bei geöffnetem Kreismenü, um zu diesem Set zu wechseln.", - "vivecraft.messages.controls.1": "Belegungen werden von SteamVR Input verwaltet.", - "vivecraft.messages.controls.2": "Gehen Sie zu Einstellungen > Controller > Controllerkonfiguration verwalten.", - "vivecraft.messages.controls.3": "§6Steam muss §ovor§r§6 SteamVR gestartet werden, sonst werden Änderungen nicht gespeichert.", - "vivecraft.messages.serverplugin": "Vivecraft Server Mod erkannt: %s", - "vivecraft.messages.noserverplugin": "Vivecraft Server Mod nicht erkannt. Dieser Server unterstützt möglicherweise kein Teleportieren. Der eingeschränkte Bewegungsmodus (Fallback auf freie Bewegung) wurde aktiviert.", - "vivecraft.messages.calibrateheight": "Bitte kalibrieren Sie Ihre Körpergröße im Pause Menü.", - "vivecraft.messages.rendersetupfailed": "Render Setup fehlgeschlagen: %s", - "vivecraft.messages.intelgraphics": "Intel Integrated Graphics werden nicht unterstützt. Wenn es sich um einen Laptop handelt, erzwingen Sie bitte die Hochleistungs-GPU. Erkannte GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR runtime nicht erkannt. Ist SteamVR installiert?", - "vivecraft.messages.menuworldexportcomplete.1": "Weltexport abgeschlossen... Flächengröße: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Gespeichert unter %s", - "vivecraft.messages.menuworldexportclientwarning": "WARNUNG: Speichern der Menüwelt mithilfe einer Clientwelt. Daten können unvollständig sein. Es wird empfohlen, Menüwelten im Einzelspielermodus zu speichern.", - "vivecraft.messages.teleportdisabled": "Bewegungseinschränkung aktiviert (Teleportation nicht erlaubt)", - "vivecraft.messages.teleportenabled": "Bewegungseinschränkung deaktiviert (Teleportation erlaubt)", - "vivecraft.messages.walkupblocks": "Blöcke hochlaufen (RCTRL+B): %s", - "vivecraft.messages.showaim": "Ziel zeigen (RCTRL+RSHIFT): aktiviert", - "vivecraft.messages.playerinertia": "Spieler Bewegungsträgheit (LCTRL+I): %s", - "vivecraft.messages.movementmodeswitch": "Bewegungsmodus gewechselt zu: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Längsachse: %.1f Querachse: %.1f Vertikalachse: %.1f", - "vivecraft.messages.heightset": "Körpergröße gesetzt auf %d%%", + "_comment0": "Contributors: McRobin, acul009, 3tes, Unluckymichell, SamyPro, Kerberus, Philuu, nodscher, Irgendj0, BobaTheFATT, N1ghtTheF0x, Schnakos, zJanny, kingabut, LuckCrafter, PixelBrushArt, fayer3", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Hotbar weiter", + "vivecraft.key.hotbarPrev": "Hotbar zurück", + "vivecraft.key.hotbarScroll": "Hotbar Scrollen", + "vivecraft.key.hotbarSwipeX": "Hotbar Wischen (Links/Rechts)", + "vivecraft.key.hotbarSwipeY": "Hotbar Wischen (Hoch/Runter)", + "vivecraft.key.rotateLeft": "Nach Links Drehen", + "vivecraft.key.rotateRight": "Nach Rechts Drehen", + "vivecraft.key.rotateAxis": "Nur Drehen", + "vivecraft.key.rotateFree": "Freies Drehen", + "vivecraft.key.walkabout": "Rundgang", + "vivecraft.key.teleport": "Teleportation", + "vivecraft.key.teleportFallback": "Forwärts gehen, wenn die Teleportation deaktiviert ist", + "vivecraft.key.freeMoveRotate": "Bewegen/Drehen", + "vivecraft.key.freeMoveStrafe": "Nur Bewegen", + "vivecraft.key.toggleMovement": "Bewegungsart umschalten", + "vivecraft.key.quickTorch": "Fackel Auswählen", + "vivecraft.key.ingameMenuButton": "Spielmenü", + "vivecraft.key.exportWorld": "Menü-Welt Exportieren", + "vivecraft.key.radialMenu": "Kreismenü öffnen", + "vivecraft.key.swapMirrorView": "Zuschaueransicht Wechseln", + "vivecraft.key.toggleKeyboard": "Tastatur Zeigen/Verstecken", + "vivecraft.key.moveThirdPersonCam": "Außenansicht Bewegen", + "vivecraft.key.togglePlayerList": "Spielerliste Anzeigen", + "vivecraft.key.toggleHandheldCam": "Kamera Umschalten", + "vivecraft.key.quickHandheldCam": "Schnell Kamera", + "vivecraft.key.trackpadTouch": "Trackpad Berühren", + "vivecraft.key.vrInteract": "Kontextbasierte Interaktion", + "vivecraft.key.guiLeftClick": "Links Klick", + "vivecraft.key.guiRightClick": "Rechts Klick", + "vivecraft.key.guiMiddleClick": "Mausrad Klick", + "vivecraft.key.guiShift": "Umschalt", + "vivecraft.key.guiCtrl": "Strg", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "nach oben scrollen", + "vivecraft.key.guiScrollDown": "nach unten scrollen", + "vivecraft.key.guiScrollAxis": "Scrollen", + "vivecraft.key.keyboardClick": "Klick", + "vivecraft.key.keyboardShift": "Umschalt", + "vivecraft.key.climbeyGrab": "Kletterausrüstung", + "vivecraft.key.climbeyJump": "Sprung-Schuhe", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "Benutzeroberfläche", + "vivecraft.key.category.climbey": "Kletter Bewegung", + "vivecraft.key.category.keyboard": "Tastatur", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "Im-Spiel", + "vivecraft.actionset.gui": "Benutzeroberfläche", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "modifiziert", + "vivecraft.actionset.contextual": "Kontextbasiert", + "vivecraft.actionset.keyboard": "Tastatur", + "vivecraft.actionset.mixedReality": "Gemischte Realität", + "vivecraft.actionset.technical": "Technisch", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "VR Einstellungen", + "vivecraft.options.screen.freemove": "Freie Bewegungseinstellungen", + "vivecraft.options.screen.gui": "Benutzeroberflächen Einstellungen", + "vivecraft.options.screen.menuworld": "Menü-Welt Einstellungen", + "vivecraft.options.screen.guiother": "Chat/Fadenkreuz Einstellungen", + "vivecraft.options.screen.quickcommands": "Schnelle Befehle", + "vivecraft.options.screen.radialmenu": "Kreismenu Konfiguration", + "vivecraft.options.screen.stereorendering": "Stereo Renderer Einstellungen", + "vivecraft.options.screen.roomscale": "Raumskala Interaktion Einstellungen", + "vivecraft.options.screen.seated": "Sitzeinstellungen", + "vivecraft.options.screen.standing": "Stehende Fortbewegungseinstellungen", + "vivecraft.options.screen.teleport": "Teleportationseinstellungen", + "vivecraft.options.screen.controls": "Controller-Einstellungen", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR Einstellungen...", + "vivecraft.options.screen.gui.button": "Benutzeroberflächen Einst...", + "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", + "vivecraft.options.screen.quickcommands.button": "Schnelle Befehle...", + "vivecraft.options.screen.guiother.button": "Chat/Fadenkreuz Einst...", + "vivecraft.options.screen.standing.button": "Fortbewegungs-Einst...", + "vivecraft.options.screen.roomscale.button": "Interaktionseinstellungen...", + "vivecraft.options.screen.controls.button": "Controller-Einstellungen...", + "vivecraft.options.screen.radialmenu.button": "Kreismenü...", + "vivecraft.options.screen.seated.button": "Sitzeinstellungen", + "vivecraft.options.screen.menuworld.button": "Menü-Welt Einstellungen...", + "vivecraft.options.screen.teleport.button": "Teleporteinstellungen...", + "vivecraft.options.screen.freemove.button": "Freie Bewegungseinst...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Kopf-HUD Größe", + "vivecraft.options.HUD_DISTANCE": "Kopf-HUD Entfernung", + "vivecraft.options.HUD_LOCK_TO": "HUD Position", + "vivecraft.options.HUD_OPACITY": "HUD Deckkraft", + "vivecraft.options.HUD_HIDE": "HUD verstecken (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Hintergrund", + "vivecraft.options.HUD_OCCLUSION": "HUD-Verdeckung", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Hauptmenü Folgen", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Fadenkreuz-Verdeckung", + "vivecraft.options.CROSSHAIR_SCALE": "Fadenkreuzgröße", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menü Fadenkreuzgröße", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Fadenkreuz anzeigen", + "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Benachrichtigung", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Benachrichtigungston", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Fadenkreuzskalierung", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Blockumriss anzeigen", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Tastatur immer öffnen", + "vivecraft.options.RADIAL_MODE_HOLD": "Kreismenü Modus", + "vivecraft.options.PHYSICAL_KEYBOARD": "Tastaturtyp", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Tastaturgröße", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Über Block erscheinen", + "vivecraft.options.FSAA": "Lanczos-Skalierer", + "vivecraft.options.MIRROR_DISPLAY": "Spiegel", + "vivecraft.options.MIRROR_EYE": "Gespiegeltes Auge", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Knopf Farbe", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Hände anzeigen", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Unverzerrter Durchgang", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Maske", + "vivecraft.options.MIXED_REALITY_FOV": "Außenansicht FOV", + "vivecraft.options.WALK_UP_BLOCKS": "Blöcke Hochlaufen", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Bewegungs Multiplikator", + "vivecraft.options.INERTIA_FACTOR": "Spieler-Trägheit", + "vivecraft.options.SIMULATE_FALLING": "Fallsimulierung", + "vivecraft.options.WEAPON_COLLISION": "Waffenkollision", + "vivecraft.options.ALLOW_CRAWLING": "Raumskala Krabbeln", + "vivecraft.options.LIMIT_TELEPORT": "Limitiere im Überlebensmodus", + "vivecraft.options.REVERSE_HANDS": "Hände vertauschen", + "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS": "Rohe Gegenstand Position", + "vivecraft.options.STENCIL_ON": "Augenschablone nutzen", + "vivecraft.options.BCB_ON": "Körperposition Anzeigen", + "vivecraft.options.WORLD_SCALE": "Welt Skalierung", + "vivecraft.options.WORLD_ROTATION": "Welt Rotation", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotations-Inkrement", + "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Aktiviert", + "vivecraft.options.PLAY_MODE_SEATED": "Spielmodus", + "vivecraft.options.RENDER_SCALEFACTOR": "Auflösung", + "vivecraft.options.MONO_FOV": "Unverzerrtes FOV", + "vivecraft.options.REALISTIC_JUMP": "Raumskala Springen", + "vivecraft.options.REALISTIC_SNEAK": "Raumskala Schleichen", + "vivecraft.options.PHYSICAL_GUI": "Physikalisches GUIs", + "vivecraft.options.REALISTIC_CLIMB": "Raumskala Klettern", + "vivecraft.options.REALISTIC_SWIM": "Raumskala Schwimmen", + "vivecraft.options.REALISTIC_ROW": "Raumskala Rudern", + "vivecraft.options.WALK_MULTIPLIER": "Lauf Multiplikator", + "vivecraft.options.FREEMOVE_MODE": "Frei Bewegen", + "vivecraft.options.VEHICLE_ROTATION": "Vehikel Rotation", + "vivecraft.options.RESET_ORIGIN": "Ursprung Zurücksetzen", + "vivecraft.options.X_SENSITIVITY": "Rotations Geschwindigkeit", + "vivecraft.options.Y_SENSITIVITY": "Y-Sensitivität", + "vivecraft.options.KEYHOLE": "Schlüsselloch", + "vivecraft.options.FOV_REDUCTION": "FOV Komfort Reduzierung", + "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduzierungs Größe", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduzierungs Versatz", + "vivecraft.options.SEATED_HMD": "Vorwärts Richtung", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD folgt", + "vivecraft.options.BACKPACK_SWITCH": "Rucksack Wechsel", + "vivecraft.options.ANALOG_MOVEMENT": "Analoge Bewegung", + "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Schwellenwert", + "vivecraft.options.BOW_MODE": "Raumskala Bogen Modus", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limit nach unten", + "vivecraft.options.TELEPORT_UP_LIMIT": "Limit nach oben", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distanz Limit", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Erlaube Ursprungs Versatz", + "vivecraft.options.SEATED_FREE_MOVE": "Bewegungs Art", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Erzwinge Freies Bewegen", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Zeige Erweiterte Tasten", + "vivecraft.options.MENU_WORLD_SELECTION": "Welten", + "vivecraft.options.HRTF_SELECTION": "Raumklang (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Externe Kamera neu laden", + "vivecraft.options.RIGHT_CLICK_DELAY": "Rechtsklick Wiederholung", + "vivecraft.options.ANIMAL_TOUCHING": "Tier Berührungen", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Kamera FOV", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Kamera Auflösung", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Zeige Kameramodell", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Tastatur Aussehen", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Die Relative Größe vom HUD im Sichtfeld.\nDie Einheiten sind relativ, nicht in Grad oder einem Bruchteil von FOV.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Abstand, den das schwebende HUD vom Körper weg angezeigt wird.\nDie relative Größe des HUDs bleibt dadurch unverändert.\nDer Abstand wird in Metern angegeben (wird aber nicht durch Blöcke versperrt).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Gibt an, in welcher Ausrichtung das HUD gesperrt ist.\n Hand: Das HUD erscheint direkt über der nicht Dominanten Hand.\n Kopf: Das HUD wird immer geradeaus im Sichtfeld erscheinen.\n Handgelenk: Das HUD erscheint an der Innenseite des Handgelenks. Es erscheint, wenn man es betrachtet.", + "vivecraft.options.HUD_OPACITY.tooltip": "Wie transparent das HUD und die UI im Spiel gezeichnet wird.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Gibt an, ob die GUI-Menüs im Spiel einen halbtransparenten Hintergrund haben oder nicht.\n An: Halbtransparenter Hintergrund bei In-Game-Menüs.\n Aus: Kein Hintergrund bei In-Game-Menüs.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Gibt an, ob das HUD durch nähere Objekte verdeckt wird.\n An: Das HUD wird von näher liegenden Objekten verdeckt. Kann in beengten Umgebungen vollständig verborgen werden!\n Aus: Das HUD ist immer sichtbar. Probleme mit der Stereotiefe können bemerkbar sein.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Gibt an, wann das Hauptmenü Ihrer Blickrichtung folgt.\n Sitzt: Das Hauptmenü folgt nur im sitzenden Modus.\n Immer: Das Hauptmenü wird immer folgen.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Legt die Größe des Fadenkreuzes im Spiel fest.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Legt die Größe des Fadenkreuzes im Menü fest.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Stellen Sie den Anzeigemodus des Fadenkreuzes im Spiel ein.\n Immer: Das Fadenkreuz wird immer angezeigt, auch wenn das HUD deaktiviert ist.\n Mit HUD: Das Fadenkreuz wird nur angezeigt, wenn das HUD aktiviert ist.\n Nie: Das Fadenkreuz wird nie eingeblendet.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Legt fest, was passiert, wenn Sie eine Chat-Nachricht erhalten.\n Keine: Gar nichts!\n Haptisch: Puls am linken Controller.\n Ton: Spielt den Chat-Benachrichtigungston ab.\n Beides: Sowohl haptisch als auch akustisch.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Legt den Chat-Benachrichtigungston fest.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Bestimmt, wie sich das Fadenkreuz mit der Entfernung verändert.\n An: Das Fadenkreuz wird in der Entfernung größer, um aus Ihrer Sicht gleich groß zu bleiben.\n Aus: Das Fadenkreuz wird in der Welt immer gleich groß sein und mit der Entfernung schrumpfen.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Legt den Anzeigemodus der Blockumrisse im Spiel fest.\n Immer: Der Blockumriss wird immer angezeigt, auch wenn das HUD deaktiviert ist.\n Mit HUD: Der Blockumriss wird nur angezeigt, wenn das HUD aktiviert ist.\n Nie: Der Blockumriss wird nie angezeigt.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Wenn deaktiviert, wird die Tastatur nur geöffnet, wenn Sie auf ein Textfeld klicken oder wenn ein Textfeld den Fokus nicht verlieren kann.\n\nWenn aktiviert, öffnet sich die Tastatur automatisch, sobald ein Textfeld den Fokus erhält. Wenn sie aktiviert ist, wird sie in unerwünschten Situationen mit Mods geöffnet.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Verhalten des Kreismenüs beim Drücken der Taste.\n Halten: Kreismenü-Taste halten, über Auswahl schweben und loslassen.\n Drücken: Kreismenü-Taste drücken, Knöpfe anklicken, Kreismenü-Taste erneut drücken um zu schließen.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Welche Art von VR-Tastatur zum Tippen verwendet werden soll.\n Physisch: Eine Tastatur, auf der Sie wie auf einer echten Tastatur tippen können.\n Zeiger: Eine Tastatur, die Sie verwenden können, indem Sie mit dem Fadenkreuz des Controllers von einen der beiden Controller zeigen und drücken.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Wie groß die physische Tastatur im Verhältnis zu ihrer Basisgröße sein sollte.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Wenn aktiviert, wird die GUI für Blöcke (wie Truhen und Öfen) über dem Block platziert. Andernfalls befindet sie sich an der üblichen Position.", + "vivecraft.options.FSAA.tooltip": "Verwendet eine ausgeklügeltere Methode zur Neuabtastung des Spiels, bevor es an das HMD geschickt wird. Funktioniert am besten bei hohen Render-Skalierungen.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Spiegelt das Bild auf dem HMD in ein separates Desktop-Fenster.\nKann auf Aus, Einzel- oder Dual-HMD-Ansicht, unverzerrte 1. Person-, unverzerrte 3. Person- und Mixed Reality eingestellt werden. Die unverzerrten und gemischten Realitätsansichten haben einen Leistungspreis.", + "vivecraft.options.MIRROR_EYE.tooltip": "Welches Auge in den Modi Ausschnitt und Einzel verwendet werden soll.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Die Farbe, die auf die \"transparenten\" Bereiche der Ansicht der Mixed Reality gezeichnet wird. Andere Farben im Spiel werden daran gehindert, dies abzugleichen, damit es keine Verwirrung verursacht.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Geben Sie die Mixed Reality ansicht wieder. Schaltet nur das Rendern der tatsächlichen Handmodelle um, Items werden weiterhin gerendert.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Wähle zwischen einem 4-Fenster-Layout im Unity-Stil oder einem 2-Fenster-Layout nebeneinander.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Einfügen einer unverzerrten Ansicht im 4-Fenster-Layout Erfordert einen zusätzlichen Render-Pass. Andernfalls wird die HMD-Ansicht verwendet.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "Im Unity-Layout, wenn ja, wird eine Graustufen-Alpha-Maske in den oberen rechten Quadranten gezeichnet (wie Unity), die zur Maskierung der Vordergrundebene verwendet wird. Andernfalls wird der Vordergrund mit der Schlüsselfarbe gezeichnet, damit er mit dem Farbschlüssel-Effekt verwendet werden kann.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "Das für den Mixed-Reality-Spiegelmodus verwendete FOV.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Ermöglicht es Ihnen, die Fähigkeit einzustellen, Blöcke hochzugehen, ohne springen zu müssen. Tastenkombination: Strg+B\n§cWARNUNG: Kann Anti-Cheat-Warnungen auslösen, wenn auf einem Multiplayer-Server!\n Aus: (Standard) Sie müssen Blöcke hochspringen.\n An: Sie können einzelne Blöcke hochspringen. Kann bei einigen die durch die Fortbewegung verursachte Simulatorkrankheit verringern.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Legt einen Multiplikator fest, der eine langsamere Bewegung als die Standardeinstellung ermöglicht. Dies kann dazu beitragen, die durch die Fortbewegung induzierte Simulatorkrankheit zu reduzieren.\n§cWARNUNG: Kann Anti-Cheat-Warnungen auslösen, wenn auf einem Mehrspieler-Server!\nStandardeinstellung ist die standard Minecraft-Bewegungs Geschwindigkeit (1.0).", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Legt die Bewegungsträgheit des Spielers im Einzelspielermodus fest. Geringere Trägheit bedeutet schnellere Beschleunigung, höhere Trägheit langsamere Beschleunigung. Hohe Trägheit kann bei manchen die Reisekrankheit verringern, aber Vorsicht vor Klippenrändern!\n Normal: (Standard) Standard-Minecraft-Spielerbewegung.\n Automan < Normal < Viel < Noch mehr. Beeinflusst derzeit keine Lava-, Wasser- oder Sprungbewegungen.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Wenn aktiviert, fällt der Spieler im Teleportmodus auf den Boden, wenn er über einem leeren Raum steht. Erlaubt auch Springen.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Ermöglicht das Treffen von Blöcken und Entities im Raumskala.\nIst Automatisch bei Survival eingeschaltet und bei Creative ausgeschaltet.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Wenn diese Option aktiviert ist, kann sich der Spieler unter dem Block ducken.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "Wenn aktiviert, hat der Bogen-Teleporter im Überlebensmodus Einschränkungen. Er wird nicht in der Lage sein, seitlich an Blöcken hochzuspringen, er wird Hunger verbrauchen, und er wird einen Energieriegel haben, der sich mit der Zeit wieder auffüllt.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Tauschen Sie die linke/rechte Hand als dominant.\n An: Links dominant\n Aus: Rechts-dominant\n\nUm die Tastenbelegung zu vertauschen, starten Sie das Spiel neu und stellen Sie sicher, dass die Standardbindungen in SteamVR ausgewählt sind.", + "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip": "Bestimmt wie gehaltene Gegenstände transformiert werden.\n An: Benutzt unveränderte 3. Person transformationen.\n Aus: Benutzt adaptierte 1. Person transformationen\n\n3. Person transformationen können besser für Mod Gegenstände funktionieren.", + "vivecraft.options.STENCIL_ON.tooltip": "Bereiche des Bildschirms außerhalb des FOV ausblenden.\nVerbessert die Leistung.", + "vivecraft.options.BCB_ON.tooltip": "Zeigt Ihre Körperposition als quadratischen Schatten auf dem Boden an.\nDies ist Ihr quadratischer Schatten Kumpel™.\nVerlieren Sie Ihren quadratischen Schatten Kumpel nicht.", + "vivecraft.options.WORLD_SCALE.tooltip": "Skaliert den Spieler in der Welt.\nÜber eins macht Sie größer\nUnd darunter macht es sie kleiner\nUnd die, die Ihnen Ihre Mutter gibt\nmachen überhaupt nichts.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Fügt Ihrem HMD eine zusätzliche Rotation hinzu.\nNützlicher an einer Taste gebunden oder mit den Pfeiltasten verändert.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Wie viele Grad bei der Drehung der Welt gedreht werden müssen.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Wenn aktiviert, können Sie die Hotbar mit der Haupthand berühren, um ein Item auszuwählen.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Stehender oder sitzender Spielmodus.\nStehen ist bei weitem überlegen.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Die interne Rendering-Skala des Spiels, relativ zum nativen HMD-Display. Höhere Werte verbessern die visuelle Qualität auf Kosten der Leistung.", + "vivecraft.options.MONO_FOV.tooltip": "Das für den unverzerrten Spiegelmodus verwendete FOV.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "Wenn eingeschaltet, springt Ihr Spieler sobald Sie im wirklichen Leben springen. Aktiviert auch Jump Boots.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Wenn eingeschaltet , wird sich Ihr Spieler sobald Sie sich im wirklichen Leben ducken, auch schleichen.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Wenn sie eingeschaltet ist, werden GUIs durch interaktionsfähige 3D-Modelle ersetzt.\nWenn die Rucksackverfolgung aktiviert ist, bringt ein Griff auf den Rücken den Inventarbeutel zum Vorschein.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Wenn eingeschaltet, erlauben Sie das Besteigen von Leitern und Ranken, indem Sie diese berühren. Ermöglicht auch das Besteigen von Krallen.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Falls eingeschaltet, erlauben Sie das Schwimmen durch Brustschwimm-Bewegung mit den Controllern.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Ruder, Ruder, Ruder dein Boot... wie verrückt mit den Armen .", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multipliziert Ihre Position im Raum mit einem Faktor.\nErlaubt Ihnen, mehr herumzulaufen, kann aber Bewegungsübelkeit verursachen.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "Die Quelle für die Frei Bewegen-Richtung.\n\n Controller: Richtung des nicht dominanten Controllers.\n HMD: Blickrichtung des Headsets.\n Run-In-Place: Die Neigung basiert auf dem Schwingen der Controller. Pitch ist Ihr Headset.\n Raum: Die Neigung ist relativ zu Ihrem VR-Raum nach vorne. Neigung: Die Neigung ist basiert auf Ihr Headset. Dieser Modus ist am besten nur für 180 Setups geeignet.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Wenn man in einem Vehikel fährt, dreht sich die Welt, während sich das Vehikel dreht. Kann verwirrend sein.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Stellen Sie die Füße des Spielers in der Welt auf 1,62 m unter die aktuelle HMD-Position zurück. Für nicht-absolute Trackingsysteme oder sitzendes Spiel.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Geschwindigkeit, mit der sich die Ansicht dreht, wenn sie auf den Rand des Schlüssellochs gedrückt wird.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertikale Geschwindigkeit des Fadenkreuzes bezogen auf die Maus.", + "vivecraft.options.KEYHOLE.tooltip": "Die Anzahl der Grad links und rechts von der Mitte, um die sich die Ansicht zu drehen beginnt.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Verkleinert das Sichtfeld während der Bewegung. Kann bei Bewegungsübelkeit helfen.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Die endgültige Größe der FOV-Reduktion.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontaler Versatz des Zentrums der FOV-Reduktion für Nicht-Standard HMDs.", + "vivecraft.options.SEATED_HMD.tooltip": "Die Richtung, in die die Vorwärts-Taste (W) geht.\nHMD-Blickrichtung oder die Richtung des Fadenkreuzes.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Die Richtung, in die der HUD platziert werden soll.\nHMD-Blickrichtung oder die Richtung des Fadenkreuzes.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Wenn eingeschaltet, können Sie mit dem rechten Controller hinter den Kopf greifen und zum ersten Hotbar-Slot oder zurück zum vorherigen Slot wechseln. Wenn Sie dasselbe mit dem linken Controller tun, vertauschen Sie die Items zwischen linke und rechte Hand.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Die Laufgeschwindigkeit wird durch die Achse des Controller-Buttons bestimmt, wenn der gebundene Button eine variable Achse hat.\n\nFür eine vollständige analoge Steuerung ist es besser, \"Nur Bewegen\" oder \"Bewegen/Drehen\" zu verwenden.", + "vivecraft.options.AUTO_SPRINT.tooltip": "Bei Verwendung von Freemove wird Sprint automatisch aktiviert, wenn die Achse den konfigurierten Schwellenwert erreicht.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Der Achsenschwellenwert, bei dem automatisch Sprinten aktiviert wird.", + "vivecraft.options.BOW_MODE.tooltip": "Legt fest, wann Bogenschießen im Raumskala verwendet werden soll\n Aus: Niemals.\n Vanilla: Nur für den Vanilla-Bogen, keine Mod-Items.\n An: Immer für jeden Gegenstand, der die Aktion \"Bogen\" verwendet.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Begrenzt die die Anzahl der Blöcke, die Sie unter sich teleportieren können.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Begrenzt Sie die Anzahl der Blöcke, die Sie über sich teleportieren können.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Begrenzt Sie die Anzahl der Blöcke, die Sie seitwärts teleportieren können.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Ermöglicht die Verwendung der Schaltfläche \"Standard Zurücksetzen\" im Stehen für diejenigen, die physisch sitzend spielen möchten, während sie Bewegungsverfolgte Controller verwenden.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Welche Fortbewegungsart im Sitzen verwendet werden soll.\n\n Teleportieren: Zum Aktivieren eine beliebige Richtung drücken.\n Freie Bewegung: WASD-Bewegung wie Vanilla Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Erzwingt die Verwendung des Fallback Forwärts Bewegung-Bindungs (standardmäßig linker Auslöser). Für weitere Bewegungsoptionen bearbeiten Sie die SteamVR-Controller-Bindungen.\n\nBeachten Sie, dass dadurch die Teleportbindung deaktiviert wird.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Blendet zusätzliche SteamVR-Bindungen für Climbey, Tastatur und Mixed Reality ein.\n\nErfordert einen Neustart, um effekt zu nehmen", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Welche Menüwelten beim Start geladen werden sollen.\n\nWenn keine benutzerdefinierten Welten gefunden werden, werden trotzdem offizielle Welten verwendet.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF-Profil zur Verwendung für positionelles 3D-Audio. Die Qualität kann je nach Gerät und Treiber variieren.\n\n Aus: HRTF explizit deaktivieren.\n Voreinstellung: Verwenden Sie das Standard-HRTF-Profil.\n Andere: Verwenden Sie ein spezifisches HRTF-Profil.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Lädt die Kamerakonfiguration aus ExternalCamera.cfg neu", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Die Anzahl der Spielticks zwischen \"Rechtsklicks\", während Sie die Taste gedrückt halten.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Wenn aktiviert, wird beim Berühren eines passiven Mobs (Tiere) ohne Waffe ein Rechtsklick (Interaktion) ausgeführt, anstatt anzugreifen.\nAusschalten für Schweineschellen, Josh.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV der handgeführten Screenshot-Kamera.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Auflösung der Handheld-Screenshot-Kamera, für die Aufnahme von Screenshots, die viel größer als die normale Render-Auflösung sind.\nKann nicht verwendet werden, wenn Shader aktiviert sind.\n§cWARNUNG: Wenn Sie diesen Wert sehr hoch einstellen, kann der Computer schmelzen!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Zeige das Modell einer Kamera (nur in HMD Ansicht) um anzuzeigen wo sich die Mixed Reality oder 3. Person Kamera derzeit befindet. Die Kamera kann auch durch das halten der Interaktionstaste bewegt werden.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Voreinstellung des Farbschemas für die physische Tastatur. Das Aussehen kann durch das Bearbeiten der keyboardtheme.txt im Spielverzeichnis angepasst werden. Beim öffnen der Tastatur wird diese Datei neu geladen, um Echtzeitänderungen anzuzeigen.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "Ich kann nichts sehen", + "vivecraft.options.yes": "Ja", + "vivecraft.options.no": "Nein", + "vivecraft.options.weaponcollision.auto": "Automatisch", + "vivecraft.options.default": "Standard", + "vivecraft.options.opaque": "Undurchsichtig", + "vivecraft.options.mirrormode.off": "OFF (Schnell)", + "vivecraft.options.mirrormode.dual": "Doppel (Schnell)", + "vivecraft.options.mirrormode.single": "Einzeln (Schnell)", + "vivecraft.options.mirrormode.firstperson": "1. Person (Langsam)", + "vivecraft.options.mirrormode.thirdperson": "3. Person (Langsam)", + "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (Langsam)", + "vivecraft.options.mirrormode.cropped": "Ausschnitt (Schnell)", + "vivecraft.options.mirrormode.gui": "2D Benutzeroberfäche", + "vivecraft.options.left": "Links", + "vivecraft.options.right": "Rechts", + "vivecraft.options.color.black": "Schwarz", + "vivecraft.options.color.red": "Rot", + "vivecraft.options.color.yellow": "Gelb", + "vivecraft.options.color.green": "Grün", + "vivecraft.options.color.cyan": "Türkis", + "vivecraft.options.color.blue": "Blau", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Seite-an-Seite", + "vivecraft.options.hudlock.hand": "Hand", + "vivecraft.options.hudlock.head": "Kopf", + "vivecraft.options.hudlock.wrist": "Handgelenk", + "vivecraft.options.renderpointerelement.always": "Immer", + "vivecraft.options.renderpointerelement.withhud": "Mit HUD", + "vivecraft.options.renderpointerelement.never": "Nie", + "vivecraft.options.chatnotifications.none": "Keine", + "vivecraft.options.chatnotifications.haptic": "Haptisch", + "vivecraft.options.chatnotifications.sound": "Sound", + "vivecraft.options.chatnotifications.both": "Beide", + "vivecraft.options.always": "Immer", + "vivecraft.options.seated": "Sitzend", + "vivecraft.options.standing": "Stehend", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normal", + "vivecraft.options.inertiafactor.large": "Viel", + "vivecraft.options.inertiafactor.massive": "Noch mehr", + "vivecraft.options.smooth": "Glatt", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Fadenkreuz", + "vivecraft.options.freemove.controller": "Controller", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Run-In-Place", + "vivecraft.options.freemove.room": "Raum", + "vivecraft.options.hold": "Halten", + "vivecraft.options.press": "Drücken", + "vivecraft.options.keyboard.physical": "Physisch", + "vivecraft.options.keyboard.pointer": "Zeiger", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blöcke", + "vivecraft.options.teleport": "Teleportation", + "vivecraft.options.freemove": "Frei bewegen", + "vivecraft.options.menuworld.both": "Von Benutzer & Offiziell", + "vivecraft.options.menuworld.custom": "Nur von Benutzer", + "vivecraft.options.menuworld.official": "Nur Offiziell", + "vivecraft.options.menuworld.none": "Keine", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Langsam", + "vivecraft.options.rightclickdelay.slower": "Langsamer", + "vivecraft.options.rightclickdelay.slowest": "Am langsamsten", + "vivecraft.options.keyboardtheme.default": "Weiß", + "vivecraft.options.keyboardtheme.red": "Rot", + "vivecraft.options.keyboardtheme.green": "Grün", + "vivecraft.options.keyboardtheme.blue": "Blau", + "vivecraft.options.keyboardtheme.black": "Leere", + "vivecraft.options.keyboardtheme.grass": "Gras Block", + "vivecraft.options.keyboardtheme.bees": "Bumblebee", + "vivecraft.options.keyboardtheme.aesthetic": "§bħbs§bt§bh§be§bt§bi§bs§bc§bh", + "vivecraft.options.keyboardtheme.dose": "Medizin", + "vivecraft.options.keyboardtheme.custom": "Benutzerdefiniert", + "_comment12": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Löschen", + "vivecraft.gui.loaddefaults": "Standard Laden", + "vivecraft.gui.menuworld.refresh": "Menü Welt Neu Laden", + "vivecraft.gui.menuworld.loadnew": "Lade Neue Menü Welt", + "vivecraft.gui.radialmenu.mainset": "Haupt-Set", + "vivecraft.gui.radialmenu.alternateset": "Alternativ-Set", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Befehle", + "vivecraft.gui.overlay": "Overlay", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Bildschirmfoto", + "vivecraft.gui.calibrateheight": "Höhe Kalibrieren", + "vivecraft.gui.alignkatwalk": "KAT WALK Ausrichten", + "vivecraft.gui.movethirdpersoncam": "Bewege 3. Kamera", + "vivecraft.gui.social": "Sozial", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Sprung-Schuhe", + "vivecraft.item.climbclaws": "Kletterkrallen", + "vivecraft.item.telescope": "Auge des Weitsehers", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Das Umschalten in den Sitzmodus deaktiviert die Controller-Eingabe. Fortfahren?", + "vivecraft.messages.radialmenubind.1": "Stelle sicher das 'Kreismenü öffnen' gebunden ist.", + "vivecraft.messages.radialmenubind.2": "Drücken Sie (Tastatur Shift) bei geöffnetem Kreismenü, um zu diesem Set zu wechseln.", + "vivecraft.messages.controls.1": "Belegungen werden von SteamVR Input verwaltet.", + "vivecraft.messages.controls.2": "Gehen Sie zu Einstellungen > Controller > Controllerkonfiguration verwalten.", + "vivecraft.messages.controls.3": "§6Steam muss §ovor§r§6 SteamVR gestartet werden, sonst werden Änderungen nicht gespeichert.", + "vivecraft.messages.serverplugin": "Vivecraft Server Mod erkannt: %s", + "vivecraft.messages.noserverplugin": "Vivecraft Server Mod nicht erkannt. Dieser Server unterstützt möglicherweise kein Teleportieren. Der eingeschränkte Bewegungsmodus (Fallback auf freie Bewegung) wurde aktiviert.", + "vivecraft.messages.calibrateheight": "Bitte kalibrieren Sie Ihre Körpergröße im Pause Menü.", + "vivecraft.messages.rendersetupfailed": "Render Setup fehlgeschlagen: %s", + "vivecraft.messages.intelgraphics": "Intel Integrated Graphics werden nicht unterstützt. Wenn es sich um einen Laptop handelt, erzwingen Sie bitte die Hochleistungs-GPU. Erkannte GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR runtime nicht erkannt. Ist SteamVR installiert?", + "vivecraft.messages.menuworldexportcomplete.1": "Weltexport abgeschlossen... Flächengröße: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Gespeichert unter %s", + "vivecraft.messages.menuworldexportclientwarning": "WARNUNG: Speichern der Menüwelt mithilfe einer Clientwelt. Daten können unvollständig sein. Es wird empfohlen, Menüwelten im Einzelspielermodus zu speichern.", + "vivecraft.messages.teleportdisabled": "Bewegungseinschränkung aktiviert (Teleportation nicht erlaubt)", + "vivecraft.messages.teleportenabled": "Bewegungseinschränkung deaktiviert (Teleportation erlaubt)", + "vivecraft.messages.walkupblocks": "Blöcke hochlaufen (RCTRL+B): %s", + "vivecraft.messages.showaim": "Ziel zeigen (RCTRL+RSHIFT): aktiviert", + "vivecraft.messages.playerinertia": "Spieler Bewegungsträgheit (LCTRL+I): %s", + "vivecraft.messages.movementmodeswitch": "Bewegungsmodus gewechselt zu: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Längsachse: %.1f Querachse: %.1f Vertikalachse: %.1f", + "vivecraft.messages.heightset": "Körpergröße gesetzt auf %d%%", - "_comment_m": "mixin version exclusive strings", - "_comment_m0": "Option values", - "vivecraft.options.screen.settings": "Vivecraft Einstellungen", - "vivecraft.options.screen.server": "Vivecraft Server Einstellungen", - "vivecraft.options.shaderguirender.aftershader": "Nach Shader", - "vivecraft.options.shaderguirender.aftertranslucent": "Transparent", - "vivecraft.options.shaderguirender.beforetranslucentsolid": "Undurchsichtig", - "vivecraft.options.chatserverpluginmessage.always": "Immer", - "vivecraft.options.chatserverpluginmessage.serveronly": "Nur Server", - "vivecraft.options.chatserverpluginmessage.never": "Nie", - "vivecraft.options.once": "Einmal", - "vivecraft.options.disabled": "Deaktiviert", - "vivecraft.options.editlist": "Liste bearbeiten", - "vivecraft.options.addnew": "Neuen hinzufügen", - "_comment_m5": "Option names", - "vivecraft.options.LOW_HEALTH_INDICATOR": "Gesundheit Indikator", - "vivecraft.options.SHADER_GUI_RENDER": "Shader GUI", - "vivecraft.options.FREEMOVE_FLY_MODE": "Frei Bewegen Fliegen", - "vivecraft.options.SHOW_UPDATES": "Update Nachricht", - "vivecraft.options.SHOW_PLUGIN": "Plugin Nachricht", - "vivecraft.options.SHOW_PLUGIN_MISSING": "Plugin fehlt Nachricht", - "vivecraft.options.CHAT_MESSAGE_STENCIL": "Schablonen Nachricht", - "vivecraft.options.VR_HOTSWITCH": "Schnellwechsel", - "vivecraft.options.VR_TOGGLE_BUTTON_VISIBLE": "VR Aktivierungsknopf Sichtbar", - "vivecraft.options.VR_SETTINGS_BUTTON_VISIBLE": "VR Einstellungsknopf Sichtbar", - "vivecraft.options.VR_SETTINGS_BUTTON_POSITION": "VR Einstellungsknopf Position", - "vivecraft.options.INGAME_BINDINGS_IN_GUI": "Im-Spiel Tatest im GUI", - "_comment_m6": "Option tooltips", - "vivecraft.options.LOW_HEALTH_INDICATOR.tooltip": "Pulsiert den Bildschirm Rot bei niedriger Gesundheit, um den derzeitigen Gesundheitszustand anzuzeigen.", - "vivecraft.options.SHADER_GUI_RENDER.tooltip": "Bestimmt wie die Benutzeroberfläche mit Shadern dargestellt wird.\n Nach Shader: zeigt die Benutzeroberfläche ohne Shader, beste Kompatibilität. (Probleme mit PTGI HRR)\n Transparent: zeigt die Benutzeroberfläche mit Shadern und transparent. (Probleme mit Sildurs Vibrant)\n Undurchsichtig: zeigt die Benutzeroberfläche mit Shadern, aber Undurchsichtig", - "vivecraft.options.VR_MODE.tooltip": "wechsle zwischen VR/NONVR", - "vivecraft.options.FREEMOVE_FLY_MODE.tooltip": "Die Quelle für die Frei Bewegen-Richtung im Flugmodus.\n\n Auto: Verwendet die gleiche richtung wie das normale Frei Bewegen.\n Controller: Richtung des nicht dominanten Controllers.\n HMD: Blickrichtung des Headsets.", - "vivecraft.options.SHOW_UPDATES.tooltip": "Wie oft eine Update Nachricht im Chat gezeigt werden soll.\n Immer: zeigt die Nachricht immer, wenn eine Welt geladen wird.\n Einmal: Zeigt die Nachricht einmal, wenn ein neues Update verfügbar ist.", - "vivecraft.options.SHOW_PLUGIN.tooltip": "Wann die Server Mod erkannt Nachricht im Chat gezeigt werden soll.\n Immer: Zeigt die Nachricht in Einzel/Mehrspieler.\n Nur Server: Zeigt die Nachricht nur im Mehrspieler.\n Nie: Zeigt die Nachricht niemals.", - "vivecraft.options.SHOW_PLUGIN_MISSING.tooltip": "Wie oft die Server Mod nicht erkannt Nachricht im Chat gezeigt werden soll.\n Immer: Zeigt die Nachricht bei Server beitritt und Dimension/Server wechsel.\n Einmal: Zeigt die Nachricht nur beim beitreten eines Servers.", - "vivecraft.options.CHAT_MESSAGE_STENCIL.tooltip": "Schreibt eine Nachricht in den Chat, wenn ein anderer Mod erkannt wird, der ebenfalls die Schablone verwendet.", - "vivecraft.options.VR_HOTSWITCH.tooltip": "Schnellwechsel wechselt automatisch zu NONVR wenn das Headset abgenommen wird.\nWenn diese Einstellung ausgeschalten ist, befindet sich das Spiel dauerhaft im VR Modus, sobald VR eingeschalten wurde", - "vivecraft.options.INGAME_BINDINGS_IN_GUI.tooltip": "Erlaubt es alle Im-Spiel Tasten in Menüs zu verwenden. Dies kann zu nicht gewollten doppel Tastendrücken führen.", - "_comment_m10": "Messages", - "vivecraft.messages.mode": "Modus:", - "vivecraft.messages.novrhotswitchinglegacy": "Veralteten Vivecraft server mod erkannt. Dieser Server unterstützt kein VR Schnellwechsel. Sie können den Modus nur im Hauptmenü wechseln.", - "vivecraft.messages.novrhotswitching": "Dieser Server hat VR Schnellwechsel deaktiviert. Sie können den Modus nur im Hauptmenü wechseln.", - "vivecraft.messages.vrhotswitchinginfo": "VR Schnellwechsel aktiviert: Setze dein Headset auf, um zu VR zu wechseln", - "vivecraft.messages.updateAvailable": "§a[Vivecraft]§r Update verfügbar: %s. Klicke für mehr Details.", - "vivecraft.messages.click": "Klicke für mehr Details.", - "vivecraft.messages.incompatiblesettings": "Inkompatible Einstellungen", - "vivecraft.messages.optifineaa": "Optifines Antialiasing ist nicht compatible mit VR. Um VR zu nutzen, deaktiviere Antialiasing und starte das Spiel neu.", - "vivecraft.messages.menuworldexporterror": "Weltexport fehlgeschlagen mit folgendem Fehler: %s", - "vivecraft.messages.stencil": "[Vivecraft] Ein anderer Mod verwendet den Schablonen Puffer, wenn Sie Grafikfehler bemerken, versuchen Sie die Augenschablone in folgendem Menü zu deaktivieren: %s\nSie können diese Nachricht in folgendem Menü deaktivieren: %s", - "vivecraft.messages.3options": "%s > %s > %s", - "vivecraft.messages.openSettings": "Klicken um die Einstellungen zu öffnen.", - "vivecraft.message.kofi": "Unterstütze uns auf Ko-Fi", + "_comment_m": "mixin version exclusive strings", + "_comment_m0": "Option values", + "vivecraft.options.screen.settings": "Vivecraft Einstellungen", + "vivecraft.options.screen.server": "Vivecraft Server Einstellungen", + "vivecraft.options.shaderguirender.aftershader": "Nach Shader", + "vivecraft.options.shaderguirender.aftertranslucent": "Transparent", + "vivecraft.options.shaderguirender.beforetranslucentsolid": "Undurchsichtig", + "vivecraft.options.chatserverpluginmessage.always": "Immer", + "vivecraft.options.chatserverpluginmessage.serveronly": "Nur Server", + "vivecraft.options.chatserverpluginmessage.never": "Nie", + "vivecraft.options.once": "Einmal", + "vivecraft.options.disabled": "Deaktiviert", + "vivecraft.options.editlist": "Liste bearbeiten", + "vivecraft.options.addnew": "Neuen hinzufügen", + "_comment_m5": "Option names", + "vivecraft.options.LOW_HEALTH_INDICATOR": "Gesundheit Indikator", + "vivecraft.options.SHADER_GUI_RENDER": "Shader GUI", + "vivecraft.options.FREEMOVE_FLY_MODE": "Frei Bewegen Fliegen", + "vivecraft.options.SHOW_UPDATES": "Update Nachricht", + "vivecraft.options.SHOW_PLUGIN": "Plugin Nachricht", + "vivecraft.options.SHOW_PLUGIN_MISSING": "Plugin fehlt Nachricht", + "vivecraft.options.CHAT_MESSAGE_STENCIL": "Schablonen Nachricht", + "vivecraft.options.VR_HOTSWITCH": "Schnellwechsel", + "vivecraft.options.VR_TOGGLE_BUTTON_VISIBLE": "VR Aktivierungsknopf Sichtbar", + "vivecraft.options.VR_SETTINGS_BUTTON_VISIBLE": "VR Einstellungsknopf Sichtbar", + "vivecraft.options.VR_SETTINGS_BUTTON_POSITION": "VR Einstellungsknopf Position", + "vivecraft.options.INGAME_BINDINGS_IN_GUI": "Im-Spiel Tatest im GUI", + "_comment_m6": "Option tooltips", + "vivecraft.options.LOW_HEALTH_INDICATOR.tooltip": "Pulsiert den Bildschirm Rot bei niedriger Gesundheit, um den derzeitigen Gesundheitszustand anzuzeigen.", + "vivecraft.options.SHADER_GUI_RENDER.tooltip": "Bestimmt wie die Benutzeroberfläche mit Shadern dargestellt wird.\n Nach Shader: zeigt die Benutzeroberfläche ohne Shader, beste Kompatibilität. (Probleme mit PTGI HRR)\n Transparent: zeigt die Benutzeroberfläche mit Shadern und transparent. (Probleme mit Sildurs Vibrant)\n Undurchsichtig: zeigt die Benutzeroberfläche mit Shadern, aber Undurchsichtig", + "vivecraft.options.VR_MODE.tooltip": "wechsle zwischen VR/NONVR", + "vivecraft.options.FREEMOVE_FLY_MODE.tooltip": "Die Quelle für die Frei Bewegen-Richtung im Flugmodus.\n\n Auto: Verwendet die gleiche richtung wie das normale Frei Bewegen.\n Controller: Richtung des nicht dominanten Controllers.\n HMD: Blickrichtung des Headsets.", + "vivecraft.options.SHOW_UPDATES.tooltip": "Wie oft eine Update Nachricht im Chat gezeigt werden soll.\n Immer: zeigt die Nachricht immer, wenn eine Welt geladen wird.\n Einmal: Zeigt die Nachricht einmal, wenn ein neues Update verfügbar ist.", + "vivecraft.options.SHOW_PLUGIN.tooltip": "Wann die Server Mod erkannt Nachricht im Chat gezeigt werden soll.\n Immer: Zeigt die Nachricht in Einzel/Mehrspieler.\n Nur Server: Zeigt die Nachricht nur im Mehrspieler.\n Nie: Zeigt die Nachricht niemals.", + "vivecraft.options.SHOW_PLUGIN_MISSING.tooltip": "Wie oft die Server Mod nicht erkannt Nachricht im Chat gezeigt werden soll.\n Immer: Zeigt die Nachricht bei Server beitritt und Dimension/Server wechsel.\n Einmal: Zeigt die Nachricht nur beim beitreten eines Servers.", + "vivecraft.options.CHAT_MESSAGE_STENCIL.tooltip": "Schreibt eine Nachricht in den Chat, wenn ein anderer Mod erkannt wird, der ebenfalls die Schablone verwendet.", + "vivecraft.options.VR_HOTSWITCH.tooltip": "Schnellwechsel wechselt automatisch zu NONVR wenn das Headset abgenommen wird.\nWenn diese Einstellung ausgeschalten ist, befindet sich das Spiel dauerhaft im VR Modus, sobald VR eingeschalten wurde", + "vivecraft.options.INGAME_BINDINGS_IN_GUI.tooltip": "Erlaubt es alle Im-Spiel Tasten in Menüs zu verwenden. Dies kann zu nicht gewollten doppel Tastendrücken führen.", + "_comment_m10": "Messages", + "vivecraft.messages.mode": "Modus:", + "vivecraft.messages.novrhotswitchinglegacy": "Veralteten Vivecraft server mod erkannt. Dieser Server unterstützt kein VR Schnellwechsel. Sie können den Modus nur im Hauptmenü wechseln.", + "vivecraft.messages.novrhotswitching": "Dieser Server hat VR Schnellwechsel deaktiviert. Sie können den Modus nur im Hauptmenü wechseln.", + "vivecraft.messages.vrhotswitchinginfo": "VR Schnellwechsel aktiviert: Setze dein Headset auf, um zu VR zu wechseln", + "vivecraft.messages.updateAvailable": "§a[Vivecraft]§r Update verfügbar: %s. Klicke für mehr Details.", + "vivecraft.messages.click": "Klicke für mehr Details.", + "vivecraft.messages.incompatiblesettings": "Inkompatible Einstellungen", + "vivecraft.messages.optifineaa": "Optifines Antialiasing ist nicht compatible mit VR. Um VR zu nutzen, deaktiviere Antialiasing und starte das Spiel neu.", + "vivecraft.messages.menuworldexporterror": "Weltexport fehlgeschlagen mit folgendem Fehler: %s", + "vivecraft.messages.stencil": "[Vivecraft] Ein anderer Mod verwendet den Schablonen Puffer, wenn Sie Grafikfehler bemerken, versuchen Sie die Augenschablone in folgendem Menü zu deaktivieren: %s\nSie können diese Nachricht in folgendem Menü deaktivieren: %s", + "vivecraft.messages.3options": "%s > %s > %s", + "vivecraft.messages.openSettings": "Klicken um die Einstellungen zu öffnen.", + "vivecraft.message.kofi": "Unterstütze uns auf Ko-Fi", - "vivecraft.gui.update": "§aⓘ§r Update", - "vivecraft.gui.vr": "VR: %s", + "vivecraft.gui.update": "§aⓘ§r Update", + "vivecraft.gui.vr": "VR: %s", - "vivecraft.toasts.move1": "Laufe mit %s", - "vivecraft.toasts.move2": "Laufe mit %s und %s", - "vivecraft.toasts.move3": "Laufe mit %s, %s und %s", - "vivecraft.toasts.move4": "Laufe mit %s, %s, %s und %s", - "vivecraft.toasts.point_controller": "Zeige mit deinem %s", - "vivecraft.toasts.point_controller.left": "linken Controller", - "vivecraft.toasts.point_controller.right": "rechten Controller", - "vivecraft.toasts.teleport": "Teleportiere mit %s" + "vivecraft.toasts.move1": "Laufe mit %s", + "vivecraft.toasts.move2": "Laufe mit %s und %s", + "vivecraft.toasts.move3": "Laufe mit %s, %s und %s", + "vivecraft.toasts.move4": "Laufe mit %s, %s, %s und %s", + "vivecraft.toasts.point_controller": "Zeige mit deinem %s", + "vivecraft.toasts.point_controller.left": "linken Controller", + "vivecraft.toasts.point_controller.right": "rechten Controller", + "vivecraft.toasts.teleport": "Teleportiere mit %s" } diff --git a/common/src/main/resources/assets/vivecraft/lang/en_ca.json b/common/src/main/resources/assets/vivecraft/lang/en_ca.json index d5302bd29..e763f23d5 100644 --- a/common/src/main/resources/assets/vivecraft/lang/en_ca.json +++ b/common/src/main/resources/assets/vivecraft/lang/en_ca.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: dangerousones", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Hotbar Next", - "vivecraft.key.hotbarPrev": "Hotbar Previous", - "vivecraft.key.hotbarScroll": "Hotbar Scroll", - "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", - "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", - "vivecraft.key.rotateLeft": "Rotate Left", - "vivecraft.key.rotateRight": "Rotate Right", - "vivecraft.key.rotateAxis": "Rotate Only", - "vivecraft.key.rotateFree": "Rotate Free", - "vivecraft.key.walkabout": "Walkabout", - "vivecraft.key.teleport": "Teleport", - "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", - "vivecraft.key.freeMoveRotate": "Move/Rotate", - "vivecraft.key.freeMoveStrafe": "Move/Strafe", - "vivecraft.key.toggleMovement": "Toggle Movement Mode", - "vivecraft.key.quickTorch": "Quick Torch", - "vivecraft.key.ingameMenuButton": "Game Menu", - "vivecraft.key.exportWorld": "Export Menu World", - "vivecraft.key.radialMenu": "Open Radial Menu", - "vivecraft.key.swapMirrorView": "Swap Mirror View", - "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", - "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", - "vivecraft.key.togglePlayerList": "Toggle Player List", - "vivecraft.key.toggleHandheldCam": "Toggle Camera", - "vivecraft.key.quickHandheldCam": "Quick Camera", - "vivecraft.key.trackpadTouch": "Track-pad Touch", - "vivecraft.key.vrInteract": "Contextual Interact", - "vivecraft.key.guiLeftClick": "Left Click", - "vivecraft.key.guiRightClick": "Right Click", - "vivecraft.key.guiMiddleClick": "Middle Click", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Scroll Up", - "vivecraft.key.guiScrollDown": "Scroll Down", - "vivecraft.key.guiScrollAxis": "Scroll", - "vivecraft.key.keyboardClick": "Click", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Climb Claws", - "vivecraft.key.climbeyJump": "Jump Boots", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "Climbey Motion", - "vivecraft.key.category.keyboard": "Keyboard", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "In-Game", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "Modded", - "vivecraft.actionset.contextual": "Contextual", - "vivecraft.actionset.keyboard": "Keyboard", - "vivecraft.actionset.mixedReality": "Mixed Reality", - "vivecraft.actionset.technical": "Technical", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "VR Settings", - "vivecraft.options.screen.freemove": "Free Move Settings", - "vivecraft.options.screen.gui": "HUD and GUI Settings", - "vivecraft.options.screen.menuworld": "Menu World Settings", - "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", - "vivecraft.options.screen.quickcommands": "Quick Commands", - "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", - "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", - "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", - "vivecraft.options.screen.seated": "Seated Settings", - "vivecraft.options.screen.standing": "Standing Locomotion Settings", - "vivecraft.options.screen.teleport": "Teleport Settings", - "vivecraft.options.screen.controls": "Controller Settings", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR Settings...", - "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", - "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", - "vivecraft.options.screen.quickcommands.button": "Quick Commands...", - "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", - "vivecraft.options.screen.standing.button": "Locomotion Settings...", - "vivecraft.options.screen.roomscale.button": "Interaction Settings...", - "vivecraft.options.screen.controls.button": "Controller Settings...", - "vivecraft.options.screen.radialmenu.button": "Radial Menu...", - "vivecraft.options.screen.seated.button": "Seated Settings...", - "vivecraft.options.screen.menuworld.button": "Menu World Settings...", - "vivecraft.options.screen.teleport.button": "Teleport Settings...", - "vivecraft.options.screen.freemove.button": "Free Move Settings...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Head HUD Size", - "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", - "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", - "vivecraft.options.HUD_OPACITY": "HUD Opacity", - "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", - "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", - "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", - "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", - "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", - "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", - "vivecraft.options.FSAA": "Lanczos Scaler", - "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", - "vivecraft.options.MIRROR_EYE": "Mirror Eye", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Colour", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", - "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", - "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", - "vivecraft.options.INERTIA_FACTOR": "Player Inertia", - "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", - "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", - "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", - "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", - "vivecraft.options.REVERSE_HANDS": "Reverse Hands", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Use Eye Stencil", - "vivecraft.options.BCB_ON": "Show Body Position", - "vivecraft.options.WORLD_SCALE": "World Scale", - "vivecraft.options.WORLD_ROTATION": "World Rotation", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", - "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Enabled", - "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", - "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", - "vivecraft.options.MONO_FOV": "Undistorted FOV", - "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", - "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", - "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", - "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", - "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", - "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", - "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", - "vivecraft.options.FREEMOVE_MODE": "Free Move Type", - "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", - "vivecraft.options.RESET_ORIGIN": "Reset Origin", - "vivecraft.options.X_SENSITIVITY": "Rotation Speed", - "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", - "vivecraft.options.KEYHOLE": "Keyhole", - "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", - "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", - "vivecraft.options.SEATED_HMD": "Forward Direction", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", - "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", - "vivecraft.options.ANALOG_MOVEMENT": "Analogue Movement", - "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", - "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", - "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", - "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", - "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", - "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", - "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", - "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in metres (though isn't obstructed by blocks).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", - "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behaviour of the radial menu when pressing the button.\n Hold: Hold radial menu button, hover over selection and release.\n Press: Press radial menu button, click buttons, press radial menu button again to dismiss.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", - "vivecraft.options.FSAA.tooltip": "Uses a fancier method of re-sampling the game before sending it to the HMD. Works best at high render scales.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual HMD-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", - "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The colour drawn to the \"transparent\" areas of the mixed reality view. Other colours in-game will be prevented from matching this so it doesn't cause weirdness.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a greyscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key colour for use with colour key effect.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under blocks.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will be have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", - "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", - "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "If enabled allow you to touch the hotbar with your main hand to select an item.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", - "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3D interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Recentre the player's feet in the world to 1.62 metres below the current HMD position. For non-absolute tracking systems or seated play.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", - "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of centre where the view will begin to rotate.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the centre of the FOV reduction for non-standard HMDs.", - "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analogue control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", - "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limits the number of blocks you can teleport below you.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limits the number of blocks you can teleport above you.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limits the number of blocks you can teleport sideways you.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Colour scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", - "vivecraft.options.yes": "YES", - "vivecraft.options.no": "NO", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Default", - "vivecraft.options.opaque": "Opaque", - "vivecraft.options.mirrormode.off": "OFF (fast)", - "vivecraft.options.mirrormode.dual": "Dual (fast)", - "vivecraft.options.mirrormode.single": "Single (fast)", - "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", - "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", - "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", - "vivecraft.options.mirrormode.cropped": "Cropped (fast)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Left", - "vivecraft.options.right": "Right", - "vivecraft.options.color.black": "Black", - "vivecraft.options.color.red": "Red", - "vivecraft.options.color.yellow": "Yellow", - "vivecraft.options.color.green": "Green", - "vivecraft.options.color.cyan": "Cyan", - "vivecraft.options.color.blue": "Blue", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Side-by-Side", - "vivecraft.options.hudlock.hand": "Hand", - "vivecraft.options.hudlock.head": "Head", - "vivecraft.options.hudlock.wrist": "Wrist", - "vivecraft.options.renderpointerelement.always": "Always", - "vivecraft.options.renderpointerelement.withhud": "With HUD", - "vivecraft.options.renderpointerelement.never": "Never", - "vivecraft.options.chatnotifications.none": "None", - "vivecraft.options.chatnotifications.haptic": "Haptic", - "vivecraft.options.chatnotifications.sound": "Sound", - "vivecraft.options.chatnotifications.both": "Both", - "vivecraft.options.always": "Always", - "vivecraft.options.seated": "Seated", - "vivecraft.options.standing": "Standing", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normal", - "vivecraft.options.inertiafactor.large": "A Lot", - "vivecraft.options.inertiafactor.massive": "Even More", - "vivecraft.options.smooth": "Smooth", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Crosshair", - "vivecraft.options.freemove.controller": "Controller", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Run-In-Place", - "vivecraft.options.freemove.room": "Room", - "vivecraft.options.hold": "Hold", - "vivecraft.options.press": "Press", - "vivecraft.options.keyboard.physical": "Physical", - "vivecraft.options.keyboard.pointer": "Pointer", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blocks", - "vivecraft.options.teleport": "Teleport", - "vivecraft.options.freemove": "Free Move", - "vivecraft.options.menuworld.both": "Official & Custom", - "vivecraft.options.menuworld.custom": "Custom Only", - "vivecraft.options.menuworld.official": "Official Only", - "vivecraft.options.menuworld.none": "None", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Slow", - "vivecraft.options.rightclickdelay.slower": "Slower", - "vivecraft.options.rightclickdelay.slowest": "Slowest", - "vivecraft.options.keyboardtheme.default": "White", - "vivecraft.options.keyboardtheme.red": "Red", - "vivecraft.options.keyboardtheme.green": "Green", - "vivecraft.options.keyboardtheme.blue": "Blue", - "vivecraft.options.keyboardtheme.black": "Void", - "vivecraft.options.keyboardtheme.grass": "Grass Block", - "vivecraft.options.keyboardtheme.bees": "Bumblebee", - "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", - "vivecraft.options.keyboardtheme.dose": "Medicine", - "vivecraft.options.keyboardtheme.custom": "Custom", - "_comment12": "Button text", - "vivecraft.gui.ok": "Okay", - "vivecraft.gui.clear": "Clear", - "vivecraft.gui.loaddefaults": "Load Defaults", - "vivecraft.gui.menuworld.refresh": "Refresh Menu World", - "vivecraft.gui.menuworld.loadnew": "Load New Menu World", - "vivecraft.gui.radialmenu.mainset": "Main Set", - "vivecraft.gui.radialmenu.alternateset": "Alternate Set", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Commands", - "vivecraft.gui.overlay": "Overlay (F3)", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Screenshot (F2)", - "vivecraft.gui.calibrateheight": "Calibrate Height", - "vivecraft.gui.alignkatwalk": "Align KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Move Third Cam", - "vivecraft.gui.social": "Social", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Jump Boots", - "vivecraft.item.climbclaws": "Climb Claws", - "vivecraft.item.telescope": "Eye of the Farseer", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", - "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", - "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", - "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", - "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", - "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", - "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", - "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", - "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", - "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", - "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", - "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", - "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", - "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", - "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", - "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", - "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", - "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", - "vivecraft.messages.heightset": "User height set to %d%%" -} \ No newline at end of file + "_comment0": "Contributors: dangerousones", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Hotbar Next", + "vivecraft.key.hotbarPrev": "Hotbar Previous", + "vivecraft.key.hotbarScroll": "Hotbar Scroll", + "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", + "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", + "vivecraft.key.rotateLeft": "Rotate Left", + "vivecraft.key.rotateRight": "Rotate Right", + "vivecraft.key.rotateAxis": "Rotate Only", + "vivecraft.key.rotateFree": "Rotate Free", + "vivecraft.key.walkabout": "Walkabout", + "vivecraft.key.teleport": "Teleport", + "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", + "vivecraft.key.freeMoveRotate": "Move/Rotate", + "vivecraft.key.freeMoveStrafe": "Move/Strafe", + "vivecraft.key.toggleMovement": "Toggle Movement Mode", + "vivecraft.key.quickTorch": "Quick Torch", + "vivecraft.key.ingameMenuButton": "Game Menu", + "vivecraft.key.exportWorld": "Export Menu World", + "vivecraft.key.radialMenu": "Open Radial Menu", + "vivecraft.key.swapMirrorView": "Swap Mirror View", + "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", + "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", + "vivecraft.key.togglePlayerList": "Toggle Player List", + "vivecraft.key.toggleHandheldCam": "Toggle Camera", + "vivecraft.key.quickHandheldCam": "Quick Camera", + "vivecraft.key.trackpadTouch": "Track-pad Touch", + "vivecraft.key.vrInteract": "Contextual Interact", + "vivecraft.key.guiLeftClick": "Left Click", + "vivecraft.key.guiRightClick": "Right Click", + "vivecraft.key.guiMiddleClick": "Middle Click", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Scroll Up", + "vivecraft.key.guiScrollDown": "Scroll Down", + "vivecraft.key.guiScrollAxis": "Scroll", + "vivecraft.key.keyboardClick": "Click", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Climb Claws", + "vivecraft.key.climbeyJump": "Jump Boots", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "Climbey Motion", + "vivecraft.key.category.keyboard": "Keyboard", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "In-Game", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "Modded", + "vivecraft.actionset.contextual": "Contextual", + "vivecraft.actionset.keyboard": "Keyboard", + "vivecraft.actionset.mixedReality": "Mixed Reality", + "vivecraft.actionset.technical": "Technical", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "VR Settings", + "vivecraft.options.screen.freemove": "Free Move Settings", + "vivecraft.options.screen.gui": "HUD and GUI Settings", + "vivecraft.options.screen.menuworld": "Menu World Settings", + "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", + "vivecraft.options.screen.quickcommands": "Quick Commands", + "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", + "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", + "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", + "vivecraft.options.screen.seated": "Seated Settings", + "vivecraft.options.screen.standing": "Standing Locomotion Settings", + "vivecraft.options.screen.teleport": "Teleport Settings", + "vivecraft.options.screen.controls": "Controller Settings", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR Settings...", + "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", + "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", + "vivecraft.options.screen.quickcommands.button": "Quick Commands...", + "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", + "vivecraft.options.screen.standing.button": "Locomotion Settings...", + "vivecraft.options.screen.roomscale.button": "Interaction Settings...", + "vivecraft.options.screen.controls.button": "Controller Settings...", + "vivecraft.options.screen.radialmenu.button": "Radial Menu...", + "vivecraft.options.screen.seated.button": "Seated Settings...", + "vivecraft.options.screen.menuworld.button": "Menu World Settings...", + "vivecraft.options.screen.teleport.button": "Teleport Settings...", + "vivecraft.options.screen.freemove.button": "Free Move Settings...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Head HUD Size", + "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", + "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", + "vivecraft.options.HUD_OPACITY": "HUD Opacity", + "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", + "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", + "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", + "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", + "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", + "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", + "vivecraft.options.FSAA": "Lanczos Scaler", + "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", + "vivecraft.options.MIRROR_EYE": "Mirror Eye", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Colour", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", + "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", + "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", + "vivecraft.options.INERTIA_FACTOR": "Player Inertia", + "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", + "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", + "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", + "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", + "vivecraft.options.REVERSE_HANDS": "Reverse Hands", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Use Eye Stencil", + "vivecraft.options.BCB_ON": "Show Body Position", + "vivecraft.options.WORLD_SCALE": "World Scale", + "vivecraft.options.WORLD_ROTATION": "World Rotation", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", + "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Enabled", + "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", + "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", + "vivecraft.options.MONO_FOV": "Undistorted FOV", + "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", + "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", + "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", + "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", + "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", + "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", + "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", + "vivecraft.options.FREEMOVE_MODE": "Free Move Type", + "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", + "vivecraft.options.RESET_ORIGIN": "Reset Origin", + "vivecraft.options.X_SENSITIVITY": "Rotation Speed", + "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", + "vivecraft.options.KEYHOLE": "Keyhole", + "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", + "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", + "vivecraft.options.SEATED_HMD": "Forward Direction", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", + "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", + "vivecraft.options.ANALOG_MOVEMENT": "Analogue Movement", + "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", + "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", + "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", + "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", + "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", + "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", + "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", + "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in metres (though isn't obstructed by blocks).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", + "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behaviour of the radial menu when pressing the button.\n Hold: Hold radial menu button, hover over selection and release.\n Press: Press radial menu button, click buttons, press radial menu button again to dismiss.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", + "vivecraft.options.FSAA.tooltip": "Uses a fancier method of re-sampling the game before sending it to the HMD. Works best at high render scales.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual HMD-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", + "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The colour drawn to the \"transparent\" areas of the mixed reality view. Other colours in-game will be prevented from matching this so it doesn't cause weirdness.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a greyscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key colour for use with colour key effect.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under blocks.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will be have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", + "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", + "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "If enabled allow you to touch the hotbar with your main hand to select an item.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", + "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3D interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Recentre the player's feet in the world to 1.62 metres below the current HMD position. For non-absolute tracking systems or seated play.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", + "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of centre where the view will begin to rotate.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the centre of the FOV reduction for non-standard HMDs.", + "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analogue control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", + "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limits the number of blocks you can teleport below you.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limits the number of blocks you can teleport above you.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limits the number of blocks you can teleport sideways you.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Colour scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", + "vivecraft.options.yes": "YES", + "vivecraft.options.no": "NO", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Default", + "vivecraft.options.opaque": "Opaque", + "vivecraft.options.mirrormode.off": "OFF (fast)", + "vivecraft.options.mirrormode.dual": "Dual (fast)", + "vivecraft.options.mirrormode.single": "Single (fast)", + "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", + "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", + "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", + "vivecraft.options.mirrormode.cropped": "Cropped (fast)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Left", + "vivecraft.options.right": "Right", + "vivecraft.options.color.black": "Black", + "vivecraft.options.color.red": "Red", + "vivecraft.options.color.yellow": "Yellow", + "vivecraft.options.color.green": "Green", + "vivecraft.options.color.cyan": "Cyan", + "vivecraft.options.color.blue": "Blue", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Side-by-Side", + "vivecraft.options.hudlock.hand": "Hand", + "vivecraft.options.hudlock.head": "Head", + "vivecraft.options.hudlock.wrist": "Wrist", + "vivecraft.options.renderpointerelement.always": "Always", + "vivecraft.options.renderpointerelement.withhud": "With HUD", + "vivecraft.options.renderpointerelement.never": "Never", + "vivecraft.options.chatnotifications.none": "None", + "vivecraft.options.chatnotifications.haptic": "Haptic", + "vivecraft.options.chatnotifications.sound": "Sound", + "vivecraft.options.chatnotifications.both": "Both", + "vivecraft.options.always": "Always", + "vivecraft.options.seated": "Seated", + "vivecraft.options.standing": "Standing", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normal", + "vivecraft.options.inertiafactor.large": "A Lot", + "vivecraft.options.inertiafactor.massive": "Even More", + "vivecraft.options.smooth": "Smooth", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Crosshair", + "vivecraft.options.freemove.controller": "Controller", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Run-In-Place", + "vivecraft.options.freemove.room": "Room", + "vivecraft.options.hold": "Hold", + "vivecraft.options.press": "Press", + "vivecraft.options.keyboard.physical": "Physical", + "vivecraft.options.keyboard.pointer": "Pointer", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blocks", + "vivecraft.options.teleport": "Teleport", + "vivecraft.options.freemove": "Free Move", + "vivecraft.options.menuworld.both": "Official & Custom", + "vivecraft.options.menuworld.custom": "Custom Only", + "vivecraft.options.menuworld.official": "Official Only", + "vivecraft.options.menuworld.none": "None", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Slow", + "vivecraft.options.rightclickdelay.slower": "Slower", + "vivecraft.options.rightclickdelay.slowest": "Slowest", + "vivecraft.options.keyboardtheme.default": "White", + "vivecraft.options.keyboardtheme.red": "Red", + "vivecraft.options.keyboardtheme.green": "Green", + "vivecraft.options.keyboardtheme.blue": "Blue", + "vivecraft.options.keyboardtheme.black": "Void", + "vivecraft.options.keyboardtheme.grass": "Grass Block", + "vivecraft.options.keyboardtheme.bees": "Bumblebee", + "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", + "vivecraft.options.keyboardtheme.dose": "Medicine", + "vivecraft.options.keyboardtheme.custom": "Custom", + "_comment12": "Button text", + "vivecraft.gui.ok": "Okay", + "vivecraft.gui.clear": "Clear", + "vivecraft.gui.loaddefaults": "Load Defaults", + "vivecraft.gui.menuworld.refresh": "Refresh Menu World", + "vivecraft.gui.menuworld.loadnew": "Load New Menu World", + "vivecraft.gui.radialmenu.mainset": "Main Set", + "vivecraft.gui.radialmenu.alternateset": "Alternate Set", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Commands", + "vivecraft.gui.overlay": "Overlay (F3)", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Screenshot (F2)", + "vivecraft.gui.calibrateheight": "Calibrate Height", + "vivecraft.gui.alignkatwalk": "Align KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Move Third Cam", + "vivecraft.gui.social": "Social", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Jump Boots", + "vivecraft.item.climbclaws": "Climb Claws", + "vivecraft.item.telescope": "Eye of the Farseer", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", + "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", + "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", + "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", + "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", + "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", + "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", + "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", + "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", + "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", + "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", + "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", + "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", + "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", + "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", + "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", + "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", + "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", + "vivecraft.messages.heightset": "User height set to %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/en_gb.json b/common/src/main/resources/assets/vivecraft/lang/en_gb.json index e1c5e606a..074d32562 100644 --- a/common/src/main/resources/assets/vivecraft/lang/en_gb.json +++ b/common/src/main/resources/assets/vivecraft/lang/en_gb.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: bloodninja, aloxo.black, putper, Merlo", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Hotbar Next", - "vivecraft.key.hotbarPrev": "Hotbar Previous", - "vivecraft.key.hotbarScroll": "Hotbar Scroll", - "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", - "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", - "vivecraft.key.rotateLeft": "Rotate Left", - "vivecraft.key.rotateRight": "Rotate Right", - "vivecraft.key.rotateAxis": "Rotate Only", - "vivecraft.key.rotateFree": "Rotate Free", - "vivecraft.key.walkabout": "Walkabout", - "vivecraft.key.teleport": "Teleport", - "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", - "vivecraft.key.freeMoveRotate": "Move/Rotate", - "vivecraft.key.freeMoveStrafe": "Move/Strafe", - "vivecraft.key.toggleMovement": "Toggle Movement Mode", - "vivecraft.key.quickTorch": "Quick Torch", - "vivecraft.key.ingameMenuButton": "Game Menu", - "vivecraft.key.exportWorld": "Export Menu World", - "vivecraft.key.radialMenu": "Open Radial Menu", - "vivecraft.key.swapMirrorView": "Swap Mirror View", - "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", - "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", - "vivecraft.key.togglePlayerList": "Toggle Player List", - "vivecraft.key.toggleHandheldCam": "Toggle Camera", - "vivecraft.key.quickHandheldCam": "Quick Camera", - "vivecraft.key.trackpadTouch": "Trackpad Touch", - "vivecraft.key.vrInteract": "Contextual Interact", - "vivecraft.key.guiLeftClick": "Left Click", - "vivecraft.key.guiRightClick": "Right Click", - "vivecraft.key.guiMiddleClick": "Middle Click", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Scroll Up", - "vivecraft.key.guiScrollDown": "Scroll Down", - "vivecraft.key.guiScrollAxis": "Scroll", - "vivecraft.key.keyboardClick": "Click", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Climb Claws", - "vivecraft.key.climbeyJump": "Jump Boots", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "Climbey Motion", - "vivecraft.key.category.keyboard": "Keyboard", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "In-Game", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "Modded", - "vivecraft.actionset.contextual": "Contextual", - "vivecraft.actionset.keyboard": "Keyboard", - "vivecraft.actionset.mixedReality": "Mixed Reality", - "vivecraft.actionset.technical": "Technical", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "VR Settings", - "vivecraft.options.screen.freemove": "Free Move Settings", - "vivecraft.options.screen.gui": "HUD and GUI Settings", - "vivecraft.options.screen.menuworld": "Menu World Settings", - "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", - "vivecraft.options.screen.quickcommands": "Quick Commands", - "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", - "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", - "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", - "vivecraft.options.screen.seated": "Seated Settings", - "vivecraft.options.screen.standing": "Standing Locomotion Settings", - "vivecraft.options.screen.teleport": "Teleport Settings", - "vivecraft.options.screen.controls": "Controller Settings", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR Settings...", - "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", - "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", - "vivecraft.options.screen.quickcommands.button": "Quick Commands...", - "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", - "vivecraft.options.screen.standing.button": "Locomotion Settings...", - "vivecraft.options.screen.roomscale.button": "Interaction Settings...", - "vivecraft.options.screen.controls.button": "Controller Settings...", - "vivecraft.options.screen.radialmenu.button": "Radial Menu...", - "vivecraft.options.screen.seated.button": "Seated Settings...", - "vivecraft.options.screen.menuworld.button": "Menu World Settings...", - "vivecraft.options.screen.teleport.button": "Teleport Settings...", - "vivecraft.options.screen.freemove.button": "Free Move Settings...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Head HUD Size", - "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", - "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", - "vivecraft.options.HUD_OPACITY": "HUD Opacity", - "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", - "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", - "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", - "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", - "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", - "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", - "vivecraft.options.FSAA": "Lanczos Scaler", - "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", - "vivecraft.options.MIRROR_EYE": "Mirror Eye", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Colour", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", - "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", - "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", - "vivecraft.options.INERTIA_FACTOR": "Player Inertia", - "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", - "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", - "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", - "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", - "vivecraft.options.REVERSE_HANDS": "Reverse Hands", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Use Eye Stencil", - "vivecraft.options.BCB_ON": "Show Body Position", - "vivecraft.options.WORLD_SCALE": "World Scale", - "vivecraft.options.WORLD_ROTATION": "World Rotation", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", - "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Enabled", - "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", - "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", - "vivecraft.options.MONO_FOV": "Undistorted FOV", - "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", - "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", - "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", - "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", - "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", - "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", - "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", - "vivecraft.options.FREEMOVE_MODE": "Free Move Type", - "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", - "vivecraft.options.RESET_ORIGIN": "Reset Origin", - "vivecraft.options.X_SENSITIVITY": "Rotation Speed", - "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", - "vivecraft.options.KEYHOLE": "Keyhole", - "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", - "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", - "vivecraft.options.SEATED_HMD": "Forward Direction", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", - "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", - "vivecraft.options.ANALOG_MOVEMENT": "Analogue Movement", - "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", - "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", - "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", - "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", - "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", - "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", - "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", - "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in metres (though isn't obstructed by blocks).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", - "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behaviour of the radial menu when pressing the button.\nHold: Hold radial menu button, hover over selection and release.\nPress: Press radial menu button, click buttons, press radial menu button again to dismiss.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", - "vivecraft.options.FSAA.tooltip": "Uses a fancier method of resampling the game before sending it to the HMD. Works best at high render scales.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual hmd-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", - "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The colour drawn to the \"transparent\" areas of the mixed reality view. Other colours in-game will be prevented from matching this so it doesn't cause weirdness.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a grayscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key colour for use with colour key effect.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under block.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", - "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", - "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "If enabled allow you to touch the hotbar with your main hand to select an item.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", - "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3d interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Re-centre the player's feet in the world to 1.62m below the current HMD position. For non-absolute tracking systems or seated play.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", - "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of centre where the view will begin to rotate.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the centre of the FOV reduction for non-standard HMDs.", - "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analogue control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", - "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit the number of blocks you can teleport below you.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit the number of blocks you can teleport above you.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit the number of blocks you can teleport sideways you.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Colour scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", - "vivecraft.options.yes": "YES", - "vivecraft.options.no": "NO", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Default", - "vivecraft.options.opaque": "Opaque", - "vivecraft.options.mirrormode.off": "OFF (fast)", - "vivecraft.options.mirrormode.dual": "Dual (fast)", - "vivecraft.options.mirrormode.single": "Single (fast)", - "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", - "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", - "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", - "vivecraft.options.mirrormode.cropped": "Cropped (fast)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Left", - "vivecraft.options.right": "Right", - "vivecraft.options.color.black": "Black", - "vivecraft.options.color.red": "Red", - "vivecraft.options.color.yellow": "Yellow", - "vivecraft.options.color.green": "Green", - "vivecraft.options.color.cyan": "Cyan", - "vivecraft.options.color.blue": "Blue", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Side-by-Side", - "vivecraft.options.hudlock.hand": "Hand", - "vivecraft.options.hudlock.head": "Head", - "vivecraft.options.hudlock.wrist": "Wrist", - "vivecraft.options.renderpointerelement.always": "Always", - "vivecraft.options.renderpointerelement.withhud": "With HUD", - "vivecraft.options.renderpointerelement.never": "Never", - "vivecraft.options.chatnotifications.none": "None", - "vivecraft.options.chatnotifications.haptic": "Haptic", - "vivecraft.options.chatnotifications.sound": "Sound", - "vivecraft.options.chatnotifications.both": "Both", - "vivecraft.options.always": "Always", - "vivecraft.options.seated": "Seated", - "vivecraft.options.standing": "Standing", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normal", - "vivecraft.options.inertiafactor.large": "A Lot", - "vivecraft.options.inertiafactor.massive": "Even More", - "vivecraft.options.smooth": "Smooth", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Crosshair", - "vivecraft.options.freemove.controller": "Controller", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Run-In-Place", - "vivecraft.options.freemove.room": "Room", - "vivecraft.options.hold": "Hold", - "vivecraft.options.press": "Press", - "vivecraft.options.keyboard.physical": "Physical", - "vivecraft.options.keyboard.pointer": "Pointer", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blocks", - "vivecraft.options.teleport": "Teleport", - "vivecraft.options.freemove": "Free Move", - "vivecraft.options.menuworld.both": "Official & Custom", - "vivecraft.options.menuworld.custom": "Custom Only", - "vivecraft.options.menuworld.official": "Official Only", - "vivecraft.options.menuworld.none": "None", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Slow", - "vivecraft.options.rightclickdelay.slower": "Slower", - "vivecraft.options.rightclickdelay.slowest": "Slowest", - "vivecraft.options.keyboardtheme.default": "White", - "vivecraft.options.keyboardtheme.red": "Red", - "vivecraft.options.keyboardtheme.green": "Green", - "vivecraft.options.keyboardtheme.blue": "Blue", - "vivecraft.options.keyboardtheme.black": "Void", - "vivecraft.options.keyboardtheme.grass": "Grass Block", - "vivecraft.options.keyboardtheme.bees": "Bumblebee", - "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", - "vivecraft.options.keyboardtheme.dose": "Medicine", - "vivecraft.options.keyboardtheme.custom": "Custom", - "_comment12": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Clear", - "vivecraft.gui.loaddefaults": "Load Defaults", - "vivecraft.gui.menuworld.refresh": "Refresh Menu World", - "vivecraft.gui.menuworld.loadnew": "Load New Menu World", - "vivecraft.gui.radialmenu.mainset": "Main Set", - "vivecraft.gui.radialmenu.alternateset": "Alternate Set", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Commands", - "vivecraft.gui.overlay": "Overlay", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Screenshot", - "vivecraft.gui.calibrateheight": "Calibrate Height", - "vivecraft.gui.alignkatwalk": "Align KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Move Third Cam", - "vivecraft.gui.social": "Social", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Jump Boots", - "vivecraft.item.climbclaws": "Climb Claws", - "vivecraft.item.telescope": "Eye of the Farseer", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", - "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", - "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", - "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", - "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", - "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", - "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", - "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", - "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", - "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", - "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", - "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", - "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", - "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", - "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", - "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", - "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", - "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", - "vivecraft.messages.heightset": "User height set to %d%%" -} \ No newline at end of file + "_comment0": "Contributors: bloodninja, aloxo.black, putper, Merlo", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Hotbar Next", + "vivecraft.key.hotbarPrev": "Hotbar Previous", + "vivecraft.key.hotbarScroll": "Hotbar Scroll", + "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", + "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", + "vivecraft.key.rotateLeft": "Rotate Left", + "vivecraft.key.rotateRight": "Rotate Right", + "vivecraft.key.rotateAxis": "Rotate Only", + "vivecraft.key.rotateFree": "Rotate Free", + "vivecraft.key.walkabout": "Walkabout", + "vivecraft.key.teleport": "Teleport", + "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", + "vivecraft.key.freeMoveRotate": "Move/Rotate", + "vivecraft.key.freeMoveStrafe": "Move/Strafe", + "vivecraft.key.toggleMovement": "Toggle Movement Mode", + "vivecraft.key.quickTorch": "Quick Torch", + "vivecraft.key.ingameMenuButton": "Game Menu", + "vivecraft.key.exportWorld": "Export Menu World", + "vivecraft.key.radialMenu": "Open Radial Menu", + "vivecraft.key.swapMirrorView": "Swap Mirror View", + "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", + "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", + "vivecraft.key.togglePlayerList": "Toggle Player List", + "vivecraft.key.toggleHandheldCam": "Toggle Camera", + "vivecraft.key.quickHandheldCam": "Quick Camera", + "vivecraft.key.trackpadTouch": "Trackpad Touch", + "vivecraft.key.vrInteract": "Contextual Interact", + "vivecraft.key.guiLeftClick": "Left Click", + "vivecraft.key.guiRightClick": "Right Click", + "vivecraft.key.guiMiddleClick": "Middle Click", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Scroll Up", + "vivecraft.key.guiScrollDown": "Scroll Down", + "vivecraft.key.guiScrollAxis": "Scroll", + "vivecraft.key.keyboardClick": "Click", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Climb Claws", + "vivecraft.key.climbeyJump": "Jump Boots", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "Climbey Motion", + "vivecraft.key.category.keyboard": "Keyboard", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "In-Game", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "Modded", + "vivecraft.actionset.contextual": "Contextual", + "vivecraft.actionset.keyboard": "Keyboard", + "vivecraft.actionset.mixedReality": "Mixed Reality", + "vivecraft.actionset.technical": "Technical", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "VR Settings", + "vivecraft.options.screen.freemove": "Free Move Settings", + "vivecraft.options.screen.gui": "HUD and GUI Settings", + "vivecraft.options.screen.menuworld": "Menu World Settings", + "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", + "vivecraft.options.screen.quickcommands": "Quick Commands", + "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", + "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", + "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", + "vivecraft.options.screen.seated": "Seated Settings", + "vivecraft.options.screen.standing": "Standing Locomotion Settings", + "vivecraft.options.screen.teleport": "Teleport Settings", + "vivecraft.options.screen.controls": "Controller Settings", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR Settings...", + "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", + "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", + "vivecraft.options.screen.quickcommands.button": "Quick Commands...", + "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", + "vivecraft.options.screen.standing.button": "Locomotion Settings...", + "vivecraft.options.screen.roomscale.button": "Interaction Settings...", + "vivecraft.options.screen.controls.button": "Controller Settings...", + "vivecraft.options.screen.radialmenu.button": "Radial Menu...", + "vivecraft.options.screen.seated.button": "Seated Settings...", + "vivecraft.options.screen.menuworld.button": "Menu World Settings...", + "vivecraft.options.screen.teleport.button": "Teleport Settings...", + "vivecraft.options.screen.freemove.button": "Free Move Settings...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Head HUD Size", + "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", + "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", + "vivecraft.options.HUD_OPACITY": "HUD Opacity", + "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", + "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", + "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", + "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", + "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", + "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", + "vivecraft.options.FSAA": "Lanczos Scaler", + "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", + "vivecraft.options.MIRROR_EYE": "Mirror Eye", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Colour", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", + "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", + "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", + "vivecraft.options.INERTIA_FACTOR": "Player Inertia", + "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", + "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", + "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", + "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", + "vivecraft.options.REVERSE_HANDS": "Reverse Hands", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Use Eye Stencil", + "vivecraft.options.BCB_ON": "Show Body Position", + "vivecraft.options.WORLD_SCALE": "World Scale", + "vivecraft.options.WORLD_ROTATION": "World Rotation", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", + "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar Enabled", + "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", + "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", + "vivecraft.options.MONO_FOV": "Undistorted FOV", + "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", + "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", + "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", + "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", + "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", + "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", + "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", + "vivecraft.options.FREEMOVE_MODE": "Free Move Type", + "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", + "vivecraft.options.RESET_ORIGIN": "Reset Origin", + "vivecraft.options.X_SENSITIVITY": "Rotation Speed", + "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", + "vivecraft.options.KEYHOLE": "Keyhole", + "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", + "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", + "vivecraft.options.SEATED_HMD": "Forward Direction", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", + "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", + "vivecraft.options.ANALOG_MOVEMENT": "Analogue Movement", + "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", + "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", + "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", + "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", + "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", + "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", + "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", + "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in metres (though isn't obstructed by blocks).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", + "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behaviour of the radial menu when pressing the button.\nHold: Hold radial menu button, hover over selection and release.\nPress: Press radial menu button, click buttons, press radial menu button again to dismiss.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", + "vivecraft.options.FSAA.tooltip": "Uses a fancier method of resampling the game before sending it to the HMD. Works best at high render scales.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual hmd-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", + "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The colour drawn to the \"transparent\" areas of the mixed reality view. Other colours in-game will be prevented from matching this so it doesn't cause weirdness.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a grayscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key colour for use with colour key effect.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under block.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", + "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", + "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "If enabled allow you to touch the hotbar with your main hand to select an item.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", + "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3d interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Re-centre the player's feet in the world to 1.62m below the current HMD position. For non-absolute tracking systems or seated play.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", + "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of centre where the view will begin to rotate.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the centre of the FOV reduction for non-standard HMDs.", + "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analogue control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", + "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit the number of blocks you can teleport below you.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit the number of blocks you can teleport above you.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit the number of blocks you can teleport sideways you.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Colour scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", + "vivecraft.options.yes": "YES", + "vivecraft.options.no": "NO", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Default", + "vivecraft.options.opaque": "Opaque", + "vivecraft.options.mirrormode.off": "OFF (fast)", + "vivecraft.options.mirrormode.dual": "Dual (fast)", + "vivecraft.options.mirrormode.single": "Single (fast)", + "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", + "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", + "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", + "vivecraft.options.mirrormode.cropped": "Cropped (fast)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Left", + "vivecraft.options.right": "Right", + "vivecraft.options.color.black": "Black", + "vivecraft.options.color.red": "Red", + "vivecraft.options.color.yellow": "Yellow", + "vivecraft.options.color.green": "Green", + "vivecraft.options.color.cyan": "Cyan", + "vivecraft.options.color.blue": "Blue", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Side-by-Side", + "vivecraft.options.hudlock.hand": "Hand", + "vivecraft.options.hudlock.head": "Head", + "vivecraft.options.hudlock.wrist": "Wrist", + "vivecraft.options.renderpointerelement.always": "Always", + "vivecraft.options.renderpointerelement.withhud": "With HUD", + "vivecraft.options.renderpointerelement.never": "Never", + "vivecraft.options.chatnotifications.none": "None", + "vivecraft.options.chatnotifications.haptic": "Haptic", + "vivecraft.options.chatnotifications.sound": "Sound", + "vivecraft.options.chatnotifications.both": "Both", + "vivecraft.options.always": "Always", + "vivecraft.options.seated": "Seated", + "vivecraft.options.standing": "Standing", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normal", + "vivecraft.options.inertiafactor.large": "A Lot", + "vivecraft.options.inertiafactor.massive": "Even More", + "vivecraft.options.smooth": "Smooth", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Crosshair", + "vivecraft.options.freemove.controller": "Controller", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Run-In-Place", + "vivecraft.options.freemove.room": "Room", + "vivecraft.options.hold": "Hold", + "vivecraft.options.press": "Press", + "vivecraft.options.keyboard.physical": "Physical", + "vivecraft.options.keyboard.pointer": "Pointer", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blocks", + "vivecraft.options.teleport": "Teleport", + "vivecraft.options.freemove": "Free Move", + "vivecraft.options.menuworld.both": "Official & Custom", + "vivecraft.options.menuworld.custom": "Custom Only", + "vivecraft.options.menuworld.official": "Official Only", + "vivecraft.options.menuworld.none": "None", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Slow", + "vivecraft.options.rightclickdelay.slower": "Slower", + "vivecraft.options.rightclickdelay.slowest": "Slowest", + "vivecraft.options.keyboardtheme.default": "White", + "vivecraft.options.keyboardtheme.red": "Red", + "vivecraft.options.keyboardtheme.green": "Green", + "vivecraft.options.keyboardtheme.blue": "Blue", + "vivecraft.options.keyboardtheme.black": "Void", + "vivecraft.options.keyboardtheme.grass": "Grass Block", + "vivecraft.options.keyboardtheme.bees": "Bumblebee", + "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", + "vivecraft.options.keyboardtheme.dose": "Medicine", + "vivecraft.options.keyboardtheme.custom": "Custom", + "_comment12": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Clear", + "vivecraft.gui.loaddefaults": "Load Defaults", + "vivecraft.gui.menuworld.refresh": "Refresh Menu World", + "vivecraft.gui.menuworld.loadnew": "Load New Menu World", + "vivecraft.gui.radialmenu.mainset": "Main Set", + "vivecraft.gui.radialmenu.alternateset": "Alternate Set", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Commands", + "vivecraft.gui.overlay": "Overlay", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Screenshot", + "vivecraft.gui.calibrateheight": "Calibrate Height", + "vivecraft.gui.alignkatwalk": "Align KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Move Third Cam", + "vivecraft.gui.social": "Social", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Jump Boots", + "vivecraft.item.climbclaws": "Climb Claws", + "vivecraft.item.telescope": "Eye of the Farseer", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", + "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", + "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", + "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", + "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", + "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", + "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", + "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", + "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", + "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", + "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", + "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", + "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", + "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", + "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", + "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", + "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", + "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", + "vivecraft.messages.heightset": "User height set to %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/en_us.json b/common/src/main/resources/assets/vivecraft/lang/en_us.json index 961cf4b8c..14812fd01 100644 --- a/common/src/main/resources/assets/vivecraft/lang/en_us.json +++ b/common/src/main/resources/assets/vivecraft/lang/en_us.json @@ -1,516 +1,516 @@ { - "_comment0": "Key bindings", - "vivecraft.key.hotbarNext": "Hotbar Next", - "vivecraft.key.hotbarPrev": "Hotbar Previous", - "vivecraft.key.hotbarScroll": "Hotbar Scroll", - "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", - "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", - "vivecraft.key.rotateLeft": "Rotate Left", - "vivecraft.key.rotateRight": "Rotate Right", - "vivecraft.key.rotateAxis": "Rotate Only", - "vivecraft.key.rotateFree": "Rotate Free", - "vivecraft.key.walkabout": "Walkabout", - "vivecraft.key.teleport": "Teleport", - "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", - "vivecraft.key.freeMoveRotate": "Move/Rotate", - "vivecraft.key.freeMoveStrafe": "Move/Strafe", - "vivecraft.key.toggleMovement": "Toggle Movement Mode", - "vivecraft.key.quickTorch": "Quick Torch", - "vivecraft.key.ingameMenuButton": "Game Menu", - "vivecraft.key.exportWorld": "Export Menu World", - "vivecraft.key.radialMenu": "Open Radial Menu", - "vivecraft.key.swapMirrorView": "Swap Mirror View", - "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", - "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", - "vivecraft.key.togglePlayerList": "Toggle Player List", - "vivecraft.key.toggleHandheldCam": "Toggle Camera", - "vivecraft.key.quickHandheldCam": "Quick Camera", - "vivecraft.key.trackpadTouch": "Trackpad Touch", - "vivecraft.key.mainThumb": "Main Thumb", - "vivecraft.key.mainIndex": "Main Index", - "vivecraft.key.mainMiddle": "Main Middle", - "vivecraft.key.mainRing": "Main Ring", - "vivecraft.key.mainLittle": "Main Pinky", - "vivecraft.key.offThumb": "Off Thumb", - "vivecraft.key.offIndex": "Off Index", - "vivecraft.key.offMiddle": "Off Middle", - "vivecraft.key.offRing": "Off Ring", - "vivecraft.key.offLittle": "Off Pinky", - "vivecraft.key.vrInteract": "Contextual Interact", - "vivecraft.key.guiLeftClick": "Left Click", - "vivecraft.key.guiRightClick": "Right Click", - "vivecraft.key.guiMiddleClick": "Middle Click", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Scroll Up", - "vivecraft.key.guiScrollDown": "Scroll Down", - "vivecraft.key.guiScrollAxis": "Scroll", - "vivecraft.key.keyboardClick": "Click", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Climb Claws", - "vivecraft.key.climbeyJump": "Jump Boots", - "_comment1": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "Climbey Motion", - "vivecraft.key.category.keyboard": "Keyboard", - "_comment2": "Action set names", - "vivecraft.actionset.ingame": "In-Game", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "Modded", - "vivecraft.actionset.contextual": "Contextual", - "vivecraft.actionset.keyboard": "Keyboard", - "vivecraft.actionset.mixedReality": "Mixed Reality", - "vivecraft.actionset.technical": "Technical", - "_comment3": "Option screens", - "vivecraft.options.screen.main": "VR Settings", - "vivecraft.options.screen.freemove": "Free Move Settings", - "vivecraft.options.screen.gui": "HUD and GUI Settings", - "vivecraft.options.screen.menuworld": "Menu World Settings", - "vivecraft.options.screen.touch_hotbar": "Touch Hotbar Settings", - "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", - "vivecraft.options.screen.quickcommands": "Quick Commands", - "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", - "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", - "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", - "vivecraft.options.screen.seated": "Seated Settings", - "vivecraft.options.screen.standing": "Standing Locomotion Settings", - "vivecraft.options.screen.teleport": "Teleport Settings", - "vivecraft.options.screen.controls": "Controller Settings", - "vivecraft.options.screen.controls.skeletal_input": "Gesture Settings", - "vivecraft.options.screen.controls.skeletal_input.finger_displays": "Finger Displays", - "_comment4": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR Settings...", - "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", - "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", - "vivecraft.options.screen.quickcommands.button": "Quick Commands...", - "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", - "vivecraft.options.screen.standing.button": "Locomotion Settings...", - "vivecraft.options.screen.roomscale.button": "Interaction Settings...", - "vivecraft.options.screen.controls.button": "Controller Settings...", - "vivecraft.options.screen.controls.skeletal_input.button": "Gesture Settings...", - "vivecraft.options.screen.controls.skeletal_input.finger_displays.button": "Finger Displays...", - "vivecraft.options.screen.radialmenu.button": "Radial Menu...", - "vivecraft.options.screen.seated.button": "Seated Settings...", - "vivecraft.options.screen.menuworld.button": "Menu World Settings...", - "vivecraft.options.screen.touch_hotbar.button": "Touch Hotbar Settings...", - "vivecraft.options.screen.teleport.button": "Teleport Settings...", - "vivecraft.options.screen.freemove.button": "Free Move Settings...", - "_comment5": "Option names", - "vivecraft.options.HUD_SCALE": "Head HUD Size", - "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", - "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", - "vivecraft.options.HUD_OPACITY": "HUD Opacity", - "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", - "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", - "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", - "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", - "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", - "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", - "vivecraft.options.FSAA": "Lanczos Scaler", - "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", - "vivecraft.options.MIRROR_EYE": "Mirror Eye", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Color", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", - "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", - "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", - "vivecraft.options.INERTIA_FACTOR": "Player Inertia", - "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", - "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", - "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", - "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", - "vivecraft.options.REVERSE_HANDS": "Reverse Hands", - "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS": "Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Use Eye Stencil", - "vivecraft.options.BCB_ON": "Show Body Position", - "vivecraft.options.WORLD_SCALE": "World Scale", - "vivecraft.options.WORLD_ROTATION": "World Rotation", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", - "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar", - "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", - "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", - "vivecraft.options.MONO_FOV": "Undistorted FOV", - "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", - "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", - "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", - "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", - "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", - "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", - "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", - "vivecraft.options.FREEMOVE_MODE": "Free Move Type", - "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", - "vivecraft.options.RESET_ORIGIN": "Reset Origin", - "vivecraft.options.X_SENSITIVITY": "Rotation Speed", - "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", - "vivecraft.options.KEYHOLE": "Keyhole", - "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", - "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", - "vivecraft.options.SEATED_HMD": "Forward Direction", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", - "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", - "vivecraft.options.ANALOG_MOVEMENT": "Analog Movement", - "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", - "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", - "vivecraft.options.SKELETAL_INPUT": "Skeletal Input", - "vivecraft.options.FINGER_COUNT": "Finger Count", - "vivecraft.options.FINGER_VIEW": "Finger View", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", - "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", - "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", - "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", - "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", - "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", - "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", - "_comment6": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in meters (though isn't obstructed by blocks).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", - "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behavior of the radial menu when pressing the button.\n Hold: Hold radial menu button, hover over selection and release.\n Press: Press radial menu button, click buttons, press radial menu button again to dismiss.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", - "vivecraft.options.FSAA.tooltip": "Uses a fancier method of resampling the game before sending it to the HMD. Works best at high render scales.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual hmd-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", - "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The color drawn to the \"transparent\" areas of the mixed reality view. Other colors in-game will be prevented from matching this so it doesn't cause weirdness.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a grayscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key color for use with color key effect.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under block.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will be have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", - "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip": "Determines how held items are transformed.\n ON: Use thirdperson transforms unmodified\n OFF: Use firstperson transforms customized\n\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", - "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", - "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Allows you to touch the hotbar with your hand opposite the HUD to select an item.", - "vivecraft.options.TOUCH_HOTBAR_COLOR_R.tooltip": "Changes the red color channel of the hotbar slot selection indicator.", - "vivecraft.options.TOUCH_HOTBAR_COLOR_G.tooltip": "Changes the green color channel of the hotbar slot selection indicator.", - "vivecraft.options.TOUCH_HOTBAR_COLOR_B.tooltip": "Changes the blue color channel of the hotbar slot selection indicator.", - "vivecraft.options.TOUCH_HOTBAR_COLOR_A.tooltip": "Changes the opacity of the hotbar slot selection indicator.", - "vivecraft.options.TOUCH_OFFBAR_COLOR_R.tooltip": "Changes the red color channel of the Off Hand slot selection indicator.", - "vivecraft.options.TOUCH_OFFBAR_COLOR_G.tooltip": "Changes the green color channel of the Off Hand slot selection indicator.", - "vivecraft.options.TOUCH_OFFBAR_COLOR_B.tooltip": "Changes the blue color channel of the Off Hand slot selection indicator.", - "vivecraft.options.TOUCH_OFFBAR_COLOR_A.tooltip": "Changes the opacity of the Off Hand slot selection indicator.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", - "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3d interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Recenter the player's feet in the world to 1.62m below the current HMD position. For non-absolute tracking systems or seated play.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", - "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of center where the view will begin to rotate.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the center of the FOV reduction for non-standard HMDs.", - "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analog control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", - "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", - "vivecraft.options.SKELETAL_INPUT.tooltip": "Enable or disable Skeletal Input\n OFF: Finger gestures ignored.\n ON: Finger gestures detected.\n\n This setting doesn't affect the VR arm position or inputs.\n%s", - "vivecraft.options.SKELETAL_INPUT.tooltip.controller": "\n%s controller tracking: %s", - "vivecraft.options.SKELETAL_INPUT.tooltip.0": "Estimated Skeletal Tracking\nYour controller reported the lowest accuracy tracking.\n The controller likely lacks dedicated gesture sensors\n and may provide poor gesture controls.", - "vivecraft.options.SKELETAL_INPUT.tooltip.1": "Partial Skeletal Tracking\nYour controller reported the minimum recommended tracking.\n The controller likely has dedicated gesture sensors\n to provide accurate gesture controls.", - "vivecraft.options.SKELETAL_INPUT.tooltip.2": "Full Skeletal Tracking\nYour controller reported the highest accuracy tracking.\n The controller likely has dedicated sensors for each joint\n to provide the most accurate gesture controls.", - "vivecraft.options.SKELETAL_INPUT.tooltip.unknown": "Unknown Skeletal Tracking\nYour controller reported an unknown tracking level.\nPlease record and report the following tracking level:\n%d", - "vivecraft.options.SKELETAL_INPUT.tooltip.unsupported": "Unsupported VR System\n Skeletal Input has only been tested on OpenVR.", - "vivecraft.options.SKELETAL_INPUT.tooltip.nonvr": "VR is Disabled!\n The Skeletal Tracking Level of your hardware\n may be presented here\n only when VR is active!", - "vivecraft.options.MAIN_THUMB_THRESHOLD.tooltip": "The Main Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.MAIN_INDEX_THRESHOLD.tooltip": "The Main Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.MAIN_MIDDLE_THRESHOLD.tooltip": "The Main Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.MAIN_RING_THRESHOLD.tooltip": "The Main Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", - "vivecraft.options.MAIN_LITTLE_THRESHOLD.tooltip": "The Main Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.OFF_THUMB_THRESHOLD.tooltip": "The Off Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.OFF_INDEX_THRESHOLD.tooltip": "The Off Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.OFF_MIDDLE_THRESHOLD.tooltip": "The Off Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.OFF_RING_THRESHOLD.tooltip": "The Off Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", - "vivecraft.options.OFF_LITTLE_THRESHOLD.tooltip": "The Off Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", - "vivecraft.options.MAIN_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Thumb.\n Default: 5", - "vivecraft.options.MAIN_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Index finger.\n Default: 4", - "vivecraft.options.MAIN_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Middle finger.\n Default: 3", - "vivecraft.options.MAIN_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Ring finger.\n Default: 2", - "vivecraft.options.MAIN_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Pinky finger.\n Default: 1", - "vivecraft.options.OFF_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Thumb.\n Default: 6", - "vivecraft.options.OFF_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Index finger.\n Default: 7", - "vivecraft.options.OFF_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Middle finger.\n Default: 8", - "vivecraft.options.OFF_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Ring finger.\n Default: 9", - "vivecraft.options.OFF_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Pinky finger.\n Default: Off Hand", - "vivecraft.options.FINGER_COUNT.extension": "Extension", - "vivecraft.options.FINGER_COUNT.curl": "Curl", - "vivecraft.options.FINGER_COUNT.tooltip": " Extension: Count the fingers above the extension threshold.\n Curl: Count the fingers below the extension threshold.", - "vivecraft.options.FINGER_VIEW.tooltip": "Render finger indicators on the player hand.\n When Skeletal Input is OFF, a static hand gesture will be used.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit the number of blocks you can teleport below you.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit the number of blocks you can teleport above you.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit the number of blocks you can teleport sideways you.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Color scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", - "_comment7": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", - "vivecraft.options.yes": "YES", - "vivecraft.options.no": "NO", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Default", - "vivecraft.options.opaque": "Opaque", - "vivecraft.options.mirrormode.off": "OFF (fast)", - "vivecraft.options.mirrormode.dual": "Dual (fast)", - "vivecraft.options.mirrormode.single": "Single (fast)", - "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", - "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", - "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", - "vivecraft.options.mirrormode.cropped": "Cropped (fast)", - "vivecraft.options.mirrormode.gui": "2D GUI", - "vivecraft.options.left": "Left", - "vivecraft.options.right": "Right", - "vivecraft.options.color.black": "Black", - "vivecraft.options.color.red": "Red", - "vivecraft.options.color.yellow": "Yellow", - "vivecraft.options.color.green": "Green", - "vivecraft.options.color.cyan": "Cyan", - "vivecraft.options.color.blue": "Blue", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Side-by-Side", - "vivecraft.options.hudlock.hand": "Hand", - "vivecraft.options.hudlock.head": "Head", - "vivecraft.options.hudlock.wrist": "Wrist", - "vivecraft.options.PLAYER_STATUS": "Player Status", - "vivecraft.options.playerstatus.none": "None", - "vivecraft.options.playerstatus.entity": "Entity", - "vivecraft.options.playerstatus.icon": "Icon", - "vivecraft.options.playerstatus.both": "Both", - "vivecraft.options.ENTITY_STATUS": "Entity Status", - "vivecraft.options.entitystatus.always": "Always", - "vivecraft.options.entitystatus.sometimes": "Not Walking", - "vivecraft.options.renderpointerelement.always": "Always", - "vivecraft.options.renderpointerelement.withhud": "With HUD", - "vivecraft.options.renderpointerelement.never": "Never", - "vivecraft.options.chatnotifications.none": "None", - "vivecraft.options.chatnotifications.haptic": "Haptic", - "vivecraft.options.chatnotifications.sound": "Sound", - "vivecraft.options.chatnotifications.both": "Both", - "vivecraft.options.always": "Always", - "vivecraft.options.seated": "Seated", - "vivecraft.options.standing": "Standing", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normal", - "vivecraft.options.inertiafactor.large": "A Lot", - "vivecraft.options.inertiafactor.massive": "Even More", - "vivecraft.options.smooth": "Smooth", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Crosshair", - "vivecraft.options.freemove.controller": "Controller", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Run-In-Place", - "vivecraft.options.freemove.room": "Room", - "vivecraft.options.hold": "Hold", - "vivecraft.options.press": "Press", - "vivecraft.options.keyboard.physical": "Physical", - "vivecraft.options.keyboard.pointer": "Pointer", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blocks", - "vivecraft.options.offhand": "Off Hand", - "vivecraft.options.teleport": "Teleport", - "vivecraft.options.teleport.style": "Teleport style (RCTRL-M): %s", - "vivecraft.options.teleport.style.unknown": "Unknown teleport style requested: %s", - "vivecraft.options.freemove": "Free Move", - "vivecraft.options.menuworld.both": "Official & Custom", - "vivecraft.options.menuworld.custom": "Custom Only", - "vivecraft.options.menuworld.official": "Official Only", - "vivecraft.options.menuworld.none": "None", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Slow", - "vivecraft.options.rightclickdelay.slower": "Slower", - "vivecraft.options.rightclickdelay.slowest": "Slowest", - "vivecraft.options.keyboardtheme.default": "White", - "vivecraft.options.keyboardtheme.red": "Red", - "vivecraft.options.keyboardtheme.green": "Green", - "vivecraft.options.keyboardtheme.blue": "Blue", - "vivecraft.options.keyboardtheme.black": "Void", - "vivecraft.options.keyboardtheme.grass": "Grass Block", - "vivecraft.options.keyboardtheme.bees": "Bumblebee", - "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", - "vivecraft.options.keyboardtheme.dose": "Medicine", - "vivecraft.options.keyboardtheme.custom": "Custom", - "_comment8": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Clear", - "vivecraft.gui.loaddefaults": "Load Defaults", - "vivecraft.gui.menuworld.refresh": "Refresh Menu World", - "vivecraft.gui.menuworld.loadnew": "Load New Menu World", - "vivecraft.gui.radialmenu.mainset": "Main Set", - "vivecraft.gui.radialmenu.alternateset": "Alternate Set", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Commands", - "vivecraft.gui.overlay": "Overlay", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Screenshot", - "vivecraft.gui.calibrateheight": "Calibrate Height", - "vivecraft.gui.alignkatwalk": "Align KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Move Third Cam", - "vivecraft.gui.social": "Social", - "_comment9": "Items", - "vivecraft.item.jumpboots": "Jump Boots", - "vivecraft.item.climbclaws": "Climb Claws", - "vivecraft.item.telescope": "Eye of the Farseer", - "_comment10": "Messages", - "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", - "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", - "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", - "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", - "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", - "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", - "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", - "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", - "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", - "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", - "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", - "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", - "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", - "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", - "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", - "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", - "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", - "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", - "vivecraft.messages.heightset": "User height set to %d%%", + "_comment0": "Key bindings", + "vivecraft.key.hotbarNext": "Hotbar Next", + "vivecraft.key.hotbarPrev": "Hotbar Previous", + "vivecraft.key.hotbarScroll": "Hotbar Scroll", + "vivecraft.key.hotbarSwipeX": "Hotbar Swipe (Left/Right)", + "vivecraft.key.hotbarSwipeY": "Hotbar Swipe (Up/Down)", + "vivecraft.key.rotateLeft": "Rotate Left", + "vivecraft.key.rotateRight": "Rotate Right", + "vivecraft.key.rotateAxis": "Rotate Only", + "vivecraft.key.rotateFree": "Rotate Free", + "vivecraft.key.walkabout": "Walkabout", + "vivecraft.key.teleport": "Teleport", + "vivecraft.key.teleportFallback": "Walk Forwards When Teleport Disabled", + "vivecraft.key.freeMoveRotate": "Move/Rotate", + "vivecraft.key.freeMoveStrafe": "Move/Strafe", + "vivecraft.key.toggleMovement": "Toggle Movement Mode", + "vivecraft.key.quickTorch": "Quick Torch", + "vivecraft.key.ingameMenuButton": "Game Menu", + "vivecraft.key.exportWorld": "Export Menu World", + "vivecraft.key.radialMenu": "Open Radial Menu", + "vivecraft.key.swapMirrorView": "Swap Mirror View", + "vivecraft.key.toggleKeyboard": "Show/Hide Keyboard", + "vivecraft.key.moveThirdPersonCam": "Move Third Person Camera", + "vivecraft.key.togglePlayerList": "Toggle Player List", + "vivecraft.key.toggleHandheldCam": "Toggle Camera", + "vivecraft.key.quickHandheldCam": "Quick Camera", + "vivecraft.key.trackpadTouch": "Trackpad Touch", + "vivecraft.key.mainThumb": "Main Thumb", + "vivecraft.key.mainIndex": "Main Index", + "vivecraft.key.mainMiddle": "Main Middle", + "vivecraft.key.mainRing": "Main Ring", + "vivecraft.key.mainLittle": "Main Pinky", + "vivecraft.key.offThumb": "Off Thumb", + "vivecraft.key.offIndex": "Off Index", + "vivecraft.key.offMiddle": "Off Middle", + "vivecraft.key.offRing": "Off Ring", + "vivecraft.key.offLittle": "Off Pinky", + "vivecraft.key.vrInteract": "Contextual Interact", + "vivecraft.key.guiLeftClick": "Left Click", + "vivecraft.key.guiRightClick": "Right Click", + "vivecraft.key.guiMiddleClick": "Middle Click", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Scroll Up", + "vivecraft.key.guiScrollDown": "Scroll Down", + "vivecraft.key.guiScrollAxis": "Scroll", + "vivecraft.key.keyboardClick": "Click", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Climb Claws", + "vivecraft.key.climbeyJump": "Jump Boots", + "_comment1": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "Climbey Motion", + "vivecraft.key.category.keyboard": "Keyboard", + "_comment2": "Action set names", + "vivecraft.actionset.ingame": "In-Game", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "Modded", + "vivecraft.actionset.contextual": "Contextual", + "vivecraft.actionset.keyboard": "Keyboard", + "vivecraft.actionset.mixedReality": "Mixed Reality", + "vivecraft.actionset.technical": "Technical", + "_comment3": "Option screens", + "vivecraft.options.screen.main": "VR Settings", + "vivecraft.options.screen.freemove": "Free Move Settings", + "vivecraft.options.screen.gui": "HUD and GUI Settings", + "vivecraft.options.screen.menuworld": "Menu World Settings", + "vivecraft.options.screen.touch_hotbar": "Touch Hotbar Settings", + "vivecraft.options.screen.guiother": "Chat/Crosshair Settings", + "vivecraft.options.screen.quickcommands": "Quick Commands", + "vivecraft.options.screen.radialmenu": "Radial Menu Configuration", + "vivecraft.options.screen.stereorendering": "Stereo Renderer Settings", + "vivecraft.options.screen.roomscale": "Roomscale Interactions Settings", + "vivecraft.options.screen.seated": "Seated Settings", + "vivecraft.options.screen.standing": "Standing Locomotion Settings", + "vivecraft.options.screen.teleport": "Teleport Settings", + "vivecraft.options.screen.controls": "Controller Settings", + "vivecraft.options.screen.controls.skeletal_input": "Gesture Settings", + "vivecraft.options.screen.controls.skeletal_input.finger_displays": "Finger Displays", + "_comment4": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR Settings...", + "vivecraft.options.screen.gui.button": "HUD and GUI Settings...", + "vivecraft.options.screen.stereorendering.button": "Stereo Rendering...", + "vivecraft.options.screen.quickcommands.button": "Quick Commands...", + "vivecraft.options.screen.guiother.button": "Chat & Crosshair Settings...", + "vivecraft.options.screen.standing.button": "Locomotion Settings...", + "vivecraft.options.screen.roomscale.button": "Interaction Settings...", + "vivecraft.options.screen.controls.button": "Controller Settings...", + "vivecraft.options.screen.controls.skeletal_input.button": "Gesture Settings...", + "vivecraft.options.screen.controls.skeletal_input.finger_displays.button": "Finger Displays...", + "vivecraft.options.screen.radialmenu.button": "Radial Menu...", + "vivecraft.options.screen.seated.button": "Seated Settings...", + "vivecraft.options.screen.menuworld.button": "Menu World Settings...", + "vivecraft.options.screen.touch_hotbar.button": "Touch Hotbar Settings...", + "vivecraft.options.screen.teleport.button": "Teleport Settings...", + "vivecraft.options.screen.freemove.button": "Free Move Settings...", + "_comment5": "Option names", + "vivecraft.options.HUD_SCALE": "Head HUD Size", + "vivecraft.options.HUD_DISTANCE": "Head HUD Distance", + "vivecraft.options.HUD_LOCK_TO": "HUD Orientation Lock", + "vivecraft.options.HUD_OPACITY": "HUD Opacity", + "vivecraft.options.HUD_HIDE": "Hide HUD (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Background", + "vivecraft.options.HUD_OCCLUSION": "HUD Occlusion", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Main Menu Follow", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusion", + "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Size", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Size", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Show Crosshair", + "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Notifications", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Notification Sound", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Scaling", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Show Block Outline", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Always Open Keyboard", + "vivecraft.options.RADIAL_MODE_HOLD": "Radial Menu Mode", + "vivecraft.options.PHYSICAL_KEYBOARD": "Keyboard Type", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Keyboard Size", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Appear Over Block", + "vivecraft.options.FSAA": "Lanczos Scaler", + "vivecraft.options.MIRROR_DISPLAY": "Desktop Mirror", + "vivecraft.options.MIRROR_EYE": "Mirror Eye", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Key Color", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Show Hands", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Layout", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Undistorted Pass", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alpha Mask", + "vivecraft.options.MIXED_REALITY_FOV": "Third Person FOV", + "vivecraft.options.WALK_UP_BLOCKS": "Walk Up Blocks", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Move. Speed Multiplier", + "vivecraft.options.INERTIA_FACTOR": "Player Inertia", + "vivecraft.options.SIMULATE_FALLING": "Simulate Falling", + "vivecraft.options.WEAPON_COLLISION": "Weapon Collision", + "vivecraft.options.ALLOW_CRAWLING": "Roomscale Crawling", + "vivecraft.options.LIMIT_TELEPORT": "Limit in Survival", + "vivecraft.options.REVERSE_HANDS": "Reverse Hands", + "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS": "Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Use Eye Stencil", + "vivecraft.options.BCB_ON": "Show Body Position", + "vivecraft.options.WORLD_SCALE": "World Scale", + "vivecraft.options.WORLD_ROTATION": "World Rotation", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotation Increment", + "vivecraft.options.TOUCH_HOTBAR": "Touch Hotbar", + "vivecraft.options.PLAY_MODE_SEATED": "Play Mode", + "vivecraft.options.RENDER_SCALEFACTOR": "Resolution", + "vivecraft.options.MONO_FOV": "Undistorted FOV", + "vivecraft.options.REALISTIC_JUMP": "Roomscale Jumping", + "vivecraft.options.REALISTIC_SNEAK": "Roomscale Sneaking", + "vivecraft.options.PHYSICAL_GUI": "Physical GUIs", + "vivecraft.options.REALISTIC_CLIMB": "Roomscale Climbing", + "vivecraft.options.REALISTIC_SWIM": "Roomscale Swimming", + "vivecraft.options.REALISTIC_ROW": "Roomscale Rowing", + "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", + "vivecraft.options.FREEMOVE_MODE": "Free Move Type", + "vivecraft.options.VEHICLE_ROTATION": "Vehicle Rotation", + "vivecraft.options.RESET_ORIGIN": "Reset Origin", + "vivecraft.options.X_SENSITIVITY": "Rotation Speed", + "vivecraft.options.Y_SENSITIVITY": "Y Sensitivity", + "vivecraft.options.KEYHOLE": "Keyhole", + "vivecraft.options.FOV_REDUCTION": "FOV Comfort Reduction", + "vivecraft.options.FOV_REDUCTION_MIN": "FOV Reduction Size", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reduction Offset", + "vivecraft.options.SEATED_HMD": "Forward Direction", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD Follows", + "vivecraft.options.BACKPACK_SWITCH": "Backpack Switching", + "vivecraft.options.ANALOG_MOVEMENT": "Analog Movement", + "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprint Threshold", + "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", + "vivecraft.options.SKELETAL_INPUT": "Skeletal Input", + "vivecraft.options.FINGER_COUNT": "Finger Count", + "vivecraft.options.FINGER_VIEW": "Finger View", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", + "vivecraft.options.TELEPORT_UP_LIMIT": "Up Limit", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distance Limit", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Allow Origin Offset", + "vivecraft.options.SEATED_FREE_MOVE": "Movement Type", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Force Free Move", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Show Advanced Bindings", + "vivecraft.options.MENU_WORLD_SELECTION": "Worlds", + "vivecraft.options.HRTF_SELECTION": "Directional Audio (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Reload External Camera", + "vivecraft.options.RIGHT_CLICK_DELAY": "Right Click Repeat", + "vivecraft.options.ANIMAL_TOUCHING": "Animal Touching", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolution", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Show Camera Model", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Keyboard Theme", + "_comment6": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Relative size HUD takes up in field-of-view.\nThe units are just relative, not in degrees or a fraction of FOV or anything.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Distance the floating HUD is drawn in front of your body.\nThe relative size of the HUD is unchanged by this.\nDistance is in meters (though isn't obstructed by blocks).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Specifies which orientation the HUD is locked to.\n Hand: The HUD will appear just above your off-hand.\n Head: The HUD will always appear in your field of view straight ahead.\n Wrist: The HUD will appear on the inside of your off-hand arm. It will \"pop out\" when looked at.", + "vivecraft.options.HUD_OPACITY.tooltip": "How transparent to draw the in-game HUD and UI.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Specifies whether the in game GUI menus have a semi-transparent background or not.\n ON: Semi-transparent background on in-game menus.\n OFF: No background on in-game menus.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Specifies whether the HUD is occluded by closer objects.\n ON: The HUD will be hidden by closer objects. May be hidden completely in confined environments!\n OFF: The HUD is always visible. Stereo depth issues may be noticeable.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specifies when the main menu follows your look direction.\n Seated: The main menu will only follow in seated mode.\n Always: The main menu will always follow.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Sets the size of the in-game crosshair.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Sets the size of the menu crosshair.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Set the in-game crosshair display mode.\n Always: The crosshair is always shown even if the HUD is disabled.\n With HUD: The crosshair is only shown when the HUD is enabled.\n Never: The crosshair is never shown.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Sets what happens when you receive a chat message.\n None: Nothing!\n Haptic: Pulse on left controller.\n Sound: Plays the Chat Notification Sound.\n Both: Both haptic and sound.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Sets the chat notification sound.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determines how the crosshair changes with distance.\n ON: The crosshair will grow larger in the distance to remain the same apparent size from your viewpoint.\n OFF: The crosshair will always be the same size in the world and appear to shrink with distance.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Sets the in-game block outline display mode.\n Always: The block outline is always shown even if the HUD is disabled.\n With HUD: The block outline is only shown when the HUD is enabled.\n Never: The block outline is never shown.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "If disabled, the keyboard will only open when you click a text field, or if a text field can't lose focus.\n\nIf enabled, the keyboard will open automatically any time a text field comes into focus. Enabling this will cause it to open in unwanted situations with mods.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Behavior of the radial menu when pressing the button.\n Hold: Hold radial menu button, hover over selection and release.\n Press: Press radial menu button, click buttons, press radial menu button again to dismiss.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Which type of VR keyboard to use for typing.\n Physical: A keyboard which you can type on like a real keyboard.\n Pointer: A keyboard which you can use by pointing either controller's crosshair at and pressing buttons.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "How large the physical keyboard should be, relative to its base size.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "If enabled, the GUI for blocks (such as chests and furnaces) will be placed above the block. Otherwise, it will be at the usual position.", + "vivecraft.options.FSAA.tooltip": "Uses a fancier method of resampling the game before sending it to the HMD. Works best at high render scales.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Mirrors image on HMD to separate desktop window.\nCan be set to OFF, single or dual hmd-view, first-person undistorted, third person undistorted and mixed reality. The undistorted and mixed reality views have a performance cost.", + "vivecraft.options.MIRROR_EYE.tooltip": "Which eye to use in cropped and single modes.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "The color drawn to the \"transparent\" areas of the mixed reality view. Other colors in-game will be prevented from matching this so it doesn't cause weirdness.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Render hands on the mixed reality view. Only toggles rendering of the actual hand models, items will still be rendered.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choose between Unity-style 4-pane layout, or 2-pane side-by-side.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Include an undistorted view in 4-pane layout Requires an extra render pass. Otherwise the HMD view will be used.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity layout, if yes, will draw a grayscale alpha mask to the upper-right quadrant (like Unity) for use in masking the foreground layer. Otherwise, foreground will be drawn with key color for use with color key effect.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "The FOV used for the mixed reality mirror mode.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Allows you to set the ability to walk up blocks without having to jump. Hotkey: RCtrl+B\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\n OFF: (Default) You will have to jump up blocks.\n ON: You can walk up single blocks. May reduce locomotion induced simulator sickness for some.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Sets a movement multiplier, allowing slower movement than default. This may help reduce locomotion induced simulator sickness.\n§cWARNING: May trigger anti-cheat warnings if on a multiplayer server!!\nDefaults to standard Minecraft movement (1.0) speed.", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Sets the player's movement inertia in single player mode. Lower inertia means faster acceleration, higher inertia slower acceleration. High inertia may reduce motion sickness for some, but beware of cliff edges!\n Normal: (Default) Standard Minecraft player movement.\n Automan < Normal < A lot < Even More. Does not affect lava, water or jumping movement currently.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "If enabled the player will fall to the ground in teleport mode when standing above empty space. Also allows jumping.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Enables hitting blocks and entities in roomscale.\nAuto is on in survival and off in creative.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "If enabled the player will be able to duck under block.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "If enabled the arc teleporter will be have restrictions in survival mode. It will not be able to jump up the side of blocks, it will consume food, and it will have an energy bar that refills over time.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Swap left/right hands as dominant.\n ON: Left dominant\n OFF: Right dominant\n\nTo swap the buttons, restart the game and make sure default bindings are selected in SteamVR.", + "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip": "Determines how held items are transformed.\n ON: Use thirdperson transforms unmodified\n OFF: Use firstperson transforms customized\n\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Mask out areas of the screen outside the FOV.\nImproves performance.", + "vivecraft.options.BCB_ON.tooltip": "Shows your body position as a square shadow on the ground.\nThis is your Square Shadow Buddy™.\nDo not lose your Square Shadow Buddy.", + "vivecraft.options.WORLD_SCALE.tooltip": "Scales the player in the world.\nAbove one makes you larger\nAnd below one makes you small\nAnd the ones that mother gives you\ndon't do anything at all.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Adds extra rotation to your HMD.\nMore useful bound to a button or changed with the arrow keys.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "How many degrees to rotate when rotating the world.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Allows you to touch the hotbar with your hand opposite the HUD to select an item.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_R.tooltip": "Changes the red color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_G.tooltip": "Changes the green color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_B.tooltip": "Changes the blue color channel of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_HOTBAR_COLOR_A.tooltip": "Changes the opacity of the hotbar slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_R.tooltip": "Changes the red color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_G.tooltip": "Changes the green color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_B.tooltip": "Changes the blue color channel of the Off Hand slot selection indicator.", + "vivecraft.options.TOUCH_OFFBAR_COLOR_A.tooltip": "Changes the opacity of the Off Hand slot selection indicator.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Standing or seated play mode.\nStanding is vastly superior.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "The internal rendering scale of the game, relative to the native HMD display. Higher values improve visual quality at the cost of performance.", + "vivecraft.options.MONO_FOV.tooltip": "The FOV used for the undistorted mirror mode.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "If turned on, once you jump in real life your player will also jump. Also enables Jump Boots.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "If turned on, once you duck in real life your player will also sneak.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "If turned on, GUIs will be replaced with 3d interactable models.\nIf Backpack tracking is enabled, reaching on your back will bring out your inventory bag.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "If turned on, allow climbing ladders and vines by touching them. Also enables Climb Claws.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "If turned on, allow swimming by doing the breaststroke with the controllers.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Row, row, row your boat... by flapping your arms like mad.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplies your position in the room by a factor.\nAllows you to walk around more, but may cause motion sickness.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "The source for freemove direction.\n\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.\n Run-In-Place: Yaw is based on how controllers are swinging. Pitch is your Headset.\n Room: Yaw is relative to your VR room forward. Pitch is your Headset. This mode is best only for 180 setups.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Riding in a vehicle will rotate the world as the vehicle rotates. May be disorienting.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Recenter the player's feet in the world to 1.62m below the current HMD position. For non-absolute tracking systems or seated play.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Speed the view will rotate when pushed on the edge of the keyhole.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Vertical speed of the crosshair related to the mouse.", + "vivecraft.options.KEYHOLE.tooltip": "The number of degrees to the left and right of center where the view will begin to rotate.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Shrinks the field of view while moving. Can help with motion sickness.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "The final size of FOV reduction.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Horizontally offsets the center of the FOV reduction for non-standard HMDs.", + "vivecraft.options.SEATED_HMD.tooltip": "The direction the forward (W) key will go.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "The direction the HUD will be placed.\nHMD view direction or crosshair pointing direction.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "If turned on, reaching behind your head with the right controller will swap to the 1st hotbar slot, or back to the previous slot. Doing the same with the left controller will swap the left and right hand items.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Walking speed will be determined by the controller button axis, if the bound button has a variable axis.\n\nFor full analog control it is better to use \"Move/Strafe\" or \"Move/Rotate\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "While using freemove, sprint will automatically activate when the axis reaches the configured threshold.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "The axis threshold at which auto-sprint activates.", + "vivecraft.options.BOW_MODE.tooltip": "Sets when to use Roomscale Archery\n OFF: Never.\n Vanilla: Only for the vanilla bow, no mod items.\n ON: Always for any item that uses the \"bow\" action.", + "vivecraft.options.SKELETAL_INPUT.tooltip": "Enable or disable Skeletal Input\n OFF: Finger gestures ignored.\n ON: Finger gestures detected.\n\n This setting doesn't affect the VR arm position or inputs.\n%s", + "vivecraft.options.SKELETAL_INPUT.tooltip.controller": "\n%s controller tracking: %s", + "vivecraft.options.SKELETAL_INPUT.tooltip.0": "Estimated Skeletal Tracking\nYour controller reported the lowest accuracy tracking.\n The controller likely lacks dedicated gesture sensors\n and may provide poor gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.1": "Partial Skeletal Tracking\nYour controller reported the minimum recommended tracking.\n The controller likely has dedicated gesture sensors\n to provide accurate gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.2": "Full Skeletal Tracking\nYour controller reported the highest accuracy tracking.\n The controller likely has dedicated sensors for each joint\n to provide the most accurate gesture controls.", + "vivecraft.options.SKELETAL_INPUT.tooltip.unknown": "Unknown Skeletal Tracking\nYour controller reported an unknown tracking level.\nPlease record and report the following tracking level:\n%d", + "vivecraft.options.SKELETAL_INPUT.tooltip.unsupported": "Unsupported VR System\n Skeletal Input has only been tested on OpenVR.", + "vivecraft.options.SKELETAL_INPUT.tooltip.nonvr": "VR is Disabled!\n The Skeletal Tracking Level of your hardware\n may be presented here\n only when VR is active!", + "vivecraft.options.MAIN_THUMB_THRESHOLD.tooltip": "The Main Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_INDEX_THRESHOLD.tooltip": "The Main Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_MIDDLE_THRESHOLD.tooltip": "The Main Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_RING_THRESHOLD.tooltip": "The Main Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", + "vivecraft.options.MAIN_LITTLE_THRESHOLD.tooltip": "The Main Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_THUMB_THRESHOLD.tooltip": "The Off Hand thumb extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_INDEX_THRESHOLD.tooltip": "The Off Hand index finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_MIDDLE_THRESHOLD.tooltip": "The Off Hand middle finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.OFF_RING_THRESHOLD.tooltip": "The Off Hand ring finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 10%%: Limited extension will trigger this input.", + "vivecraft.options.OFF_LITTLE_THRESHOLD.tooltip": "The Off Hand pinky finger extension threshold.\n 0%%: Only full/hyper extension will trigger this input.\n 100%%: Any Extension will trigger this input.\n Default:\n 75%%: Mostly extended will trigger this input.", + "vivecraft.options.MAIN_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Thumb.\n Default: 5", + "vivecraft.options.MAIN_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Index finger.\n Default: 4", + "vivecraft.options.MAIN_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Middle finger.\n Default: 3", + "vivecraft.options.MAIN_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Ring finger.\n Default: 2", + "vivecraft.options.MAIN_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Main Hand Pinky finger.\n Default: 1", + "vivecraft.options.OFF_THUMB_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Thumb.\n Default: 6", + "vivecraft.options.OFF_INDEX_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Index finger.\n Default: 7", + "vivecraft.options.OFF_MIDDLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Middle finger.\n Default: 8", + "vivecraft.options.OFF_RING_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Ring finger.\n Default: 9", + "vivecraft.options.OFF_LITTLE_DISPLAY.tooltip": "The Hotbar Slot to display on the Off Hand Pinky finger.\n Default: Off Hand", + "vivecraft.options.FINGER_COUNT.extension": "Extension", + "vivecraft.options.FINGER_COUNT.curl": "Curl", + "vivecraft.options.FINGER_COUNT.tooltip": " Extension: Count the fingers above the extension threshold.\n Curl: Count the fingers below the extension threshold.", + "vivecraft.options.FINGER_VIEW.tooltip": "Render finger indicators on the player hand.\n When Skeletal Input is OFF, a static hand gesture will be used.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit the number of blocks you can teleport below you.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit the number of blocks you can teleport above you.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit the number of blocks you can teleport sideways you.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Allows the \"Reset Origin\" button to be used in standing mode, for those that wish to play physically seated while using tracked controllers.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Which locomotion mode to use in seated mode.\n\n Teleport: Press any direction to activate.\n Free Move: WASD movement like vanilla Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Forces the use of the fallback walk forwards binding (left trigger by default). For more movement options, edit the SteamVR controller bindings.\n\nNote that this disables the teleport binding.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Unhides additional SteamVR bindings for climbey, keyboard and mixed reality.\n\nRequires a restart to take effect.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Which menu worlds to load on startup.\n\nIf no custom worlds are found, official worlds will be used regardless.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF profile to use for positional 3D audio. Quality may vary by device and driver.\n\n OFF: Explicitly disable HRTF.\n Default: Use the default HRTF profile.\n Others: Use a specific HRTF profile.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Reloads the camera config from ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "The number of game ticks between \"right clicks\" while holding the button down.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "If enabled, touching a passive mob (animal) without a weapon will right-click (interact) instead of attacking.\nTurn off for Piggy Slapping, Josh.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV of the handheld screenshot camera.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolution of the handheld screenshot camera, for taking screenshots much larger than normal render resolution.\nCannot be used when shaders are enabled.\n§cWARNING: Setting this very high may melt your computer!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Show model of a video camera (only in HMD view) to represent where the mixed reality or third person camera is currently located. It can also be grabbed to move it around using the interact binding.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Color scheme preset for the physical keyboard. Custom theme can be edited via keyboardtheme.txt in the game directory. It will be reloaded every time the keyboard is opened, to allow real-time tweaking.", + "_comment7": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "I Can't See", + "vivecraft.options.yes": "YES", + "vivecraft.options.no": "NO", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Default", + "vivecraft.options.opaque": "Opaque", + "vivecraft.options.mirrormode.off": "OFF (fast)", + "vivecraft.options.mirrormode.dual": "Dual (fast)", + "vivecraft.options.mirrormode.single": "Single (fast)", + "vivecraft.options.mirrormode.firstperson": "1st Person (slow)", + "vivecraft.options.mirrormode.thirdperson": "3rd Person (slow)", + "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (slow)", + "vivecraft.options.mirrormode.cropped": "Cropped (fast)", + "vivecraft.options.mirrormode.gui": "2D GUI", + "vivecraft.options.left": "Left", + "vivecraft.options.right": "Right", + "vivecraft.options.color.black": "Black", + "vivecraft.options.color.red": "Red", + "vivecraft.options.color.yellow": "Yellow", + "vivecraft.options.color.green": "Green", + "vivecraft.options.color.cyan": "Cyan", + "vivecraft.options.color.blue": "Blue", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Side-by-Side", + "vivecraft.options.hudlock.hand": "Hand", + "vivecraft.options.hudlock.head": "Head", + "vivecraft.options.hudlock.wrist": "Wrist", + "vivecraft.options.PLAYER_STATUS": "Player Status", + "vivecraft.options.playerstatus.none": "None", + "vivecraft.options.playerstatus.entity": "Entity", + "vivecraft.options.playerstatus.icon": "Icon", + "vivecraft.options.playerstatus.both": "Both", + "vivecraft.options.ENTITY_STATUS": "Entity Status", + "vivecraft.options.entitystatus.always": "Always", + "vivecraft.options.entitystatus.sometimes": "Not Walking", + "vivecraft.options.renderpointerelement.always": "Always", + "vivecraft.options.renderpointerelement.withhud": "With HUD", + "vivecraft.options.renderpointerelement.never": "Never", + "vivecraft.options.chatnotifications.none": "None", + "vivecraft.options.chatnotifications.haptic": "Haptic", + "vivecraft.options.chatnotifications.sound": "Sound", + "vivecraft.options.chatnotifications.both": "Both", + "vivecraft.options.always": "Always", + "vivecraft.options.seated": "Seated", + "vivecraft.options.standing": "Standing", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normal", + "vivecraft.options.inertiafactor.large": "A Lot", + "vivecraft.options.inertiafactor.massive": "Even More", + "vivecraft.options.smooth": "Smooth", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Crosshair", + "vivecraft.options.freemove.controller": "Controller", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Run-In-Place", + "vivecraft.options.freemove.room": "Room", + "vivecraft.options.hold": "Hold", + "vivecraft.options.press": "Press", + "vivecraft.options.keyboard.physical": "Physical", + "vivecraft.options.keyboard.pointer": "Pointer", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blocks", + "vivecraft.options.offhand": "Off Hand", + "vivecraft.options.teleport": "Teleport", + "vivecraft.options.teleport.style": "Teleport style (RCTRL-M): %s", + "vivecraft.options.teleport.style.unknown": "Unknown teleport style requested: %s", + "vivecraft.options.freemove": "Free Move", + "vivecraft.options.menuworld.both": "Official & Custom", + "vivecraft.options.menuworld.custom": "Custom Only", + "vivecraft.options.menuworld.official": "Official Only", + "vivecraft.options.menuworld.none": "None", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Slow", + "vivecraft.options.rightclickdelay.slower": "Slower", + "vivecraft.options.rightclickdelay.slowest": "Slowest", + "vivecraft.options.keyboardtheme.default": "White", + "vivecraft.options.keyboardtheme.red": "Red", + "vivecraft.options.keyboardtheme.green": "Green", + "vivecraft.options.keyboardtheme.blue": "Blue", + "vivecraft.options.keyboardtheme.black": "Void", + "vivecraft.options.keyboardtheme.grass": "Grass Block", + "vivecraft.options.keyboardtheme.bees": "Bumblebee", + "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", + "vivecraft.options.keyboardtheme.dose": "Medicine", + "vivecraft.options.keyboardtheme.custom": "Custom", + "_comment8": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Clear", + "vivecraft.gui.loaddefaults": "Load Defaults", + "vivecraft.gui.menuworld.refresh": "Refresh Menu World", + "vivecraft.gui.menuworld.loadnew": "Load New Menu World", + "vivecraft.gui.radialmenu.mainset": "Main Set", + "vivecraft.gui.radialmenu.alternateset": "Alternate Set", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Commands", + "vivecraft.gui.overlay": "Overlay", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Screenshot", + "vivecraft.gui.calibrateheight": "Calibrate Height", + "vivecraft.gui.alignkatwalk": "Align KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Move Third Cam", + "vivecraft.gui.social": "Social", + "_comment9": "Items", + "vivecraft.item.jumpboots": "Jump Boots", + "vivecraft.item.climbclaws": "Climb Claws", + "vivecraft.item.telescope": "Eye of the Farseer", + "_comment10": "Messages", + "vivecraft.messages.seatedmode": "Switching to Seated Mode will disable controller input. Continue?", + "vivecraft.messages.radialmenubind.1": "Make sure Open Radial Menu is bound.", + "vivecraft.messages.radialmenubind.2": "Hold (Keyboard Shift) with the radial menu open to switch to this set.", + "vivecraft.messages.controls.1": "Bindings are handled by SteamVR Input.", + "vivecraft.messages.controls.2": "Go to Settings > Controllers > Manage Controller Bindings in the dashboard.", + "vivecraft.messages.controls.3": "§6Steam must be running §obefore§r§6 SteamVR is started, or bindings will not save.", + "vivecraft.messages.serverplugin": "Vivecraft server mod detected: %s", + "vivecraft.messages.noserverplugin": "Vivecraft server mod not detected. This server may not support teleporting. Restricted movement mode (fallback to free move) has been enabled.", + "vivecraft.messages.calibrateheight": "Please calibrate your height in the pause menu.", + "vivecraft.messages.rendersetupfailed": "Render setup failed: %s", + "vivecraft.messages.intelgraphics": "Intel Integrated Graphics are not supported. If this is a laptop, please force the high-performance GPU. Detected GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR runtime not detected. Did you install SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "World export complete... area size: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Saved to %s", + "vivecraft.messages.menuworldexportclientwarning": "WARNING: Saving menu world using a client world. Data may be incomplete. It is recommended to save menu worlds in singleplayer.", + "vivecraft.messages.teleportdisabled": "Restricted movement enabled (no teleporting)", + "vivecraft.messages.teleportenabled": "Restricted movement disabled (teleporting allowed)", + "vivecraft.messages.walkupblocks": "Walk up blocks (RCTRL+B): %s", + "vivecraft.messages.showaim": "Show aim (RCTRL+RSHIFT): enabled", + "vivecraft.messages.playerinertia": "Player movement inertia (LCTRL+I): %s", + "vivecraft.messages.movementmodeswitch": "Movement mode switched to: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", + "vivecraft.messages.heightset": "User height set to %d%%", - "_comment_m": "mixin version exclusive strings", - "vivecraft.options.screen.settings": "Vivecraft Settings", - "vivecraft.options.screen.server": "Vivecraft Server Settings", - "_comment_m0": "Option values", - "vivecraft.options.shaderguirender.aftershader": "After Shader", - "vivecraft.options.shaderguirender.aftertranslucent": "Translucent", - "vivecraft.options.shaderguirender.beforetranslucentsolid": "Opaque", - "vivecraft.options.freemove.auto": "Auto", - "vivecraft.options.chatserverpluginmessage.always": "Always", - "vivecraft.options.chatserverpluginmessage.serveronly": "Server Only", - "vivecraft.options.chatserverpluginmessage.never": "Never", - "vivecraft.options.once": "Once", - "vivecraft.options.disabled": "Disabled", - "vivecraft.options.editlist": "Edit List", - "vivecraft.options.addnew": "Add New", - "_comment_m5": "Option names", - "vivecraft.options.LOW_HEALTH_INDICATOR": "Health Indicator", - "vivecraft.options.SHADER_GUI_RENDER": "Shaders GUI", - "vivecraft.options.FREEMOVE_FLY_MODE": "Free Move Flying", - "vivecraft.options.SHOW_UPDATES": "Update Message", - "vivecraft.options.SHOW_PLUGIN": "Plugin Message", - "vivecraft.options.SHOW_PLUGIN_MISSING": "Plugin Missing Message", - "vivecraft.options.CHAT_MESSAGE_STENCIL": "Stencil Message", - "vivecraft.options.VR_HOTSWITCH": "Hotswitching", - "vivecraft.options.VR_TOGGLE_BUTTON_VISIBLE": "VR Toggle Button Visible", - "vivecraft.options.VR_SETTINGS_BUTTON_VISIBLE": "VR Settings Button Visible", - "vivecraft.options.VR_SETTINGS_BUTTON_POSITION": "VR Settings Button Position", - "vivecraft.options.INGAME_BINDINGS_IN_GUI": "In-Game Bindings In GUI", - "_comment_m6": "Option tooltips", - "vivecraft.options.LOW_HEALTH_INDICATOR.tooltip": "Pulses the screen red, when at low health, to indicate your current health status", - "vivecraft.options.SHADER_GUI_RENDER.tooltip": "Determines how the GUI is rendered with shaders.\n After Shader: renders the GUI without using the shader, best compatibility. (issues with PTGI HRR)\n Translucent: renders the GUI with shader and transparency. (issues with Sildurs Vibrant)\n Opaque: renders the GUI with shader and opaque", - "vivecraft.options.VR_MODE.tooltip": "change between VR/NONVR", - "vivecraft.options.FREEMOVE_FLY_MODE.tooltip": "The source for freemove direction when flying.\n\n Auto: uses the same direction as regular Freemove.\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.", - "vivecraft.options.SHOW_UPDATES.tooltip": "How often an update message should show up in chat.\n Always: Shows the update message each time a world is loaded.\n Once: Shows the update message only on the first world load after a new update is out.", - "vivecraft.options.SHOW_PLUGIN.tooltip": "When the server mod detected message should show up in chat.\n Always: Shows the message on single/multiplayer.\n Server Only: Only shows the message in multiplayer.\n Never: Never shows the message.", - "vivecraft.options.SHOW_PLUGIN_MISSING.tooltip": "How often the server mod not detected message should show up in chat.\n Always: Shows the message on server join and dimension/server change.\n Once: Only shows the message when joining a server.", - "vivecraft.options.CHAT_MESSAGE_STENCIL.tooltip": "Prints a message in chat, when another mod is detected, that also uses the stencil buffer.", - "vivecraft.options.VR_HOTSWITCH.tooltip": "Hotswitching switches to NONVR when the headset is taken off.\nIf this setting is off, the game will always be in VR mode, when VR is enabled", - "vivecraft.options.INGAME_BINDINGS_IN_GUI.tooltip": "Allows for all In-Game bindings to be used in menus, this can cause unwanted double presses.", - "_comment_m10": "Messages", - "vivecraft.messages.mode": "Mode:", - "vivecraft.messages.novrhotswitchinglegacy": "Legacy Vivecraft server mod detected. This Server does not support VR hot switching, you can only change it in the main menu.", - "vivecraft.messages.novrhotswitching": "This Server has VR hot switching disabled, you can only change it in the main menu.", - "vivecraft.messages.vrhotswitchinginfo": "VR Hotswitching enabled: Put on your headset to swtich to VR", - "vivecraft.messages.updateAvailable": "§a[Vivecraft]§r Update available: %s. click for more details.", - "vivecraft.messages.click": "Click for more details.", - "vivecraft.messages.incompatiblesettings": "Incompatible Settings", - "vivecraft.messages.optifineaa": "Optifine antialiasing is not compatible with VR. To use VR disable antialiasing and restart the game.", - "vivecraft.messages.menuworldexporterror": "World export failed with error: %s", - "vivecraft.messages.stencil": "[Vivecraft] A different mod uses the stencil buffer, if you run into weird rendering issues, try disabling the Eye Stencil in: %s\nYou can disable this message in: %s", - "vivecraft.messages.3options": "%s > %s > %s", - "vivecraft.messages.openSettings": "Click to open settings", - "vivecraft.message.kofi": "Support us on Ko-Fi", + "_comment_m": "mixin version exclusive strings", + "vivecraft.options.screen.settings": "Vivecraft Settings", + "vivecraft.options.screen.server": "Vivecraft Server Settings", + "_comment_m0": "Option values", + "vivecraft.options.shaderguirender.aftershader": "After Shader", + "vivecraft.options.shaderguirender.aftertranslucent": "Translucent", + "vivecraft.options.shaderguirender.beforetranslucentsolid": "Opaque", + "vivecraft.options.freemove.auto": "Auto", + "vivecraft.options.chatserverpluginmessage.always": "Always", + "vivecraft.options.chatserverpluginmessage.serveronly": "Server Only", + "vivecraft.options.chatserverpluginmessage.never": "Never", + "vivecraft.options.once": "Once", + "vivecraft.options.disabled": "Disabled", + "vivecraft.options.editlist": "Edit List", + "vivecraft.options.addnew": "Add New", + "_comment_m5": "Option names", + "vivecraft.options.LOW_HEALTH_INDICATOR": "Health Indicator", + "vivecraft.options.SHADER_GUI_RENDER": "Shaders GUI", + "vivecraft.options.FREEMOVE_FLY_MODE": "Free Move Flying", + "vivecraft.options.SHOW_UPDATES": "Update Message", + "vivecraft.options.SHOW_PLUGIN": "Plugin Message", + "vivecraft.options.SHOW_PLUGIN_MISSING": "Plugin Missing Message", + "vivecraft.options.CHAT_MESSAGE_STENCIL": "Stencil Message", + "vivecraft.options.VR_HOTSWITCH": "Hotswitching", + "vivecraft.options.VR_TOGGLE_BUTTON_VISIBLE": "VR Toggle Button Visible", + "vivecraft.options.VR_SETTINGS_BUTTON_VISIBLE": "VR Settings Button Visible", + "vivecraft.options.VR_SETTINGS_BUTTON_POSITION": "VR Settings Button Position", + "vivecraft.options.INGAME_BINDINGS_IN_GUI": "In-Game Bindings In GUI", + "_comment_m6": "Option tooltips", + "vivecraft.options.LOW_HEALTH_INDICATOR.tooltip": "Pulses the screen red, when at low health, to indicate your current health status", + "vivecraft.options.SHADER_GUI_RENDER.tooltip": "Determines how the GUI is rendered with shaders.\n After Shader: renders the GUI without using the shader, best compatibility. (issues with PTGI HRR)\n Translucent: renders the GUI with shader and transparency. (issues with Sildurs Vibrant)\n Opaque: renders the GUI with shader and opaque", + "vivecraft.options.VR_MODE.tooltip": "change between VR/NONVR", + "vivecraft.options.FREEMOVE_FLY_MODE.tooltip": "The source for freemove direction when flying.\n\n Auto: uses the same direction as regular Freemove.\n Controller: Offhand controller pointing direction.\n HMD: Headset look direction.", + "vivecraft.options.SHOW_UPDATES.tooltip": "How often an update message should show up in chat.\n Always: Shows the update message each time a world is loaded.\n Once: Shows the update message only on the first world load after a new update is out.", + "vivecraft.options.SHOW_PLUGIN.tooltip": "When the server mod detected message should show up in chat.\n Always: Shows the message on single/multiplayer.\n Server Only: Only shows the message in multiplayer.\n Never: Never shows the message.", + "vivecraft.options.SHOW_PLUGIN_MISSING.tooltip": "How often the server mod not detected message should show up in chat.\n Always: Shows the message on server join and dimension/server change.\n Once: Only shows the message when joining a server.", + "vivecraft.options.CHAT_MESSAGE_STENCIL.tooltip": "Prints a message in chat, when another mod is detected, that also uses the stencil buffer.", + "vivecraft.options.VR_HOTSWITCH.tooltip": "Hotswitching switches to NONVR when the headset is taken off.\nIf this setting is off, the game will always be in VR mode, when VR is enabled", + "vivecraft.options.INGAME_BINDINGS_IN_GUI.tooltip": "Allows for all In-Game bindings to be used in menus, this can cause unwanted double presses.", + "_comment_m10": "Messages", + "vivecraft.messages.mode": "Mode:", + "vivecraft.messages.novrhotswitchinglegacy": "Legacy Vivecraft server mod detected. This Server does not support VR hot switching, you can only change it in the main menu.", + "vivecraft.messages.novrhotswitching": "This Server has VR hot switching disabled, you can only change it in the main menu.", + "vivecraft.messages.vrhotswitchinginfo": "VR Hotswitching enabled: Put on your headset to swtich to VR", + "vivecraft.messages.updateAvailable": "§a[Vivecraft]§r Update available: %s. click for more details.", + "vivecraft.messages.click": "Click for more details.", + "vivecraft.messages.incompatiblesettings": "Incompatible Settings", + "vivecraft.messages.optifineaa": "Optifine antialiasing is not compatible with VR. To use VR disable antialiasing and restart the game.", + "vivecraft.messages.menuworldexporterror": "World export failed with error: %s", + "vivecraft.messages.stencil": "[Vivecraft] A different mod uses the stencil buffer, if you run into weird rendering issues, try disabling the Eye Stencil in: %s\nYou can disable this message in: %s", + "vivecraft.messages.3options": "%s > %s > %s", + "vivecraft.messages.openSettings": "Click to open settings", + "vivecraft.message.kofi": "Support us on Ko-Fi", - "vivecraft.gui.update": "§aⓘ§r Update", - "vivecraft.gui.vr": "VR: %s", + "vivecraft.gui.update": "§aⓘ§r Update", + "vivecraft.gui.vr": "VR: %s", - "vivecraft.toasts.move1": "Move with %s", - "vivecraft.toasts.move2": "Move with %s and %s", - "vivecraft.toasts.move3": "Move with %s, %s and %s", - "vivecraft.toasts.move4": "Move with %s, %s, %s and %s", - "vivecraft.toasts.point_controller": "Point with your %s", - "vivecraft.toasts.point_controller.left": "left Controller", - "vivecraft.toasts.point_controller.right": "right Controller", - "vivecraft.toasts.teleport": "Teleport with %s" + "vivecraft.toasts.move1": "Move with %s", + "vivecraft.toasts.move2": "Move with %s and %s", + "vivecraft.toasts.move3": "Move with %s, %s and %s", + "vivecraft.toasts.move4": "Move with %s, %s, %s and %s", + "vivecraft.toasts.point_controller": "Point with your %s", + "vivecraft.toasts.point_controller.left": "left Controller", + "vivecraft.toasts.point_controller.right": "right Controller", + "vivecraft.toasts.teleport": "Teleport with %s" } diff --git a/common/src/main/resources/assets/vivecraft/lang/es_es.json b/common/src/main/resources/assets/vivecraft/lang/es_es.json index 3446fd087..c6df045e7 100644 --- a/common/src/main/resources/assets/vivecraft/lang/es_es.json +++ b/common/src/main/resources/assets/vivecraft/lang/es_es.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: jlsalvador, Kyasu_Aur, Romitus, kerotan24, techroot, Vararo7, aloxo.black, Tenebrozo, EdwinAlvarez", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Barra rápida Siguiente", - "vivecraft.key.hotbarPrev": "Barra rápida Anterior", - "vivecraft.key.hotbarScroll": "Barra rápida Desplaz.", - "vivecraft.key.hotbarSwipeX": "Barra rápida Desplaz. (Izda./Dcha.)", - "vivecraft.key.hotbarSwipeY": "Barra rápida Desplaz. (Arr./Abj.)", - "vivecraft.key.rotateLeft": "Rotar Izquierda", - "vivecraft.key.rotateRight": "Rotar Derecha", - "vivecraft.key.rotateAxis": "Rotar Solamente", - "vivecraft.key.rotateFree": "Rotar Libremente", - "vivecraft.key.walkabout": "Caminar", - "vivecraft.key.teleport": "Teletransporte", - "vivecraft.key.teleportFallback": "Avanzar sin Teletransporte", - "vivecraft.key.freeMoveRotate": "Mover/Rotar", - "vivecraft.key.freeMoveStrafe": "Mover/Desplazamiento lateral", - "vivecraft.key.toggleMovement": "Alternar Modo Movimiento", - "vivecraft.key.quickTorch": "Antorcha Rápida", - "vivecraft.key.ingameMenuButton": "Menú del Juego", - "vivecraft.key.exportWorld": "Menú Para Exportar Mundos", - "vivecraft.key.radialMenu": "Abrir Menú Radial", - "vivecraft.key.swapMirrorView": "Cambiar Vista Duplicada", - "vivecraft.key.toggleKeyboard": "Mostrar/Ocultar Teclado", - "vivecraft.key.moveThirdPersonCam": "Mover cámara en tercera persona", - "vivecraft.key.togglePlayerList": "Alternar Lista de Jugadores", - "vivecraft.key.toggleHandheldCam": "Cambiar Cámara", - "vivecraft.key.quickHandheldCam": "Cámara Rápida", - "vivecraft.key.trackpadTouch": "Tocar Panel Táctil", - "vivecraft.key.vrInteract": "Interacción Contextual", - "vivecraft.key.guiLeftClick": "Clic izdo.", - "vivecraft.key.guiRightClick": "Clic dcho.", - "vivecraft.key.guiMiddleClick": "Clic central", - "vivecraft.key.guiShift": "Mayús", - "vivecraft.key.guiCtrl": "Control", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Rueda Arriba", - "vivecraft.key.guiScrollDown": "Rueda Abajo", - "vivecraft.key.guiScrollAxis": "Rueda", - "vivecraft.key.keyboardClick": "Clic", - "vivecraft.key.keyboardShift": "Mayús", - "vivecraft.key.climbeyGrab": "Garras Trepadoras", - "vivecraft.key.climbeyJump": "Botas Saltarinas", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "Interfaz", - "vivecraft.key.category.climbey": "Movimientos Acrobáticos", - "vivecraft.key.category.keyboard": "Teclado", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "En-juego", - "vivecraft.actionset.gui": "Interfaz", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "Modeado", - "vivecraft.actionset.contextual": "Contextual", - "vivecraft.actionset.keyboard": "Teclado", - "vivecraft.actionset.mixedReality": "Realidad Mixta", - "vivecraft.actionset.technical": "Técnico", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "Ajustes de VR", - "vivecraft.options.screen.freemove": "Ajustes de Movimiento Libre", - "vivecraft.options.screen.gui": "Ajustes de Barra e Interfaz", - "vivecraft.options.screen.menuworld": "Ajustes de Mundo del Menú", - "vivecraft.options.screen.guiother": "Ajustes de Chat y Mira", - "vivecraft.options.screen.quickcommands": "Ajustes de Comandos Rápidos", - "vivecraft.options.screen.radialmenu": "Ajustes de Menú Radial", - "vivecraft.options.screen.stereorendering": "Ajustes de Renderizado Estéreo", - "vivecraft.options.screen.roomscale": "Ajustes de Interacción", - "vivecraft.options.screen.seated": "Ajustes de Sentado", - "vivecraft.options.screen.standing": "Ajustes de Locomoción", - "vivecraft.options.screen.teleport": "Ajustes de Teletransporte", - "vivecraft.options.screen.controls": "Ajustes de Mandos", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR...", - "vivecraft.options.screen.gui.button": "Barra e Interfaz...", - "vivecraft.options.screen.stereorendering.button": "Renderizado Estéreo...", - "vivecraft.options.screen.quickcommands.button": "Comandos rápidos...", - "vivecraft.options.screen.guiother.button": "Chat y Mira...", - "vivecraft.options.screen.standing.button": "Locomoción...", - "vivecraft.options.screen.roomscale.button": "Interacción...", - "vivecraft.options.screen.controls.button": "Mandos...", - "vivecraft.options.screen.radialmenu.button": "Menú Radial...", - "vivecraft.options.screen.seated.button": "Sentado...", - "vivecraft.options.screen.menuworld.button": "Mundo del Menú...", - "vivecraft.options.screen.teleport.button": "Teletransporte...", - "vivecraft.options.screen.freemove.button": "Movimiento Libre...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Tamaño Barra", - "vivecraft.options.HUD_DISTANCE": "Distancia Barra", - "vivecraft.options.HUD_LOCK_TO": "Posición Barra", - "vivecraft.options.HUD_OPACITY": "Opacidad Barra", - "vivecraft.options.HUD_HIDE": "Ocultar Barra (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "Fondo Barra/Interfaz", - "vivecraft.options.HUD_OCCLUSION": "Oclusión Barra", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Seguimiento Menú", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Oclusión Mira", - "vivecraft.options.CROSSHAIR_SCALE": "Tamaño Mira En-Juego", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Tamaño Mira en Menús", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Mostrar Mira", - "vivecraft.options.CHAT_NOTIFICATIONS": "Notificación de Chat", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Sonido de Notificacion", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Escalar Mira", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Contorno Bloque", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Abrir Siempre Teclado", - "vivecraft.options.RADIAL_MODE_HOLD": "Modo Menú Radial", - "vivecraft.options.PHYSICAL_KEYBOARD": "Tipo de Teclado", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Tamaño Teclado", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Encima del Bloque", - "vivecraft.options.FSAA": "Escalado Lanczos", - "vivecraft.options.MIRROR_DISPLAY": "Escritorio", - "vivecraft.options.MIRROR_EYE": "Ojo a Duplicar", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Color Principal", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Mostrar Manos", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Distribución", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Sin distorsiones", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Máscara Transparencia", - "vivecraft.options.MIXED_REALITY_FOV": "CdV 3ª Pers.", - "vivecraft.options.WALK_UP_BLOCKS": "Auto-subir bloques", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Multiplicador Vel. Mov.", - "vivecraft.options.INERTIA_FACTOR": "Inercia del Jugador", - "vivecraft.options.SIMULATE_FALLING": "Simular Caída", - "vivecraft.options.WEAPON_COLLISION": "Colisión del Arma", - "vivecraft.options.ALLOW_CRAWLING": "Gatear en la Realidad", - "vivecraft.options.LIMIT_TELEPORT": "Limitar en Supervivencia", - "vivecraft.options.REVERSE_HANDS": "Invertir Manos", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Plantilla de Ojo", - "vivecraft.options.BCB_ON": "Mostrar Posición del Cuerpo", - "vivecraft.options.WORLD_SCALE": "Escala del Mundo", - "vivecraft.options.WORLD_ROTATION": "Rotación del Mundo", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Incrementos de Rotación", - "vivecraft.options.TOUCH_HOTBAR": "Barra rápida Táctil", - "vivecraft.options.PLAY_MODE_SEATED": "Modo de Juego", - "vivecraft.options.RENDER_SCALEFACTOR": "Resolución", - "vivecraft.options.MONO_FOV": "Camp. Visión Sin Dist.", - "vivecraft.options.REALISTIC_JUMP": "Saltar en la Realidad", - "vivecraft.options.REALISTIC_SNEAK": "Agacharse en la Realidad", - "vivecraft.options.PHYSICAL_GUI": "Interfaz Física", - "vivecraft.options.REALISTIC_CLIMB": "Trepar en la Realidad", - "vivecraft.options.REALISTIC_SWIM": "Nadar en la Realidad", - "vivecraft.options.REALISTIC_ROW": "Remar en la Realidad", - "vivecraft.options.WALK_MULTIPLIER": "Multiplicador de Andar", - "vivecraft.options.FREEMOVE_MODE": "Movimiento", - "vivecraft.options.VEHICLE_ROTATION": "Rotación Vehículos", - "vivecraft.options.RESET_ORIGIN": "Reiniciar Origen", - "vivecraft.options.X_SENSITIVITY": "Velocidad Rotación", - "vivecraft.options.Y_SENSITIVITY": "Sensibilidad Y", - "vivecraft.options.KEYHOLE": "Cerrojo", - "vivecraft.options.FOV_REDUCTION": "Visión Cómoda", - "vivecraft.options.FOV_REDUCTION_MIN": "CdV. Tamaño Reducción", - "vivecraft.options.FOV_REDUCTION_OFFSET": "CdV. Desplazamiento Reducción", - "vivecraft.options.SEATED_HMD": "Dirección de Avance", - "vivecraft.options.SEATED_HUD_XHAIR": "Seguimiento Barra", - "vivecraft.options.BACKPACK_SWITCH": "Intercambiar Mochilas", - "vivecraft.options.ANALOG_MOVEMENT": "Movimiento Analógico", - "vivecraft.options.AUTO_SPRINT": "Carrera automática", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Umbral Eje Carrera", - "vivecraft.options.BOW_MODE": "Tiro al Arco en la Realidad", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Por debajo", - "vivecraft.options.TELEPORT_UP_LIMIT": "Por encima", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distancia", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Permitir Origen Desplazado", - "vivecraft.options.SEATED_FREE_MOVE": "Movimiento", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forzar Movimiento Libre", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Mostrar Asignaciones Avdas.", - "vivecraft.options.MENU_WORLD_SELECTION": "Mundos", - "vivecraft.options.HRTF_SELECTION": "Audio direccional (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Recargar Cámara Externa", - "vivecraft.options.RIGHT_CLICK_DELAY": "Repet. Clic dcho.", - "vivecraft.options.ANIMAL_TOUCHING": "Tocar Animales", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Campo de Visión Cámara", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Resolución Cámara", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Mostrar Modelo Cámara", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Tema Teclado", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Tamaño relativo que ocupa la Barra en el campo-de-visión.\nLas unidades son relativas, ni en grados o fracciones de campo-de-visión ni nada.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Distancia a la que se dibuja la Barra flotante frente a tu cuerpo.\nEsto no modifica el tamaño relativo de la Barra.\nLa distancia se mide en metros (aunque no sea obstruida por bloques).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Especifica dónde se fijará la Barra.\n Mano: La Barra aparecerá por encima de tu mano izquierda.\n Cabeza: La Barra siempre aparecerá en línea recta a tu campo de visión.\n Muñeca: La Barra aparecerá dentro de tu mano izquierda. \"Saldrá\" cuando la mires.", - "vivecraft.options.HUD_OPACITY.tooltip": "Qué tan transparente se dibuja la Barra e Interfaz en-juego.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Especifica si los menús de la Interfaz tienen un fondo semitransparente o no.\n SÍ: Menús en-juego con fondo semitransparente.\n NO: Menús en-juego sin fondo.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Especifica si la Barra puede ser ocluida por objetos cercanos.\n SÍ: La Barra será ocultada por objetos cercanos. ¡Quizás ocultada completamente en entornos cerrados!\n NO: La Barra estará siempre visible. Puede notarse problemas con la profundidad estéreo.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Especifica cuándo el menú principal seguirá tu dirección.\n Sentado: El menú principal sólo seguirá tu dirección en el modo Sentado.\n Siempre: El menú principal siempre seguirá tu dirección.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Establece el tamaño de la mira en-juego.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Establece el tamaño de la mira en los menús.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Establece el modo de visualización de la mira en-juego.\n Siempre: La mira se mostrará siempre aunque la Barra esté desactivada.\n Con Barra: La mira sólo se mostrará cuando la Barra esté activada.\n Nunca: La mira nunca será mostrada.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Establece qué pasa cuando recibes un mensaje de chat.\n Ninguno: ¡Nada!\n Táctil: Vibración en el mando izquierdo.\n Sonido: Reproduce el sonido de notificación de chat.\n Ambos: Táctil y sonido.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Establece el sonido de notificación de chat.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determina cómo la mira cambia con la distancia.\n SÍ: La mira crecerá con la distancia para aparentar el mismo tamaño desde tu punto de vista.\n NO: La mira siempre será del mismo tamaño en el mundo y parecerá que encoje con la distancia.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Establece el modo de visualización del contorno del bloque en-juego.\n Siempre: El contorno del bloque se mostrará siempre incluso cuando la Barra esté desactivada.\n Con Barra: El contorno del bloque se mostrará sólo cuando la Barra esté activada.\n Nunca: El contorno del bloque nunca será mostrado.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Si está deshabilitado, el teclado sólo se abrirá cuando hagas clic en un campo de texto, o si este no pierde el foco.\n\nSi está habilitado, el teclado siempre se abrirá automáticamente en cualquier momento que un campo de texto reciba foco. Habilitando esto causará que se abra en situaciones no deseadas con mods.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Comportamiento del menú radial al presionar un botón.\n Mantener: Mantenga el botón de menú radial, selecciona y suelta el botón.\n Presionar: Presiona el botón de menú radial, pulsa sobre los botones, presiona de nuevo el botón de menú radial para cerrarlo.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Qué tipo de teclado VR se usará para escribir.\n Físico: Un teclado con el que puedes escribir como si fuera uno real.\n Puntero: Un teclado que puedes usar apuntando con la mira del mando y presionando botones.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Cuánto de grande debe ser el teclado físico, en relación a su tamaño base.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Si está habilitado, la Interfaz para bloques (como cofres y hornos) se mostrará por encima del bloque. De lo contrario, estará en la posición usual.", - "vivecraft.options.FSAA.tooltip": "Utiliza un método más sofisticado de super muestreo del juego antes de enviarlo al Visor. Funciona mejor en altas resoluciones.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "La imagen duplicada del Visor en la ventana de escritorio.\nPuede ser NO, vista Simple o Dual del visor, Primera Persona o Tercera Persona sin distorsiones y Realidad Mixta. La vistas sin distorsiones y mixtas tienen un coste de rendimiento.", - "vivecraft.options.MIRROR_EYE.tooltip": "Qué ojo usar en los modos entrecortado y simple.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "El color que dibujará las áreas \"transparentes\" de la vista de realidad mixta. Se evitará que otros colores del juego coincidan con este para que no cause rarezas.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Renderiza las manos en la vista de realidad mixta. Sólo alterna el renderizado del modelo de las manos actuales, los objetos se seguirán renderizando.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Elige entre una distribución de estilo Unity de 4 paneles, o 2-paneles lado-a-lado.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Incluir una vista sin distorsiones en la distribución de 4-paneles. Requiere una pasada extra de renderización. De lo contrario se usará la vista del Visor.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "En distribuciones Unity, si aplica, se dibujará en escala de grises un canal de transparencia en el cuadrante superior derecho (como en Unity) para usar como capa principal para enmascarar. De otra forma, se dibujará el primer plano con el color principal para usar con el efecto de color principal.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "El campo de visión usado en el duplicado en el modo de realidad mixta.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Te permite la habilidad de subir bloques sin tener que saltar. Tecla rápida: Control dcho.+B\n§cADVERTENCIA: ¡¡Puede causar advertencias anti-trampas si estás en un servidor multijugador!!\n NO: (Por defecto) Tendrás que saltar para subir bloques.\n SÍ: Puedes subir bloques de uno en uno. Puede reducir mareos por simulación inducidos por locomoción.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Establece un multiplicador a la velocidad de movimiento, permitiendo movimientos más lentos que por defecto. Esto puede ayudar a reducir mareos por simulación inducidos por locomoción.\n§cADVERTENCIA: ¡¡Puede causar advertencias anti-trampas si estás en un servidor multijugador!!\nPor defecto a la velocidad estándar de Minecraft (1.0).", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Establece el movimiento de inercia del jugador en modo un sólo jugador. Una baja inercia significa una aceleración rápida. Una Alta inercia puede reducir el mareo por movimiento, pero ¡cuidado con los precipicios!\n Normal: (Por defecto) Estándar de Minecraft.\n Baja < Normal < Alta < Altísima. Actualmente no afecta a movimientos por lava, agua o saltando.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Si se habilita el jugador caerá al suelo al teletransportarse a un espacio vacío. También permite saltar.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Permite golpear bloques y entidades en la Realidad.\nAutomático significa activado en supervivencia y desactivado en creativo.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Si está habilitado el jugador podrá agacharse por debajo del bloque.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "Si se habilita el arco del teletransporte tendrá restricciones en modo supervivencia. No podrá saltar por encima de bloques, consumirá alimentos, y tendrá una barra de energía que se recarga con el tiempo.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Intercambia las manos izquierda/derecha como dominante.\n SÍ: Mano izquierda dominante\n NO: Mano derecha dominante\n\nPara intercambiar los botones, reinicia el juego y asegúrate que las asignaciones por defecto están seleccionadas en SteamVR.", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Enmascara las áreas de la pantalla fuera del campo de visión.\nMejora el rendimiento.", - "vivecraft.options.BCB_ON.tooltip": "Muestra la posición de tu cuerpo como una sombra cuadrada en el suelo.\nEste es tu Compañera Sombra Cuadrada™.\nNo pierdas a tu Compañera Sombra Cuadrada.", - "vivecraft.options.WORLD_SCALE.tooltip": "Escala el jugador en el mundo.\nPor encima de uno te hace grande\nY por debajo de uno te hace pequeño\nY el uno representa tu estatura real\nsin modificar nada.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Agrega rotación adicional a tu Visor.\nEs más útil asignar un botón o cambiarlo con las teclas de dirección.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Cuántos grados girarás al girar el mundo.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Si está activada te permite tocar la barra rápida con tu mano principal para elegir un objeto.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Modo de juego De pié o Sentado.\nDe pié es bastante superior.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "La escala de renderizado interno del juego, en relación con la pantalla del Visor. Valores altos mejoran la calidad de visionado a costa del rendimiento.", - "vivecraft.options.MONO_FOV.tooltip": "El campo de visión usado para la vista duplicada sin distorsiones.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "Si se activa, al saltar en la realidad tu personaje saltará. También activa las Botas Saltarinas.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Si se activa, al agacharte en la realidad tu personaje se agachará.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Si se activa, la Interfaz será reemplazada por modelos 3d interactuables.\nSi el Seguimiento de mochila está activado, al alcanzar tu espalda se mostrará el inventario de tu mochila.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Si se activa, permite trepar escaleras y enredaderas tocándolos. También activa Garras Trepadoras.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Si se activa, permite nadar realizando brazadas con los mandos.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Rema, rema, rema tu barca... agitando los brazos como una parca.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplica tu posición en la habitación por un factor.\nTe permite andar más alrededor, pero puede causar mareo por movimiento.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "Origen de dirección del movimiento libre.\n\n Mando: Dirección donde apunte el mando.\n Visor: Dirección de tu mirada.\n Correr-Sin-Moverse: Guiñada basada en cómo se mueven los mandos. Cabeceo basado en tu Visor.\n Habitación: Guiñada relativa a avanzar en la realidad. Cabeceo basado en tu Visor. Este modo sólo es mejor para RV de 180 grados.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Viajar en un vehículo rotará el mundo con el giro del vehículo. Puede ser desorientador.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Recentra los pies del jugador en el mundo a 1,62m por debajo de la posición actual del Visor. Para sistema de posicionamiento no-absolutos o jugar sentados.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Velocidad a la que rotará la vista al alcanzar los bordes del cerrojo.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Velocidad vertical de la mira relacionada con el ratón.", - "vivecraft.options.KEYHOLE.tooltip": "El número de grados a la izquierda y derecha desde el centro donde la vista comenzará a rotar.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Encoge el campo de visión mientras te mueves. Puede aliviar el mareo por movimiento.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "El tamaño final de la reducción del campo de visión.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Desplaza horizontalmente el centro de la reducción del campo de visión para Visores no estándar.", - "vivecraft.options.SEATED_HMD.tooltip": "La dirección a la que irá la tecla de avance (W).\nLa dirección de la vista del Visor o de la mira.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "La dirección donde se mostrará la Barra.\nLa dirección de la vista del Visor o de la mira.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Si está habilitado, alcanzando con el mando derecho detrás de tu cabeza cambiará a la primera ranura de la 1ª barra rápida, o volverá a la ranura anterior. Haciendo lo mismo con el mando izquierdo intercambiará los objetos de las manos.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "La velocidad al andar será determinada por el eje del mando, si dicho mando tiene un eje con valor variable.\n\nPara un control analógico completo es mejor usar \"Mover/Desplazamiento lateral\" o \"Mover/Rotar\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "Mientras usas movimiento libre, correrás automáticamente al alcanzar el umbral configurado del eje.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "El umbral del eje que activa la carrera automática.", - "vivecraft.options.BOW_MODE.tooltip": "Establece cuándo usar Tiro al Arco en la Realidad\n NO: Nunca.\n Vanilla: Sólo para el arco vanilla, no objetos de mods.\n SÍ: Siempre para cualquier objeto que use la acción \"arquear\".", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limita la cantidad de bloques de puedes teletransportarte por debajo de ti.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limita la cantidad de bloques que puedes teletransportarte por encima de ti.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limita la cantidad de bloques que puedes teletransportarte alrededor.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Permite que el botón \"Reiniciar Origen\" sea usado en el modo sentado, para aquellos que desean jugar físicamente sentados mientras usan mandos de seguimiento.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Qué modo de locomoción se usará en el modo sentado.\n\n Teletransporte: Presiona cualquier dirección para activarlo.\n Libre: Movimientos tipo WASD de Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Fuerza el uso alternativo de la asignación de avanzar (gatillo izquierdo por defecto). Para más opciones de movimiento, edita las asignaciones de mando de SteamVR.\n\nTenga en cuenta que esto desactiva la asignación de teletransporte.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Muestra asignaciones adicionales de SteamVR para trepar, teclado y realidad mixta.\n\nRequiere un reinicio para que surta efecto.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Qué mundos para el menú principal se cagará al iniciar.\n\nSi no se encuentra mundos personalizados, se usarán independientemente mundos oficiales.", - "vivecraft.options.HRTF_SELECTION.tooltip": "Perfil de HRTF a usar para el audio 3D posicional. La calidad puede variar por dispositivo y controlador.\n\n NO: Desactiva explícitamente HRTF.\n Por defecto: Usa el perfil por defecto de HRTF.\n Otros: Usa el perfil especificado de HRTF.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Recarga la configuración de la cámara desde ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "El número de tics del juego entre \"clics derecho\" mientras se mantiene presionado el botón.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Si está habilitado, tocar un animal (mob) pasivo sin un arma interactuará (clic dcho.) en vez de atacarlo.\nDeshabilitar para abofetear cerditos.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "CdV de la cámara de fotos.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolución de la cámara de fotos, para tomar capturas de pantalla a mayor resolución de lo normal.\nNo puede ser usado con sombreados activados.\n§cATENCIÓN: ¡Valores muy altos pueden derretir tu ordenador!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Muestra el modelo de una cámara de vídeo (sólo en vista Visor) para representar dónde se encuentra la realidad mixta o cámara en tercera persona. También se puede mover alrededor agarrándola usando la interacción asociada.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Esquema de colores preestablecido para el teclado físico. El tema personalizado se puede editar vía keyboardtheme.txt en el directorio del juego. Se recargará cada vez que se abra el teclado, para permitir ajustes en tiempo real.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "No Puedo Ver", - "vivecraft.options.yes": "SÍ", - "vivecraft.options.no": "NO", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Por defecto", - "vivecraft.options.opaque": "Opaca", - "vivecraft.options.mirrormode.off": "Desactivado (ráp.)", - "vivecraft.options.mirrormode.dual": "Dual (ráp.)", - "vivecraft.options.mirrormode.single": "Simple (ráp.)", - "vivecraft.options.mirrormode.firstperson": "1ª Pers. (lento)", - "vivecraft.options.mirrormode.thirdperson": "3ª Pers. (lento)", - "vivecraft.options.mirrormode.mixedreality": "Real. Mixta (lento)", - "vivecraft.options.mirrormode.cropped": "Recortado (ráp.)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Izquierdo", - "vivecraft.options.right": "Derecho", - "vivecraft.options.color.black": "Negro", - "vivecraft.options.color.red": "Rojo", - "vivecraft.options.color.yellow": "Amarillo", - "vivecraft.options.color.green": "Verde", - "vivecraft.options.color.cyan": "Cian", - "vivecraft.options.color.blue": "Azul", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Lado a Lado", - "vivecraft.options.hudlock.hand": "Mano", - "vivecraft.options.hudlock.head": "Cabeza", - "vivecraft.options.hudlock.wrist": "Muñeca", - "vivecraft.options.renderpointerelement.always": "Siempre", - "vivecraft.options.renderpointerelement.withhud": "Con Barra", - "vivecraft.options.renderpointerelement.never": "Nunca", - "vivecraft.options.chatnotifications.none": "Ninguno", - "vivecraft.options.chatnotifications.haptic": "Táctil", - "vivecraft.options.chatnotifications.sound": "Sonido", - "vivecraft.options.chatnotifications.both": "Ambos", - "vivecraft.options.always": "Siempre", - "vivecraft.options.seated": "Sentado", - "vivecraft.options.standing": "De pié", - "vivecraft.options.inertiafactor.none": "Baja", - "vivecraft.options.inertiafactor.normal": "Normal", - "vivecraft.options.inertiafactor.large": "Alta", - "vivecraft.options.inertiafactor.massive": "Altísima", - "vivecraft.options.smooth": "Suave", - "vivecraft.options.hmd": "Visor", - "vivecraft.options.crosshair": "Mira", - "vivecraft.options.freemove.controller": "Mandos", - "vivecraft.options.freemove.hmd": "Visor", - "vivecraft.options.freemove.runinplace": "Correr-Sin-Moverse", - "vivecraft.options.freemove.room": "Habitación", - "vivecraft.options.hold": "Mantener", - "vivecraft.options.press": "Presionar", - "vivecraft.options.keyboard.physical": "Físico", - "vivecraft.options.keyboard.pointer": "Puntero", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d bloques", - "vivecraft.options.teleport": "Teletransporte", - "vivecraft.options.freemove": "Libre", - "vivecraft.options.menuworld.both": "Todos", - "vivecraft.options.menuworld.custom": "Sólo Personalizados", - "vivecraft.options.menuworld.official": "Sólo Oficial", - "vivecraft.options.menuworld.none": "Ninguno", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Lento", - "vivecraft.options.rightclickdelay.slower": "Muy lento", - "vivecraft.options.rightclickdelay.slowest": "Lentísimo", - "vivecraft.options.keyboardtheme.default": "Blanco", - "vivecraft.options.keyboardtheme.red": "Rojo", - "vivecraft.options.keyboardtheme.green": "Verde", - "vivecraft.options.keyboardtheme.blue": "Azul", - "vivecraft.options.keyboardtheme.black": "Vacío", - "vivecraft.options.keyboardtheme.grass": "Bloque de Tierra", - "vivecraft.options.keyboardtheme.bees": "Abejorro", - "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§dé§bt§di§bc§do", - "vivecraft.options.keyboardtheme.dose": "Medicina", - "vivecraft.options.keyboardtheme.custom": "Personalizado", - "_comment12": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Limpiar", - "vivecraft.gui.loaddefaults": "Por Defecto", - "vivecraft.gui.menuworld.refresh": "Refrescar Mundos del Menú", - "vivecraft.gui.menuworld.loadnew": "Cargar Nuevo Mundo del Menú", - "vivecraft.gui.radialmenu.mainset": "Principal", - "vivecraft.gui.radialmenu.alternateset": "Alternativo", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Comandos", - "vivecraft.gui.overlay": "Depurar", - "vivecraft.gui.profiler": "Gráfico", - "vivecraft.gui.screenshot": "Cap. Pantalla", - "vivecraft.gui.calibrateheight": "Calibrar Altura", - "vivecraft.gui.alignkatwalk": "Alinear KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Mover Cám. 3ª Pers.", - "vivecraft.gui.social": "Social", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Botas Saltarinas", - "vivecraft.item.climbclaws": "Garras Trepadoras", - "vivecraft.item.telescope": "Ojo Amplificador", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Cambiar al modo Sentado desactivará los mandos. ¿Continuar?", - "vivecraft.messages.radialmenubind.1": "Asegúrate que Abrir Menú Radial está asignado.", - "vivecraft.messages.radialmenubind.2": "Mantenga pulsado (Mayús Teclado) con el menú radial para cambiar a las opciones alternativas.", - "vivecraft.messages.controls.1": "Las Asignaciones son controladas por SteamVR Input.", - "vivecraft.messages.controls.2": "Ir a Ajustes > Mandos > Administrar Asignaciones de Mandos en el tablero.", - "vivecraft.messages.controls.3": "§6Steam debe ejecutarse §oantes que§r§6 SteamVR, o no se guardarán las asignaciones.", - "vivecraft.messages.serverplugin": "Detectado mod de servidor Vivecraft: %s", - "vivecraft.messages.noserverplugin": "Mod de servidor Vivecraft no detectado. Este servidor podría no soportar teletransporte. Se ha activado el Movimiento Restringido (alternativa a movimiento libre).", - "vivecraft.messages.calibrateheight": "Por favor calibra tu altura en el menú de pausa.", - "vivecraft.messages.rendersetupfailed": "Inicialización de Renderizado fallida: %s", - "vivecraft.messages.intelgraphics": "No se soporta las Gráficas Integradas de Intel. Si estás usando un portátil, por favor use la GPU de gran-rendimiento. GPU Detectada: %s", - "vivecraft.messages.nosteamvr": "Componente OpenVR no detectado. ¿Ha instalado SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "Exportación de Mundo completada... tamaño de área: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Guardado como %s", - "vivecraft.messages.menuworldexportclientwarning": "ADVERTENCIA: Guardando mundo para menú usando un mundo como cliente. Los datos pueden estar incompletos. Se recomienda guardar mundos para el menú en modo un sólo jugador.", - "vivecraft.messages.teleportdisabled": "Movimiento Restringido activado (sin teletransporte)", - "vivecraft.messages.teleportenabled": "Movimiento Restringido desactivado (teletransporte permitido)", - "vivecraft.messages.walkupblocks": "Subir bloques (Control Dcho.+B): %s", - "vivecraft.messages.showaim": "Mostrar objetivo (Control Dcho.+Mayús Dcho): habilitado", - "vivecraft.messages.playerinertia": "Inercia movimiento del jugador (Control Izdo.+I): %s", - "vivecraft.messages.movementmodeswitch": "Modo Movimiento cambiado a: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Cabeceo: %.1f Guiñada: %.1f Alabeo: %.1f", - "vivecraft.messages.heightset": "Tamaño del jugador establecido a %d%%" -} \ No newline at end of file + "_comment0": "Contributors: jlsalvador, Kyasu_Aur, Romitus, kerotan24, techroot, Vararo7, aloxo.black, Tenebrozo, EdwinAlvarez", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Barra rápida Siguiente", + "vivecraft.key.hotbarPrev": "Barra rápida Anterior", + "vivecraft.key.hotbarScroll": "Barra rápida Desplaz.", + "vivecraft.key.hotbarSwipeX": "Barra rápida Desplaz. (Izda./Dcha.)", + "vivecraft.key.hotbarSwipeY": "Barra rápida Desplaz. (Arr./Abj.)", + "vivecraft.key.rotateLeft": "Rotar Izquierda", + "vivecraft.key.rotateRight": "Rotar Derecha", + "vivecraft.key.rotateAxis": "Rotar Solamente", + "vivecraft.key.rotateFree": "Rotar Libremente", + "vivecraft.key.walkabout": "Caminar", + "vivecraft.key.teleport": "Teletransporte", + "vivecraft.key.teleportFallback": "Avanzar sin Teletransporte", + "vivecraft.key.freeMoveRotate": "Mover/Rotar", + "vivecraft.key.freeMoveStrafe": "Mover/Desplazamiento lateral", + "vivecraft.key.toggleMovement": "Alternar Modo Movimiento", + "vivecraft.key.quickTorch": "Antorcha Rápida", + "vivecraft.key.ingameMenuButton": "Menú del Juego", + "vivecraft.key.exportWorld": "Menú Para Exportar Mundos", + "vivecraft.key.radialMenu": "Abrir Menú Radial", + "vivecraft.key.swapMirrorView": "Cambiar Vista Duplicada", + "vivecraft.key.toggleKeyboard": "Mostrar/Ocultar Teclado", + "vivecraft.key.moveThirdPersonCam": "Mover cámara en tercera persona", + "vivecraft.key.togglePlayerList": "Alternar Lista de Jugadores", + "vivecraft.key.toggleHandheldCam": "Cambiar Cámara", + "vivecraft.key.quickHandheldCam": "Cámara Rápida", + "vivecraft.key.trackpadTouch": "Tocar Panel Táctil", + "vivecraft.key.vrInteract": "Interacción Contextual", + "vivecraft.key.guiLeftClick": "Clic izdo.", + "vivecraft.key.guiRightClick": "Clic dcho.", + "vivecraft.key.guiMiddleClick": "Clic central", + "vivecraft.key.guiShift": "Mayús", + "vivecraft.key.guiCtrl": "Control", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Rueda Arriba", + "vivecraft.key.guiScrollDown": "Rueda Abajo", + "vivecraft.key.guiScrollAxis": "Rueda", + "vivecraft.key.keyboardClick": "Clic", + "vivecraft.key.keyboardShift": "Mayús", + "vivecraft.key.climbeyGrab": "Garras Trepadoras", + "vivecraft.key.climbeyJump": "Botas Saltarinas", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "Interfaz", + "vivecraft.key.category.climbey": "Movimientos Acrobáticos", + "vivecraft.key.category.keyboard": "Teclado", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "En-juego", + "vivecraft.actionset.gui": "Interfaz", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "Modeado", + "vivecraft.actionset.contextual": "Contextual", + "vivecraft.actionset.keyboard": "Teclado", + "vivecraft.actionset.mixedReality": "Realidad Mixta", + "vivecraft.actionset.technical": "Técnico", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "Ajustes de VR", + "vivecraft.options.screen.freemove": "Ajustes de Movimiento Libre", + "vivecraft.options.screen.gui": "Ajustes de Barra e Interfaz", + "vivecraft.options.screen.menuworld": "Ajustes de Mundo del Menú", + "vivecraft.options.screen.guiother": "Ajustes de Chat y Mira", + "vivecraft.options.screen.quickcommands": "Ajustes de Comandos Rápidos", + "vivecraft.options.screen.radialmenu": "Ajustes de Menú Radial", + "vivecraft.options.screen.stereorendering": "Ajustes de Renderizado Estéreo", + "vivecraft.options.screen.roomscale": "Ajustes de Interacción", + "vivecraft.options.screen.seated": "Ajustes de Sentado", + "vivecraft.options.screen.standing": "Ajustes de Locomoción", + "vivecraft.options.screen.teleport": "Ajustes de Teletransporte", + "vivecraft.options.screen.controls": "Ajustes de Mandos", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR...", + "vivecraft.options.screen.gui.button": "Barra e Interfaz...", + "vivecraft.options.screen.stereorendering.button": "Renderizado Estéreo...", + "vivecraft.options.screen.quickcommands.button": "Comandos rápidos...", + "vivecraft.options.screen.guiother.button": "Chat y Mira...", + "vivecraft.options.screen.standing.button": "Locomoción...", + "vivecraft.options.screen.roomscale.button": "Interacción...", + "vivecraft.options.screen.controls.button": "Mandos...", + "vivecraft.options.screen.radialmenu.button": "Menú Radial...", + "vivecraft.options.screen.seated.button": "Sentado...", + "vivecraft.options.screen.menuworld.button": "Mundo del Menú...", + "vivecraft.options.screen.teleport.button": "Teletransporte...", + "vivecraft.options.screen.freemove.button": "Movimiento Libre...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Tamaño Barra", + "vivecraft.options.HUD_DISTANCE": "Distancia Barra", + "vivecraft.options.HUD_LOCK_TO": "Posición Barra", + "vivecraft.options.HUD_OPACITY": "Opacidad Barra", + "vivecraft.options.HUD_HIDE": "Ocultar Barra (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "Fondo Barra/Interfaz", + "vivecraft.options.HUD_OCCLUSION": "Oclusión Barra", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Seguimiento Menú", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Oclusión Mira", + "vivecraft.options.CROSSHAIR_SCALE": "Tamaño Mira En-Juego", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Tamaño Mira en Menús", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Mostrar Mira", + "vivecraft.options.CHAT_NOTIFICATIONS": "Notificación de Chat", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Sonido de Notificacion", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Escalar Mira", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Contorno Bloque", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Abrir Siempre Teclado", + "vivecraft.options.RADIAL_MODE_HOLD": "Modo Menú Radial", + "vivecraft.options.PHYSICAL_KEYBOARD": "Tipo de Teclado", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Tamaño Teclado", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Encima del Bloque", + "vivecraft.options.FSAA": "Escalado Lanczos", + "vivecraft.options.MIRROR_DISPLAY": "Escritorio", + "vivecraft.options.MIRROR_EYE": "Ojo a Duplicar", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Color Principal", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Mostrar Manos", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Distribución", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Sin distorsiones", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Máscara Transparencia", + "vivecraft.options.MIXED_REALITY_FOV": "CdV 3ª Pers.", + "vivecraft.options.WALK_UP_BLOCKS": "Auto-subir bloques", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Multiplicador Vel. Mov.", + "vivecraft.options.INERTIA_FACTOR": "Inercia del Jugador", + "vivecraft.options.SIMULATE_FALLING": "Simular Caída", + "vivecraft.options.WEAPON_COLLISION": "Colisión del Arma", + "vivecraft.options.ALLOW_CRAWLING": "Gatear en la Realidad", + "vivecraft.options.LIMIT_TELEPORT": "Limitar en Supervivencia", + "vivecraft.options.REVERSE_HANDS": "Invertir Manos", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Plantilla de Ojo", + "vivecraft.options.BCB_ON": "Mostrar Posición del Cuerpo", + "vivecraft.options.WORLD_SCALE": "Escala del Mundo", + "vivecraft.options.WORLD_ROTATION": "Rotación del Mundo", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Incrementos de Rotación", + "vivecraft.options.TOUCH_HOTBAR": "Barra rápida Táctil", + "vivecraft.options.PLAY_MODE_SEATED": "Modo de Juego", + "vivecraft.options.RENDER_SCALEFACTOR": "Resolución", + "vivecraft.options.MONO_FOV": "Camp. Visión Sin Dist.", + "vivecraft.options.REALISTIC_JUMP": "Saltar en la Realidad", + "vivecraft.options.REALISTIC_SNEAK": "Agacharse en la Realidad", + "vivecraft.options.PHYSICAL_GUI": "Interfaz Física", + "vivecraft.options.REALISTIC_CLIMB": "Trepar en la Realidad", + "vivecraft.options.REALISTIC_SWIM": "Nadar en la Realidad", + "vivecraft.options.REALISTIC_ROW": "Remar en la Realidad", + "vivecraft.options.WALK_MULTIPLIER": "Multiplicador de Andar", + "vivecraft.options.FREEMOVE_MODE": "Movimiento", + "vivecraft.options.VEHICLE_ROTATION": "Rotación Vehículos", + "vivecraft.options.RESET_ORIGIN": "Reiniciar Origen", + "vivecraft.options.X_SENSITIVITY": "Velocidad Rotación", + "vivecraft.options.Y_SENSITIVITY": "Sensibilidad Y", + "vivecraft.options.KEYHOLE": "Cerrojo", + "vivecraft.options.FOV_REDUCTION": "Visión Cómoda", + "vivecraft.options.FOV_REDUCTION_MIN": "CdV. Tamaño Reducción", + "vivecraft.options.FOV_REDUCTION_OFFSET": "CdV. Desplazamiento Reducción", + "vivecraft.options.SEATED_HMD": "Dirección de Avance", + "vivecraft.options.SEATED_HUD_XHAIR": "Seguimiento Barra", + "vivecraft.options.BACKPACK_SWITCH": "Intercambiar Mochilas", + "vivecraft.options.ANALOG_MOVEMENT": "Movimiento Analógico", + "vivecraft.options.AUTO_SPRINT": "Carrera automática", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Umbral Eje Carrera", + "vivecraft.options.BOW_MODE": "Tiro al Arco en la Realidad", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Por debajo", + "vivecraft.options.TELEPORT_UP_LIMIT": "Por encima", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Distancia", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Permitir Origen Desplazado", + "vivecraft.options.SEATED_FREE_MOVE": "Movimiento", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forzar Movimiento Libre", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Mostrar Asignaciones Avdas.", + "vivecraft.options.MENU_WORLD_SELECTION": "Mundos", + "vivecraft.options.HRTF_SELECTION": "Audio direccional (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Recargar Cámara Externa", + "vivecraft.options.RIGHT_CLICK_DELAY": "Repet. Clic dcho.", + "vivecraft.options.ANIMAL_TOUCHING": "Tocar Animales", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Campo de Visión Cámara", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Resolución Cámara", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Mostrar Modelo Cámara", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Tema Teclado", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Tamaño relativo que ocupa la Barra en el campo-de-visión.\nLas unidades son relativas, ni en grados o fracciones de campo-de-visión ni nada.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Distancia a la que se dibuja la Barra flotante frente a tu cuerpo.\nEsto no modifica el tamaño relativo de la Barra.\nLa distancia se mide en metros (aunque no sea obstruida por bloques).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Especifica dónde se fijará la Barra.\n Mano: La Barra aparecerá por encima de tu mano izquierda.\n Cabeza: La Barra siempre aparecerá en línea recta a tu campo de visión.\n Muñeca: La Barra aparecerá dentro de tu mano izquierda. \"Saldrá\" cuando la mires.", + "vivecraft.options.HUD_OPACITY.tooltip": "Qué tan transparente se dibuja la Barra e Interfaz en-juego.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Especifica si los menús de la Interfaz tienen un fondo semitransparente o no.\n SÍ: Menús en-juego con fondo semitransparente.\n NO: Menús en-juego sin fondo.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Especifica si la Barra puede ser ocluida por objetos cercanos.\n SÍ: La Barra será ocultada por objetos cercanos. ¡Quizás ocultada completamente en entornos cerrados!\n NO: La Barra estará siempre visible. Puede notarse problemas con la profundidad estéreo.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Especifica cuándo el menú principal seguirá tu dirección.\n Sentado: El menú principal sólo seguirá tu dirección en el modo Sentado.\n Siempre: El menú principal siempre seguirá tu dirección.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Establece el tamaño de la mira en-juego.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Establece el tamaño de la mira en los menús.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Establece el modo de visualización de la mira en-juego.\n Siempre: La mira se mostrará siempre aunque la Barra esté desactivada.\n Con Barra: La mira sólo se mostrará cuando la Barra esté activada.\n Nunca: La mira nunca será mostrada.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Establece qué pasa cuando recibes un mensaje de chat.\n Ninguno: ¡Nada!\n Táctil: Vibración en el mando izquierdo.\n Sonido: Reproduce el sonido de notificación de chat.\n Ambos: Táctil y sonido.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Establece el sonido de notificación de chat.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Determina cómo la mira cambia con la distancia.\n SÍ: La mira crecerá con la distancia para aparentar el mismo tamaño desde tu punto de vista.\n NO: La mira siempre será del mismo tamaño en el mundo y parecerá que encoje con la distancia.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Establece el modo de visualización del contorno del bloque en-juego.\n Siempre: El contorno del bloque se mostrará siempre incluso cuando la Barra esté desactivada.\n Con Barra: El contorno del bloque se mostrará sólo cuando la Barra esté activada.\n Nunca: El contorno del bloque nunca será mostrado.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Si está deshabilitado, el teclado sólo se abrirá cuando hagas clic en un campo de texto, o si este no pierde el foco.\n\nSi está habilitado, el teclado siempre se abrirá automáticamente en cualquier momento que un campo de texto reciba foco. Habilitando esto causará que se abra en situaciones no deseadas con mods.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Comportamiento del menú radial al presionar un botón.\n Mantener: Mantenga el botón de menú radial, selecciona y suelta el botón.\n Presionar: Presiona el botón de menú radial, pulsa sobre los botones, presiona de nuevo el botón de menú radial para cerrarlo.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Qué tipo de teclado VR se usará para escribir.\n Físico: Un teclado con el que puedes escribir como si fuera uno real.\n Puntero: Un teclado que puedes usar apuntando con la mira del mando y presionando botones.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Cuánto de grande debe ser el teclado físico, en relación a su tamaño base.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Si está habilitado, la Interfaz para bloques (como cofres y hornos) se mostrará por encima del bloque. De lo contrario, estará en la posición usual.", + "vivecraft.options.FSAA.tooltip": "Utiliza un método más sofisticado de super muestreo del juego antes de enviarlo al Visor. Funciona mejor en altas resoluciones.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "La imagen duplicada del Visor en la ventana de escritorio.\nPuede ser NO, vista Simple o Dual del visor, Primera Persona o Tercera Persona sin distorsiones y Realidad Mixta. La vistas sin distorsiones y mixtas tienen un coste de rendimiento.", + "vivecraft.options.MIRROR_EYE.tooltip": "Qué ojo usar en los modos entrecortado y simple.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "El color que dibujará las áreas \"transparentes\" de la vista de realidad mixta. Se evitará que otros colores del juego coincidan con este para que no cause rarezas.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Renderiza las manos en la vista de realidad mixta. Sólo alterna el renderizado del modelo de las manos actuales, los objetos se seguirán renderizando.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Elige entre una distribución de estilo Unity de 4 paneles, o 2-paneles lado-a-lado.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Incluir una vista sin distorsiones en la distribución de 4-paneles. Requiere una pasada extra de renderización. De lo contrario se usará la vista del Visor.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "En distribuciones Unity, si aplica, se dibujará en escala de grises un canal de transparencia en el cuadrante superior derecho (como en Unity) para usar como capa principal para enmascarar. De otra forma, se dibujará el primer plano con el color principal para usar con el efecto de color principal.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "El campo de visión usado en el duplicado en el modo de realidad mixta.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Te permite la habilidad de subir bloques sin tener que saltar. Tecla rápida: Control dcho.+B\n§cADVERTENCIA: ¡¡Puede causar advertencias anti-trampas si estás en un servidor multijugador!!\n NO: (Por defecto) Tendrás que saltar para subir bloques.\n SÍ: Puedes subir bloques de uno en uno. Puede reducir mareos por simulación inducidos por locomoción.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Establece un multiplicador a la velocidad de movimiento, permitiendo movimientos más lentos que por defecto. Esto puede ayudar a reducir mareos por simulación inducidos por locomoción.\n§cADVERTENCIA: ¡¡Puede causar advertencias anti-trampas si estás en un servidor multijugador!!\nPor defecto a la velocidad estándar de Minecraft (1.0).", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Establece el movimiento de inercia del jugador en modo un sólo jugador. Una baja inercia significa una aceleración rápida. Una Alta inercia puede reducir el mareo por movimiento, pero ¡cuidado con los precipicios!\n Normal: (Por defecto) Estándar de Minecraft.\n Baja < Normal < Alta < Altísima. Actualmente no afecta a movimientos por lava, agua o saltando.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Si se habilita el jugador caerá al suelo al teletransportarse a un espacio vacío. También permite saltar.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Permite golpear bloques y entidades en la Realidad.\nAutomático significa activado en supervivencia y desactivado en creativo.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Si está habilitado el jugador podrá agacharse por debajo del bloque.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "Si se habilita el arco del teletransporte tendrá restricciones en modo supervivencia. No podrá saltar por encima de bloques, consumirá alimentos, y tendrá una barra de energía que se recarga con el tiempo.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Intercambia las manos izquierda/derecha como dominante.\n SÍ: Mano izquierda dominante\n NO: Mano derecha dominante\n\nPara intercambiar los botones, reinicia el juego y asegúrate que las asignaciones por defecto están seleccionadas en SteamVR.", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Enmascara las áreas de la pantalla fuera del campo de visión.\nMejora el rendimiento.", + "vivecraft.options.BCB_ON.tooltip": "Muestra la posición de tu cuerpo como una sombra cuadrada en el suelo.\nEste es tu Compañera Sombra Cuadrada™.\nNo pierdas a tu Compañera Sombra Cuadrada.", + "vivecraft.options.WORLD_SCALE.tooltip": "Escala el jugador en el mundo.\nPor encima de uno te hace grande\nY por debajo de uno te hace pequeño\nY el uno representa tu estatura real\nsin modificar nada.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Agrega rotación adicional a tu Visor.\nEs más útil asignar un botón o cambiarlo con las teclas de dirección.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Cuántos grados girarás al girar el mundo.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Si está activada te permite tocar la barra rápida con tu mano principal para elegir un objeto.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Modo de juego De pié o Sentado.\nDe pié es bastante superior.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "La escala de renderizado interno del juego, en relación con la pantalla del Visor. Valores altos mejoran la calidad de visionado a costa del rendimiento.", + "vivecraft.options.MONO_FOV.tooltip": "El campo de visión usado para la vista duplicada sin distorsiones.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "Si se activa, al saltar en la realidad tu personaje saltará. También activa las Botas Saltarinas.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Si se activa, al agacharte en la realidad tu personaje se agachará.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Si se activa, la Interfaz será reemplazada por modelos 3d interactuables.\nSi el Seguimiento de mochila está activado, al alcanzar tu espalda se mostrará el inventario de tu mochila.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Si se activa, permite trepar escaleras y enredaderas tocándolos. También activa Garras Trepadoras.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Si se activa, permite nadar realizando brazadas con los mandos.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Rema, rema, rema tu barca... agitando los brazos como una parca.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplica tu posición en la habitación por un factor.\nTe permite andar más alrededor, pero puede causar mareo por movimiento.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "Origen de dirección del movimiento libre.\n\n Mando: Dirección donde apunte el mando.\n Visor: Dirección de tu mirada.\n Correr-Sin-Moverse: Guiñada basada en cómo se mueven los mandos. Cabeceo basado en tu Visor.\n Habitación: Guiñada relativa a avanzar en la realidad. Cabeceo basado en tu Visor. Este modo sólo es mejor para RV de 180 grados.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Viajar en un vehículo rotará el mundo con el giro del vehículo. Puede ser desorientador.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Recentra los pies del jugador en el mundo a 1,62m por debajo de la posición actual del Visor. Para sistema de posicionamiento no-absolutos o jugar sentados.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Velocidad a la que rotará la vista al alcanzar los bordes del cerrojo.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Velocidad vertical de la mira relacionada con el ratón.", + "vivecraft.options.KEYHOLE.tooltip": "El número de grados a la izquierda y derecha desde el centro donde la vista comenzará a rotar.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Encoge el campo de visión mientras te mueves. Puede aliviar el mareo por movimiento.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "El tamaño final de la reducción del campo de visión.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Desplaza horizontalmente el centro de la reducción del campo de visión para Visores no estándar.", + "vivecraft.options.SEATED_HMD.tooltip": "La dirección a la que irá la tecla de avance (W).\nLa dirección de la vista del Visor o de la mira.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "La dirección donde se mostrará la Barra.\nLa dirección de la vista del Visor o de la mira.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Si está habilitado, alcanzando con el mando derecho detrás de tu cabeza cambiará a la primera ranura de la 1ª barra rápida, o volverá a la ranura anterior. Haciendo lo mismo con el mando izquierdo intercambiará los objetos de las manos.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "La velocidad al andar será determinada por el eje del mando, si dicho mando tiene un eje con valor variable.\n\nPara un control analógico completo es mejor usar \"Mover/Desplazamiento lateral\" o \"Mover/Rotar\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "Mientras usas movimiento libre, correrás automáticamente al alcanzar el umbral configurado del eje.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "El umbral del eje que activa la carrera automática.", + "vivecraft.options.BOW_MODE.tooltip": "Establece cuándo usar Tiro al Arco en la Realidad\n NO: Nunca.\n Vanilla: Sólo para el arco vanilla, no objetos de mods.\n SÍ: Siempre para cualquier objeto que use la acción \"arquear\".", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limita la cantidad de bloques de puedes teletransportarte por debajo de ti.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limita la cantidad de bloques que puedes teletransportarte por encima de ti.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limita la cantidad de bloques que puedes teletransportarte alrededor.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Permite que el botón \"Reiniciar Origen\" sea usado en el modo sentado, para aquellos que desean jugar físicamente sentados mientras usan mandos de seguimiento.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Qué modo de locomoción se usará en el modo sentado.\n\n Teletransporte: Presiona cualquier dirección para activarlo.\n Libre: Movimientos tipo WASD de Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Fuerza el uso alternativo de la asignación de avanzar (gatillo izquierdo por defecto). Para más opciones de movimiento, edita las asignaciones de mando de SteamVR.\n\nTenga en cuenta que esto desactiva la asignación de teletransporte.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Muestra asignaciones adicionales de SteamVR para trepar, teclado y realidad mixta.\n\nRequiere un reinicio para que surta efecto.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Qué mundos para el menú principal se cagará al iniciar.\n\nSi no se encuentra mundos personalizados, se usarán independientemente mundos oficiales.", + "vivecraft.options.HRTF_SELECTION.tooltip": "Perfil de HRTF a usar para el audio 3D posicional. La calidad puede variar por dispositivo y controlador.\n\n NO: Desactiva explícitamente HRTF.\n Por defecto: Usa el perfil por defecto de HRTF.\n Otros: Usa el perfil especificado de HRTF.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Recarga la configuración de la cámara desde ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "El número de tics del juego entre \"clics derecho\" mientras se mantiene presionado el botón.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Si está habilitado, tocar un animal (mob) pasivo sin un arma interactuará (clic dcho.) en vez de atacarlo.\nDeshabilitar para abofetear cerditos.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "CdV de la cámara de fotos.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolución de la cámara de fotos, para tomar capturas de pantalla a mayor resolución de lo normal.\nNo puede ser usado con sombreados activados.\n§cATENCIÓN: ¡Valores muy altos pueden derretir tu ordenador!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Muestra el modelo de una cámara de vídeo (sólo en vista Visor) para representar dónde se encuentra la realidad mixta o cámara en tercera persona. También se puede mover alrededor agarrándola usando la interacción asociada.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Esquema de colores preestablecido para el teclado físico. El tema personalizado se puede editar vía keyboardtheme.txt en el directorio del juego. Se recargará cada vez que se abra el teclado, para permitir ajustes en tiempo real.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "No Puedo Ver", + "vivecraft.options.yes": "SÍ", + "vivecraft.options.no": "NO", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Por defecto", + "vivecraft.options.opaque": "Opaca", + "vivecraft.options.mirrormode.off": "Desactivado (ráp.)", + "vivecraft.options.mirrormode.dual": "Dual (ráp.)", + "vivecraft.options.mirrormode.single": "Simple (ráp.)", + "vivecraft.options.mirrormode.firstperson": "1ª Pers. (lento)", + "vivecraft.options.mirrormode.thirdperson": "3ª Pers. (lento)", + "vivecraft.options.mirrormode.mixedreality": "Real. Mixta (lento)", + "vivecraft.options.mirrormode.cropped": "Recortado (ráp.)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Izquierdo", + "vivecraft.options.right": "Derecho", + "vivecraft.options.color.black": "Negro", + "vivecraft.options.color.red": "Rojo", + "vivecraft.options.color.yellow": "Amarillo", + "vivecraft.options.color.green": "Verde", + "vivecraft.options.color.cyan": "Cian", + "vivecraft.options.color.blue": "Azul", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Lado a Lado", + "vivecraft.options.hudlock.hand": "Mano", + "vivecraft.options.hudlock.head": "Cabeza", + "vivecraft.options.hudlock.wrist": "Muñeca", + "vivecraft.options.renderpointerelement.always": "Siempre", + "vivecraft.options.renderpointerelement.withhud": "Con Barra", + "vivecraft.options.renderpointerelement.never": "Nunca", + "vivecraft.options.chatnotifications.none": "Ninguno", + "vivecraft.options.chatnotifications.haptic": "Táctil", + "vivecraft.options.chatnotifications.sound": "Sonido", + "vivecraft.options.chatnotifications.both": "Ambos", + "vivecraft.options.always": "Siempre", + "vivecraft.options.seated": "Sentado", + "vivecraft.options.standing": "De pié", + "vivecraft.options.inertiafactor.none": "Baja", + "vivecraft.options.inertiafactor.normal": "Normal", + "vivecraft.options.inertiafactor.large": "Alta", + "vivecraft.options.inertiafactor.massive": "Altísima", + "vivecraft.options.smooth": "Suave", + "vivecraft.options.hmd": "Visor", + "vivecraft.options.crosshair": "Mira", + "vivecraft.options.freemove.controller": "Mandos", + "vivecraft.options.freemove.hmd": "Visor", + "vivecraft.options.freemove.runinplace": "Correr-Sin-Moverse", + "vivecraft.options.freemove.room": "Habitación", + "vivecraft.options.hold": "Mantener", + "vivecraft.options.press": "Presionar", + "vivecraft.options.keyboard.physical": "Físico", + "vivecraft.options.keyboard.pointer": "Puntero", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d bloques", + "vivecraft.options.teleport": "Teletransporte", + "vivecraft.options.freemove": "Libre", + "vivecraft.options.menuworld.both": "Todos", + "vivecraft.options.menuworld.custom": "Sólo Personalizados", + "vivecraft.options.menuworld.official": "Sólo Oficial", + "vivecraft.options.menuworld.none": "Ninguno", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Lento", + "vivecraft.options.rightclickdelay.slower": "Muy lento", + "vivecraft.options.rightclickdelay.slowest": "Lentísimo", + "vivecraft.options.keyboardtheme.default": "Blanco", + "vivecraft.options.keyboardtheme.red": "Rojo", + "vivecraft.options.keyboardtheme.green": "Verde", + "vivecraft.options.keyboardtheme.blue": "Azul", + "vivecraft.options.keyboardtheme.black": "Vacío", + "vivecraft.options.keyboardtheme.grass": "Bloque de Tierra", + "vivecraft.options.keyboardtheme.bees": "Abejorro", + "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§dé§bt§di§bc§do", + "vivecraft.options.keyboardtheme.dose": "Medicina", + "vivecraft.options.keyboardtheme.custom": "Personalizado", + "_comment12": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Limpiar", + "vivecraft.gui.loaddefaults": "Por Defecto", + "vivecraft.gui.menuworld.refresh": "Refrescar Mundos del Menú", + "vivecraft.gui.menuworld.loadnew": "Cargar Nuevo Mundo del Menú", + "vivecraft.gui.radialmenu.mainset": "Principal", + "vivecraft.gui.radialmenu.alternateset": "Alternativo", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Comandos", + "vivecraft.gui.overlay": "Depurar", + "vivecraft.gui.profiler": "Gráfico", + "vivecraft.gui.screenshot": "Cap. Pantalla", + "vivecraft.gui.calibrateheight": "Calibrar Altura", + "vivecraft.gui.alignkatwalk": "Alinear KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Mover Cám. 3ª Pers.", + "vivecraft.gui.social": "Social", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Botas Saltarinas", + "vivecraft.item.climbclaws": "Garras Trepadoras", + "vivecraft.item.telescope": "Ojo Amplificador", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Cambiar al modo Sentado desactivará los mandos. ¿Continuar?", + "vivecraft.messages.radialmenubind.1": "Asegúrate que Abrir Menú Radial está asignado.", + "vivecraft.messages.radialmenubind.2": "Mantenga pulsado (Mayús Teclado) con el menú radial para cambiar a las opciones alternativas.", + "vivecraft.messages.controls.1": "Las Asignaciones son controladas por SteamVR Input.", + "vivecraft.messages.controls.2": "Ir a Ajustes > Mandos > Administrar Asignaciones de Mandos en el tablero.", + "vivecraft.messages.controls.3": "§6Steam debe ejecutarse §oantes que§r§6 SteamVR, o no se guardarán las asignaciones.", + "vivecraft.messages.serverplugin": "Detectado mod de servidor Vivecraft: %s", + "vivecraft.messages.noserverplugin": "Mod de servidor Vivecraft no detectado. Este servidor podría no soportar teletransporte. Se ha activado el Movimiento Restringido (alternativa a movimiento libre).", + "vivecraft.messages.calibrateheight": "Por favor calibra tu altura en el menú de pausa.", + "vivecraft.messages.rendersetupfailed": "Inicialización de Renderizado fallida: %s", + "vivecraft.messages.intelgraphics": "No se soporta las Gráficas Integradas de Intel. Si estás usando un portátil, por favor use la GPU de gran-rendimiento. GPU Detectada: %s", + "vivecraft.messages.nosteamvr": "Componente OpenVR no detectado. ¿Ha instalado SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "Exportación de Mundo completada... tamaño de área: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Guardado como %s", + "vivecraft.messages.menuworldexportclientwarning": "ADVERTENCIA: Guardando mundo para menú usando un mundo como cliente. Los datos pueden estar incompletos. Se recomienda guardar mundos para el menú en modo un sólo jugador.", + "vivecraft.messages.teleportdisabled": "Movimiento Restringido activado (sin teletransporte)", + "vivecraft.messages.teleportenabled": "Movimiento Restringido desactivado (teletransporte permitido)", + "vivecraft.messages.walkupblocks": "Subir bloques (Control Dcho.+B): %s", + "vivecraft.messages.showaim": "Mostrar objetivo (Control Dcho.+Mayús Dcho): habilitado", + "vivecraft.messages.playerinertia": "Inercia movimiento del jugador (Control Izdo.+I): %s", + "vivecraft.messages.movementmodeswitch": "Modo Movimiento cambiado a: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Cabeceo: %.1f Guiñada: %.1f Alabeo: %.1f", + "vivecraft.messages.heightset": "Tamaño del jugador establecido a %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/fr_fr.json b/common/src/main/resources/assets/vivecraft/lang/fr_fr.json index 013a34698..8d0469e15 100644 --- a/common/src/main/resources/assets/vivecraft/lang/fr_fr.json +++ b/common/src/main/resources/assets/vivecraft/lang/fr_fr.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: PierraNova, tomaveclevdsl, Weelobeae, Silinox, AkitakeKun, tommoron66, dangerousones, coco875, tinato, vgtom4, TheComputerHead", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Case suivante", - "vivecraft.key.hotbarPrev": "Case précédente", - "vivecraft.key.hotbarScroll": "Faire défiler la barre d'action", - "vivecraft.key.hotbarSwipeX": "Défiler (Gauche/Droite)", - "vivecraft.key.hotbarSwipeY": "Défiler (Haut/Bas)", - "vivecraft.key.rotateLeft": "Rotation à gauche", - "vivecraft.key.rotateRight": "Rotation à droite", - "vivecraft.key.rotateAxis": "Rotation uniquement", - "vivecraft.key.rotateFree": "Rotation libre", - "vivecraft.key.walkabout": "\"Walkabout\"", - "vivecraft.key.teleport": "Téléportation", - "vivecraft.key.teleportFallback": "Avancer lorsque la téléportation est désactivée", - "vivecraft.key.freeMoveRotate": "Déplacement/Rotation", - "vivecraft.key.freeMoveStrafe": "Déplacement/Strafe", - "vivecraft.key.toggleMovement": "Changer type de déplacement", - "vivecraft.key.quickTorch": "Torche rapide", - "vivecraft.key.ingameMenuButton": "Menu", - "vivecraft.key.exportWorld": "Exporter un fond avec votre monde", - "vivecraft.key.radialMenu": "Ouvrir le menu radial", - "vivecraft.key.swapMirrorView": "Échanger vue du bureau", - "vivecraft.key.toggleKeyboard": "Montrer le clavier", - "vivecraft.key.moveThirdPersonCam": "Bouger caméra 3ème personne", - "vivecraft.key.togglePlayerList": "Afficher la liste de joueurs", - "vivecraft.key.toggleHandheldCam": "Activer/désactiver la caméra", - "vivecraft.key.quickHandheldCam": "Caméra rapide", - "vivecraft.key.trackpadTouch": "Touché du pavé tactile", - "vivecraft.key.vrInteract": "Interactions contextuelles", - "vivecraft.key.guiLeftClick": "Clic gauche", - "vivecraft.key.guiRightClick": "Clic droit", - "vivecraft.key.guiMiddleClick": "Clic molette", - "vivecraft.key.guiShift": "Maj. gauche", - "vivecraft.key.guiCtrl": "Ctrl gauche", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Défiler en haut", - "vivecraft.key.guiScrollDown": "Défiler en bas", - "vivecraft.key.guiScrollAxis": "Défiler", - "vivecraft.key.keyboardClick": "Clic", - "vivecraft.key.keyboardShift": "Maj. gauche", - "vivecraft.key.climbeyGrab": "Griffes d'escalade", - "vivecraft.key.climbeyJump": "Bottes de Saut", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "Interface", - "vivecraft.key.category.climbey": "Déplacement à-la \"Climbey\"", - "vivecraft.key.category.keyboard": "Clavier", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "En jeu", - "vivecraft.actionset.gui": "Interface", - "vivecraft.actionset.global": "Global", - "vivecraft.actionset.mod": "Modée", - "vivecraft.actionset.contextual": "Contextuel", - "vivecraft.actionset.keyboard": "Clavier", - "vivecraft.actionset.mixedReality": "Réalité mixte", - "vivecraft.actionset.technical": "Technique", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "Paramètres VR", - "vivecraft.options.screen.freemove": "Paramètres de déplacement libre", - "vivecraft.options.screen.gui": "Paramètres de l'interface", - "vivecraft.options.screen.menuworld": "Paramètres monde menu principal", - "vivecraft.options.screen.guiother": "Paramètres de discussion/réticule", - "vivecraft.options.screen.quickcommands": "Commandes rapides", - "vivecraft.options.screen.radialmenu": "Configuration du menu radial", - "vivecraft.options.screen.stereorendering": "Paramètres de l'affichage Stéréo", - "vivecraft.options.screen.roomscale": "Paramètres d’interactions à l'échelle de la pièce", - "vivecraft.options.screen.seated": "Paramètres assis", - "vivecraft.options.screen.standing": "Paramètres de Locomotion sur place", - "vivecraft.options.screen.teleport": "Paramètres de téléportation", - "vivecraft.options.screen.controls": "Paramètres de manette", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "Paramètres VR...", - "vivecraft.options.screen.gui.button": "Paramètres de l'interface...", - "vivecraft.options.screen.stereorendering.button": "Affichage Stéréo", - "vivecraft.options.screen.quickcommands.button": "Commandes rapides", - "vivecraft.options.screen.guiother.button": "Paramètres du réticule...", - "vivecraft.options.screen.standing.button": "Paramètres de locomotion...", - "vivecraft.options.screen.roomscale.button": "Paramètres d'interaction...", - "vivecraft.options.screen.controls.button": "Paramètres du manette...", - "vivecraft.options.screen.radialmenu.button": "Menu radial...", - "vivecraft.options.screen.seated.button": "Paramètres du mode assis...", - "vivecraft.options.screen.menuworld.button": "Paramètres monde menu principal...", - "vivecraft.options.screen.teleport.button": "Paramètres de téléportation...", - "vivecraft.options.screen.freemove.button": "Paramètres de déplacement libre...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Taille de l'ATH", - "vivecraft.options.HUD_DISTANCE": "Distance de l'ATH", - "vivecraft.options.HUD_LOCK_TO": "Verrouiller l'orientation de l'ATH", - "vivecraft.options.HUD_OPACITY": "Opacité de l'ATH", - "vivecraft.options.HUD_HIDE": "Cacher l'ATH (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "Fond de l'interface", - "vivecraft.options.HUD_OCCLUSION": "Occlusion de l'ATH", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Suivre visage ds. menu princi.", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Occlusion du réticule", - "vivecraft.options.CROSSHAIR_SCALE": "Taille du réticule", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Taille du réticule dans les menus", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Afficher le réticule", - "vivecraft.options.CHAT_NOTIFICATIONS": "Notification de chat", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Son de notification", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Taille du curseur", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Afficher Contours Blocs", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Toujours afficher clavier", - "vivecraft.options.RADIAL_MODE_HOLD": "Mode du menu radiale", - "vivecraft.options.PHYSICAL_KEYBOARD": "Type du clavier", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Taille du clavier", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Apparaître sur bloc", - "vivecraft.options.FSAA": "Algorithme de Lanczos", - "vivecraft.options.MIRROR_DISPLAY": "Miroiter jeu sur bureau", - "vivecraft.options.MIRROR_EYE": "Miroiter oeil", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Couleur Clé Chroma", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Afficher les mains", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Disposition", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Nombre de \"passes\" anti-distorsion", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Masque alpha", - "vivecraft.options.MIXED_REALITY_FOV": "Champ de vis. du camera troisième personne", - "vivecraft.options.WALK_UP_BLOCKS": "Marcher au dessus des blocs", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Multi. vitesse", - "vivecraft.options.INERTIA_FACTOR": "Inertie du joueur", - "vivecraft.options.SIMULATE_FALLING": "Simuler la chute", - "vivecraft.options.WEAPON_COLLISION": "Collision des armes", - "vivecraft.options.ALLOW_CRAWLING": "Ramper à l'échelle d'une pièce", - "vivecraft.options.LIMIT_TELEPORT": "Restrictions en mode Survie", - "vivecraft.options.REVERSE_HANDS": "Inverser Les Mains", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Utiliser le Pochoir a œil ", - "vivecraft.options.BCB_ON": "Montre la position du corps", - "vivecraft.options.WORLD_SCALE": "Taille du monde", - "vivecraft.options.WORLD_ROTATION": "Rotation du monde", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Incréments de rotation", - "vivecraft.options.TOUCH_HOTBAR": "Interaction avec la barre d'action activée", - "vivecraft.options.PLAY_MODE_SEATED": "Mode de jeu", - "vivecraft.options.RENDER_SCALEFACTOR": "Résolution", - "vivecraft.options.MONO_FOV": "Champ de vis. sans distorsions", - "vivecraft.options.REALISTIC_JUMP": "Sauter à l'échelle d'une pièce", - "vivecraft.options.REALISTIC_SNEAK": "S'accroupir à l'échelle d'une pièce", - "vivecraft.options.PHYSICAL_GUI": "Interface physique", - "vivecraft.options.REALISTIC_CLIMB": "Monter à l'échelle d'une pièce", - "vivecraft.options.REALISTIC_SWIM": "Nager a l'échelle d'une pièce", - "vivecraft.options.REALISTIC_ROW": "Aviron à l'échelle d'une pièce", - "vivecraft.options.WALK_MULTIPLIER": "Multi. marche Roomscale", - "vivecraft.options.FREEMOVE_MODE": "Type de déplacement libre", - "vivecraft.options.VEHICLE_ROTATION": "Rotation dans un véhicule", - "vivecraft.options.RESET_ORIGIN": "Réinitialiser l'origine", - "vivecraft.options.X_SENSITIVITY": "Vitesse du rotation", - "vivecraft.options.Y_SENSITIVITY": "Sensibilité verticale/\"Y\"", - "vivecraft.options.KEYHOLE": "Trou de serrure", - "vivecraft.options.FOV_REDUCTION": "Réduc. champ de vis. pr. confort", - "vivecraft.options.FOV_REDUCTION_MIN": "Taille réduc. champ de vis.", - "vivecraft.options.FOV_REDUCTION_OFFSET": "Décalage réduc. champ de vis.", - "vivecraft.options.SEATED_HMD": "Vers l'avant", - "vivecraft.options.SEATED_HUD_XHAIR": "Faire suivre l'ATH", - "vivecraft.options.BACKPACK_SWITCH": "Changer le mode de sac à dos", - "vivecraft.options.ANALOG_MOVEMENT": "Déplacement analogue", - "vivecraft.options.AUTO_SPRINT": "Auto-sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Limite auto-sprint", - "vivecraft.options.BOW_MODE": "Arc à l'échelle d'une pièce", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limite vers le bas", - "vivecraft.options.TELEPORT_UP_LIMIT": "Limite vers le haut", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Limite de distance", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Autoriser décalage du point d'origine", - "vivecraft.options.SEATED_FREE_MOVE": "Changer type de déplacement", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forcer le déplacement libre", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Afficher contrôles avancés", - "vivecraft.options.MENU_WORLD_SELECTION": "Mondes", - "vivecraft.options.HRTF_SELECTION": "Audio directionnel (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Recharger la caméra externe", - "vivecraft.options.RIGHT_CLICK_DELAY": "Répéter clic droit", - "vivecraft.options.ANIMAL_TOUCHING": "Toucher les animales", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Champ de vis. caméra", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Résolution de la caméra", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Afficher Modèle Caméra", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Thème du clavier", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "La taille relative que l'ATH prend dans le champ de vis. Les unités sont relatives, ni des degrés ni des fractions du champ de vis. etc..", - "vivecraft.options.HUD_DISTANCE.tooltip": "La distance à laquelle l'ATH flottant est affiché devant vous. La taille relative de l'ATH n'est pas affectée par ce paramètre. La distance est en mètres (mais n'est pas obstrué par des blocs).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Spécifie à quelle orientation l'ATH sera bloqué.\n Main: L'ATH s'affichera juste au dessus de la main non-principale.\n Tête: L'ATH s'affichera droit devant votre champ de vis.\n Poignet: L'ATH apparaîtra à l'intérieur de votre main non-principale. Il ne deviendra visible qu'en regardant la paume.", - "vivecraft.options.HUD_OPACITY.tooltip": "La transparence de l'ATH et de l'interface.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Spécifie si l'interface graphique doit avoir un fond semi-transparent ou non.\n Oui: fonds semi-transparents dans les menus.\n Non: aucun fond dans les menus.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Spécifie si l'ATH doit être obstrué par des objets proches.\n Oui: L'ATH sera caché par des objets proches. Peut être complétement caché dans des environnements confinés.\n Non: L'ATH sera toujours visible. Des problèmes de profondeur Stéréo pourraient être visibles.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Spécifie si le menu principal suit votre regard.\n Assis: Le menu principal ne suivra qu'en mode assis.\n Toujours: Le menu principal suivra toujours.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Règle la taille du curseur hors-menus.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Règle la taille du curseur dans les menus.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Règle le mode d'affichage du curseur.\n Toujours: Le curseur sera toujours affiché, même si l'ATH ne l'est pas.\n Avec ATH: Le curseur ne sera affiché que quand l'ATH l'est.\n Jamais: Le curseur n'est jamais affiché.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Séléctionne ce qu'il se passe lorsque vous recevez un message sur le chat.\n Rien: Rien.\n Haptique: Vibration sur la manette de gauche.\n Son: Joue un bruit de notification.\n Les deux: A ton avis?", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Séléctionne le bruit de notification.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Détermine comment le curseur doit changer avec la distance.\n Oui: Le curseur grossira pour garder la même taille relative à votre vue.\n Non: Le curseur rétrécira avec la distance.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Séléctionne le mode d'affichage du contour des blocs.\n Toujours: Le contour des blocs sera toujours affiché même lorsque l'ATH est désactivé.\n Avec l'ATH: Le contour des blocs ne sera affiché que si l'ATH l'est aussi.\n Jamais: Le contour des blocs n'est jamais affiché.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Si désactivé, le clavier ne s'ouvrira que quand vous cliquerez sur un champ de texte, ou si un champ de texte ne peut s'enlever.\n\nSi activé, le clavier s'ouvrira automatiquement dès qu'un champ de texte apparaît.\n(Attention, peut s'ouvrir involontairement avec certains mods!)", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Le comportement du menu radial lorsque la touche est appuyée.\n Maintenir: Il faut garder la touche enfoncée, glisser sur la sélection et relâcher.\n Appuyer: Il faut appuyer sur le bouton, cliquer sur la sélection et de nouveau appuyer sur la touche.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Le type de clavier VR que vous souhaitez utiliser.\n Physique: Un clavier apparaîtra dans lequel vous pourrez taper comme un vrai clavier.\n Pointeur: Un clavier qu'on utilise en cliquant sur des lettres avec les touches des manettes.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "La taille du clavier physique, par rapport à sa taille par défaut.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Si activé, l'interface graphique pour les blocs (tels que les coffres et les fours) sera placée au dessus du bloc. Sinon, elle sera dans la position habituelle.", - "vivecraft.options.FSAA.tooltip": "Utilise une méthode plus complexe de sur-échantillonage du jeu avant d'envoyer au casque. Marche mieux avec de hautes échelles de rendu.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Miroite les images du casque sur le bureau. Peut être réglé sur Désactivé, Seul ou Duo (un œil miroité ou deux), en première-personne sans distorsions, troisième personne sans distorsions et en réalité mixte. Les vues sans distorsions et en réalité mixte affectent les performances.", - "vivecraft.options.MIRROR_EYE.tooltip": "Quel oeil est utilisé pour les modes d'affichage coupé et seul.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "La couleur mise dans les zones \"transparentes\" de la vue en réalité mixte. D'autres couleurs similaires dans le jeu n'apparaîtront pas afin d'empêcher que des choses pas super réglo arrivent..", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Affiche les mains en vue en réalité mixte. N'affecte que l'affichage des mains, les objets seront quand même affichés.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choisissez entre la mise en page style \"Unity\" à 4 panneaux, ou 2 panneaux côte-à-côte.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Inclure une vue sans distorsions en mise en page 4 panneaux. Requiert un passe d'affichage en plus. Sinon la vue du casque sera utilisée.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "Dans la mise en page Unity, si activé, affichera un masque alpha \"greyscale\" quart en haut à droite (comme Unity) utilisé pour masquer la couche au premier plan. Sinon, le premier plan sera déssiné avec la couleur de clé pour utilisation avec l'effet couleur de clé.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "Le champ de vis. du mode réalité mixte", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Vous permet de sélectionner la capacité à marcher au dessus des blocs sans avoir à sauter. (Raccourci: Ctrl Droit + B)\n§cATTENTION: Peut causer des alertes anti-triche si utilisé sur un serveur multijoueur!\n Non: (Défaut) Vous devrez sauter au dessus des blocs.\n Oui: Vous pouvez marcher au dessus des blocs. Peut aider contre la nausée liée au déplacement libre.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Séléctionne un multiplicateur de mouvement, permettant des mouvements plus lents que par défaut. Peut aider contre la nausée causée par le déplacement.\n§cATTENTION: Peut causer des alertes anti-triche si utilisé sur un serveur multijoueur!\nLa valeur par défaut est celle de Minecraft de base (1.0)", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Sélectionne la puissance d'inertie sur le joueur. Une inertie plus faible se traduit en une accélération plus rapide, et vice versa. Une inertie élevée peut réduire la nausée, mais faites gaffe aux précipices.\n Normal: inertie par défaut.\n Rien, que dalle < Normal < Beaucoup < Encore plus. N'affecte pas la lave, l'eau ou les sauts.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Si activé le joueur tombera au sol en mode téléportation si au dessus du vide. Permet aussi de sauter. Ne permet pas de téléporter du pain. Désolé.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Permet de taper les blocs et les entités avec vos armes.\nAutomatiquement activé en survie et désactivé en créatif.\n(En gros ça active les collisions avec les armes/outils.)", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Si activé, vous permet de ramper sous les blocs. On dit pas que quand c'est désactivé vous pouvez pas ramper, c'est juste que ça marchera pas.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "Si activé, la téléportation aura des restrictions en mode Survie. Elle ne sera pas capable de sauter sur les côtés des blocs, elle consommera de la nourriture et aura une barre d'énergie qui se remplira avec le temps.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Echange les mains dominantes et secondaires.\n Oui: Main gauche dominante.\n Non: Main droite dominante (par défaut)\n\n§cPour échanger les touches, relancez le jeu et vérifiez que les contrôles par défaut sont utilisés sur SteamVR!", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Masque les zones de l'écran en dehors du champ de vis. Améliore les performances.", - "vivecraft.options.BCB_ON.tooltip": "Montre la position de votre corps avec une ombre carrée sur le sol.\nC'est votre propre ombre. Rien que pour vous.\n§4Si vous la perdez, aucun problème on la remplace!", - "vivecraft.options.WORLD_SCALE.tooltip": "Change la taille du joueur par rapport au monde. Des valeurs au dessus de un vous rendent plus grand et vice-versa.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Donne une rotation en plus à votre casque.\nPlus utile si affecté a une touche ou changé avec les flèches directionnelles. ", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Le nombre de degrés de rotation quand vous changez de rotation.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Si activé, vous permet de toucher la barre d'action avec votre main principale pour sélectionner un objet.\n(Faites gaffe: c'est vachement cool.)", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Jouer en mode debout ou assis.\nSpoiler: Jouer debout c'est vachement mieux.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "La résolution interne du jeu, relative à la résolution du casque. Des valeurs plus élevées améliorent la qualité en échange de performances. C'est en gros du suréchantillonage.", - "vivecraft.options.MONO_FOV.tooltip": "Le champ de vision utilisé pour le mode sans distorsions.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "SI activé, vous permet de sauter dans le jeu en sautant dans la vraie vie. Au fait, ça active les bottes de saut.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Si activé, quand vous serez accroupis dans la vraie vie, vous le serez aussi dans le jeu. Sympa, hein?", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Si activé, l'interface graphique sera remplacée par des modèles en 3D interactifs.\nSi le sac-à-dos est activé, mettre la main à votre dos va afficher votre inventaire.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Si activé, permet de grimper aux échelles et au vignes en les touchant. Active aussi les griffes d'escalade. (Oui on a ça.)", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Si activé, permet de nager en brassant avec les manettes.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Permet de ramer en bougeant vos bras vachement fort.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplie votre position dans la salle par un facteur.\nVous permet de marcher un peu plus, mais peut causer la nausée.\n(Si vous vomissez, c'est pas notre faute!)", - "vivecraft.options.FREEMOVE_MODE.tooltip": "Ce qui contrôle la direction en déplacement libre.\n\n Manette: la manette de la main secondaire contrôle la direction.\n Casque: le casque contrôle la direction.\n Sur-place: la direction est déterminée par comment les manettes bougent.\n Salle: Lacet est relatif a la salle, Tangage est le casque. Utilise pour le VR en configuration 180 dégrée.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Conduire dans un véhicule va changer la rotation du monde avec le véhicule. Peut désorienter.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Recentre les pieds du joueur à 1,62 mètres sous la position actuelle du casque. pour des systèmes de capteurs non-absolus ou en mode assis.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Accélère la vitesse de rotation de la vue lorsque poussé sur le bord du trou de serrure.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "La vitesse verticale du curseur par rapport à la souris.", - "vivecraft.options.KEYHOLE.tooltip": "Le nombre de degrés à gauche et à droite à partir desquels la vue commencera à pivoter.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Réduit le champ de vision lorsque vous bougez. Peut aider contre la nausée.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "La taille finale de la réduction du champ de vis. pr. confort", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Décale horizontalement le centre de la réduction du champ de vision pour des casques non-standards.", - "vivecraft.options.SEATED_HMD.tooltip": "La direction dans laquelle la touche avancer va aller.\nla direction vue du casque ou réticule.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "La direction dans laquelle l'ATH sera mis.\nla direction vue du casque ou réticule.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Si activé, mettre votre main droite derrière votre tête sélectionnera automatiquement le 1er emplacement de la barre d'outils. Faire la même chose avec la main gauche vous permet de mettre des trucs dans la main non dominante. (Exemple: bouclier dans main droite > main gauche derrière tête > bouclier dans main gauche)", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "La vitesse de marche sera déterminée par la position du joystick, si la touche avancer est configurée sur un joystick.\n\nPour des contrôles complètement analogues, meilleure idée d'utiliser \"Déplacement/Strafe\" ou \"Déplacement/Rotation\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "Lors du déplacement libre, le sprint s'activera automatiquement lorsque le joystick dépassera la limite configurée.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "La limite à laquelle l'auto-sprint s'active.", - "vivecraft.options.BOW_MODE.tooltip": "Sélectionne quand utiliser l'arc à l'échelle de la pièce.\n Non: Jamais!\n Vanilla: Que pour l'arc par défaut.\n Oui: Pour tous les objets qui marchent comme des arcs.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limite le nombre de blocs que vous pouvez descendre en une téléportation.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limite le nombre de blocs que vous pouvez grimper en une téléportation.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limite la distance que vous pouvez parcourir en une téléportation.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Permet le bouton pour \"Réinitialiser l'origine\" d'être utilisé debout, pour ceux qui veulent jouer assis mais avec les manettes.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Quel mode de locomotion doit être utilisé en mode assis.\n Téléportation: Rien a ajouter je pense.\n Déplacement libre: ZQSD comme le bon vieux Minecraft de base!", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Force l'utilisation de la touche pour avancer \"d'urgence\" (bouton téléportation pr. défaut). Pour plus d'options de déplacement, éditez les contrôles dans SteamVR.\nAh, et si c'était pas clair §cça désactive la téléportation!", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Vous permet de changer les touches pour le mouvement Climbey, le clavier et la réalité mixte. Redémarrage nécessaire.\n\nVous vous débrouillez après, par contre.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Quels mondes devraient être affichés au démarrage.\n\nSI aucun monde n'est trouvé, les mondes officiels seront utilisés.", - "vivecraft.options.HRTF_SELECTION.tooltip": "Le profile HRTF a utiliser pour la simulation de son 3D. La qualité peut varier en fonction du casque et des pilotes.\n\n Non: Désactive le système HRTF.\n Défaut: Utilise le profile HRTF par défaut.\n Autres: Utilise un profile HRTF spécifique.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Recharge la configuration de la caméra depuis ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Le nombre de \"ticks\" entre chaque clic droit lorsque la touche est enfoncée.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Si activé, vous permet de toucher les animaux pour faire les actions du clic droit. Désactiver pour donner des coups de poing à des pauvres cochons. Sale monstre.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Champ de vision de la caméra de capture d'écran portable.", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Résolution de la caméra de capture d'écran portable, pour des captures plus grandes qu'à la normale.\nIncompatible avec les shaders.\n§cWARNING: Nécessite un ordinateur très puissant!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Afficher le modèle de la caméra (seulement dans le casque) représentant où le casque de réalité mixte ou la caméra à la troisième personne est positionnée. Il peut aussi être attrapé et déplacé en utilisant la touche d'interaction.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Palette de couleurs prédéfinie pour le clavier physique. Le thème personnalisé peut être modifié via keyboardtheme.txt dans le répertoire du jeu. Il sera rechargé à chaque fois que le clavier est ouvert, pour permettre des ajustements en temps réel.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "Je ne peux pas voir", - "vivecraft.options.yes": "Oui", - "vivecraft.options.no": "Non", - "vivecraft.options.weaponcollision.auto": "Automatique", - "vivecraft.options.default": "Défaut", - "vivecraft.options.opaque": "Opaque", - "vivecraft.options.mirrormode.off": "Désactivé (Rapide)", - "vivecraft.options.mirrormode.dual": "Duo (Rapide)", - "vivecraft.options.mirrormode.single": "Seul (Rapide)", - "vivecraft.options.mirrormode.firstperson": "1ère Personne (lent)", - "vivecraft.options.mirrormode.thirdperson": "3ème Personne (lent)", - "vivecraft.options.mirrormode.mixedreality": "Réalité mixte (Lent)", - "vivecraft.options.mirrormode.cropped": "Recadré (Rapide)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Gauche", - "vivecraft.options.right": "Droite", - "vivecraft.options.color.black": "Noir", - "vivecraft.options.color.red": "Rouge", - "vivecraft.options.color.yellow": "Jaune", - "vivecraft.options.color.green": "Vert", - "vivecraft.options.color.cyan": "Cyan", - "vivecraft.options.color.blue": "Bleu", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Côte-a-côte", - "vivecraft.options.hudlock.hand": "Main", - "vivecraft.options.hudlock.head": "Tête", - "vivecraft.options.hudlock.wrist": "Poignet", - "vivecraft.options.renderpointerelement.always": "Toujours", - "vivecraft.options.renderpointerelement.withhud": "Avec ATH", - "vivecraft.options.renderpointerelement.never": "Jamais", - "vivecraft.options.chatnotifications.none": "Aucun", - "vivecraft.options.chatnotifications.haptic": "Haptique", - "vivecraft.options.chatnotifications.sound": "Son", - "vivecraft.options.chatnotifications.both": "Les deux", - "vivecraft.options.always": "Toujours", - "vivecraft.options.seated": "Assis", - "vivecraft.options.standing": "Debout", - "vivecraft.options.inertiafactor.none": "Rien, que dalle", - "vivecraft.options.inertiafactor.normal": "Normale", - "vivecraft.options.inertiafactor.large": "Beaucoup", - "vivecraft.options.inertiafactor.massive": "Encore plus", - "vivecraft.options.smooth": "Fluide", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Réticule", - "vivecraft.options.freemove.controller": "Manette", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Sur-place (Run-In-Place)", - "vivecraft.options.freemove.room": "Salle", - "vivecraft.options.hold": "Tenir", - "vivecraft.options.press": "Appuyer", - "vivecraft.options.keyboard.physical": "Physique", - "vivecraft.options.keyboard.pointer": "Pointeur", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blocs", - "vivecraft.options.teleport": "Téléportation", - "vivecraft.options.freemove": "Déplacement libre", - "vivecraft.options.menuworld.both": "Officiel & Customisé", - "vivecraft.options.menuworld.custom": "Customisé uniquement", - "vivecraft.options.menuworld.official": "Officiel uniquement", - "vivecraft.options.menuworld.none": "Aucun ", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Lent", - "vivecraft.options.rightclickdelay.slower": "Plus lent", - "vivecraft.options.rightclickdelay.slowest": "Le plus lent possible!", - "vivecraft.options.keyboardtheme.default": "Blanc", - "vivecraft.options.keyboardtheme.red": "Rouge", - "vivecraft.options.keyboardtheme.green": "Vert", - "vivecraft.options.keyboardtheme.blue": "Bleu", - "_comment12": "vivecraft.options.keyboardtheme.black=Void", - "vivecraft.options.keyboardtheme.grass": "Bloc d'herbe", - "_comment13": "vivecraft.options.keyboardtheme.bees=Bumblebee", - "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§dh§bé§dt§bi§dq§bu§de", - "_comment14": "vivecraft.options.keyboardtheme.dose=Medicine", - "vivecraft.options.keyboardtheme.custom": "Personnalisé", - "_comment15": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Nettoyer", - "vivecraft.gui.loaddefaults": "Charger les paramètres par défaut", - "vivecraft.gui.menuworld.refresh": "Actualiser le monde du menu", - "vivecraft.gui.menuworld.loadnew": "Changer un nouveau monde du menu", - "vivecraft.gui.radialmenu.mainset": "Ensemble principal", - "vivecraft.gui.radialmenu.alternateset": "Ensemble alternatif", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Commandes", - "vivecraft.gui.overlay": "Overlay", - "vivecraft.gui.profiler": "Profileur", - "vivecraft.gui.screenshot": "Capture d'écran", - "vivecraft.gui.calibrateheight": "Calibrer la hauteur", - "vivecraft.gui.alignkatwalk": "Aligner le KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Bouger caméra 3ᵉ pers.", - "vivecraft.gui.social": "Social", - "_comment16": "Items", - "vivecraft.item.jumpboots": "Bottes de saut", - "vivecraft.item.climbclaws": "Griffes d'escalade", - "vivecraft.item.telescope": "La moitié d'une paire de jumelles", - "_comment17": "Messages", - "vivecraft.messages.seatedmode": "Le passage en mode assis va désactiver l'entrée de commandes avec vos manettes? Voulez vous continuer?", - "vivecraft.messages.radialmenubind.1": "Veuillez affecter une touche pour \"Ouvrir le menu radial\"", - "vivecraft.messages.radialmenubind.2": "Restez appuyé sur Maj. avec le menu radial ouvert pour passer à cet ensemble.", - "vivecraft.messages.controls.1": "Les contrôles sont gérés par SteamVR, si vous voulez les changer, passez par SteamVR!", - "vivecraft.messages.controls.2": "Allez dans Paramètres>Manettes>Changer les contrôles dans le tableau de bord.", - "vivecraft.messages.controls.3": "§6Steam doit être en marche §oavant que§r§6 SteamVR soit lancé, sinon les commandes ne seront pas sauvegardées.", - "vivecraft.messages.serverplugin": "Mod/Plugin Vivecraft détecté sur le serveur: %s", - "vivecraft.messages.noserverplugin": "Vivecraft pour serveurs non détecté. Ce serveur pourrait ne pas supporter la téléportation. Dans le doute, on va restreindre vos déplacements. Ne le prenez pas mal hein, c'est pas contre vous.", - "vivecraft.messages.calibrateheight": "Calibrez votre hauteur dans le menu pause.", - "vivecraft.messages.rendersetupfailed": "Erreur d'affichage! (Render setup failed: %s) ", - "vivecraft.messages.intelgraphics": "Les graphismes intégrés d'Intel ne sont pas supportés. Si ceci est un PC portable, veuillez forcer l'utilisation de la carte vidéo. Carte vidéo détectée: %s", - "vivecraft.messages.nosteamvr": "Runtime d'OpenVR non détecté, avez vous installé SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "Exportation du monde finie... Taille de la zone: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Sauvegardé sur %s", - "vivecraft.messages.menuworldexportclientwarning": "§cATTENTION: Sauvegarde du monde utilisant un monde client. Les données pourraient être incomplètes. Il est recommandé de sauvegarder les mondes pr. le menu principal en solo.", - "vivecraft.messages.teleportdisabled": "Déplacement restreint activé. (Téléportation interdite)", - "vivecraft.messages.teleportenabled": "Déplacement non restreint. (Téléportation autorisée)", - "vivecraft.messages.walkupblocks": "Marchez sur les blocs (Ctrl droit + B): %s", - "vivecraft.messages.showaim": "Montrer la visée (Ctrl Droit+Maj. droit): activé", - "vivecraft.messages.playerinertia": "Inertie du joueur (Ctrl gauche + I): %s", - "vivecraft.messages.movementmodeswitch": "Mode de déplacement changé a: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Tangage: %.1f Lacet: %.1f Roulis: %.1f", - "vivecraft.messages.heightset": "Hauteur du joueur définie sur: %d%%" -} \ No newline at end of file + "_comment0": "Contributors: PierraNova, tomaveclevdsl, Weelobeae, Silinox, AkitakeKun, tommoron66, dangerousones, coco875, tinato, vgtom4, TheComputerHead", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Case suivante", + "vivecraft.key.hotbarPrev": "Case précédente", + "vivecraft.key.hotbarScroll": "Faire défiler la barre d'action", + "vivecraft.key.hotbarSwipeX": "Défiler (Gauche/Droite)", + "vivecraft.key.hotbarSwipeY": "Défiler (Haut/Bas)", + "vivecraft.key.rotateLeft": "Rotation à gauche", + "vivecraft.key.rotateRight": "Rotation à droite", + "vivecraft.key.rotateAxis": "Rotation uniquement", + "vivecraft.key.rotateFree": "Rotation libre", + "vivecraft.key.walkabout": "\"Walkabout\"", + "vivecraft.key.teleport": "Téléportation", + "vivecraft.key.teleportFallback": "Avancer lorsque la téléportation est désactivée", + "vivecraft.key.freeMoveRotate": "Déplacement/Rotation", + "vivecraft.key.freeMoveStrafe": "Déplacement/Strafe", + "vivecraft.key.toggleMovement": "Changer type de déplacement", + "vivecraft.key.quickTorch": "Torche rapide", + "vivecraft.key.ingameMenuButton": "Menu", + "vivecraft.key.exportWorld": "Exporter un fond avec votre monde", + "vivecraft.key.radialMenu": "Ouvrir le menu radial", + "vivecraft.key.swapMirrorView": "Échanger vue du bureau", + "vivecraft.key.toggleKeyboard": "Montrer le clavier", + "vivecraft.key.moveThirdPersonCam": "Bouger caméra 3ème personne", + "vivecraft.key.togglePlayerList": "Afficher la liste de joueurs", + "vivecraft.key.toggleHandheldCam": "Activer/désactiver la caméra", + "vivecraft.key.quickHandheldCam": "Caméra rapide", + "vivecraft.key.trackpadTouch": "Touché du pavé tactile", + "vivecraft.key.vrInteract": "Interactions contextuelles", + "vivecraft.key.guiLeftClick": "Clic gauche", + "vivecraft.key.guiRightClick": "Clic droit", + "vivecraft.key.guiMiddleClick": "Clic molette", + "vivecraft.key.guiShift": "Maj. gauche", + "vivecraft.key.guiCtrl": "Ctrl gauche", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Défiler en haut", + "vivecraft.key.guiScrollDown": "Défiler en bas", + "vivecraft.key.guiScrollAxis": "Défiler", + "vivecraft.key.keyboardClick": "Clic", + "vivecraft.key.keyboardShift": "Maj. gauche", + "vivecraft.key.climbeyGrab": "Griffes d'escalade", + "vivecraft.key.climbeyJump": "Bottes de Saut", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "Interface", + "vivecraft.key.category.climbey": "Déplacement à-la \"Climbey\"", + "vivecraft.key.category.keyboard": "Clavier", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "En jeu", + "vivecraft.actionset.gui": "Interface", + "vivecraft.actionset.global": "Global", + "vivecraft.actionset.mod": "Modée", + "vivecraft.actionset.contextual": "Contextuel", + "vivecraft.actionset.keyboard": "Clavier", + "vivecraft.actionset.mixedReality": "Réalité mixte", + "vivecraft.actionset.technical": "Technique", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "Paramètres VR", + "vivecraft.options.screen.freemove": "Paramètres de déplacement libre", + "vivecraft.options.screen.gui": "Paramètres de l'interface", + "vivecraft.options.screen.menuworld": "Paramètres monde menu principal", + "vivecraft.options.screen.guiother": "Paramètres de discussion/réticule", + "vivecraft.options.screen.quickcommands": "Commandes rapides", + "vivecraft.options.screen.radialmenu": "Configuration du menu radial", + "vivecraft.options.screen.stereorendering": "Paramètres de l'affichage Stéréo", + "vivecraft.options.screen.roomscale": "Paramètres d’interactions à l'échelle de la pièce", + "vivecraft.options.screen.seated": "Paramètres assis", + "vivecraft.options.screen.standing": "Paramètres de Locomotion sur place", + "vivecraft.options.screen.teleport": "Paramètres de téléportation", + "vivecraft.options.screen.controls": "Paramètres de manette", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "Paramètres VR...", + "vivecraft.options.screen.gui.button": "Paramètres de l'interface...", + "vivecraft.options.screen.stereorendering.button": "Affichage Stéréo", + "vivecraft.options.screen.quickcommands.button": "Commandes rapides", + "vivecraft.options.screen.guiother.button": "Paramètres du réticule...", + "vivecraft.options.screen.standing.button": "Paramètres de locomotion...", + "vivecraft.options.screen.roomscale.button": "Paramètres d'interaction...", + "vivecraft.options.screen.controls.button": "Paramètres du manette...", + "vivecraft.options.screen.radialmenu.button": "Menu radial...", + "vivecraft.options.screen.seated.button": "Paramètres du mode assis...", + "vivecraft.options.screen.menuworld.button": "Paramètres monde menu principal...", + "vivecraft.options.screen.teleport.button": "Paramètres de téléportation...", + "vivecraft.options.screen.freemove.button": "Paramètres de déplacement libre...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Taille de l'ATH", + "vivecraft.options.HUD_DISTANCE": "Distance de l'ATH", + "vivecraft.options.HUD_LOCK_TO": "Verrouiller l'orientation de l'ATH", + "vivecraft.options.HUD_OPACITY": "Opacité de l'ATH", + "vivecraft.options.HUD_HIDE": "Cacher l'ATH (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "Fond de l'interface", + "vivecraft.options.HUD_OCCLUSION": "Occlusion de l'ATH", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Suivre visage ds. menu princi.", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Occlusion du réticule", + "vivecraft.options.CROSSHAIR_SCALE": "Taille du réticule", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Taille du réticule dans les menus", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Afficher le réticule", + "vivecraft.options.CHAT_NOTIFICATIONS": "Notification de chat", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Son de notification", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Taille du curseur", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Afficher Contours Blocs", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Toujours afficher clavier", + "vivecraft.options.RADIAL_MODE_HOLD": "Mode du menu radiale", + "vivecraft.options.PHYSICAL_KEYBOARD": "Type du clavier", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Taille du clavier", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Apparaître sur bloc", + "vivecraft.options.FSAA": "Algorithme de Lanczos", + "vivecraft.options.MIRROR_DISPLAY": "Miroiter jeu sur bureau", + "vivecraft.options.MIRROR_EYE": "Miroiter oeil", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Couleur Clé Chroma", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Afficher les mains", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Disposition", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Nombre de \"passes\" anti-distorsion", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Masque alpha", + "vivecraft.options.MIXED_REALITY_FOV": "Champ de vis. du camera troisième personne", + "vivecraft.options.WALK_UP_BLOCKS": "Marcher au dessus des blocs", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Multi. vitesse", + "vivecraft.options.INERTIA_FACTOR": "Inertie du joueur", + "vivecraft.options.SIMULATE_FALLING": "Simuler la chute", + "vivecraft.options.WEAPON_COLLISION": "Collision des armes", + "vivecraft.options.ALLOW_CRAWLING": "Ramper à l'échelle d'une pièce", + "vivecraft.options.LIMIT_TELEPORT": "Restrictions en mode Survie", + "vivecraft.options.REVERSE_HANDS": "Inverser Les Mains", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Utiliser le Pochoir a œil ", + "vivecraft.options.BCB_ON": "Montre la position du corps", + "vivecraft.options.WORLD_SCALE": "Taille du monde", + "vivecraft.options.WORLD_ROTATION": "Rotation du monde", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Incréments de rotation", + "vivecraft.options.TOUCH_HOTBAR": "Interaction avec la barre d'action activée", + "vivecraft.options.PLAY_MODE_SEATED": "Mode de jeu", + "vivecraft.options.RENDER_SCALEFACTOR": "Résolution", + "vivecraft.options.MONO_FOV": "Champ de vis. sans distorsions", + "vivecraft.options.REALISTIC_JUMP": "Sauter à l'échelle d'une pièce", + "vivecraft.options.REALISTIC_SNEAK": "S'accroupir à l'échelle d'une pièce", + "vivecraft.options.PHYSICAL_GUI": "Interface physique", + "vivecraft.options.REALISTIC_CLIMB": "Monter à l'échelle d'une pièce", + "vivecraft.options.REALISTIC_SWIM": "Nager a l'échelle d'une pièce", + "vivecraft.options.REALISTIC_ROW": "Aviron à l'échelle d'une pièce", + "vivecraft.options.WALK_MULTIPLIER": "Multi. marche Roomscale", + "vivecraft.options.FREEMOVE_MODE": "Type de déplacement libre", + "vivecraft.options.VEHICLE_ROTATION": "Rotation dans un véhicule", + "vivecraft.options.RESET_ORIGIN": "Réinitialiser l'origine", + "vivecraft.options.X_SENSITIVITY": "Vitesse du rotation", + "vivecraft.options.Y_SENSITIVITY": "Sensibilité verticale/\"Y\"", + "vivecraft.options.KEYHOLE": "Trou de serrure", + "vivecraft.options.FOV_REDUCTION": "Réduc. champ de vis. pr. confort", + "vivecraft.options.FOV_REDUCTION_MIN": "Taille réduc. champ de vis.", + "vivecraft.options.FOV_REDUCTION_OFFSET": "Décalage réduc. champ de vis.", + "vivecraft.options.SEATED_HMD": "Vers l'avant", + "vivecraft.options.SEATED_HUD_XHAIR": "Faire suivre l'ATH", + "vivecraft.options.BACKPACK_SWITCH": "Changer le mode de sac à dos", + "vivecraft.options.ANALOG_MOVEMENT": "Déplacement analogue", + "vivecraft.options.AUTO_SPRINT": "Auto-sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Limite auto-sprint", + "vivecraft.options.BOW_MODE": "Arc à l'échelle d'une pièce", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limite vers le bas", + "vivecraft.options.TELEPORT_UP_LIMIT": "Limite vers le haut", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Limite de distance", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Autoriser décalage du point d'origine", + "vivecraft.options.SEATED_FREE_MOVE": "Changer type de déplacement", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forcer le déplacement libre", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Afficher contrôles avancés", + "vivecraft.options.MENU_WORLD_SELECTION": "Mondes", + "vivecraft.options.HRTF_SELECTION": "Audio directionnel (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Recharger la caméra externe", + "vivecraft.options.RIGHT_CLICK_DELAY": "Répéter clic droit", + "vivecraft.options.ANIMAL_TOUCHING": "Toucher les animales", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Champ de vis. caméra", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Résolution de la caméra", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Afficher Modèle Caméra", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Thème du clavier", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "La taille relative que l'ATH prend dans le champ de vis. Les unités sont relatives, ni des degrés ni des fractions du champ de vis. etc..", + "vivecraft.options.HUD_DISTANCE.tooltip": "La distance à laquelle l'ATH flottant est affiché devant vous. La taille relative de l'ATH n'est pas affectée par ce paramètre. La distance est en mètres (mais n'est pas obstrué par des blocs).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Spécifie à quelle orientation l'ATH sera bloqué.\n Main: L'ATH s'affichera juste au dessus de la main non-principale.\n Tête: L'ATH s'affichera droit devant votre champ de vis.\n Poignet: L'ATH apparaîtra à l'intérieur de votre main non-principale. Il ne deviendra visible qu'en regardant la paume.", + "vivecraft.options.HUD_OPACITY.tooltip": "La transparence de l'ATH et de l'interface.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Spécifie si l'interface graphique doit avoir un fond semi-transparent ou non.\n Oui: fonds semi-transparents dans les menus.\n Non: aucun fond dans les menus.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Spécifie si l'ATH doit être obstrué par des objets proches.\n Oui: L'ATH sera caché par des objets proches. Peut être complétement caché dans des environnements confinés.\n Non: L'ATH sera toujours visible. Des problèmes de profondeur Stéréo pourraient être visibles.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Spécifie si le menu principal suit votre regard.\n Assis: Le menu principal ne suivra qu'en mode assis.\n Toujours: Le menu principal suivra toujours.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Règle la taille du curseur hors-menus.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Règle la taille du curseur dans les menus.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Règle le mode d'affichage du curseur.\n Toujours: Le curseur sera toujours affiché, même si l'ATH ne l'est pas.\n Avec ATH: Le curseur ne sera affiché que quand l'ATH l'est.\n Jamais: Le curseur n'est jamais affiché.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Séléctionne ce qu'il se passe lorsque vous recevez un message sur le chat.\n Rien: Rien.\n Haptique: Vibration sur la manette de gauche.\n Son: Joue un bruit de notification.\n Les deux: A ton avis?", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Séléctionne le bruit de notification.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Détermine comment le curseur doit changer avec la distance.\n Oui: Le curseur grossira pour garder la même taille relative à votre vue.\n Non: Le curseur rétrécira avec la distance.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Séléctionne le mode d'affichage du contour des blocs.\n Toujours: Le contour des blocs sera toujours affiché même lorsque l'ATH est désactivé.\n Avec l'ATH: Le contour des blocs ne sera affiché que si l'ATH l'est aussi.\n Jamais: Le contour des blocs n'est jamais affiché.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Si désactivé, le clavier ne s'ouvrira que quand vous cliquerez sur un champ de texte, ou si un champ de texte ne peut s'enlever.\n\nSi activé, le clavier s'ouvrira automatiquement dès qu'un champ de texte apparaît.\n(Attention, peut s'ouvrir involontairement avec certains mods!)", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Le comportement du menu radial lorsque la touche est appuyée.\n Maintenir: Il faut garder la touche enfoncée, glisser sur la sélection et relâcher.\n Appuyer: Il faut appuyer sur le bouton, cliquer sur la sélection et de nouveau appuyer sur la touche.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Le type de clavier VR que vous souhaitez utiliser.\n Physique: Un clavier apparaîtra dans lequel vous pourrez taper comme un vrai clavier.\n Pointeur: Un clavier qu'on utilise en cliquant sur des lettres avec les touches des manettes.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "La taille du clavier physique, par rapport à sa taille par défaut.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Si activé, l'interface graphique pour les blocs (tels que les coffres et les fours) sera placée au dessus du bloc. Sinon, elle sera dans la position habituelle.", + "vivecraft.options.FSAA.tooltip": "Utilise une méthode plus complexe de sur-échantillonage du jeu avant d'envoyer au casque. Marche mieux avec de hautes échelles de rendu.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Miroite les images du casque sur le bureau. Peut être réglé sur Désactivé, Seul ou Duo (un œil miroité ou deux), en première-personne sans distorsions, troisième personne sans distorsions et en réalité mixte. Les vues sans distorsions et en réalité mixte affectent les performances.", + "vivecraft.options.MIRROR_EYE.tooltip": "Quel oeil est utilisé pour les modes d'affichage coupé et seul.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "La couleur mise dans les zones \"transparentes\" de la vue en réalité mixte. D'autres couleurs similaires dans le jeu n'apparaîtront pas afin d'empêcher que des choses pas super réglo arrivent..", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Affiche les mains en vue en réalité mixte. N'affecte que l'affichage des mains, les objets seront quand même affichés.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Choisissez entre la mise en page style \"Unity\" à 4 panneaux, ou 2 panneaux côte-à-côte.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Inclure une vue sans distorsions en mise en page 4 panneaux. Requiert un passe d'affichage en plus. Sinon la vue du casque sera utilisée.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "Dans la mise en page Unity, si activé, affichera un masque alpha \"greyscale\" quart en haut à droite (comme Unity) utilisé pour masquer la couche au premier plan. Sinon, le premier plan sera déssiné avec la couleur de clé pour utilisation avec l'effet couleur de clé.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "Le champ de vis. du mode réalité mixte", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Vous permet de sélectionner la capacité à marcher au dessus des blocs sans avoir à sauter. (Raccourci: Ctrl Droit + B)\n§cATTENTION: Peut causer des alertes anti-triche si utilisé sur un serveur multijoueur!\n Non: (Défaut) Vous devrez sauter au dessus des blocs.\n Oui: Vous pouvez marcher au dessus des blocs. Peut aider contre la nausée liée au déplacement libre.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Séléctionne un multiplicateur de mouvement, permettant des mouvements plus lents que par défaut. Peut aider contre la nausée causée par le déplacement.\n§cATTENTION: Peut causer des alertes anti-triche si utilisé sur un serveur multijoueur!\nLa valeur par défaut est celle de Minecraft de base (1.0)", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Sélectionne la puissance d'inertie sur le joueur. Une inertie plus faible se traduit en une accélération plus rapide, et vice versa. Une inertie élevée peut réduire la nausée, mais faites gaffe aux précipices.\n Normal: inertie par défaut.\n Rien, que dalle < Normal < Beaucoup < Encore plus. N'affecte pas la lave, l'eau ou les sauts.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Si activé le joueur tombera au sol en mode téléportation si au dessus du vide. Permet aussi de sauter. Ne permet pas de téléporter du pain. Désolé.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Permet de taper les blocs et les entités avec vos armes.\nAutomatiquement activé en survie et désactivé en créatif.\n(En gros ça active les collisions avec les armes/outils.)", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Si activé, vous permet de ramper sous les blocs. On dit pas que quand c'est désactivé vous pouvez pas ramper, c'est juste que ça marchera pas.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "Si activé, la téléportation aura des restrictions en mode Survie. Elle ne sera pas capable de sauter sur les côtés des blocs, elle consommera de la nourriture et aura une barre d'énergie qui se remplira avec le temps.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Echange les mains dominantes et secondaires.\n Oui: Main gauche dominante.\n Non: Main droite dominante (par défaut)\n\n§cPour échanger les touches, relancez le jeu et vérifiez que les contrôles par défaut sont utilisés sur SteamVR!", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Masque les zones de l'écran en dehors du champ de vis. Améliore les performances.", + "vivecraft.options.BCB_ON.tooltip": "Montre la position de votre corps avec une ombre carrée sur le sol.\nC'est votre propre ombre. Rien que pour vous.\n§4Si vous la perdez, aucun problème on la remplace!", + "vivecraft.options.WORLD_SCALE.tooltip": "Change la taille du joueur par rapport au monde. Des valeurs au dessus de un vous rendent plus grand et vice-versa.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Donne une rotation en plus à votre casque.\nPlus utile si affecté a une touche ou changé avec les flèches directionnelles. ", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Le nombre de degrés de rotation quand vous changez de rotation.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Si activé, vous permet de toucher la barre d'action avec votre main principale pour sélectionner un objet.\n(Faites gaffe: c'est vachement cool.)", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Jouer en mode debout ou assis.\nSpoiler: Jouer debout c'est vachement mieux.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "La résolution interne du jeu, relative à la résolution du casque. Des valeurs plus élevées améliorent la qualité en échange de performances. C'est en gros du suréchantillonage.", + "vivecraft.options.MONO_FOV.tooltip": "Le champ de vision utilisé pour le mode sans distorsions.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "SI activé, vous permet de sauter dans le jeu en sautant dans la vraie vie. Au fait, ça active les bottes de saut.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Si activé, quand vous serez accroupis dans la vraie vie, vous le serez aussi dans le jeu. Sympa, hein?", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Si activé, l'interface graphique sera remplacée par des modèles en 3D interactifs.\nSi le sac-à-dos est activé, mettre la main à votre dos va afficher votre inventaire.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Si activé, permet de grimper aux échelles et au vignes en les touchant. Active aussi les griffes d'escalade. (Oui on a ça.)", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Si activé, permet de nager en brassant avec les manettes.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Permet de ramer en bougeant vos bras vachement fort.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Multiplie votre position dans la salle par un facteur.\nVous permet de marcher un peu plus, mais peut causer la nausée.\n(Si vous vomissez, c'est pas notre faute!)", + "vivecraft.options.FREEMOVE_MODE.tooltip": "Ce qui contrôle la direction en déplacement libre.\n\n Manette: la manette de la main secondaire contrôle la direction.\n Casque: le casque contrôle la direction.\n Sur-place: la direction est déterminée par comment les manettes bougent.\n Salle: Lacet est relatif a la salle, Tangage est le casque. Utilise pour le VR en configuration 180 dégrée.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Conduire dans un véhicule va changer la rotation du monde avec le véhicule. Peut désorienter.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Recentre les pieds du joueur à 1,62 mètres sous la position actuelle du casque. pour des systèmes de capteurs non-absolus ou en mode assis.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Accélère la vitesse de rotation de la vue lorsque poussé sur le bord du trou de serrure.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "La vitesse verticale du curseur par rapport à la souris.", + "vivecraft.options.KEYHOLE.tooltip": "Le nombre de degrés à gauche et à droite à partir desquels la vue commencera à pivoter.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Réduit le champ de vision lorsque vous bougez. Peut aider contre la nausée.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "La taille finale de la réduction du champ de vis. pr. confort", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Décale horizontalement le centre de la réduction du champ de vision pour des casques non-standards.", + "vivecraft.options.SEATED_HMD.tooltip": "La direction dans laquelle la touche avancer va aller.\nla direction vue du casque ou réticule.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "La direction dans laquelle l'ATH sera mis.\nla direction vue du casque ou réticule.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Si activé, mettre votre main droite derrière votre tête sélectionnera automatiquement le 1er emplacement de la barre d'outils. Faire la même chose avec la main gauche vous permet de mettre des trucs dans la main non dominante. (Exemple: bouclier dans main droite > main gauche derrière tête > bouclier dans main gauche)", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "La vitesse de marche sera déterminée par la position du joystick, si la touche avancer est configurée sur un joystick.\n\nPour des contrôles complètement analogues, meilleure idée d'utiliser \"Déplacement/Strafe\" ou \"Déplacement/Rotation\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "Lors du déplacement libre, le sprint s'activera automatiquement lorsque le joystick dépassera la limite configurée.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "La limite à laquelle l'auto-sprint s'active.", + "vivecraft.options.BOW_MODE.tooltip": "Sélectionne quand utiliser l'arc à l'échelle de la pièce.\n Non: Jamais!\n Vanilla: Que pour l'arc par défaut.\n Oui: Pour tous les objets qui marchent comme des arcs.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limite le nombre de blocs que vous pouvez descendre en une téléportation.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limite le nombre de blocs que vous pouvez grimper en une téléportation.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limite la distance que vous pouvez parcourir en une téléportation.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Permet le bouton pour \"Réinitialiser l'origine\" d'être utilisé debout, pour ceux qui veulent jouer assis mais avec les manettes.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Quel mode de locomotion doit être utilisé en mode assis.\n Téléportation: Rien a ajouter je pense.\n Déplacement libre: ZQSD comme le bon vieux Minecraft de base!", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Force l'utilisation de la touche pour avancer \"d'urgence\" (bouton téléportation pr. défaut). Pour plus d'options de déplacement, éditez les contrôles dans SteamVR.\nAh, et si c'était pas clair §cça désactive la téléportation!", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Vous permet de changer les touches pour le mouvement Climbey, le clavier et la réalité mixte. Redémarrage nécessaire.\n\nVous vous débrouillez après, par contre.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Quels mondes devraient être affichés au démarrage.\n\nSI aucun monde n'est trouvé, les mondes officiels seront utilisés.", + "vivecraft.options.HRTF_SELECTION.tooltip": "Le profile HRTF a utiliser pour la simulation de son 3D. La qualité peut varier en fonction du casque et des pilotes.\n\n Non: Désactive le système HRTF.\n Défaut: Utilise le profile HRTF par défaut.\n Autres: Utilise un profile HRTF spécifique.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Recharge la configuration de la caméra depuis ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Le nombre de \"ticks\" entre chaque clic droit lorsque la touche est enfoncée.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Si activé, vous permet de toucher les animaux pour faire les actions du clic droit. Désactiver pour donner des coups de poing à des pauvres cochons. Sale monstre.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Champ de vision de la caméra de capture d'écran portable.", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Résolution de la caméra de capture d'écran portable, pour des captures plus grandes qu'à la normale.\nIncompatible avec les shaders.\n§cWARNING: Nécessite un ordinateur très puissant!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Afficher le modèle de la caméra (seulement dans le casque) représentant où le casque de réalité mixte ou la caméra à la troisième personne est positionnée. Il peut aussi être attrapé et déplacé en utilisant la touche d'interaction.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Palette de couleurs prédéfinie pour le clavier physique. Le thème personnalisé peut être modifié via keyboardtheme.txt dans le répertoire du jeu. Il sera rechargé à chaque fois que le clavier est ouvert, pour permettre des ajustements en temps réel.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "Je ne peux pas voir", + "vivecraft.options.yes": "Oui", + "vivecraft.options.no": "Non", + "vivecraft.options.weaponcollision.auto": "Automatique", + "vivecraft.options.default": "Défaut", + "vivecraft.options.opaque": "Opaque", + "vivecraft.options.mirrormode.off": "Désactivé (Rapide)", + "vivecraft.options.mirrormode.dual": "Duo (Rapide)", + "vivecraft.options.mirrormode.single": "Seul (Rapide)", + "vivecraft.options.mirrormode.firstperson": "1ère Personne (lent)", + "vivecraft.options.mirrormode.thirdperson": "3ème Personne (lent)", + "vivecraft.options.mirrormode.mixedreality": "Réalité mixte (Lent)", + "vivecraft.options.mirrormode.cropped": "Recadré (Rapide)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Gauche", + "vivecraft.options.right": "Droite", + "vivecraft.options.color.black": "Noir", + "vivecraft.options.color.red": "Rouge", + "vivecraft.options.color.yellow": "Jaune", + "vivecraft.options.color.green": "Vert", + "vivecraft.options.color.cyan": "Cyan", + "vivecraft.options.color.blue": "Bleu", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Côte-a-côte", + "vivecraft.options.hudlock.hand": "Main", + "vivecraft.options.hudlock.head": "Tête", + "vivecraft.options.hudlock.wrist": "Poignet", + "vivecraft.options.renderpointerelement.always": "Toujours", + "vivecraft.options.renderpointerelement.withhud": "Avec ATH", + "vivecraft.options.renderpointerelement.never": "Jamais", + "vivecraft.options.chatnotifications.none": "Aucun", + "vivecraft.options.chatnotifications.haptic": "Haptique", + "vivecraft.options.chatnotifications.sound": "Son", + "vivecraft.options.chatnotifications.both": "Les deux", + "vivecraft.options.always": "Toujours", + "vivecraft.options.seated": "Assis", + "vivecraft.options.standing": "Debout", + "vivecraft.options.inertiafactor.none": "Rien, que dalle", + "vivecraft.options.inertiafactor.normal": "Normale", + "vivecraft.options.inertiafactor.large": "Beaucoup", + "vivecraft.options.inertiafactor.massive": "Encore plus", + "vivecraft.options.smooth": "Fluide", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Réticule", + "vivecraft.options.freemove.controller": "Manette", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Sur-place (Run-In-Place)", + "vivecraft.options.freemove.room": "Salle", + "vivecraft.options.hold": "Tenir", + "vivecraft.options.press": "Appuyer", + "vivecraft.options.keyboard.physical": "Physique", + "vivecraft.options.keyboard.pointer": "Pointeur", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blocs", + "vivecraft.options.teleport": "Téléportation", + "vivecraft.options.freemove": "Déplacement libre", + "vivecraft.options.menuworld.both": "Officiel & Customisé", + "vivecraft.options.menuworld.custom": "Customisé uniquement", + "vivecraft.options.menuworld.official": "Officiel uniquement", + "vivecraft.options.menuworld.none": "Aucun ", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Lent", + "vivecraft.options.rightclickdelay.slower": "Plus lent", + "vivecraft.options.rightclickdelay.slowest": "Le plus lent possible!", + "vivecraft.options.keyboardtheme.default": "Blanc", + "vivecraft.options.keyboardtheme.red": "Rouge", + "vivecraft.options.keyboardtheme.green": "Vert", + "vivecraft.options.keyboardtheme.blue": "Bleu", + "_comment12": "vivecraft.options.keyboardtheme.black=Void", + "vivecraft.options.keyboardtheme.grass": "Bloc d'herbe", + "_comment13": "vivecraft.options.keyboardtheme.bees=Bumblebee", + "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§dh§bé§dt§bi§dq§bu§de", + "_comment14": "vivecraft.options.keyboardtheme.dose=Medicine", + "vivecraft.options.keyboardtheme.custom": "Personnalisé", + "_comment15": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Nettoyer", + "vivecraft.gui.loaddefaults": "Charger les paramètres par défaut", + "vivecraft.gui.menuworld.refresh": "Actualiser le monde du menu", + "vivecraft.gui.menuworld.loadnew": "Changer un nouveau monde du menu", + "vivecraft.gui.radialmenu.mainset": "Ensemble principal", + "vivecraft.gui.radialmenu.alternateset": "Ensemble alternatif", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Commandes", + "vivecraft.gui.overlay": "Overlay", + "vivecraft.gui.profiler": "Profileur", + "vivecraft.gui.screenshot": "Capture d'écran", + "vivecraft.gui.calibrateheight": "Calibrer la hauteur", + "vivecraft.gui.alignkatwalk": "Aligner le KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Bouger caméra 3ᵉ pers.", + "vivecraft.gui.social": "Social", + "_comment16": "Items", + "vivecraft.item.jumpboots": "Bottes de saut", + "vivecraft.item.climbclaws": "Griffes d'escalade", + "vivecraft.item.telescope": "La moitié d'une paire de jumelles", + "_comment17": "Messages", + "vivecraft.messages.seatedmode": "Le passage en mode assis va désactiver l'entrée de commandes avec vos manettes? Voulez vous continuer?", + "vivecraft.messages.radialmenubind.1": "Veuillez affecter une touche pour \"Ouvrir le menu radial\"", + "vivecraft.messages.radialmenubind.2": "Restez appuyé sur Maj. avec le menu radial ouvert pour passer à cet ensemble.", + "vivecraft.messages.controls.1": "Les contrôles sont gérés par SteamVR, si vous voulez les changer, passez par SteamVR!", + "vivecraft.messages.controls.2": "Allez dans Paramètres>Manettes>Changer les contrôles dans le tableau de bord.", + "vivecraft.messages.controls.3": "§6Steam doit être en marche §oavant que§r§6 SteamVR soit lancé, sinon les commandes ne seront pas sauvegardées.", + "vivecraft.messages.serverplugin": "Mod/Plugin Vivecraft détecté sur le serveur: %s", + "vivecraft.messages.noserverplugin": "Vivecraft pour serveurs non détecté. Ce serveur pourrait ne pas supporter la téléportation. Dans le doute, on va restreindre vos déplacements. Ne le prenez pas mal hein, c'est pas contre vous.", + "vivecraft.messages.calibrateheight": "Calibrez votre hauteur dans le menu pause.", + "vivecraft.messages.rendersetupfailed": "Erreur d'affichage! (Render setup failed: %s) ", + "vivecraft.messages.intelgraphics": "Les graphismes intégrés d'Intel ne sont pas supportés. Si ceci est un PC portable, veuillez forcer l'utilisation de la carte vidéo. Carte vidéo détectée: %s", + "vivecraft.messages.nosteamvr": "Runtime d'OpenVR non détecté, avez vous installé SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "Exportation du monde finie... Taille de la zone: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Sauvegardé sur %s", + "vivecraft.messages.menuworldexportclientwarning": "§cATTENTION: Sauvegarde du monde utilisant un monde client. Les données pourraient être incomplètes. Il est recommandé de sauvegarder les mondes pr. le menu principal en solo.", + "vivecraft.messages.teleportdisabled": "Déplacement restreint activé. (Téléportation interdite)", + "vivecraft.messages.teleportenabled": "Déplacement non restreint. (Téléportation autorisée)", + "vivecraft.messages.walkupblocks": "Marchez sur les blocs (Ctrl droit + B): %s", + "vivecraft.messages.showaim": "Montrer la visée (Ctrl Droit+Maj. droit): activé", + "vivecraft.messages.playerinertia": "Inertie du joueur (Ctrl gauche + I): %s", + "vivecraft.messages.movementmodeswitch": "Mode de déplacement changé a: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Tangage: %.1f Lacet: %.1f Roulis: %.1f", + "vivecraft.messages.heightset": "Hauteur du joueur définie sur: %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/nl_nl.json b/common/src/main/resources/assets/vivecraft/lang/nl_nl.json index c797fc227..b55928c7b 100644 --- a/common/src/main/resources/assets/vivecraft/lang/nl_nl.json +++ b/common/src/main/resources/assets/vivecraft/lang/nl_nl.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: marijnessen, Lelebees, BlockBanana123, twjfransen, stijnotter, ZeeuwsGamertje, MarijnIsN00B, putper", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Hotbar Volgende", - "vivecraft.key.hotbarPrev": "Hotbar Vorige", - "vivecraft.key.hotbarScroll": "Hotbar Scroll", - "vivecraft.key.hotbarSwipeX": "Hotbar Veeg (Links/Rechts)", - "vivecraft.key.hotbarSwipeY": "Hotbar Veeg (Omhoog/Omlaag)", - "vivecraft.key.rotateLeft": "Draai Links", - "vivecraft.key.rotateRight": "Draai Rechts", - "vivecraft.key.rotateAxis": "Alleen Draaien", - "vivecraft.key.rotateFree": "Vrij draaien", - "vivecraft.key.walkabout": "Rondgang", - "vivecraft.key.teleport": "Teleporteer", - "vivecraft.key.teleportFallback": "Loop Vooruit Als Teleporteren Uitgeschakeld is", - "vivecraft.key.freeMoveRotate": "Beweeg/Draai", - "vivecraft.key.freeMoveStrafe": "Beweeg/Loop Zijwaarts", - "vivecraft.key.toggleMovement": "Verander Bewegingsmodus", - "vivecraft.key.quickTorch": "Snelle Fakkel", - "vivecraft.key.ingameMenuButton": "Spelmenu", - "vivecraft.key.exportWorld": "Exporteer Menuwereld", - "vivecraft.key.radialMenu": "Open Radiaal Menu", - "vivecraft.key.swapMirrorView": "Wissel Spiegelweergave", - "vivecraft.key.toggleKeyboard": "Toon/Verberg Toetsenbord", - "vivecraft.key.moveThirdPersonCam": "Verplaats Derde Persoon Camera", - "vivecraft.key.togglePlayerList": "Spelerslijst Wisselen", - "vivecraft.key.toggleHandheldCam": "Camera Aanpassen", - "vivecraft.key.quickHandheldCam": "Snelle Camera", - "vivecraft.key.trackpadTouch": "Trackpad Aanraking", - "vivecraft.key.vrInteract": "Contextuele Interactie", - "vivecraft.key.guiLeftClick": "Linkermuisklik", - "vivecraft.key.guiRightClick": "Rechtermuisklik", - "vivecraft.key.guiMiddleClick": "Middelmuisklik", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Scroll Omhoog", - "vivecraft.key.guiScrollDown": "Scroll Omlaag", - "vivecraft.key.guiScrollAxis": "Scroll", - "vivecraft.key.keyboardClick": "Klik", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Klimklauwen", - "vivecraft.key.climbeyJump": "Springschoenen", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "Climbey Beweging", - "vivecraft.key.category.keyboard": "Toetsenbord", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "In-Spel", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "Globaal", - "vivecraft.actionset.mod": "Gemodificeerd", - "vivecraft.actionset.contextual": "Contextueel", - "vivecraft.actionset.keyboard": "Toetsenbord", - "vivecraft.actionset.mixedReality": "Gemengde Realiteit", - "vivecraft.actionset.technical": "Technisch", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "VR Instellingen", - "vivecraft.options.screen.freemove": "Vrij Bewegen Instellingen", - "vivecraft.options.screen.gui": "HUD en GUI Instellingen", - "vivecraft.options.screen.menuworld": "Menu Wereld Instellingen", - "vivecraft.options.screen.guiother": "Chat/Crosshair Instellingen", - "vivecraft.options.screen.quickcommands": "Snelle Commando's", - "vivecraft.options.screen.radialmenu": "Radiaal Menu Configuratie", - "vivecraft.options.screen.stereorendering": "Stereo Renderer Instellingen", - "vivecraft.options.screen.roomscale": "Kamerschaal Interactie Instellingen", - "vivecraft.options.screen.seated": "Zittend Instellingen", - "vivecraft.options.screen.standing": "Staand Bewegen Instellingen", - "vivecraft.options.screen.teleport": "Teleporteer-Instellingen", - "vivecraft.options.screen.controls": "Bedienings-Instellingen", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR Instellingen...", - "vivecraft.options.screen.gui.button": "HUD en GUI Instellingen...", - "vivecraft.options.screen.stereorendering.button": "Stereo Renderen...", - "vivecraft.options.screen.quickcommands.button": "Snelle Commando's...", - "vivecraft.options.screen.guiother.button": "Chat & Crosshair Instellingen...", - "vivecraft.options.screen.standing.button": "Bewegings-Instellingen...", - "vivecraft.options.screen.roomscale.button": "Interactie Instellingen...", - "vivecraft.options.screen.controls.button": "Bedienings Instellingen...", - "vivecraft.options.screen.radialmenu.button": "Radiaal Menu...", - "vivecraft.options.screen.seated.button": "Zittend Instellingen...", - "vivecraft.options.screen.menuworld.button": "Menu Wereld Instellingen...", - "vivecraft.options.screen.teleport.button": "Teleporteer-Instellingen...", - "vivecraft.options.screen.freemove.button": "Vrij Bewegen Instellingen...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Hoofd HUD Grootte", - "vivecraft.options.HUD_DISTANCE": "Hoofd HUD Afstand", - "vivecraft.options.HUD_LOCK_TO": "HUD Oriëntatie Slot", - "vivecraft.options.HUD_OPACITY": "HUD Doorzichtigheid", - "vivecraft.options.HUD_HIDE": "Verberg HUD (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Achtergrond", - "vivecraft.options.HUD_OCCLUSION": "HUD Occlusie", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Hoofdmenu Volg", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusie", - "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Grootte", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Grootte", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Toon Crosshair", - "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Meldingen", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Meldingsgeluid", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Schaling", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Toon Blokomlijning", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Toetsenbord Altijd Openen", - "vivecraft.options.RADIAL_MODE_HOLD": "Radiaal Menu Modus", - "vivecraft.options.PHYSICAL_KEYBOARD": "Toetsenbordtype", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Toetsenbordgrootte", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Verschijnen boven blok", - "vivecraft.options.FSAA": "Lanczos Scaler", - "vivecraft.options.MIRROR_DISPLAY": "Bureaublad Spiegel", - "vivecraft.options.MIRROR_EYE": "Spiegeloog", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Sleutel kleur", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Toon Handen", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Indeling", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Onvervormde Pas", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alfamasker", - "vivecraft.options.MIXED_REALITY_FOV": "Gezichtsveld Derde Persoon", - "vivecraft.options.WALK_UP_BLOCKS": "Loop Blokken Op", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Bewegingssnelheid Vermenigvuldiger", - "vivecraft.options.INERTIA_FACTOR": "Speler Traagheid", - "vivecraft.options.SIMULATE_FALLING": "Simuleer Vallen", - "vivecraft.options.WEAPON_COLLISION": "Wapens Botsen", - "vivecraft.options.ALLOW_CRAWLING": "Kamerschaal Kruipen", - "vivecraft.options.LIMIT_TELEPORT": "Limiteer in Overleving", - "vivecraft.options.REVERSE_HANDS": "Keer Handen Om", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Gebruik Oogstencil", - "vivecraft.options.BCB_ON": "Toon Lichaamspositie", - "vivecraft.options.WORLD_SCALE": "Wereldschaal", - "vivecraft.options.WORLD_ROTATION": "Werelddraai", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotatieverhoging", - "vivecraft.options.TOUCH_HOTBAR": "Tik op Hotbar Ingeschakeld", - "vivecraft.options.PLAY_MODE_SEATED": "Speelmodus", - "vivecraft.options.RENDER_SCALEFACTOR": "Resolutie", - "vivecraft.options.MONO_FOV": "Onvervormde Gezichtsveld", - "vivecraft.options.REALISTIC_JUMP": "Kamerschaal Springen", - "vivecraft.options.REALISTIC_SNEAK": "Kamerschaal Sluipen", - "vivecraft.options.PHYSICAL_GUI": "Fysieke GUI's", - "vivecraft.options.REALISTIC_CLIMB": "Kamerschaal Klimmen", - "vivecraft.options.REALISTIC_SWIM": "Kamerschaal Zwemmen", - "vivecraft.options.REALISTIC_ROW": "Kamerschaal Roeien", - "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", - "vivecraft.options.FREEMOVE_MODE": "Vrij Bewegen Type", - "vivecraft.options.VEHICLE_ROTATION": "Voertuigrotatie", - "vivecraft.options.RESET_ORIGIN": "Oorsprong Resetten", - "vivecraft.options.X_SENSITIVITY": "Rotatiesnelheid", - "vivecraft.options.Y_SENSITIVITY": "Y Gevoeligheid", - "vivecraft.options.KEYHOLE": "Sleutelgat", - "vivecraft.options.FOV_REDUCTION": "FOV Comfortvermindering", - "vivecraft.options.FOV_REDUCTION_MIN": "Grootte Gezichtsveldreductie", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reductie Offset", - "vivecraft.options.SEATED_HMD": "Voorwaartse Richting", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD Volgt", - "vivecraft.options.BACKPACK_SWITCH": "Rugzak Wisselen", - "vivecraft.options.ANALOG_MOVEMENT": "Analoge Beweging", - "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprintdrempel", - "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", - "vivecraft.options.TELEPORT_UP_LIMIT": "bovenlimiet", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Afstandslimiet", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Origin-offset toestaan", - "vivecraft.options.SEATED_FREE_MOVE": "Bewegingstype", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forceer Vrije Beweging", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Geavanceerde Bindingen Weergeven", - "vivecraft.options.MENU_WORLD_SELECTION": "Werelden", - "vivecraft.options.HRTF_SELECTION": "3D-geluid (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Laad de Externe Camera Opnieuw", - "vivecraft.options.RIGHT_CLICK_DELAY": "Klik Met de Rechtermuisknop Op Herhalen", - "vivecraft.options.ANIMAL_TOUCHING": "Dier Betasting", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolutie", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Cameramodel Tonen", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Toetsenbord Thema", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Relatieve grootte HUD neemt in gezichtsveld in beslag.\nDe eenheden zijn slechts relatief, niet in graden of een fractie van FOV of zoiets.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Afstand de zwevende HUD wordt voor je lichaam getekend.\nDe relatieve grootte van de HUD wordt hierdoor niet gewijzigd.\nAfstand is in meters (maar wordt niet belemmerd door blokken).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Geeft aan in welke richting de HUD is vergrendeld.\n Hand: De HUD verschijnt net boven je hand.\n Head: De HUD verschijnt altijd recht voor je in je gezichtsveld.\n Pols: De HUD verschijnt aan de binnenkant van je off-hand arm. Het zal eruit springen als er naar wordt gekeken.", - "vivecraft.options.HUD_OPACITY.tooltip": "Hoe transparant om de in-game HUD en UI te tekenen.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Geeft aan of de GUI-menu's in het spel een semi-transparante achtergrond hebben of niet.\n AAN: semi-transparante achtergrond in in-game menu's.\n UIT: Geen achtergrondinformatie over in-game menu's.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Specificeert of de HUD wordt afgesloten door dichterbijgelegen objecten.\n AAN: De HUD wordt verborgen door objecten die dichterbij zijn. Kan volledig verborgen zijn in besloten omgevingen!\n UIT: De HUD is altijd zichtbaar. Problemen met stereodiepte zijn mogelijk merkbaar.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specificeert wanneer het hoofdmenu uw kijkrichting volgt.\n Zittend: het hoofdmenu volgt alleen in zittende modus.\n Altijd: het hoofdmenu volgt altijd.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Bepaalt de grootte van het in-game dradenkruis.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Stelt de grootte van het menu dradenkruis in.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Stel de in-game crosshair-weergavemodus in.\n Altijd: het dradenkruis wordt altijd weergegeven, zelfs als de HUD is uitgeschakeld.\n Met HUD: het dradenkruis wordt alleen weergegeven als de HUD is ingeschakeld.\n Nooit: het dradenkruis wordt nooit getoond.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Stelt in wat er gebeurt wanneer u een chatbericht ontvangt. \n Geen: niets! \n Haptic: Pulse op de linker controller. \n Geluid: speelt het geluid van de chatmelding af. \n Beiden: zowel haptisch als geluid.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Stelt het geluid voor chatmeldingen in.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Bepaalt hoe het draadkruis verandert met de afstand.\n AAN: Het dradenkruis zal in de verte groter worden om vanuit uw gezichtspunt dezelfde schijnbare grootte te behouden.\n UIT: Het dradenkruis zal altijd dezelfde maat hebben in de wereld en lijkt te krimpen met de afstand.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Hiermee stelt u de weergavemodus van de blokweergave in het spel in.\n Altijd: de blokomtrek wordt altijd weergegeven, zelfs als de HUD is uitgeschakeld.\n Met HUD: de blokomtrek wordt alleen weergegeven als de HUD is ingeschakeld.\n Nooit: de blokomtrek wordt nooit weergegeven.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Indien uitgeschakeld, wordt het toetsenbord alleen geopend wanneer u op een tekstveld klikt of als een tekstveld de focus niet kan verliezen.\n\nIndien ingeschakeld, wordt het toetsenbord automatisch geopend wanneer er een tekstveld in beeld komt. Als je dit inschakelt, wordt het geopend in ongewenste situaties met mods.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Gedrag van het radiale menu bij het indrukken van de knop.\n Houd ingedrukt: houd de radiale menuknop ingedrukt, beweeg over de selectie en laat los.\n Druk op: Druk op de radiale menuknop, klik op de knoppen en druk nogmaals op de radiale menuknop om te sluiten.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Welk type VR-toetsenbord om te gebruiken om te typen.\n Fysiek: een toetsenbord waarop u kunt typen als een echt toetsenbord.\n Pointer: Een toetsenbord dat u kunt gebruiken door het dradenkruis van een van beide controllers te richten en op knoppen te drukken.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Hoe groot het fysieke toetsenbord moet zijn, in verhouding tot zijn basismaat.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Indien ingeschakeld, wordt de GUI voor blokken (zoals kisten en ovens) boven het blok geplaatst. Anders bevindt het zich op de gebruikelijke positie.", - "vivecraft.options.FSAA.tooltip": "Gebruikt een liefhebber methode om het spel te resamplen voordat het naar de HMD wordt gestuurd. Werkt het beste bij hoge renderschalen.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Spiegelt de afbeelding op HMD om het bureaubladvenster te scheiden.\nKan worden ingesteld op UIT, enkele of dubbele hmd-weergave, eerste persoon onvervormd, derde persoon onvervormd en gemengde realiteit. De onvervormde en gemengde realiteitsopvattingen hebben een prestatiekost.", - "vivecraft.options.MIRROR_EYE.tooltip": "Welk oog te gebruiken in bijgesneden en enkele modi.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "De kleur wordt getekend door de \"transparante\" gebieden van de mixed reality-weergave. Andere kleuren in de game worden hierdoor niet aangepast, zodat het geen gekheid veroorzaakt.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Geef handen op de mixed reality-weergave. Schakelt alleen de weergave van de daadwerkelijke handmodellen om, items worden nog steeds weergegeven.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Kies tussen Unity-stijl lay-out met 4 panelen of 2 vensters naast elkaar.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Voeg een onvervormde weergave toe in de indeling met 4 panelen. Vereist een extra renderpas. Anders wordt de HMD-weergave gebruikt.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity indeling, zal, indien ja, een alfa-masker in grijstinten naar het kwadrant rechtsboven tekenen (zoals Unity) voor gebruik bij het maskeren van de voorgrondlaag. Anders wordt de voorgrond getekend met toetskleur voor gebruik met kleurtoetseffect.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "De kijkhoek wordt gebruikt voor de mixed reality-spiegelmodus.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Hiermee kunt u de mogelijkheid instellen om blokken op te lopen zonder te hoeven springen. Sneltoets: RCtrl + B\n§cWAARSCHUWING: Kan anti-cheat-waarschuwingen activeren als deze zich op een multiplayer-server bevinden !!\n UIT: (standaard) Je moet blokken omhoog springen.\n AAN: U kunt enkele blokken oplopen. Kan voor sommigen door voortbeweging veroorzaakte simulatorziekte verminderen.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Stelt een bewegingsvermenigvuldiger in, waardoor langzamere bewegingen dan standaard mogelijk zijn. Dit kan de door voortbeweging veroorzaakte ziekte van de simulator helpen verminderen.\n§cWAARSCHUWING: Kan anti-cheat-waarschuwingen activeren als deze zich op een multiplayer-server bevinden !!\n\nWordt standaard ingesteld op de standaardsnelheid voor Minecraft-bewegingen (1.0).", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Stelt de bewegingsinertie van de speler in de modus voor één speler in. Lagere traagheid betekent snellere acceleratie, hogere traagheid langzamere acceleratie. Hoge traagheid kan voor sommigen bewegingsziekte verminderen, maar pas op voor klifranden!\n Normaal: (standaard) Standaardbeweging van Minecraft-speler.\n Automan < Normaal < Veel < Nog meer. Heeft momenteel geen invloed op lava, water of springende bewegingen.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Indien ingeschakeld, valt de speler op de grond in teleporteermodus wanneer hij boven de lege ruimte staat. Maakt ook springen mogelijk.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Maakt het raken van blokken en entiteiten op ruimteschaal mogelijk.\nAuto staat aan in overleven en uit aan creatief.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Indien ingeschakeld, kan de speler onder een blok duiken.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "Indien ingeschakeld, heeft de boogteleporter beperkingen in de overlevingsmodus. Het zal niet in staat zijn om tegen de zijkant van blokken op te springen, het zal voedsel consumeren en het zal een energiebalk hebben die na verloop van tijd opnieuw wordt gevuld.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Wissel links / rechts als dominant.\n AAN: Links dominant\n UIT: Rechts dominant\n\nOm de knoppen te verwisselen, herstart je het spel en zorg je ervoor dat standaard bindingen zijn geselecteerd in SteamVR.", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Maskeer delen van het scherm buiten het gezichtsveld.\nVerbetert de prestaties.", - "vivecraft.options.BCB_ON.tooltip": "Toont uw lichaamshouding als een vierkante schaduw op de grond.\nDit is je Square Shadow Buddy ™.\nVerlies je Square Shadow Buddy niet.", - "vivecraft.options.WORLD_SCALE.tooltip": "Schaalt de speler in de wereld.\nBovenstaande maakt je groter\nEn hieronder maakt je klein\nEn degene die moeder je geeft\n\ndoet helemaal niets.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Voegt extra rotatie toe aan uw HMD.\nHandiger gebonden aan een knop of gewijzigd met de pijltjestoetsen.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Hoeveel graden te draaien bij het draaien van de wereld.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Indien ingeschakeld, kunt u de hotbar met uw hoofdhand aanraken om een item te selecteren.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Staande of zittende speelmodus.\nStaan is enorm superieur.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "De interne weergaveschaal van het spel, ten opzichte van het oorspronkelijke HMD-scherm. Hogere waarden verbeteren de visuele kwaliteit ten koste van de prestaties.", - "vivecraft.options.MONO_FOV.tooltip": "De kijkhoek wordt gebruikt voor de onvervormde spiegelmodus.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "Indien ingeschakeld, zal je speler, zodra je in het echte leven springt, ook springen. Maakt ook Spring Schoenen mogelijk.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Indien ingeschakeld, zal je speler, zodra je in het echte leven duikt, ook sluipen.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Indien ingeschakeld, worden GUI's vervangen door 3D-interactieve modellen.\nAls het volgen van rugzakken is ingeschakeld, wordt je inventariszak tevoorschijn gehaald als je op je rug reikt.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Indien ingeschakeld, laat klimladders en wijnstokken klimmen door ze aan te raken. Maakt ook Beklim klauwen mogelijk.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Als het is ingeschakeld, Kan u zwemmen door de schoolslag te doen met de controllers.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Roei, roei, roei je boot ... door met je armen te fladderen als een gek.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Vermenigvuldigt uw positie in de kamer met een factor.\nLaat je meer rondlopen, maar kan bewegingsziekte veroorzaken.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "De bron voor freemove-richting.\n\n Controller: Offhand controller wijzende richting.\n HMD: kijkrichting headset.\n Run-In-Place: Yaw is gebaseerd op hoe controllers slingeren. Pitch is uw headset.\n Kamer: Yaw is relatief ten opzichte van je VR-kamer vooruit. Pitch is uw headset. Deze modus is alleen het beste voor 180 opstellingen.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Rijden in een voertuig zal de wereld draaien terwijl het voertuig draait. Kan desoriënterend zijn.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Herhaal de voeten van de speler in de wereld tot 1,62 m onder de huidige HMD-positie. Voor niet-absolute volgsystemen of zittend spelen.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Snelheid: het beeld draait wanneer het op de rand van het sleutelgat wordt geduwd.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Verticale snelheid van het draadkruis gerelateerd aan de muis.", - "vivecraft.options.KEYHOLE.tooltip": "Het aantal graden links en rechts van het midden waar de weergave begint te draaien.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Verkleint het gezichtsveld tijdens het bewegen. Kan helpen bij bewegingsziekte.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "De uiteindelijke grootte van FOV-reductie.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Verschuift horizontaal het midden van de FOV-reductie voor niet-standaard HMD's.", - "vivecraft.options.SEATED_HMD.tooltip": "De richting waarin de vooruit (W) -toets gaat.\nHMD kijkrichting of richtingskruis richting.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "De richting waarin de HUD wordt geplaatst.\nHMD kijkrichting of richtingskruis richting.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Als deze optie is ingeschakeld en je met de rechter controller achter je hoofd reikt, wordt er overgeschakeld naar de eerste hotbar-sleuf of terug naar de vorige sleuf. Als u hetzelfde doet met de linkercontroller, worden de linker- en rechterhand items verwisseld.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "De loopsnelheid wordt bepaald door de knopas van de controller, als de gebonden knop een variabele as heeft.\n\nVoor volledige analoge controle is het beter om \"Beweeg / Strafe\" of \"Beweeg / Roteer\" te gebruiken.", - "vivecraft.options.AUTO_SPRINT.tooltip": "Tijdens het gebruik van freemove wordt sprint automatisch geactiveerd wanneer de as de geconfigureerde drempel bereikt.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "De asdrempel waarop automatische sprint wordt geactiveerd.", - "vivecraft.options.BOW_MODE.tooltip": "Stelt in wanneer Room Scale Archery moet worden gebruikt\n UIT: Nooit.\n Normaal: Alleen voor de normaale boog, geen mod items.\n AAN: Altijd voor elk item dat de actie \"boog\" gebruikt.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Beperk het aantal blokken dat u onder u kunt teleporteren.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Beperk het aantal blokken dat u boven u kunt teleporteren.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Beperk het aantal blokken dat u zijwaarts kunt teleporteren.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Maakt het mogelijk de knop \"Herstel oorsprong\" te gebruiken in staande modus, voor degenen die fysiek zittend willen spelen terwijl ze bijgehouden controllers gebruiken.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Welke bewegingsmodus te gebruiken in zittende modus.\n\n Teleporteren: druk op een willekeurige richting om te activeren.\n Free Move: WASD-beweging zoals normale Minecraft.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Dwingt het gebruik van de fallback walk forwards binding (standaard linker trigger). Bewerk de SteamVR-controllerbindingen voor meer bewegingsopties.\nMerk op dat dit de teleport-binding uitschakelt.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Onthult extra SteamVR-bindingen voor climbey, keyboard en mixed reality.\n\nVereist een herstart om van kracht te worden.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Welke menuwerelden worden geladen bij het opstarten.\n\nAls er geen aangepaste werelden worden gevonden, worden officiële werelden gebruikt.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF-profiel voor positionele 3D-audio. De kwaliteit kan verschillen per apparaat en stuurprogramma.\n\n UIT: HRTF expliciet uitschakelen.\n Standaard: gebruik het standaard HRTF-profiel.\n Overige: gebruik een specifiek HRTF-profiel.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Laadt de camera-configuratie opnieuw vanaf ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Het aantal van het spel tikt tussen 'rechtsklikken' terwijl je de knop ingedrukt houdt.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Indien ingeschakeld, zal het aanraken van een passieve menigte (dier) zonder wapen met de rechtermuisknop klikken (interactie) in plaats van aanvallen.\nZet uit voor varken Spanking, Bert.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Gezichtsveld van de schermafbeelding camera", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolutie van de schermafbeelding camera, voor het nemen van schermafbeeldingen veel groter dan de normale render resolutie.\nKan niet gebruikt worden shaders aan staan.\n§cWaarschuwing: Als je deze instelling heel hoog zet kan je je computer smelten!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Toon een model van een videocamera (alleen in HMD-weergave) om aan te geven waar de mixed reality-camera of de camera van een derde persoon zich momenteel bevindt. Het kan ook worden vastgepakt om het te verplaatsen met behulp van de interactiebinding.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Vooraf ingesteld kleurenschema voor het fysieke toetsenbord. Een aangepast thema kan worden bewerkt via keyboardtheme.txt in de gamedirectory. Het wordt opnieuw geladen elke keer als het toetsenbord word geopend, om realtime tweaken mogelijk te maken.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "Ik Kan Niet Zien", - "vivecraft.options.yes": "JA", - "vivecraft.options.no": "NEE", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Standaard", - "vivecraft.options.opaque": "Ondoorzichtig", - "vivecraft.options.mirrormode.off": "UIT (snel)", - "vivecraft.options.mirrormode.dual": "Dual (snel)", - "vivecraft.options.mirrormode.single": "Single (snel)", - "vivecraft.options.mirrormode.firstperson": "1e Persoon (langzaam)", - "vivecraft.options.mirrormode.thirdperson": "3e Persoon (langzaam)", - "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (langzaam)", - "vivecraft.options.mirrormode.cropped": "Bijgesneden (snel)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Links", - "vivecraft.options.right": "Rechts", - "vivecraft.options.color.black": "Zwart", - "vivecraft.options.color.red": "Rood", - "vivecraft.options.color.yellow": "Geel", - "vivecraft.options.color.green": "Groen", - "vivecraft.options.color.cyan": "Cyaan", - "vivecraft.options.color.blue": "Blauw ", - "vivecraft.options.color.magenta": "Roodpaars", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Zij aan Zij", - "vivecraft.options.hudlock.hand": "Hand", - "vivecraft.options.hudlock.head": "Hooft", - "vivecraft.options.hudlock.wrist": "Pols", - "vivecraft.options.renderpointerelement.always": "Altijd", - "vivecraft.options.renderpointerelement.withhud": "Met HUD", - "vivecraft.options.renderpointerelement.never": "Nooit", - "vivecraft.options.chatnotifications.none": "Geen", - "vivecraft.options.chatnotifications.haptic": "haptisch ", - "vivecraft.options.chatnotifications.sound": "Geluid", - "vivecraft.options.chatnotifications.both": "Bijde", - "vivecraft.options.always": "Altijd", - "vivecraft.options.seated": "Zittend", - "vivecraft.options.standing": "Staand", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normaal", - "vivecraft.options.inertiafactor.large": "Veel", - "vivecraft.options.inertiafactor.massive": "Nog meer", - "vivecraft.options.smooth": "Effen", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Crosshair", - "vivecraft.options.freemove.controller": "Controller", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Run-In-Place", - "vivecraft.options.freemove.room": "Kamer", - "vivecraft.options.hold": "Houden", - "vivecraft.options.press": "Druk", - "vivecraft.options.keyboard.physical": "Fysiek", - "vivecraft.options.keyboard.pointer": "Wijzer", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%d Blokken", - "vivecraft.options.teleport": "Teleporteer", - "vivecraft.options.freemove": "Vrij Bewegen", - "vivecraft.options.menuworld.both": "Officieel & Aangepast", - "vivecraft.options.menuworld.custom": "Alleen Aangepast", - "vivecraft.options.menuworld.official": "Alleen Officieel", - "vivecraft.options.menuworld.none": "Geen", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Langzaam", - "vivecraft.options.rightclickdelay.slower": "Langzamer", - "vivecraft.options.rightclickdelay.slowest": "Traagst", - "vivecraft.options.keyboardtheme.default": "Wit", - "vivecraft.options.keyboardtheme.red": "Rood", - "vivecraft.options.keyboardtheme.green": "Groen", - "vivecraft.options.keyboardtheme.blue": "Blauw ", - "vivecraft.options.keyboardtheme.black": "Leegte", - "vivecraft.options.keyboardtheme.grass": "Grasblok", - "vivecraft.options.keyboardtheme.bees": "Hommel", - "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", - "vivecraft.options.keyboardtheme.dose": "Medicijn", - "vivecraft.options.keyboardtheme.custom": "Aangepast", - "_comment12": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Verschoon", - "vivecraft.gui.loaddefaults": "Laad De Standaardinstellingen", - "vivecraft.gui.menuworld.refresh": "Menuwereld Vernieuwen", - "vivecraft.gui.menuworld.loadnew": "Laad Nieuwe Menuwereld", - "vivecraft.gui.radialmenu.mainset": "Hoofdset", - "vivecraft.gui.radialmenu.alternateset": "Alternatieve Set", - "vivecraft.gui.chat": "Chat", - "vivecraft.gui.commands": "Commando's", - "vivecraft.gui.overlay": "Overlay", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Schermafbeelding", - "vivecraft.gui.calibrateheight": "Hoogte Kalibreren", - "vivecraft.gui.alignkatwalk": "Align KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Verplaats Derde Camera", - "vivecraft.gui.social": "Sociaal", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Spring Schoenen", - "vivecraft.item.climbclaws": "Beklim Klauwen", - "vivecraft.item.telescope": "Oog van de Telescoop", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Overschakelen naar de zittende modus, Controllerinvoer wordt hierdoor uitgeschakeld. Doorgaan?", - "vivecraft.messages.radialmenubind.1": "Zorg ervoor dat Open Radiaal Menu is gebonden.", - "vivecraft.messages.radialmenubind.2": "Houd (Toetsenbord Shift) ingedrukt met het radiaal menu open om over te schakelen naar deze set.", - "vivecraft.messages.controls.1": "Bindingen worden gehandeld door SteamVR Input.", - "vivecraft.messages.controls.2": "Ga naar Instellingen > Controllers > Beheer Controller Bindingen in het dashboard.", - "vivecraft.messages.controls.3": "§6Steam moet actief §ozijn voordat§r§6 SteamVR wordt gestart, anders worden bindingen niet opgeslagen.", - "vivecraft.messages.serverplugin": "Vivecraft-servermod gedetecteerd: %s", - "vivecraft.messages.noserverplugin": "Vivecraft-servermod niet gedetecteerd. Deze server biedt mogelijk geen ondersteuning voor teleporteren. De beperkte bewegingsmodus (terugvallen op vrije beweging) is ingeschakeld.", - "vivecraft.messages.calibrateheight": "Kalibreer uw lengte in het pauzemenu.", - "vivecraft.messages.rendersetupfailed": "Installatie van weergave mislukt: %s", - "vivecraft.messages.intelgraphics": "Intel Integrated Graphics wordt niet ondersteund. Als dit een laptop is, forceer dan de krachtige GPU. Gedetecteerde GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR runtime niet gedetecteerd. Heb je SteamVR geïnstalleerd?", - "vivecraft.messages.menuworldexportcomplete.1": "Wereld export compleet ... gebiedsgrootte: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Opgeslagen naar %s", - "vivecraft.messages.menuworldexportclientwarning": "WAARSCHUWING: Menuwereld opslaan met behulp van een clientwereld. Gegevens zijn mogelijk onvolledig. Het is aan te raden om menuwerelden in singleplayer op te slaan.", - "vivecraft.messages.teleportdisabled": "Beperkte beweging ingeschakeld (geen teleportatie)", - "vivecraft.messages.teleportenabled": "Beperkte beweging uitgeschakeld (teleporteren toegestaan)", - "vivecraft.messages.walkupblocks": "Walk-up blokken (RCTRL + B): %s", - "vivecraft.messages.showaim": "Doel tonen (RCTRL + RSHIFT): ingeschakeld", - "vivecraft.messages.playerinertia": "Traagheid van de spelersbeweging (LCTRL + I): %s", - "vivecraft.messages.movementmodeswitch": "Bewegingsmodus overgeschakeld naar: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", - "vivecraft.messages.heightset": "Hoogte gebruiker ingesteld op %d%%" -} \ No newline at end of file + "_comment0": "Contributors: marijnessen, Lelebees, BlockBanana123, twjfransen, stijnotter, ZeeuwsGamertje, MarijnIsN00B, putper", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Hotbar Volgende", + "vivecraft.key.hotbarPrev": "Hotbar Vorige", + "vivecraft.key.hotbarScroll": "Hotbar Scroll", + "vivecraft.key.hotbarSwipeX": "Hotbar Veeg (Links/Rechts)", + "vivecraft.key.hotbarSwipeY": "Hotbar Veeg (Omhoog/Omlaag)", + "vivecraft.key.rotateLeft": "Draai Links", + "vivecraft.key.rotateRight": "Draai Rechts", + "vivecraft.key.rotateAxis": "Alleen Draaien", + "vivecraft.key.rotateFree": "Vrij draaien", + "vivecraft.key.walkabout": "Rondgang", + "vivecraft.key.teleport": "Teleporteer", + "vivecraft.key.teleportFallback": "Loop Vooruit Als Teleporteren Uitgeschakeld is", + "vivecraft.key.freeMoveRotate": "Beweeg/Draai", + "vivecraft.key.freeMoveStrafe": "Beweeg/Loop Zijwaarts", + "vivecraft.key.toggleMovement": "Verander Bewegingsmodus", + "vivecraft.key.quickTorch": "Snelle Fakkel", + "vivecraft.key.ingameMenuButton": "Spelmenu", + "vivecraft.key.exportWorld": "Exporteer Menuwereld", + "vivecraft.key.radialMenu": "Open Radiaal Menu", + "vivecraft.key.swapMirrorView": "Wissel Spiegelweergave", + "vivecraft.key.toggleKeyboard": "Toon/Verberg Toetsenbord", + "vivecraft.key.moveThirdPersonCam": "Verplaats Derde Persoon Camera", + "vivecraft.key.togglePlayerList": "Spelerslijst Wisselen", + "vivecraft.key.toggleHandheldCam": "Camera Aanpassen", + "vivecraft.key.quickHandheldCam": "Snelle Camera", + "vivecraft.key.trackpadTouch": "Trackpad Aanraking", + "vivecraft.key.vrInteract": "Contextuele Interactie", + "vivecraft.key.guiLeftClick": "Linkermuisklik", + "vivecraft.key.guiRightClick": "Rechtermuisklik", + "vivecraft.key.guiMiddleClick": "Middelmuisklik", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Scroll Omhoog", + "vivecraft.key.guiScrollDown": "Scroll Omlaag", + "vivecraft.key.guiScrollAxis": "Scroll", + "vivecraft.key.keyboardClick": "Klik", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Klimklauwen", + "vivecraft.key.climbeyJump": "Springschoenen", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "Climbey Beweging", + "vivecraft.key.category.keyboard": "Toetsenbord", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "In-Spel", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "Globaal", + "vivecraft.actionset.mod": "Gemodificeerd", + "vivecraft.actionset.contextual": "Contextueel", + "vivecraft.actionset.keyboard": "Toetsenbord", + "vivecraft.actionset.mixedReality": "Gemengde Realiteit", + "vivecraft.actionset.technical": "Technisch", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "VR Instellingen", + "vivecraft.options.screen.freemove": "Vrij Bewegen Instellingen", + "vivecraft.options.screen.gui": "HUD en GUI Instellingen", + "vivecraft.options.screen.menuworld": "Menu Wereld Instellingen", + "vivecraft.options.screen.guiother": "Chat/Crosshair Instellingen", + "vivecraft.options.screen.quickcommands": "Snelle Commando's", + "vivecraft.options.screen.radialmenu": "Radiaal Menu Configuratie", + "vivecraft.options.screen.stereorendering": "Stereo Renderer Instellingen", + "vivecraft.options.screen.roomscale": "Kamerschaal Interactie Instellingen", + "vivecraft.options.screen.seated": "Zittend Instellingen", + "vivecraft.options.screen.standing": "Staand Bewegen Instellingen", + "vivecraft.options.screen.teleport": "Teleporteer-Instellingen", + "vivecraft.options.screen.controls": "Bedienings-Instellingen", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR Instellingen...", + "vivecraft.options.screen.gui.button": "HUD en GUI Instellingen...", + "vivecraft.options.screen.stereorendering.button": "Stereo Renderen...", + "vivecraft.options.screen.quickcommands.button": "Snelle Commando's...", + "vivecraft.options.screen.guiother.button": "Chat & Crosshair Instellingen...", + "vivecraft.options.screen.standing.button": "Bewegings-Instellingen...", + "vivecraft.options.screen.roomscale.button": "Interactie Instellingen...", + "vivecraft.options.screen.controls.button": "Bedienings Instellingen...", + "vivecraft.options.screen.radialmenu.button": "Radiaal Menu...", + "vivecraft.options.screen.seated.button": "Zittend Instellingen...", + "vivecraft.options.screen.menuworld.button": "Menu Wereld Instellingen...", + "vivecraft.options.screen.teleport.button": "Teleporteer-Instellingen...", + "vivecraft.options.screen.freemove.button": "Vrij Bewegen Instellingen...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Hoofd HUD Grootte", + "vivecraft.options.HUD_DISTANCE": "Hoofd HUD Afstand", + "vivecraft.options.HUD_LOCK_TO": "HUD Oriëntatie Slot", + "vivecraft.options.HUD_OPACITY": "HUD Doorzichtigheid", + "vivecraft.options.HUD_HIDE": "Verberg HUD (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI Achtergrond", + "vivecraft.options.HUD_OCCLUSION": "HUD Occlusie", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Hoofdmenu Volg", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Crosshair Occlusie", + "vivecraft.options.CROSSHAIR_SCALE": "Crosshair Grootte", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Menu Crosshair Grootte", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Toon Crosshair", + "vivecraft.options.CHAT_NOTIFICATIONS": "Chat Meldingen", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Meldingsgeluid", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Crosshair Schaling", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Toon Blokomlijning", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Toetsenbord Altijd Openen", + "vivecraft.options.RADIAL_MODE_HOLD": "Radiaal Menu Modus", + "vivecraft.options.PHYSICAL_KEYBOARD": "Toetsenbordtype", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Toetsenbordgrootte", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Verschijnen boven blok", + "vivecraft.options.FSAA": "Lanczos Scaler", + "vivecraft.options.MIRROR_DISPLAY": "Bureaublad Spiegel", + "vivecraft.options.MIRROR_EYE": "Spiegeloog", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Sleutel kleur", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Toon Handen", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Indeling", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Onvervormde Pas", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Alfamasker", + "vivecraft.options.MIXED_REALITY_FOV": "Gezichtsveld Derde Persoon", + "vivecraft.options.WALK_UP_BLOCKS": "Loop Blokken Op", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Bewegingssnelheid Vermenigvuldiger", + "vivecraft.options.INERTIA_FACTOR": "Speler Traagheid", + "vivecraft.options.SIMULATE_FALLING": "Simuleer Vallen", + "vivecraft.options.WEAPON_COLLISION": "Wapens Botsen", + "vivecraft.options.ALLOW_CRAWLING": "Kamerschaal Kruipen", + "vivecraft.options.LIMIT_TELEPORT": "Limiteer in Overleving", + "vivecraft.options.REVERSE_HANDS": "Keer Handen Om", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Gebruik Oogstencil", + "vivecraft.options.BCB_ON": "Toon Lichaamspositie", + "vivecraft.options.WORLD_SCALE": "Wereldschaal", + "vivecraft.options.WORLD_ROTATION": "Werelddraai", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Rotatieverhoging", + "vivecraft.options.TOUCH_HOTBAR": "Tik op Hotbar Ingeschakeld", + "vivecraft.options.PLAY_MODE_SEATED": "Speelmodus", + "vivecraft.options.RENDER_SCALEFACTOR": "Resolutie", + "vivecraft.options.MONO_FOV": "Onvervormde Gezichtsveld", + "vivecraft.options.REALISTIC_JUMP": "Kamerschaal Springen", + "vivecraft.options.REALISTIC_SNEAK": "Kamerschaal Sluipen", + "vivecraft.options.PHYSICAL_GUI": "Fysieke GUI's", + "vivecraft.options.REALISTIC_CLIMB": "Kamerschaal Klimmen", + "vivecraft.options.REALISTIC_SWIM": "Kamerschaal Zwemmen", + "vivecraft.options.REALISTIC_ROW": "Kamerschaal Roeien", + "vivecraft.options.WALK_MULTIPLIER": "Walking Multiplier", + "vivecraft.options.FREEMOVE_MODE": "Vrij Bewegen Type", + "vivecraft.options.VEHICLE_ROTATION": "Voertuigrotatie", + "vivecraft.options.RESET_ORIGIN": "Oorsprong Resetten", + "vivecraft.options.X_SENSITIVITY": "Rotatiesnelheid", + "vivecraft.options.Y_SENSITIVITY": "Y Gevoeligheid", + "vivecraft.options.KEYHOLE": "Sleutelgat", + "vivecraft.options.FOV_REDUCTION": "FOV Comfortvermindering", + "vivecraft.options.FOV_REDUCTION_MIN": "Grootte Gezichtsveldreductie", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV Reductie Offset", + "vivecraft.options.SEATED_HMD": "Voorwaartse Richting", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD Volgt", + "vivecraft.options.BACKPACK_SWITCH": "Rugzak Wisselen", + "vivecraft.options.ANALOG_MOVEMENT": "Analoge Beweging", + "vivecraft.options.AUTO_SPRINT": "Auto-Sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Auto-Sprintdrempel", + "vivecraft.options.BOW_MODE": "Roomscale Bow Mode", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Down Limit", + "vivecraft.options.TELEPORT_UP_LIMIT": "bovenlimiet", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Afstandslimiet", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Origin-offset toestaan", + "vivecraft.options.SEATED_FREE_MOVE": "Bewegingstype", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Forceer Vrije Beweging", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Geavanceerde Bindingen Weergeven", + "vivecraft.options.MENU_WORLD_SELECTION": "Werelden", + "vivecraft.options.HRTF_SELECTION": "3D-geluid (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Laad de Externe Camera Opnieuw", + "vivecraft.options.RIGHT_CLICK_DELAY": "Klik Met de Rechtermuisknop Op Herhalen", + "vivecraft.options.ANIMAL_TOUCHING": "Dier Betasting", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Camera FOV", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Camera Resolutie", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Cameramodel Tonen", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Toetsenbord Thema", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Relatieve grootte HUD neemt in gezichtsveld in beslag.\nDe eenheden zijn slechts relatief, niet in graden of een fractie van FOV of zoiets.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Afstand de zwevende HUD wordt voor je lichaam getekend.\nDe relatieve grootte van de HUD wordt hierdoor niet gewijzigd.\nAfstand is in meters (maar wordt niet belemmerd door blokken).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Geeft aan in welke richting de HUD is vergrendeld.\n Hand: De HUD verschijnt net boven je hand.\n Head: De HUD verschijnt altijd recht voor je in je gezichtsveld.\n Pols: De HUD verschijnt aan de binnenkant van je off-hand arm. Het zal eruit springen als er naar wordt gekeken.", + "vivecraft.options.HUD_OPACITY.tooltip": "Hoe transparant om de in-game HUD en UI te tekenen.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Geeft aan of de GUI-menu's in het spel een semi-transparante achtergrond hebben of niet.\n AAN: semi-transparante achtergrond in in-game menu's.\n UIT: Geen achtergrondinformatie over in-game menu's.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Specificeert of de HUD wordt afgesloten door dichterbijgelegen objecten.\n AAN: De HUD wordt verborgen door objecten die dichterbij zijn. Kan volledig verborgen zijn in besloten omgevingen!\n UIT: De HUD is altijd zichtbaar. Problemen met stereodiepte zijn mogelijk merkbaar.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Specificeert wanneer het hoofdmenu uw kijkrichting volgt.\n Zittend: het hoofdmenu volgt alleen in zittende modus.\n Altijd: het hoofdmenu volgt altijd.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Bepaalt de grootte van het in-game dradenkruis.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Stelt de grootte van het menu dradenkruis in.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Stel de in-game crosshair-weergavemodus in.\n Altijd: het dradenkruis wordt altijd weergegeven, zelfs als de HUD is uitgeschakeld.\n Met HUD: het dradenkruis wordt alleen weergegeven als de HUD is ingeschakeld.\n Nooit: het dradenkruis wordt nooit getoond.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Stelt in wat er gebeurt wanneer u een chatbericht ontvangt. \n Geen: niets! \n Haptic: Pulse op de linker controller. \n Geluid: speelt het geluid van de chatmelding af. \n Beiden: zowel haptisch als geluid.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Stelt het geluid voor chatmeldingen in.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Bepaalt hoe het draadkruis verandert met de afstand.\n AAN: Het dradenkruis zal in de verte groter worden om vanuit uw gezichtspunt dezelfde schijnbare grootte te behouden.\n UIT: Het dradenkruis zal altijd dezelfde maat hebben in de wereld en lijkt te krimpen met de afstand.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Hiermee stelt u de weergavemodus van de blokweergave in het spel in.\n Altijd: de blokomtrek wordt altijd weergegeven, zelfs als de HUD is uitgeschakeld.\n Met HUD: de blokomtrek wordt alleen weergegeven als de HUD is ingeschakeld.\n Nooit: de blokomtrek wordt nooit weergegeven.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Indien uitgeschakeld, wordt het toetsenbord alleen geopend wanneer u op een tekstveld klikt of als een tekstveld de focus niet kan verliezen.\n\nIndien ingeschakeld, wordt het toetsenbord automatisch geopend wanneer er een tekstveld in beeld komt. Als je dit inschakelt, wordt het geopend in ongewenste situaties met mods.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Gedrag van het radiale menu bij het indrukken van de knop.\n Houd ingedrukt: houd de radiale menuknop ingedrukt, beweeg over de selectie en laat los.\n Druk op: Druk op de radiale menuknop, klik op de knoppen en druk nogmaals op de radiale menuknop om te sluiten.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Welk type VR-toetsenbord om te gebruiken om te typen.\n Fysiek: een toetsenbord waarop u kunt typen als een echt toetsenbord.\n Pointer: Een toetsenbord dat u kunt gebruiken door het dradenkruis van een van beide controllers te richten en op knoppen te drukken.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Hoe groot het fysieke toetsenbord moet zijn, in verhouding tot zijn basismaat.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Indien ingeschakeld, wordt de GUI voor blokken (zoals kisten en ovens) boven het blok geplaatst. Anders bevindt het zich op de gebruikelijke positie.", + "vivecraft.options.FSAA.tooltip": "Gebruikt een liefhebber methode om het spel te resamplen voordat het naar de HMD wordt gestuurd. Werkt het beste bij hoge renderschalen.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Spiegelt de afbeelding op HMD om het bureaubladvenster te scheiden.\nKan worden ingesteld op UIT, enkele of dubbele hmd-weergave, eerste persoon onvervormd, derde persoon onvervormd en gemengde realiteit. De onvervormde en gemengde realiteitsopvattingen hebben een prestatiekost.", + "vivecraft.options.MIRROR_EYE.tooltip": "Welk oog te gebruiken in bijgesneden en enkele modi.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "De kleur wordt getekend door de \"transparante\" gebieden van de mixed reality-weergave. Andere kleuren in de game worden hierdoor niet aangepast, zodat het geen gekheid veroorzaakt.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Geef handen op de mixed reality-weergave. Schakelt alleen de weergave van de daadwerkelijke handmodellen om, items worden nog steeds weergegeven.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Kies tussen Unity-stijl lay-out met 4 panelen of 2 vensters naast elkaar.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Voeg een onvervormde weergave toe in de indeling met 4 panelen. Vereist een extra renderpas. Anders wordt de HMD-weergave gebruikt.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "In Unity indeling, zal, indien ja, een alfa-masker in grijstinten naar het kwadrant rechtsboven tekenen (zoals Unity) voor gebruik bij het maskeren van de voorgrondlaag. Anders wordt de voorgrond getekend met toetskleur voor gebruik met kleurtoetseffect.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "De kijkhoek wordt gebruikt voor de mixed reality-spiegelmodus.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Hiermee kunt u de mogelijkheid instellen om blokken op te lopen zonder te hoeven springen. Sneltoets: RCtrl + B\n§cWAARSCHUWING: Kan anti-cheat-waarschuwingen activeren als deze zich op een multiplayer-server bevinden !!\n UIT: (standaard) Je moet blokken omhoog springen.\n AAN: U kunt enkele blokken oplopen. Kan voor sommigen door voortbeweging veroorzaakte simulatorziekte verminderen.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Stelt een bewegingsvermenigvuldiger in, waardoor langzamere bewegingen dan standaard mogelijk zijn. Dit kan de door voortbeweging veroorzaakte ziekte van de simulator helpen verminderen.\n§cWAARSCHUWING: Kan anti-cheat-waarschuwingen activeren als deze zich op een multiplayer-server bevinden !!\n\nWordt standaard ingesteld op de standaardsnelheid voor Minecraft-bewegingen (1.0).", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Stelt de bewegingsinertie van de speler in de modus voor één speler in. Lagere traagheid betekent snellere acceleratie, hogere traagheid langzamere acceleratie. Hoge traagheid kan voor sommigen bewegingsziekte verminderen, maar pas op voor klifranden!\n Normaal: (standaard) Standaardbeweging van Minecraft-speler.\n Automan < Normaal < Veel < Nog meer. Heeft momenteel geen invloed op lava, water of springende bewegingen.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Indien ingeschakeld, valt de speler op de grond in teleporteermodus wanneer hij boven de lege ruimte staat. Maakt ook springen mogelijk.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Maakt het raken van blokken en entiteiten op ruimteschaal mogelijk.\nAuto staat aan in overleven en uit aan creatief.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Indien ingeschakeld, kan de speler onder een blok duiken.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "Indien ingeschakeld, heeft de boogteleporter beperkingen in de overlevingsmodus. Het zal niet in staat zijn om tegen de zijkant van blokken op te springen, het zal voedsel consumeren en het zal een energiebalk hebben die na verloop van tijd opnieuw wordt gevuld.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Wissel links / rechts als dominant.\n AAN: Links dominant\n UIT: Rechts dominant\n\nOm de knoppen te verwisselen, herstart je het spel en zorg je ervoor dat standaard bindingen zijn geselecteerd in SteamVR.", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Maskeer delen van het scherm buiten het gezichtsveld.\nVerbetert de prestaties.", + "vivecraft.options.BCB_ON.tooltip": "Toont uw lichaamshouding als een vierkante schaduw op de grond.\nDit is je Square Shadow Buddy ™.\nVerlies je Square Shadow Buddy niet.", + "vivecraft.options.WORLD_SCALE.tooltip": "Schaalt de speler in de wereld.\nBovenstaande maakt je groter\nEn hieronder maakt je klein\nEn degene die moeder je geeft\n\ndoet helemaal niets.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Voegt extra rotatie toe aan uw HMD.\nHandiger gebonden aan een knop of gewijzigd met de pijltjestoetsen.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "Hoeveel graden te draaien bij het draaien van de wereld.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Indien ingeschakeld, kunt u de hotbar met uw hoofdhand aanraken om een item te selecteren.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Staande of zittende speelmodus.\nStaan is enorm superieur.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "De interne weergaveschaal van het spel, ten opzichte van het oorspronkelijke HMD-scherm. Hogere waarden verbeteren de visuele kwaliteit ten koste van de prestaties.", + "vivecraft.options.MONO_FOV.tooltip": "De kijkhoek wordt gebruikt voor de onvervormde spiegelmodus.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "Indien ingeschakeld, zal je speler, zodra je in het echte leven springt, ook springen. Maakt ook Spring Schoenen mogelijk.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Indien ingeschakeld, zal je speler, zodra je in het echte leven duikt, ook sluipen.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Indien ingeschakeld, worden GUI's vervangen door 3D-interactieve modellen.\nAls het volgen van rugzakken is ingeschakeld, wordt je inventariszak tevoorschijn gehaald als je op je rug reikt.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Indien ingeschakeld, laat klimladders en wijnstokken klimmen door ze aan te raken. Maakt ook Beklim klauwen mogelijk.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Als het is ingeschakeld, Kan u zwemmen door de schoolslag te doen met de controllers.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Roei, roei, roei je boot ... door met je armen te fladderen als een gek.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Vermenigvuldigt uw positie in de kamer met een factor.\nLaat je meer rondlopen, maar kan bewegingsziekte veroorzaken.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "De bron voor freemove-richting.\n\n Controller: Offhand controller wijzende richting.\n HMD: kijkrichting headset.\n Run-In-Place: Yaw is gebaseerd op hoe controllers slingeren. Pitch is uw headset.\n Kamer: Yaw is relatief ten opzichte van je VR-kamer vooruit. Pitch is uw headset. Deze modus is alleen het beste voor 180 opstellingen.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Rijden in een voertuig zal de wereld draaien terwijl het voertuig draait. Kan desoriënterend zijn.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Herhaal de voeten van de speler in de wereld tot 1,62 m onder de huidige HMD-positie. Voor niet-absolute volgsystemen of zittend spelen.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Snelheid: het beeld draait wanneer het op de rand van het sleutelgat wordt geduwd.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Verticale snelheid van het draadkruis gerelateerd aan de muis.", + "vivecraft.options.KEYHOLE.tooltip": "Het aantal graden links en rechts van het midden waar de weergave begint te draaien.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Verkleint het gezichtsveld tijdens het bewegen. Kan helpen bij bewegingsziekte.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "De uiteindelijke grootte van FOV-reductie.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Verschuift horizontaal het midden van de FOV-reductie voor niet-standaard HMD's.", + "vivecraft.options.SEATED_HMD.tooltip": "De richting waarin de vooruit (W) -toets gaat.\nHMD kijkrichting of richtingskruis richting.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "De richting waarin de HUD wordt geplaatst.\nHMD kijkrichting of richtingskruis richting.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Als deze optie is ingeschakeld en je met de rechter controller achter je hoofd reikt, wordt er overgeschakeld naar de eerste hotbar-sleuf of terug naar de vorige sleuf. Als u hetzelfde doet met de linkercontroller, worden de linker- en rechterhand items verwisseld.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "De loopsnelheid wordt bepaald door de knopas van de controller, als de gebonden knop een variabele as heeft.\n\nVoor volledige analoge controle is het beter om \"Beweeg / Strafe\" of \"Beweeg / Roteer\" te gebruiken.", + "vivecraft.options.AUTO_SPRINT.tooltip": "Tijdens het gebruik van freemove wordt sprint automatisch geactiveerd wanneer de as de geconfigureerde drempel bereikt.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "De asdrempel waarop automatische sprint wordt geactiveerd.", + "vivecraft.options.BOW_MODE.tooltip": "Stelt in wanneer Room Scale Archery moet worden gebruikt\n UIT: Nooit.\n Normaal: Alleen voor de normaale boog, geen mod items.\n AAN: Altijd voor elk item dat de actie \"boog\" gebruikt.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Beperk het aantal blokken dat u onder u kunt teleporteren.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Beperk het aantal blokken dat u boven u kunt teleporteren.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Beperk het aantal blokken dat u zijwaarts kunt teleporteren.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Maakt het mogelijk de knop \"Herstel oorsprong\" te gebruiken in staande modus, voor degenen die fysiek zittend willen spelen terwijl ze bijgehouden controllers gebruiken.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Welke bewegingsmodus te gebruiken in zittende modus.\n\n Teleporteren: druk op een willekeurige richting om te activeren.\n Free Move: WASD-beweging zoals normale Minecraft.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Dwingt het gebruik van de fallback walk forwards binding (standaard linker trigger). Bewerk de SteamVR-controllerbindingen voor meer bewegingsopties.\nMerk op dat dit de teleport-binding uitschakelt.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Onthult extra SteamVR-bindingen voor climbey, keyboard en mixed reality.\n\nVereist een herstart om van kracht te worden.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Welke menuwerelden worden geladen bij het opstarten.\n\nAls er geen aangepaste werelden worden gevonden, worden officiële werelden gebruikt.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF-profiel voor positionele 3D-audio. De kwaliteit kan verschillen per apparaat en stuurprogramma.\n\n UIT: HRTF expliciet uitschakelen.\n Standaard: gebruik het standaard HRTF-profiel.\n Overige: gebruik een specifiek HRTF-profiel.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Laadt de camera-configuratie opnieuw vanaf ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Het aantal van het spel tikt tussen 'rechtsklikken' terwijl je de knop ingedrukt houdt.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Indien ingeschakeld, zal het aanraken van een passieve menigte (dier) zonder wapen met de rechtermuisknop klikken (interactie) in plaats van aanvallen.\nZet uit voor varken Spanking, Bert.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Gezichtsveld van de schermafbeelding camera", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Resolutie van de schermafbeelding camera, voor het nemen van schermafbeeldingen veel groter dan de normale render resolutie.\nKan niet gebruikt worden shaders aan staan.\n§cWaarschuwing: Als je deze instelling heel hoog zet kan je je computer smelten!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Toon een model van een videocamera (alleen in HMD-weergave) om aan te geven waar de mixed reality-camera of de camera van een derde persoon zich momenteel bevindt. Het kan ook worden vastgepakt om het te verplaatsen met behulp van de interactiebinding.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Vooraf ingesteld kleurenschema voor het fysieke toetsenbord. Een aangepast thema kan worden bewerkt via keyboardtheme.txt in de gamedirectory. Het wordt opnieuw geladen elke keer als het toetsenbord word geopend, om realtime tweaken mogelijk te maken.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "Ik Kan Niet Zien", + "vivecraft.options.yes": "JA", + "vivecraft.options.no": "NEE", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Standaard", + "vivecraft.options.opaque": "Ondoorzichtig", + "vivecraft.options.mirrormode.off": "UIT (snel)", + "vivecraft.options.mirrormode.dual": "Dual (snel)", + "vivecraft.options.mirrormode.single": "Single (snel)", + "vivecraft.options.mirrormode.firstperson": "1e Persoon (langzaam)", + "vivecraft.options.mirrormode.thirdperson": "3e Persoon (langzaam)", + "vivecraft.options.mirrormode.mixedreality": "Mixed Reality (langzaam)", + "vivecraft.options.mirrormode.cropped": "Bijgesneden (snel)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Links", + "vivecraft.options.right": "Rechts", + "vivecraft.options.color.black": "Zwart", + "vivecraft.options.color.red": "Rood", + "vivecraft.options.color.yellow": "Geel", + "vivecraft.options.color.green": "Groen", + "vivecraft.options.color.cyan": "Cyaan", + "vivecraft.options.color.blue": "Blauw ", + "vivecraft.options.color.magenta": "Roodpaars", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Zij aan Zij", + "vivecraft.options.hudlock.hand": "Hand", + "vivecraft.options.hudlock.head": "Hooft", + "vivecraft.options.hudlock.wrist": "Pols", + "vivecraft.options.renderpointerelement.always": "Altijd", + "vivecraft.options.renderpointerelement.withhud": "Met HUD", + "vivecraft.options.renderpointerelement.never": "Nooit", + "vivecraft.options.chatnotifications.none": "Geen", + "vivecraft.options.chatnotifications.haptic": "haptisch ", + "vivecraft.options.chatnotifications.sound": "Geluid", + "vivecraft.options.chatnotifications.both": "Bijde", + "vivecraft.options.always": "Altijd", + "vivecraft.options.seated": "Zittend", + "vivecraft.options.standing": "Staand", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normaal", + "vivecraft.options.inertiafactor.large": "Veel", + "vivecraft.options.inertiafactor.massive": "Nog meer", + "vivecraft.options.smooth": "Effen", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Crosshair", + "vivecraft.options.freemove.controller": "Controller", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Run-In-Place", + "vivecraft.options.freemove.room": "Kamer", + "vivecraft.options.hold": "Houden", + "vivecraft.options.press": "Druk", + "vivecraft.options.keyboard.physical": "Fysiek", + "vivecraft.options.keyboard.pointer": "Wijzer", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%d Blokken", + "vivecraft.options.teleport": "Teleporteer", + "vivecraft.options.freemove": "Vrij Bewegen", + "vivecraft.options.menuworld.both": "Officieel & Aangepast", + "vivecraft.options.menuworld.custom": "Alleen Aangepast", + "vivecraft.options.menuworld.official": "Alleen Officieel", + "vivecraft.options.menuworld.none": "Geen", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Langzaam", + "vivecraft.options.rightclickdelay.slower": "Langzamer", + "vivecraft.options.rightclickdelay.slowest": "Traagst", + "vivecraft.options.keyboardtheme.default": "Wit", + "vivecraft.options.keyboardtheme.red": "Rood", + "vivecraft.options.keyboardtheme.green": "Groen", + "vivecraft.options.keyboardtheme.blue": "Blauw ", + "vivecraft.options.keyboardtheme.black": "Leegte", + "vivecraft.options.keyboardtheme.grass": "Grasblok", + "vivecraft.options.keyboardtheme.bees": "Hommel", + "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", + "vivecraft.options.keyboardtheme.dose": "Medicijn", + "vivecraft.options.keyboardtheme.custom": "Aangepast", + "_comment12": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Verschoon", + "vivecraft.gui.loaddefaults": "Laad De Standaardinstellingen", + "vivecraft.gui.menuworld.refresh": "Menuwereld Vernieuwen", + "vivecraft.gui.menuworld.loadnew": "Laad Nieuwe Menuwereld", + "vivecraft.gui.radialmenu.mainset": "Hoofdset", + "vivecraft.gui.radialmenu.alternateset": "Alternatieve Set", + "vivecraft.gui.chat": "Chat", + "vivecraft.gui.commands": "Commando's", + "vivecraft.gui.overlay": "Overlay", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Schermafbeelding", + "vivecraft.gui.calibrateheight": "Hoogte Kalibreren", + "vivecraft.gui.alignkatwalk": "Align KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Verplaats Derde Camera", + "vivecraft.gui.social": "Sociaal", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Spring Schoenen", + "vivecraft.item.climbclaws": "Beklim Klauwen", + "vivecraft.item.telescope": "Oog van de Telescoop", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Overschakelen naar de zittende modus, Controllerinvoer wordt hierdoor uitgeschakeld. Doorgaan?", + "vivecraft.messages.radialmenubind.1": "Zorg ervoor dat Open Radiaal Menu is gebonden.", + "vivecraft.messages.radialmenubind.2": "Houd (Toetsenbord Shift) ingedrukt met het radiaal menu open om over te schakelen naar deze set.", + "vivecraft.messages.controls.1": "Bindingen worden gehandeld door SteamVR Input.", + "vivecraft.messages.controls.2": "Ga naar Instellingen > Controllers > Beheer Controller Bindingen in het dashboard.", + "vivecraft.messages.controls.3": "§6Steam moet actief §ozijn voordat§r§6 SteamVR wordt gestart, anders worden bindingen niet opgeslagen.", + "vivecraft.messages.serverplugin": "Vivecraft-servermod gedetecteerd: %s", + "vivecraft.messages.noserverplugin": "Vivecraft-servermod niet gedetecteerd. Deze server biedt mogelijk geen ondersteuning voor teleporteren. De beperkte bewegingsmodus (terugvallen op vrije beweging) is ingeschakeld.", + "vivecraft.messages.calibrateheight": "Kalibreer uw lengte in het pauzemenu.", + "vivecraft.messages.rendersetupfailed": "Installatie van weergave mislukt: %s", + "vivecraft.messages.intelgraphics": "Intel Integrated Graphics wordt niet ondersteund. Als dit een laptop is, forceer dan de krachtige GPU. Gedetecteerde GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR runtime niet gedetecteerd. Heb je SteamVR geïnstalleerd?", + "vivecraft.messages.menuworldexportcomplete.1": "Wereld export compleet ... gebiedsgrootte: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Opgeslagen naar %s", + "vivecraft.messages.menuworldexportclientwarning": "WAARSCHUWING: Menuwereld opslaan met behulp van een clientwereld. Gegevens zijn mogelijk onvolledig. Het is aan te raden om menuwerelden in singleplayer op te slaan.", + "vivecraft.messages.teleportdisabled": "Beperkte beweging ingeschakeld (geen teleportatie)", + "vivecraft.messages.teleportenabled": "Beperkte beweging uitgeschakeld (teleporteren toegestaan)", + "vivecraft.messages.walkupblocks": "Walk-up blokken (RCTRL + B): %s", + "vivecraft.messages.showaim": "Doel tonen (RCTRL + RSHIFT): ingeschakeld", + "vivecraft.messages.playerinertia": "Traagheid van de spelersbeweging (LCTRL + I): %s", + "vivecraft.messages.movementmodeswitch": "Bewegingsmodus overgeschakeld naar: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", + "vivecraft.messages.heightset": "Hoogte gebruiker ingesteld op %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/pl_pl.json b/common/src/main/resources/assets/vivecraft/lang/pl_pl.json index 13f9c14a3..5b9536d19 100644 --- a/common/src/main/resources/assets/vivecraft/lang/pl_pl.json +++ b/common/src/main/resources/assets/vivecraft/lang/pl_pl.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: cichyhui, Dawidak", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Pasek narzędzi dalej", - "vivecraft.key.hotbarPrev": "Pasek narzędzi wcześniej", - "vivecraft.key.hotbarScroll": "Przewiń pasek narzędzi", - "vivecraft.key.hotbarSwipeX": "Przesuń pasek narzędzi (Lewo/Prawo)", - "vivecraft.key.hotbarSwipeY": "Przesuń pasek narzędzi (Góra/Dół)", - "vivecraft.key.rotateLeft": "Obrót w lewo", - "vivecraft.key.rotateRight": "Obrót w prawo", - "vivecraft.key.rotateAxis": "Tylko obrót", - "vivecraft.key.rotateFree": "Swobodny obrót", - "vivecraft.key.walkabout": "Chodzenie", - "vivecraft.key.teleport": "Teleportacja", - "vivecraft.key.teleportFallback": "Idź do przodu gdy teleportacja jest wyłączona", - "vivecraft.key.freeMoveRotate": "Ruch/Obrót", - "vivecraft.key.freeMoveStrafe": "Ruch/Strafe", - "vivecraft.key.toggleMovement": "Przełącz tryb chodzenia", - "vivecraft.key.quickTorch": "Szybka pochodnia", - "vivecraft.key.ingameMenuButton": "Menu gry", - "vivecraft.key.exportWorld": "Exportuj świat menu", - "vivecraft.key.radialMenu": "Otwórz menu kołowe", - "vivecraft.key.swapMirrorView": "Przełącz widok w oknie", - "vivecraft.key.toggleKeyboard": "Pokaż/Ukryj klawiaturę", - "vivecraft.key.moveThirdPersonCam": "Przesuń kamerę 3-osobową", - "vivecraft.key.togglePlayerList": "Pokaż/Ukryj listę graczy", - "vivecraft.key.toggleHandheldCam": "Przełącz kamerę", - "vivecraft.key.quickHandheldCam": "Szybka kamera", - "vivecraft.key.trackpadTouch": "Dotyk trackpada", - "vivecraft.key.vrInteract": "Interakcja", - "vivecraft.key.guiLeftClick": "Lewe kliknięcie", - "vivecraft.key.guiRightClick": "Prawe kliknięcie", - "vivecraft.key.guiMiddleClick": "Środkowe kliknięcie", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Przewiń w górę", - "vivecraft.key.guiScrollDown": "Przewiń w dół", - "vivecraft.key.guiScrollAxis": "Przewiń", - "vivecraft.key.keyboardClick": "Kliknięcie", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Wspinaczkowe pazury", - "vivecraft.key.climbeyJump": "Buty do skakania", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "Interfejs", - "vivecraft.key.category.climbey": "Ruch Climbey", - "vivecraft.key.category.keyboard": "Klawiatura", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "W grze", - "vivecraft.actionset.gui": "Interfejs", - "vivecraft.actionset.global": "Globalne", - "vivecraft.actionset.mod": "Z modami", - "vivecraft.actionset.contextual": "Kontekstowe", - "vivecraft.actionset.keyboard": "Klawiatura", - "vivecraft.actionset.mixedReality": "Mieszana rzeczywistość", - "vivecraft.actionset.technical": "Techniczne", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "Ustawienia VR", - "vivecraft.options.screen.freemove": "Ustawienia swobodnego ruchu", - "vivecraft.options.screen.gui": "Ustawienia HUD i Interfejsu", - "vivecraft.options.screen.menuworld": "Ustawienia świata menu", - "vivecraft.options.screen.guiother": "Ustawienia Czatu/Celownika", - "vivecraft.options.screen.quickcommands": "Szybkie komendy", - "vivecraft.options.screen.radialmenu": "Konfiguracja menu kołowego", - "vivecraft.options.screen.stereorendering": "Ustawienia renderowania stereo", - "vivecraft.options.screen.roomscale": "Ustawienia interakcji Roomscale", - "vivecraft.options.screen.seated": "Ustawienia trybu siedzącego", - "vivecraft.options.screen.standing": "Ustawienia lokomocji stojącej", - "vivecraft.options.screen.teleport": "Ustawienia teleportacji", - "vivecraft.options.screen.controls": "Ustawienia kontrolera", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "Ustawienia VR", - "vivecraft.options.screen.gui.button": "Ustawienia HUD i Interfejsu...", - "vivecraft.options.screen.stereorendering.button": "Ustawienia renderowania stereo", - "vivecraft.options.screen.quickcommands.button": "Szybkie komendy", - "vivecraft.options.screen.guiother.button": "Ustawienia czatu i celownika...", - "vivecraft.options.screen.standing.button": "Ustawienia lokomocji...", - "vivecraft.options.screen.roomscale.button": "Ustawienia interakcji...", - "vivecraft.options.screen.controls.button": "Ustawienia kontrolera..", - "vivecraft.options.screen.radialmenu.button": "Menu kołowe...", - "vivecraft.options.screen.seated.button": "Ustawienia trybu siedzącego...", - "vivecraft.options.screen.menuworld.button": "Ustawienia świata menu... ", - "vivecraft.options.screen.teleport.button": "Ustawienia teleportacji...", - "vivecraft.options.screen.freemove.button": "Ustawienia swobodnego ruchu...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Rozmiar HUD głowy", - "vivecraft.options.HUD_DISTANCE": "Odległość HUD głowy", - "vivecraft.options.HUD_LOCK_TO": "Blokada orientacji HUD", - "vivecraft.options.HUD_OPACITY": "Przejrzystość HUD", - "vivecraft.options.HUD_HIDE": "Ukryj HUD (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "Tło HUD/Interfejsu", - "vivecraft.options.HUD_OCCLUSION": "Okluzja HUD", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Menu główne podąża", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Okluzja celownika", - "vivecraft.options.CROSSHAIR_SCALE": "Rozmiar celownika", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Rozmiar celownika w menu", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Pokaż celownika", - "vivecraft.options.CHAT_NOTIFICATIONS": "Powiadomienia czatu", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Dźwięk powiadomienia", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Skalowanie celownika", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Pokaż zarys bloków", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Zawsze otwieraj klawiaturę", - "vivecraft.options.RADIAL_MODE_HOLD": "Tryb menu kołowego", - "vivecraft.options.PHYSICAL_KEYBOARD": "Rodzaj Klawiatury", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Wielkość Klawiatury", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Pokaż nad blokiem", - "vivecraft.options.FSAA": "Skala Lanczos", - "vivecraft.options.MIRROR_DISPLAY": "Odbicie ekranu", - "vivecraft.options.MIRROR_EYE": "Odbicie oka", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Kolor klawisza", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Pokaż dłonie", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Ułożenie", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Niezdeformowane pole", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Maska alpha", - "vivecraft.options.MIXED_REALITY_FOV": "Trzecioosobowy FOV", - "vivecraft.options.WALK_UP_BLOCKS": "Wchodzenie na bloki", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Ruch. Mnożnik szybkości", - "vivecraft.options.INERTIA_FACTOR": "Bezwładność gracza", - "vivecraft.options.SIMULATE_FALLING": "Symuluj spadanie", - "vivecraft.options.WEAPON_COLLISION": "Kolizja broni", - "vivecraft.options.ALLOW_CRAWLING": "Czołganie się Roomscale", - "vivecraft.options.LIMIT_TELEPORT": "Limit w przetrwaniu", - "vivecraft.options.REVERSE_HANDS": "Odwróć dłonie", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Używaj matrycy oczu", - "vivecraft.options.BCB_ON": "Pokaż pozycję ciała", - "vivecraft.options.WORLD_SCALE": "Skala Świata", - "vivecraft.options.WORLD_ROTATION": "Rotacja Świata", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Zwiększenie rotacji", - "vivecraft.options.TOUCH_HOTBAR": "Dotykanie paska narzędzi włączone", - "vivecraft.options.PLAY_MODE_SEATED": "Tryb gry", - "vivecraft.options.RENDER_SCALEFACTOR": "Rozdzielczość", - "vivecraft.options.MONO_FOV": "Niezniekształcony FOV", - "vivecraft.options.REALISTIC_JUMP": "Skakanie Roomscale", - "vivecraft.options.REALISTIC_SNEAK": "Skradanie się Roomscale", - "vivecraft.options.PHYSICAL_GUI": "Fizyczny Interfejs", - "vivecraft.options.REALISTIC_CLIMB": "Wspinanie się Roomscale", - "vivecraft.options.REALISTIC_SWIM": "Pływanie Roomscale", - "vivecraft.options.REALISTIC_ROW": "Wiosłowanie Roomscale", - "vivecraft.options.WALK_MULTIPLIER": "Mnożnik chodzenia", - "vivecraft.options.FREEMOVE_MODE": "Typ swobodnego ruchu", - "vivecraft.options.VEHICLE_ROTATION": "Rotacja pojazdów", - "vivecraft.options.RESET_ORIGIN": "Resetuj początek", - "vivecraft.options.X_SENSITIVITY": "Szybkość rotacji", - "vivecraft.options.Y_SENSITIVITY": "Czułość Y", - "vivecraft.options.KEYHOLE": "Dziurka", - "vivecraft.options.FOV_REDUCTION": "Redukcja komfortu FOV", - "vivecraft.options.FOV_REDUCTION_MIN": "Wielkość redukcji FOV", - "vivecraft.options.FOV_REDUCTION_OFFSET": "Przesunięcie redukcji FOV", - "vivecraft.options.SEATED_HMD": "Kierunek przodu", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD podąża", - "vivecraft.options.BACKPACK_SWITCH": "Zmienianie plecakowe", - "vivecraft.options.ANALOG_MOVEMENT": "Ruch analogiem", - "vivecraft.options.AUTO_SPRINT": "Auto-sprint", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Próg auto-sprintu", - "vivecraft.options.BOW_MODE": "Tryb łuku Roomscale", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limit w dół", - "vivecraft.options.TELEPORT_UP_LIMIT": "Limit w górę", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Limit odległości", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Pozwól ruszyć początek", - "vivecraft.options.SEATED_FREE_MOVE": "Tryb chodzenia", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Wymuś swobodny ruch", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Pokaż zaawansowane sterowanie", - "vivecraft.options.MENU_WORLD_SELECTION": "Światy", - "vivecraft.options.HRTF_SELECTION": "Dźwięk przestrzenny (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Przeładuj zewnętrzną kamerę", - "vivecraft.options.RIGHT_CLICK_DELAY": "Powtórzenie prawego kliknięcia", - "vivecraft.options.ANIMAL_TOUCHING": "Dotykanie zwierząt", - "vivecraft.options.HANDHELD_CAMERA_FOV": "FOV kamery", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Rozdzielczość kamery", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Pokaż Model Kamery", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Motyw Klawiatury", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Względna wielkość HUD. \nWartość jest względna, nie w stopniach, części FOV lub czegokolwiek.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Odległość HUD od ciebie. \nWzględna wielkość HUD nie jest z tym powiązana.\nOdległość w metrach (ale nie jest blokowana przez bloki).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Określa do czego przyczepiony jest HUD.\n Ręka: HUD jest nad ręką\n Głowa: HUD jest zawsze przed tobą w polu widzenia\n Ramię: HUD jest w środku twojej wolnej ręki. Pokaże się gdy na niego spojrzysz.", - "vivecraft.options.HUD_OPACITY.tooltip": "Jak bardzo przeźroczysty ma być HUD i interfejs.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Określa czy okienka menu mają półprzeźroczyste tło.\n Wł: Półprzeźroczyste tło w okienkach.\n Wył: Brak tła w okienkach.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Określa czy HUD jest zasłaniany przez bliższe obiekty.\n Wł: HUD będzie zasłonięty przez obiekty. Może być zasłonięty całkowicie w niektórych przypadkach.\n Wył: HUD jest zawsze widoczny. Problemy z percepcją głębi mogą występować.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Ustala kiedy menu główne podąża za twoim wzrokiem.\n Siedzący: Menu główne będzie podążało tylko w trybie siedzącym.\n Zawsze: Menu główne będzie zawsze podążało.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Ustawia rozmiar celownika w grze.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Ustawia rozmiar celownika w menu.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Ustawia tryb wyświetlania celownika w grze.\n Zawsze: Celownik jest zawsze widoczny, nawet jeśli HUD jest niewidoczny.\n Z HUD: Celownik jest widoczny gdy HUD jest widoczny.\n Nigdy: Celownik nigdy nie jest widoczny.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Ustala co się zdarzy gdy otrzymasz wiadomość czatu.\n Żaden: Nic!\n Haptyczny: Zadrży lewy kontroler.\n Dźwięk: Odtworzy się dźwięk powiadomienia.\n Oba: Drganie i dźwięk jednocześnie.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Ustawia dźwięk powiadomienia czatu.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Określa jak celownik zmienia się wraz z dystansem. \n Wł: Celownik będzie rósł wraz z dystansem, żeby zachować taki sam widoczny rozmiar. \n Wył: Celownik zawsze będzie tego samego rozmiaru i będzie wyglądał mniejszy im dalej będzie. ", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Określa czy gra pokazuje obwódkę wokół bloków. \n Zawsze: Obwódka bloków jest zawsze widoczna, nawet jeśli HUD jest wyłączony. \n Z HUD: Obwódka bloków jest widoczna gdy HUD jest włączony. \n Nigdy: Obwódka bloków nie jest widoczna. ", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Jeśli wyłączone, klawiatura będzie otwarta tylko gdy klikniesz pole tekstowe lub gdy pole tekstowe nie może stracić uwagi. \n\nJeśli włączone klawiatura otworzy się automatycznie gdy pole tekstowe zdobędzie uwagę. Włączenie tego będzie powodowało otwarcie klawiatury w niechcianych sytuacjach z modami. ", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Zachowanie menu kołowego gdy klikniesz przycisk. \n Przytrzymaj: Przytrzymaj przycisk menu kołowego, wskaż wybór i puść przycisk. \n Wciśnij: Wciśnij przycisk menu kołowego, kliknij opcję, wcisnij przycisk menu kołowego ponownie żeby anulaowac", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Który rodzaj wirtualnej klawiatury używać do pisania. \n Fizyczna: klawiatura na której możesz pisać jak na prawdziwej klawiaturze. \n Wskaznik: Klawiatura na której klikasz przez wskazywanie klawiszy kontrolerami. ", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Jak duża powinna być fizyczna klawiatura, względnie do jej bazowego rozmiaru. ", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Jeśli włączone, interfejs bloków (takich jak skrzynie i piece) będzie umieszczony nad blokami. W przeciwnym wypadku pojawi się w domyślnej pozycji. ", - "vivecraft.options.FSAA.tooltip": "Używa innej metody próbkowania gry zanim wyślę ją do HMD. Działa najlepiej z dużymi skalami renderu. ", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Wyświetla obraz z HMD w oknie Minecrafta.\nMoze być ustawione na wyłączone, pojedynczy lub podwójny widok HMD, pierwszoosobowy nie zniekształcony, trzecioosobowy nie zniekształcony i mieszaną rzeczywistość. Nie zniekształcone i mieszana rzeczywistość są kosztowne wydajnościowo. ", - "vivecraft.options.MIRROR_EYE.tooltip": "Którego oka używać w przyciętym i pojedynczym trybie. ", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Kolor rysowany w \"przeźroczystych\" strefach widoku mieszanej rzeczywistości. Inne kolory w grze nie będą takie same żeby nie powodować problemów. ", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Renderuje dłonie w mieszanej rzeczywistości. Dotyczy tylko modeli dłoni, przedmioty wciąż będą widoczne. ", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Wybór pomiędzy 4-panelowym układem w stylu Unity, a 2-panelowym obok siebie. ", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Zawiera nie zniekształcony widok w 4-panelowym układzie. Wymaga dodatkowego renderu. Inaczej będzie użyty widok z HMD. ", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "W układzie Unity, jeśli tak, będzie rysowana czarnobiała maska alpha w górnej prawej strefie (jak w Unity) do użytku w maskowaniu warstwy tła. Inaczej, tło będzie rysowane z kolorem klucza do użytku z efektami kluczowego koloru. ", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "FOV używane w trybie mieszanej rzeczywistości. ", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Umożliwia Ci na wchodzenie na bloki bez konieczności skakania. Kombinacja klawiszy: RCTRL+B\n§cUWAGA: może powodować ostrzeżenia anty-cheat na serwerach!!\n Wył: (Domyślne) Musisz wskoczyć na bloki. \n Wł: Muzesz wchodzić na pojedyncze bloki. Może zmniejszyć efekt choroby symulacyjnej. ", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Ustawia mnożnik chodzenia, pozwalając poruszać się wolniej niż domyślnie. Może pomóc chorobę lokomocyjną. \n§cUWAGA: Może wywołać ostrzeżenia anty-cheat na serwerach. \nDomyślne to standardowy noznik Minecrafta (1.0).", - "vivecraft.options.INERTIA_FACTOR.tooltip": "Ustawia przestrzeń gracza w trybie jednoosobowym. Mniejsza wartość oznacza większe przyspieszenie i odwrotnie. Duża wartość może zmniejszyć chorobę lokomocyjną ale strzeż się krawędzi klifow!\n Normalna: (Domyślne) Standardowe poruszanie się w Minecraft. \n Automan < Normalna < Dużo < Jeszcze więcej. Nie ma wpływu na poruszanie się w cieczach lub skakanie. ", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Jeśli włączone graczz spadnie na ziemię w trybie teleportacji gdy stoi nad pustą przestrzenią. Dodatkowo zezwala na skakanie. ", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Włącza możliwość uderzania bloków i stworzeń w trybie roomscale. \nAutomatycznie włączony jest w trybie przetrwania i wyłączony w kreatywnym. ", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Jeśli włączone, gracz jest w stanie kucnąć pod blokiem.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "Jeśli włączone teleporter łukowy będzie miał ograniczenia w trybie przetrwania. Nie będzie mógł wskoczyć na ściany, pochłonie głód i będzie miał pasek energii, który odnawia się po czasie. ", - "vivecraft.options.REVERSE_HANDS.tooltip": "Zamienia lewą/prawą rękę jako dominującą.\n Wł: Lewa dominująca\n Wył: Prawa dominująca\n\nAby zamienić przyciski, zrestartuj grę i Upewnij się, że domyślne przypisania są wybrane w SteamVR. ", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Maskuje strefy ekranu poza FOV. \nZwiększa wydajność. ", - "vivecraft.options.BCB_ON.tooltip": "Pokazuje pozycję twojego ciała jako kwadratowy cień na ziemi. \nTo jest twój Kwadratowy Cienisty Koleżka™.\nNie zgub swojego Kwadratowego Cienistego Koleżki. ", - "vivecraft.options.WORLD_SCALE.tooltip": "Skaluje gracza w świecie.\nPonad jedynką czynią cię większym\nPoniżej jedynki czynią cię mniejszym\nA te, które dała ci matka\nNie robią nic. ", - "vivecraft.options.WORLD_ROTATION.tooltip": "Dodaje dodatkową rotację do twojego HMD. \nBardziej użyteczne gdy przypisane do klawisza lub zmieniane strzałkami na klawiaturze. ", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "O ile stopni obróci się świat podczas obrotu.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Jeśli włączone, możesz dotykać paska narzędzi swoją główną ręką, aby wybrać przedmioty.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Stojący lub siedzący tryb gry.\nStanie jest znacznie lepsze. ", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Skala renderowania gry, względna do natywnej rozdzielczości ekranu HMD. Większe wartości poprawiają jakość obrazu kosztem wydajności. ", - "vivecraft.options.MONO_FOV.tooltip": "FOV użyty dla nie zniekształconego trybu wyświetlania.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "Jeśli włączone, twoja postać podskoczy wtedy gdy ty podskoczysz. Dodatkowo włącza Buty do skakania.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Jeśli włączone, twoja postać przykucnie gdy ty przykucniesz.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Jeśli włączone, interfejs będzie zastąpiony modelami 3D.\nJeśli śledzenie plecaka jest włączone, sięgnięcie swoich pleców otworzy twój ekwipunek.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Jeśli włączone, pozwala na wspinaczkę po drabinach i pnączach przez dotykanie ich. Dodatkowo włącza Pazury wspinaczkowe.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Jeśli włączone, pozwala na pływanie stylem klasycznym używając kontrolerów.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Płyń, płyń łódką swą... poprzez trzepotanie rękami jak szalony.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Zwiększa twoją pozycję w pokoju o daną wartość. \nPozwala Ci chodzić więcej, ale może powodować chorobę lokomocyjną. ", - "vivecraft.options.FREEMOVE_MODE.tooltip": "Źródło kierunku swobodnego ruchu.\n\n Kontroler: Druga ręka wskazuje kierunek.\n HMD: Kierunek widoku Gogli.\n Bieg w miejscu: Obrót poziomy jest zależny od tego jak wymachujesz kontrolerami. Obrót pionowy od Gogli.\n Pokój: Obrót poziomy jest względny do kierunku ułożenia twojego pokoju w SteamVR. Obrót pionowy od Gogli. Ten tryb jest Zalecany dla konfiguracji 180°.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Jeżdżenie na pojeździe będzie obracało świat razem z pojazdem. Może być dezorientujące.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Ustawia stopy gracza 1.62m pod pozycją HMD. Użyteczne dla trybu siedzącego lub śledzenia nieabsolutnego.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Szybkość z jaką widok zostanie obrócony gdy wciśnięty na krawędzi dziurki. ", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Pionowa szybkość celownika powiązana z myszką.", - "vivecraft.options.KEYHOLE.tooltip": "Liczba stopni w lewo i prawo od środka gdzie widok zacznie się obracać.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Zmniejsza pole widzenia podczas ruchu. Może pomóc z chorobą lokomocyjną.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Ostateczny rozmiar redukcji FOV.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Przesunięcie w poziomie środka redukcji FOV dla niestandardowych zestawów VR.", - "vivecraft.options.SEATED_HMD.tooltip": "Kierunek w którą klawisz \"do przodu\" (W) będzie wskazywał. \nKierunek HMD lub celownika. ", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Kierunek, w którym HUD będzie umieszczony. \nKierunek HMD lub celownika. ", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Jeśli włączone, sięganie za głowę prawym kontrolerem spowoduje wybranie pola 1 w pasku szybkiego dostępu lub poprzednio wybranego. Zrobienie tego lewym kontrolerem zamieni przedmiot między dłońmi. ", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Szybkość chodzenia zostanie zdefiniowana przez wartość osi przycisku, jeśli powiązany przycisk taką ma. \n\nDla pełnego użycia gałki analoga lepiej użyć \"Ruch/Strafe\" lub \"Ruch/Obrót\". ", - "vivecraft.options.AUTO_SPRINT.tooltip": "Gdy używasz swobodnego ruchu, sprint aktywuje się automatycznie gdy wartość osi przekroczy ustaloną wartość. ", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Wartość aktywacji automatycznego sprintu. ", - "vivecraft.options.BOW_MODE.tooltip": "Ustala czy używać Łucznictwa Roomscale. \n Wył: Nigdy. \n Vanilla: Tylko dla oryginalnego łuku, nie dla przedmiotów z modów. \n Wł: Zawsze dał każdego przedmiotu, który używa mechaniki łuku. ", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit ilości bloków pod tobą na ile możesz się teleportować.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit ilości bloków nad tobą na ile możesz się teleportować.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit ilości bloków na ile możesz się teleportować.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Zezwala na użycie przycisku \"Resetuj Początek\" w trybie stojącym, dla tych co wola grać kontrolerami ruchowymi na siedząco. ", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Którego trybu ruchu używać w trybie siedzącym.\n\n Teleportacja: Wciśnij którykolwiek kierunek do aktywacji.\n Swobodny ruch: Użyj WASD jak w zwykłym Minecraft. ", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Wymusza użycie drugorzędnego powiązania do chodzenia w przód (domyślnie lewy spust). Dla większej ilości opcji edytuj przypisania klawiszy w SteamVR. \n\nPamiętaj, że to wyłącza możliwość teleportacji. ", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Ukazuje dodatkowe przypisania klawiszy SteamVR dla climbey, klawiatury i mieszanej rzeczywistości.\n\nWymaga restartu, żeby miało efekty. ", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Jakie światy menu załadować na starcie. \n\nJeśli nie ma żadnych własnych, oficjalne światy zostaną użyte. ", - "vivecraft.options.HRTF_SELECTION.tooltip": "Profil HRTF do użytku z pozycyjnym dźwiękiem 3D. Jakość moze się różnić na różnych urządzeniach i sterownikach. \n\n Wył: Wyłącza HRTF. \n Domyślne: Używa domyślnego profilu HRTF. \n Inne: Używa specyficznego profilu HRTF. ", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Ponownie ładuje konfigurację kamery z ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Ilość ticków pomiędzy kliknięciami prawego guzika gdy przytrzymujesz guzik wciścięty.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Jeśli włączone, dotykanie pasywnego moba (rzwierzęcia), nie trzymając broni w ręku, zadziała jak PPM (interakcja) zamiast ataku. \nWyłącz dla Klepania Świnek, Josh. ", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV podręcznej kamery do zrzutów ekranu. ", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Rozdzielczość podręcznej kamery do zrzutów ekranu, aby móc robić większe zrzuty od normalnej rozdzielczości gry. \nNie może być używana z shaderami. \n§cUWAGA: Ustawienie tego bardzo wysoko może stopić twój komputer!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Pokaż model kamery (tylko w HMD) żeby widzieć gdzie aktualnie jest kamera mieszanej rzeczywistości lub kamera trzecioosobowa. Może być także złapana żeby nią poruszać używając przycisku interakcji.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Zestaw kolorów dla fizycznej klawiatury. Własny motyw może być edytowany w pliku keyboardtheme.txt w plikach gry. Będzie odświeżany za każdym razem gdy otwierana jest klawiatura, żeby mieć możliwość usprawnienia jej na żywo.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "Nie widzę", - "vivecraft.options.yes": "TAK", - "vivecraft.options.no": "NIE", - "vivecraft.options.weaponcollision.auto": "Auto", - "vivecraft.options.default": "Domyślne", - "vivecraft.options.opaque": "Nieprzeźroczysty", - "vivecraft.options.mirrormode.off": "Wyłączony (szybki)", - "vivecraft.options.mirrormode.dual": "Podwójny (szybki)", - "vivecraft.options.mirrormode.single": "Pojedyńczy (szybki)", - "vivecraft.options.mirrormode.firstperson": "Pierwszoosobowy (wolny)", - "vivecraft.options.mirrormode.thirdperson": "Trzecioosobowy (wolny)", - "vivecraft.options.mirrormode.mixedreality": "Mieszana rzeczywistość (wolny)", - "vivecraft.options.mirrormode.cropped": "przycięty (szybki)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Lewo", - "vivecraft.options.right": "Prawo", - "vivecraft.options.color.black": "Czarny", - "vivecraft.options.color.red": "Czerowny", - "vivecraft.options.color.yellow": "Żółty", - "vivecraft.options.color.green": "Zielony", - "vivecraft.options.color.cyan": "Cyjan", - "vivecraft.options.color.blue": "Niebieski", - "vivecraft.options.color.magenta": "Magenta", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "Obok siebie", - "vivecraft.options.hudlock.hand": "Dłoń", - "vivecraft.options.hudlock.head": "Głowa", - "vivecraft.options.hudlock.wrist": "Ramię", - "vivecraft.options.renderpointerelement.always": "Zawsze", - "vivecraft.options.renderpointerelement.withhud": "Z HUD", - "vivecraft.options.renderpointerelement.never": "Nigdy", - "vivecraft.options.chatnotifications.none": "Żaden", - "vivecraft.options.chatnotifications.haptic": "Haptyczny", - "vivecraft.options.chatnotifications.sound": "Dźwięk", - "vivecraft.options.chatnotifications.both": "Oba", - "vivecraft.options.always": "Zawsze", - "vivecraft.options.seated": "Siedzący", - "vivecraft.options.standing": "Stojący", - "vivecraft.options.inertiafactor.none": "Automan", - "vivecraft.options.inertiafactor.normal": "Normalny", - "vivecraft.options.inertiafactor.large": "Dużo", - "vivecraft.options.inertiafactor.massive": "Jeszcze więcej", - "vivecraft.options.smooth": "Gładko", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Celownik", - "vivecraft.options.freemove.controller": "Kontroler", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Bieg w miejscu", - "vivecraft.options.freemove.room": "Pokój", - "vivecraft.options.hold": "Przytrzymanie", - "vivecraft.options.press": "Wciśnięcie", - "vivecraft.options.keyboard.physical": "Fizyczne", - "vivecraft.options.keyboard.pointer": "Wskaźnik", - "vivecraft.options.bowmode.vanilla": "Vanilla", - "vivecraft.options.teleportlimit": "%dBloków", - "vivecraft.options.teleport": "Teleportacja", - "vivecraft.options.freemove": "Swobodny ruch", - "vivecraft.options.menuworld.both": "Oficjalny i własny", - "vivecraft.options.menuworld.custom": "Tylko Własny", - "vivecraft.options.menuworld.official": "Tylko oficjalny", - "vivecraft.options.menuworld.none": "Żaden", - "vivecraft.options.rightclickdelay.vanilla": "Vanilla", - "vivecraft.options.rightclickdelay.slow": "Wolno", - "vivecraft.options.rightclickdelay.slower": "Wolniej", - "vivecraft.options.rightclickdelay.slowest": "Najwolniej", - "vivecraft.options.keyboardtheme.default": "Biały", - "vivecraft.options.keyboardtheme.red": "Czerowny", - "vivecraft.options.keyboardtheme.green": "Zielony", - "vivecraft.options.keyboardtheme.blue": "Niebieski", - "vivecraft.options.keyboardtheme.black": "Pustka", - "vivecraft.options.keyboardtheme.grass": "Blok Trawy", - "vivecraft.options.keyboardtheme.bees": "Trzmiele", - "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§de§bt§dy§bk§da", - "vivecraft.options.keyboardtheme.dose": "Medycyna", - "vivecraft.options.keyboardtheme.custom": "Własne", - "_comment12": "Button text", - "vivecraft.gui.ok": "OK", - "vivecraft.gui.clear": "Czysto", - "vivecraft.gui.loaddefaults": "Załaduj domyślne", - "vivecraft.gui.menuworld.refresh": "Odśwież świat menu", - "vivecraft.gui.menuworld.loadnew": "Załaduj nowy świat menu", - "vivecraft.gui.radialmenu.mainset": "Główne ułożenie", - "vivecraft.gui.radialmenu.alternateset": "Alternatywne ułożenie", - "vivecraft.gui.chat": "Czat", - "vivecraft.gui.commands": "Komendy", - "vivecraft.gui.overlay": "Nakrycie", - "vivecraft.gui.profiler": "Profiler", - "vivecraft.gui.screenshot": "Zrzut ekranu", - "vivecraft.gui.calibrateheight": "Kalibruj wysokość", - "vivecraft.gui.alignkatwalk": "Wyrównaj KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Rusz kamerę 3-os", - "vivecraft.gui.social": "Społeczność", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Buty do skakania", - "vivecraft.item.climbclaws": "Pazury wspinaczkowe", - "vivecraft.item.telescope": "Oko Farseer'a", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Zmiana trybu na siedzący wyłączy sterowanie kontrolerami. Kontynuować?", - "vivecraft.messages.radialmenubind.1": "Upewnij się, że przycisk otwarcia menu kołowego jest przypisany.", - "vivecraft.messages.radialmenubind.2": "Przytrzymaj (Shift na klawiaturze) gdy jest otwarte menu kolowe, żeby znienić na to ułożenie.", - "vivecraft.messages.controls.1": "Powiązania są obsługiwane przez SteamVR Input.", - "vivecraft.messages.controls.2": "Idź do Ustawienia > Kontrolery > Zarządzaj konfiguracją kontrolera lub Otwórz stary interfejs przypisania (opcja ukryta).", - "vivecraft.messages.controls.3": "§6Steam musi być uruchomiony §ozanim§r§6 SteamVR się uruchomi, inaczej powiązania nie zapiszą się.", - "vivecraft.messages.serverplugin": "Wykryto serwerowy mod Vivecraft: %s", - "vivecraft.messages.noserverplugin": "Nie wykryto serwerowego moda Vivecraft. Ten serwer moze nie wspierać teleportacji. Restrykcyjny tryb ruchu włączony (rezerwa do swobodnego ruchu).", - "vivecraft.messages.calibrateheight": "Proszę skalibruj swoją wysokość w menu.", - "vivecraft.messages.rendersetupfailed": "Renderowanie nie powiodło się %s", - "vivecraft.messages.intelgraphics": "Zintegrowana grafika Intela nie jest wspierana. Jeśli to jest laptop, wymuś użycie wysokiej wydajności GPU. Wykryte GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR nie zostało wykryte. Zainstalowałeś SteamVR? ", - "vivecraft.messages.menuworldexportcomplete.1": "Export świata pomyślny... rozmiar strefy: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Zapisane do %s", - "vivecraft.messages.menuworldexportclientwarning": "UWAGA: Zapis świata menu używając świata klienckiego. Dane mogą być niekompletne. Zalecane jest zapisywanie światów menu w trybie jednoosobowym. ", - "vivecraft.messages.teleportdisabled": "Ograniczony ruch włączony (brak teleportacji)", - "vivecraft.messages.teleportenabled": "Ograniczony ruch wyłączony (teleportacja dozwolona)", - "vivecraft.messages.walkupblocks": "Wchodź na bloki (RCTRL+B): %s", - "vivecraft.messages.showaim": "Pokaż cel (RCTRL+RSHIFT): włączone", - "vivecraft.messages.playerinertia": "Bezwładność ruchu gracza (LCTRL+l): %s", - "vivecraft.messages.movementmodeswitch": "Tryb chodzenia zmieniony na: %s", - "vivecraft.messages.coords": "X: %.2fY: %.2f Z: %.2f", - "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", - "vivecraft.messages.heightset": "Wysokość gracza ustawiona na: %d%%" -} \ No newline at end of file + "_comment0": "Contributors: cichyhui, Dawidak", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Pasek narzędzi dalej", + "vivecraft.key.hotbarPrev": "Pasek narzędzi wcześniej", + "vivecraft.key.hotbarScroll": "Przewiń pasek narzędzi", + "vivecraft.key.hotbarSwipeX": "Przesuń pasek narzędzi (Lewo/Prawo)", + "vivecraft.key.hotbarSwipeY": "Przesuń pasek narzędzi (Góra/Dół)", + "vivecraft.key.rotateLeft": "Obrót w lewo", + "vivecraft.key.rotateRight": "Obrót w prawo", + "vivecraft.key.rotateAxis": "Tylko obrót", + "vivecraft.key.rotateFree": "Swobodny obrót", + "vivecraft.key.walkabout": "Chodzenie", + "vivecraft.key.teleport": "Teleportacja", + "vivecraft.key.teleportFallback": "Idź do przodu gdy teleportacja jest wyłączona", + "vivecraft.key.freeMoveRotate": "Ruch/Obrót", + "vivecraft.key.freeMoveStrafe": "Ruch/Strafe", + "vivecraft.key.toggleMovement": "Przełącz tryb chodzenia", + "vivecraft.key.quickTorch": "Szybka pochodnia", + "vivecraft.key.ingameMenuButton": "Menu gry", + "vivecraft.key.exportWorld": "Exportuj świat menu", + "vivecraft.key.radialMenu": "Otwórz menu kołowe", + "vivecraft.key.swapMirrorView": "Przełącz widok w oknie", + "vivecraft.key.toggleKeyboard": "Pokaż/Ukryj klawiaturę", + "vivecraft.key.moveThirdPersonCam": "Przesuń kamerę 3-osobową", + "vivecraft.key.togglePlayerList": "Pokaż/Ukryj listę graczy", + "vivecraft.key.toggleHandheldCam": "Przełącz kamerę", + "vivecraft.key.quickHandheldCam": "Szybka kamera", + "vivecraft.key.trackpadTouch": "Dotyk trackpada", + "vivecraft.key.vrInteract": "Interakcja", + "vivecraft.key.guiLeftClick": "Lewe kliknięcie", + "vivecraft.key.guiRightClick": "Prawe kliknięcie", + "vivecraft.key.guiMiddleClick": "Środkowe kliknięcie", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Przewiń w górę", + "vivecraft.key.guiScrollDown": "Przewiń w dół", + "vivecraft.key.guiScrollAxis": "Przewiń", + "vivecraft.key.keyboardClick": "Kliknięcie", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Wspinaczkowe pazury", + "vivecraft.key.climbeyJump": "Buty do skakania", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "Interfejs", + "vivecraft.key.category.climbey": "Ruch Climbey", + "vivecraft.key.category.keyboard": "Klawiatura", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "W grze", + "vivecraft.actionset.gui": "Interfejs", + "vivecraft.actionset.global": "Globalne", + "vivecraft.actionset.mod": "Z modami", + "vivecraft.actionset.contextual": "Kontekstowe", + "vivecraft.actionset.keyboard": "Klawiatura", + "vivecraft.actionset.mixedReality": "Mieszana rzeczywistość", + "vivecraft.actionset.technical": "Techniczne", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "Ustawienia VR", + "vivecraft.options.screen.freemove": "Ustawienia swobodnego ruchu", + "vivecraft.options.screen.gui": "Ustawienia HUD i Interfejsu", + "vivecraft.options.screen.menuworld": "Ustawienia świata menu", + "vivecraft.options.screen.guiother": "Ustawienia Czatu/Celownika", + "vivecraft.options.screen.quickcommands": "Szybkie komendy", + "vivecraft.options.screen.radialmenu": "Konfiguracja menu kołowego", + "vivecraft.options.screen.stereorendering": "Ustawienia renderowania stereo", + "vivecraft.options.screen.roomscale": "Ustawienia interakcji Roomscale", + "vivecraft.options.screen.seated": "Ustawienia trybu siedzącego", + "vivecraft.options.screen.standing": "Ustawienia lokomocji stojącej", + "vivecraft.options.screen.teleport": "Ustawienia teleportacji", + "vivecraft.options.screen.controls": "Ustawienia kontrolera", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "Ustawienia VR", + "vivecraft.options.screen.gui.button": "Ustawienia HUD i Interfejsu...", + "vivecraft.options.screen.stereorendering.button": "Ustawienia renderowania stereo", + "vivecraft.options.screen.quickcommands.button": "Szybkie komendy", + "vivecraft.options.screen.guiother.button": "Ustawienia czatu i celownika...", + "vivecraft.options.screen.standing.button": "Ustawienia lokomocji...", + "vivecraft.options.screen.roomscale.button": "Ustawienia interakcji...", + "vivecraft.options.screen.controls.button": "Ustawienia kontrolera..", + "vivecraft.options.screen.radialmenu.button": "Menu kołowe...", + "vivecraft.options.screen.seated.button": "Ustawienia trybu siedzącego...", + "vivecraft.options.screen.menuworld.button": "Ustawienia świata menu... ", + "vivecraft.options.screen.teleport.button": "Ustawienia teleportacji...", + "vivecraft.options.screen.freemove.button": "Ustawienia swobodnego ruchu...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Rozmiar HUD głowy", + "vivecraft.options.HUD_DISTANCE": "Odległość HUD głowy", + "vivecraft.options.HUD_LOCK_TO": "Blokada orientacji HUD", + "vivecraft.options.HUD_OPACITY": "Przejrzystość HUD", + "vivecraft.options.HUD_HIDE": "Ukryj HUD (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "Tło HUD/Interfejsu", + "vivecraft.options.HUD_OCCLUSION": "Okluzja HUD", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Menu główne podąża", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Okluzja celownika", + "vivecraft.options.CROSSHAIR_SCALE": "Rozmiar celownika", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Rozmiar celownika w menu", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Pokaż celownika", + "vivecraft.options.CHAT_NOTIFICATIONS": "Powiadomienia czatu", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Dźwięk powiadomienia", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Skalowanie celownika", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Pokaż zarys bloków", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Zawsze otwieraj klawiaturę", + "vivecraft.options.RADIAL_MODE_HOLD": "Tryb menu kołowego", + "vivecraft.options.PHYSICAL_KEYBOARD": "Rodzaj Klawiatury", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Wielkość Klawiatury", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Pokaż nad blokiem", + "vivecraft.options.FSAA": "Skala Lanczos", + "vivecraft.options.MIRROR_DISPLAY": "Odbicie ekranu", + "vivecraft.options.MIRROR_EYE": "Odbicie oka", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Kolor klawisza", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Pokaż dłonie", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Ułożenie", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Niezdeformowane pole", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Maska alpha", + "vivecraft.options.MIXED_REALITY_FOV": "Trzecioosobowy FOV", + "vivecraft.options.WALK_UP_BLOCKS": "Wchodzenie na bloki", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Ruch. Mnożnik szybkości", + "vivecraft.options.INERTIA_FACTOR": "Bezwładność gracza", + "vivecraft.options.SIMULATE_FALLING": "Symuluj spadanie", + "vivecraft.options.WEAPON_COLLISION": "Kolizja broni", + "vivecraft.options.ALLOW_CRAWLING": "Czołganie się Roomscale", + "vivecraft.options.LIMIT_TELEPORT": "Limit w przetrwaniu", + "vivecraft.options.REVERSE_HANDS": "Odwróć dłonie", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Używaj matrycy oczu", + "vivecraft.options.BCB_ON": "Pokaż pozycję ciała", + "vivecraft.options.WORLD_SCALE": "Skala Świata", + "vivecraft.options.WORLD_ROTATION": "Rotacja Świata", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Zwiększenie rotacji", + "vivecraft.options.TOUCH_HOTBAR": "Dotykanie paska narzędzi włączone", + "vivecraft.options.PLAY_MODE_SEATED": "Tryb gry", + "vivecraft.options.RENDER_SCALEFACTOR": "Rozdzielczość", + "vivecraft.options.MONO_FOV": "Niezniekształcony FOV", + "vivecraft.options.REALISTIC_JUMP": "Skakanie Roomscale", + "vivecraft.options.REALISTIC_SNEAK": "Skradanie się Roomscale", + "vivecraft.options.PHYSICAL_GUI": "Fizyczny Interfejs", + "vivecraft.options.REALISTIC_CLIMB": "Wspinanie się Roomscale", + "vivecraft.options.REALISTIC_SWIM": "Pływanie Roomscale", + "vivecraft.options.REALISTIC_ROW": "Wiosłowanie Roomscale", + "vivecraft.options.WALK_MULTIPLIER": "Mnożnik chodzenia", + "vivecraft.options.FREEMOVE_MODE": "Typ swobodnego ruchu", + "vivecraft.options.VEHICLE_ROTATION": "Rotacja pojazdów", + "vivecraft.options.RESET_ORIGIN": "Resetuj początek", + "vivecraft.options.X_SENSITIVITY": "Szybkość rotacji", + "vivecraft.options.Y_SENSITIVITY": "Czułość Y", + "vivecraft.options.KEYHOLE": "Dziurka", + "vivecraft.options.FOV_REDUCTION": "Redukcja komfortu FOV", + "vivecraft.options.FOV_REDUCTION_MIN": "Wielkość redukcji FOV", + "vivecraft.options.FOV_REDUCTION_OFFSET": "Przesunięcie redukcji FOV", + "vivecraft.options.SEATED_HMD": "Kierunek przodu", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD podąża", + "vivecraft.options.BACKPACK_SWITCH": "Zmienianie plecakowe", + "vivecraft.options.ANALOG_MOVEMENT": "Ruch analogiem", + "vivecraft.options.AUTO_SPRINT": "Auto-sprint", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Próg auto-sprintu", + "vivecraft.options.BOW_MODE": "Tryb łuku Roomscale", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Limit w dół", + "vivecraft.options.TELEPORT_UP_LIMIT": "Limit w górę", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Limit odległości", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Pozwól ruszyć początek", + "vivecraft.options.SEATED_FREE_MOVE": "Tryb chodzenia", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Wymuś swobodny ruch", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Pokaż zaawansowane sterowanie", + "vivecraft.options.MENU_WORLD_SELECTION": "Światy", + "vivecraft.options.HRTF_SELECTION": "Dźwięk przestrzenny (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Przeładuj zewnętrzną kamerę", + "vivecraft.options.RIGHT_CLICK_DELAY": "Powtórzenie prawego kliknięcia", + "vivecraft.options.ANIMAL_TOUCHING": "Dotykanie zwierząt", + "vivecraft.options.HANDHELD_CAMERA_FOV": "FOV kamery", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Rozdzielczość kamery", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Pokaż Model Kamery", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Motyw Klawiatury", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Względna wielkość HUD. \nWartość jest względna, nie w stopniach, części FOV lub czegokolwiek.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Odległość HUD od ciebie. \nWzględna wielkość HUD nie jest z tym powiązana.\nOdległość w metrach (ale nie jest blokowana przez bloki).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Określa do czego przyczepiony jest HUD.\n Ręka: HUD jest nad ręką\n Głowa: HUD jest zawsze przed tobą w polu widzenia\n Ramię: HUD jest w środku twojej wolnej ręki. Pokaże się gdy na niego spojrzysz.", + "vivecraft.options.HUD_OPACITY.tooltip": "Jak bardzo przeźroczysty ma być HUD i interfejs.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Określa czy okienka menu mają półprzeźroczyste tło.\n Wł: Półprzeźroczyste tło w okienkach.\n Wył: Brak tła w okienkach.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Określa czy HUD jest zasłaniany przez bliższe obiekty.\n Wł: HUD będzie zasłonięty przez obiekty. Może być zasłonięty całkowicie w niektórych przypadkach.\n Wył: HUD jest zawsze widoczny. Problemy z percepcją głębi mogą występować.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Ustala kiedy menu główne podąża za twoim wzrokiem.\n Siedzący: Menu główne będzie podążało tylko w trybie siedzącym.\n Zawsze: Menu główne będzie zawsze podążało.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Ustawia rozmiar celownika w grze.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Ustawia rozmiar celownika w menu.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Ustawia tryb wyświetlania celownika w grze.\n Zawsze: Celownik jest zawsze widoczny, nawet jeśli HUD jest niewidoczny.\n Z HUD: Celownik jest widoczny gdy HUD jest widoczny.\n Nigdy: Celownik nigdy nie jest widoczny.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Ustala co się zdarzy gdy otrzymasz wiadomość czatu.\n Żaden: Nic!\n Haptyczny: Zadrży lewy kontroler.\n Dźwięk: Odtworzy się dźwięk powiadomienia.\n Oba: Drganie i dźwięk jednocześnie.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Ustawia dźwięk powiadomienia czatu.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Określa jak celownik zmienia się wraz z dystansem. \n Wł: Celownik będzie rósł wraz z dystansem, żeby zachować taki sam widoczny rozmiar. \n Wył: Celownik zawsze będzie tego samego rozmiaru i będzie wyglądał mniejszy im dalej będzie. ", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Określa czy gra pokazuje obwódkę wokół bloków. \n Zawsze: Obwódka bloków jest zawsze widoczna, nawet jeśli HUD jest wyłączony. \n Z HUD: Obwódka bloków jest widoczna gdy HUD jest włączony. \n Nigdy: Obwódka bloków nie jest widoczna. ", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Jeśli wyłączone, klawiatura będzie otwarta tylko gdy klikniesz pole tekstowe lub gdy pole tekstowe nie może stracić uwagi. \n\nJeśli włączone klawiatura otworzy się automatycznie gdy pole tekstowe zdobędzie uwagę. Włączenie tego będzie powodowało otwarcie klawiatury w niechcianych sytuacjach z modami. ", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Zachowanie menu kołowego gdy klikniesz przycisk. \n Przytrzymaj: Przytrzymaj przycisk menu kołowego, wskaż wybór i puść przycisk. \n Wciśnij: Wciśnij przycisk menu kołowego, kliknij opcję, wcisnij przycisk menu kołowego ponownie żeby anulaowac", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Który rodzaj wirtualnej klawiatury używać do pisania. \n Fizyczna: klawiatura na której możesz pisać jak na prawdziwej klawiaturze. \n Wskaznik: Klawiatura na której klikasz przez wskazywanie klawiszy kontrolerami. ", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Jak duża powinna być fizyczna klawiatura, względnie do jej bazowego rozmiaru. ", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Jeśli włączone, interfejs bloków (takich jak skrzynie i piece) będzie umieszczony nad blokami. W przeciwnym wypadku pojawi się w domyślnej pozycji. ", + "vivecraft.options.FSAA.tooltip": "Używa innej metody próbkowania gry zanim wyślę ją do HMD. Działa najlepiej z dużymi skalami renderu. ", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Wyświetla obraz z HMD w oknie Minecrafta.\nMoze być ustawione na wyłączone, pojedynczy lub podwójny widok HMD, pierwszoosobowy nie zniekształcony, trzecioosobowy nie zniekształcony i mieszaną rzeczywistość. Nie zniekształcone i mieszana rzeczywistość są kosztowne wydajnościowo. ", + "vivecraft.options.MIRROR_EYE.tooltip": "Którego oka używać w przyciętym i pojedynczym trybie. ", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Kolor rysowany w \"przeźroczystych\" strefach widoku mieszanej rzeczywistości. Inne kolory w grze nie będą takie same żeby nie powodować problemów. ", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Renderuje dłonie w mieszanej rzeczywistości. Dotyczy tylko modeli dłoni, przedmioty wciąż będą widoczne. ", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Wybór pomiędzy 4-panelowym układem w stylu Unity, a 2-panelowym obok siebie. ", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Zawiera nie zniekształcony widok w 4-panelowym układzie. Wymaga dodatkowego renderu. Inaczej będzie użyty widok z HMD. ", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "W układzie Unity, jeśli tak, będzie rysowana czarnobiała maska alpha w górnej prawej strefie (jak w Unity) do użytku w maskowaniu warstwy tła. Inaczej, tło będzie rysowane z kolorem klucza do użytku z efektami kluczowego koloru. ", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "FOV używane w trybie mieszanej rzeczywistości. ", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Umożliwia Ci na wchodzenie na bloki bez konieczności skakania. Kombinacja klawiszy: RCTRL+B\n§cUWAGA: może powodować ostrzeżenia anty-cheat na serwerach!!\n Wył: (Domyślne) Musisz wskoczyć na bloki. \n Wł: Muzesz wchodzić na pojedyncze bloki. Może zmniejszyć efekt choroby symulacyjnej. ", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Ustawia mnożnik chodzenia, pozwalając poruszać się wolniej niż domyślnie. Może pomóc chorobę lokomocyjną. \n§cUWAGA: Może wywołać ostrzeżenia anty-cheat na serwerach. \nDomyślne to standardowy noznik Minecrafta (1.0).", + "vivecraft.options.INERTIA_FACTOR.tooltip": "Ustawia przestrzeń gracza w trybie jednoosobowym. Mniejsza wartość oznacza większe przyspieszenie i odwrotnie. Duża wartość może zmniejszyć chorobę lokomocyjną ale strzeż się krawędzi klifow!\n Normalna: (Domyślne) Standardowe poruszanie się w Minecraft. \n Automan < Normalna < Dużo < Jeszcze więcej. Nie ma wpływu na poruszanie się w cieczach lub skakanie. ", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Jeśli włączone graczz spadnie na ziemię w trybie teleportacji gdy stoi nad pustą przestrzenią. Dodatkowo zezwala na skakanie. ", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Włącza możliwość uderzania bloków i stworzeń w trybie roomscale. \nAutomatycznie włączony jest w trybie przetrwania i wyłączony w kreatywnym. ", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Jeśli włączone, gracz jest w stanie kucnąć pod blokiem.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "Jeśli włączone teleporter łukowy będzie miał ograniczenia w trybie przetrwania. Nie będzie mógł wskoczyć na ściany, pochłonie głód i będzie miał pasek energii, który odnawia się po czasie. ", + "vivecraft.options.REVERSE_HANDS.tooltip": "Zamienia lewą/prawą rękę jako dominującą.\n Wł: Lewa dominująca\n Wył: Prawa dominująca\n\nAby zamienić przyciski, zrestartuj grę i Upewnij się, że domyślne przypisania są wybrane w SteamVR. ", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Maskuje strefy ekranu poza FOV. \nZwiększa wydajność. ", + "vivecraft.options.BCB_ON.tooltip": "Pokazuje pozycję twojego ciała jako kwadratowy cień na ziemi. \nTo jest twój Kwadratowy Cienisty Koleżka™.\nNie zgub swojego Kwadratowego Cienistego Koleżki. ", + "vivecraft.options.WORLD_SCALE.tooltip": "Skaluje gracza w świecie.\nPonad jedynką czynią cię większym\nPoniżej jedynki czynią cię mniejszym\nA te, które dała ci matka\nNie robią nic. ", + "vivecraft.options.WORLD_ROTATION.tooltip": "Dodaje dodatkową rotację do twojego HMD. \nBardziej użyteczne gdy przypisane do klawisza lub zmieniane strzałkami na klawiaturze. ", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "O ile stopni obróci się świat podczas obrotu.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Jeśli włączone, możesz dotykać paska narzędzi swoją główną ręką, aby wybrać przedmioty.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Stojący lub siedzący tryb gry.\nStanie jest znacznie lepsze. ", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Skala renderowania gry, względna do natywnej rozdzielczości ekranu HMD. Większe wartości poprawiają jakość obrazu kosztem wydajności. ", + "vivecraft.options.MONO_FOV.tooltip": "FOV użyty dla nie zniekształconego trybu wyświetlania.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "Jeśli włączone, twoja postać podskoczy wtedy gdy ty podskoczysz. Dodatkowo włącza Buty do skakania.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Jeśli włączone, twoja postać przykucnie gdy ty przykucniesz.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Jeśli włączone, interfejs będzie zastąpiony modelami 3D.\nJeśli śledzenie plecaka jest włączone, sięgnięcie swoich pleców otworzy twój ekwipunek.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Jeśli włączone, pozwala na wspinaczkę po drabinach i pnączach przez dotykanie ich. Dodatkowo włącza Pazury wspinaczkowe.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Jeśli włączone, pozwala na pływanie stylem klasycznym używając kontrolerów.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Płyń, płyń łódką swą... poprzez trzepotanie rękami jak szalony.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Zwiększa twoją pozycję w pokoju o daną wartość. \nPozwala Ci chodzić więcej, ale może powodować chorobę lokomocyjną. ", + "vivecraft.options.FREEMOVE_MODE.tooltip": "Źródło kierunku swobodnego ruchu.\n\n Kontroler: Druga ręka wskazuje kierunek.\n HMD: Kierunek widoku Gogli.\n Bieg w miejscu: Obrót poziomy jest zależny od tego jak wymachujesz kontrolerami. Obrót pionowy od Gogli.\n Pokój: Obrót poziomy jest względny do kierunku ułożenia twojego pokoju w SteamVR. Obrót pionowy od Gogli. Ten tryb jest Zalecany dla konfiguracji 180°.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Jeżdżenie na pojeździe będzie obracało świat razem z pojazdem. Może być dezorientujące.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Ustawia stopy gracza 1.62m pod pozycją HMD. Użyteczne dla trybu siedzącego lub śledzenia nieabsolutnego.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Szybkość z jaką widok zostanie obrócony gdy wciśnięty na krawędzi dziurki. ", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Pionowa szybkość celownika powiązana z myszką.", + "vivecraft.options.KEYHOLE.tooltip": "Liczba stopni w lewo i prawo od środka gdzie widok zacznie się obracać.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Zmniejsza pole widzenia podczas ruchu. Może pomóc z chorobą lokomocyjną.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Ostateczny rozmiar redukcji FOV.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Przesunięcie w poziomie środka redukcji FOV dla niestandardowych zestawów VR.", + "vivecraft.options.SEATED_HMD.tooltip": "Kierunek w którą klawisz \"do przodu\" (W) będzie wskazywał. \nKierunek HMD lub celownika. ", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Kierunek, w którym HUD będzie umieszczony. \nKierunek HMD lub celownika. ", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Jeśli włączone, sięganie za głowę prawym kontrolerem spowoduje wybranie pola 1 w pasku szybkiego dostępu lub poprzednio wybranego. Zrobienie tego lewym kontrolerem zamieni przedmiot między dłońmi. ", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Szybkość chodzenia zostanie zdefiniowana przez wartość osi przycisku, jeśli powiązany przycisk taką ma. \n\nDla pełnego użycia gałki analoga lepiej użyć \"Ruch/Strafe\" lub \"Ruch/Obrót\". ", + "vivecraft.options.AUTO_SPRINT.tooltip": "Gdy używasz swobodnego ruchu, sprint aktywuje się automatycznie gdy wartość osi przekroczy ustaloną wartość. ", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Wartość aktywacji automatycznego sprintu. ", + "vivecraft.options.BOW_MODE.tooltip": "Ustala czy używać Łucznictwa Roomscale. \n Wył: Nigdy. \n Vanilla: Tylko dla oryginalnego łuku, nie dla przedmiotów z modów. \n Wł: Zawsze dał każdego przedmiotu, który używa mechaniki łuku. ", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Limit ilości bloków pod tobą na ile możesz się teleportować.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Limit ilości bloków nad tobą na ile możesz się teleportować.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Limit ilości bloków na ile możesz się teleportować.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Zezwala na użycie przycisku \"Resetuj Początek\" w trybie stojącym, dla tych co wola grać kontrolerami ruchowymi na siedząco. ", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Którego trybu ruchu używać w trybie siedzącym.\n\n Teleportacja: Wciśnij którykolwiek kierunek do aktywacji.\n Swobodny ruch: Użyj WASD jak w zwykłym Minecraft. ", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Wymusza użycie drugorzędnego powiązania do chodzenia w przód (domyślnie lewy spust). Dla większej ilości opcji edytuj przypisania klawiszy w SteamVR. \n\nPamiętaj, że to wyłącza możliwość teleportacji. ", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Ukazuje dodatkowe przypisania klawiszy SteamVR dla climbey, klawiatury i mieszanej rzeczywistości.\n\nWymaga restartu, żeby miało efekty. ", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Jakie światy menu załadować na starcie. \n\nJeśli nie ma żadnych własnych, oficjalne światy zostaną użyte. ", + "vivecraft.options.HRTF_SELECTION.tooltip": "Profil HRTF do użytku z pozycyjnym dźwiękiem 3D. Jakość moze się różnić na różnych urządzeniach i sterownikach. \n\n Wył: Wyłącza HRTF. \n Domyślne: Używa domyślnego profilu HRTF. \n Inne: Używa specyficznego profilu HRTF. ", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Ponownie ładuje konfigurację kamery z ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Ilość ticków pomiędzy kliknięciami prawego guzika gdy przytrzymujesz guzik wciścięty.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Jeśli włączone, dotykanie pasywnego moba (rzwierzęcia), nie trzymając broni w ręku, zadziała jak PPM (interakcja) zamiast ataku. \nWyłącz dla Klepania Świnek, Josh. ", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "FOV podręcznej kamery do zrzutów ekranu. ", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Rozdzielczość podręcznej kamery do zrzutów ekranu, aby móc robić większe zrzuty od normalnej rozdzielczości gry. \nNie może być używana z shaderami. \n§cUWAGA: Ustawienie tego bardzo wysoko może stopić twój komputer!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Pokaż model kamery (tylko w HMD) żeby widzieć gdzie aktualnie jest kamera mieszanej rzeczywistości lub kamera trzecioosobowa. Może być także złapana żeby nią poruszać używając przycisku interakcji.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Zestaw kolorów dla fizycznej klawiatury. Własny motyw może być edytowany w pliku keyboardtheme.txt w plikach gry. Będzie odświeżany za każdym razem gdy otwierana jest klawiatura, żeby mieć możliwość usprawnienia jej na żywo.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "Nie widzę", + "vivecraft.options.yes": "TAK", + "vivecraft.options.no": "NIE", + "vivecraft.options.weaponcollision.auto": "Auto", + "vivecraft.options.default": "Domyślne", + "vivecraft.options.opaque": "Nieprzeźroczysty", + "vivecraft.options.mirrormode.off": "Wyłączony (szybki)", + "vivecraft.options.mirrormode.dual": "Podwójny (szybki)", + "vivecraft.options.mirrormode.single": "Pojedyńczy (szybki)", + "vivecraft.options.mirrormode.firstperson": "Pierwszoosobowy (wolny)", + "vivecraft.options.mirrormode.thirdperson": "Trzecioosobowy (wolny)", + "vivecraft.options.mirrormode.mixedreality": "Mieszana rzeczywistość (wolny)", + "vivecraft.options.mirrormode.cropped": "przycięty (szybki)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Lewo", + "vivecraft.options.right": "Prawo", + "vivecraft.options.color.black": "Czarny", + "vivecraft.options.color.red": "Czerowny", + "vivecraft.options.color.yellow": "Żółty", + "vivecraft.options.color.green": "Zielony", + "vivecraft.options.color.cyan": "Cyjan", + "vivecraft.options.color.blue": "Niebieski", + "vivecraft.options.color.magenta": "Magenta", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "Obok siebie", + "vivecraft.options.hudlock.hand": "Dłoń", + "vivecraft.options.hudlock.head": "Głowa", + "vivecraft.options.hudlock.wrist": "Ramię", + "vivecraft.options.renderpointerelement.always": "Zawsze", + "vivecraft.options.renderpointerelement.withhud": "Z HUD", + "vivecraft.options.renderpointerelement.never": "Nigdy", + "vivecraft.options.chatnotifications.none": "Żaden", + "vivecraft.options.chatnotifications.haptic": "Haptyczny", + "vivecraft.options.chatnotifications.sound": "Dźwięk", + "vivecraft.options.chatnotifications.both": "Oba", + "vivecraft.options.always": "Zawsze", + "vivecraft.options.seated": "Siedzący", + "vivecraft.options.standing": "Stojący", + "vivecraft.options.inertiafactor.none": "Automan", + "vivecraft.options.inertiafactor.normal": "Normalny", + "vivecraft.options.inertiafactor.large": "Dużo", + "vivecraft.options.inertiafactor.massive": "Jeszcze więcej", + "vivecraft.options.smooth": "Gładko", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Celownik", + "vivecraft.options.freemove.controller": "Kontroler", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Bieg w miejscu", + "vivecraft.options.freemove.room": "Pokój", + "vivecraft.options.hold": "Przytrzymanie", + "vivecraft.options.press": "Wciśnięcie", + "vivecraft.options.keyboard.physical": "Fizyczne", + "vivecraft.options.keyboard.pointer": "Wskaźnik", + "vivecraft.options.bowmode.vanilla": "Vanilla", + "vivecraft.options.teleportlimit": "%dBloków", + "vivecraft.options.teleport": "Teleportacja", + "vivecraft.options.freemove": "Swobodny ruch", + "vivecraft.options.menuworld.both": "Oficjalny i własny", + "vivecraft.options.menuworld.custom": "Tylko Własny", + "vivecraft.options.menuworld.official": "Tylko oficjalny", + "vivecraft.options.menuworld.none": "Żaden", + "vivecraft.options.rightclickdelay.vanilla": "Vanilla", + "vivecraft.options.rightclickdelay.slow": "Wolno", + "vivecraft.options.rightclickdelay.slower": "Wolniej", + "vivecraft.options.rightclickdelay.slowest": "Najwolniej", + "vivecraft.options.keyboardtheme.default": "Biały", + "vivecraft.options.keyboardtheme.red": "Czerowny", + "vivecraft.options.keyboardtheme.green": "Zielony", + "vivecraft.options.keyboardtheme.blue": "Niebieski", + "vivecraft.options.keyboardtheme.black": "Pustka", + "vivecraft.options.keyboardtheme.grass": "Blok Trawy", + "vivecraft.options.keyboardtheme.bees": "Trzmiele", + "vivecraft.options.keyboardtheme.aesthetic": "§bE§ds§bt§de§bt§dy§bk§da", + "vivecraft.options.keyboardtheme.dose": "Medycyna", + "vivecraft.options.keyboardtheme.custom": "Własne", + "_comment12": "Button text", + "vivecraft.gui.ok": "OK", + "vivecraft.gui.clear": "Czysto", + "vivecraft.gui.loaddefaults": "Załaduj domyślne", + "vivecraft.gui.menuworld.refresh": "Odśwież świat menu", + "vivecraft.gui.menuworld.loadnew": "Załaduj nowy świat menu", + "vivecraft.gui.radialmenu.mainset": "Główne ułożenie", + "vivecraft.gui.radialmenu.alternateset": "Alternatywne ułożenie", + "vivecraft.gui.chat": "Czat", + "vivecraft.gui.commands": "Komendy", + "vivecraft.gui.overlay": "Nakrycie", + "vivecraft.gui.profiler": "Profiler", + "vivecraft.gui.screenshot": "Zrzut ekranu", + "vivecraft.gui.calibrateheight": "Kalibruj wysokość", + "vivecraft.gui.alignkatwalk": "Wyrównaj KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Rusz kamerę 3-os", + "vivecraft.gui.social": "Społeczność", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Buty do skakania", + "vivecraft.item.climbclaws": "Pazury wspinaczkowe", + "vivecraft.item.telescope": "Oko Farseer'a", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Zmiana trybu na siedzący wyłączy sterowanie kontrolerami. Kontynuować?", + "vivecraft.messages.radialmenubind.1": "Upewnij się, że przycisk otwarcia menu kołowego jest przypisany.", + "vivecraft.messages.radialmenubind.2": "Przytrzymaj (Shift na klawiaturze) gdy jest otwarte menu kolowe, żeby znienić na to ułożenie.", + "vivecraft.messages.controls.1": "Powiązania są obsługiwane przez SteamVR Input.", + "vivecraft.messages.controls.2": "Idź do Ustawienia > Kontrolery > Zarządzaj konfiguracją kontrolera lub Otwórz stary interfejs przypisania (opcja ukryta).", + "vivecraft.messages.controls.3": "§6Steam musi być uruchomiony §ozanim§r§6 SteamVR się uruchomi, inaczej powiązania nie zapiszą się.", + "vivecraft.messages.serverplugin": "Wykryto serwerowy mod Vivecraft: %s", + "vivecraft.messages.noserverplugin": "Nie wykryto serwerowego moda Vivecraft. Ten serwer moze nie wspierać teleportacji. Restrykcyjny tryb ruchu włączony (rezerwa do swobodnego ruchu).", + "vivecraft.messages.calibrateheight": "Proszę skalibruj swoją wysokość w menu.", + "vivecraft.messages.rendersetupfailed": "Renderowanie nie powiodło się %s", + "vivecraft.messages.intelgraphics": "Zintegrowana grafika Intela nie jest wspierana. Jeśli to jest laptop, wymuś użycie wysokiej wydajności GPU. Wykryte GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR nie zostało wykryte. Zainstalowałeś SteamVR? ", + "vivecraft.messages.menuworldexportcomplete.1": "Export świata pomyślny... rozmiar strefy: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Zapisane do %s", + "vivecraft.messages.menuworldexportclientwarning": "UWAGA: Zapis świata menu używając świata klienckiego. Dane mogą być niekompletne. Zalecane jest zapisywanie światów menu w trybie jednoosobowym. ", + "vivecraft.messages.teleportdisabled": "Ograniczony ruch włączony (brak teleportacji)", + "vivecraft.messages.teleportenabled": "Ograniczony ruch wyłączony (teleportacja dozwolona)", + "vivecraft.messages.walkupblocks": "Wchodź na bloki (RCTRL+B): %s", + "vivecraft.messages.showaim": "Pokaż cel (RCTRL+RSHIFT): włączone", + "vivecraft.messages.playerinertia": "Bezwładność ruchu gracza (LCTRL+l): %s", + "vivecraft.messages.movementmodeswitch": "Tryb chodzenia zmieniony na: %s", + "vivecraft.messages.coords": "X: %.2fY: %.2f Z: %.2f", + "vivecraft.messages.angles": "Pitch: %.1f Yaw: %.1f Roll: %.1f", + "vivecraft.messages.heightset": "Wysokość gracza ustawiona na: %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/ru_ru.json b/common/src/main/resources/assets/vivecraft/lang/ru_ru.json index 87861a843..bcab15884 100644 --- a/common/src/main/resources/assets/vivecraft/lang/ru_ru.json +++ b/common/src/main/resources/assets/vivecraft/lang/ru_ru.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: link1107, Krays, Hu4uTa, Shinomasu, NikMe, Jonny_Bro, Timius100, sikamamikado, Turra, Pupokman, bakva, EgorBron", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "Следующий Слот", - "vivecraft.key.hotbarPrev": "Предыдущий Слот", - "vivecraft.key.hotbarScroll": "Прокрутка Слотов", - "vivecraft.key.hotbarSwipeX": "Свайп (Влево/Вправо)", - "vivecraft.key.hotbarSwipeY": "Свайп (Вверх/Вниз)", - "vivecraft.key.rotateLeft": "Повернуться Налево", - "vivecraft.key.rotateRight": "Повернуться Направо", - "vivecraft.key.rotateAxis": "Только Вращение", - "vivecraft.key.rotateFree": "Свободно Поворачиваться ", - "vivecraft.key.walkabout": "Прогулка", - "vivecraft.key.teleport": "Телепортироваться", - "vivecraft.key.teleportFallback": "Идти вперед когда телепортирование выключено", - "vivecraft.key.freeMoveRotate": "Двигаться/Поворачиваться", - "vivecraft.key.freeMoveStrafe": "Двигаться/Стрейфить", - "vivecraft.key.toggleMovement": "Переключить режим перемещения", - "vivecraft.key.quickTorch": "Быстрый Факел", - "vivecraft.key.ingameMenuButton": "Игровое Меню", - "vivecraft.key.exportWorld": "Экспорт Мира Меню", - "vivecraft.key.radialMenu": "Открыть Радиальное Меню", - "vivecraft.key.swapMirrorView": "Выбрать зеркальный вид", - "vivecraft.key.toggleKeyboard": "Показать/Скрыть Клавиатуру", - "vivecraft.key.moveThirdPersonCam": "Передвинуть Камеру Третьего Лица", - "vivecraft.key.togglePlayerList": "Переключить Список Игроков", - "vivecraft.key.toggleHandheldCam": "Переключить камеру", - "vivecraft.key.quickHandheldCam": "Временая камера", - "vivecraft.key.trackpadTouch": "Прикосновения к сенсорной панели", - "vivecraft.key.vrInteract": "Контекстное Взаимодействие", - "vivecraft.key.guiLeftClick": "Левый Клик", - "vivecraft.key.guiRightClick": "Правый Клик", - "vivecraft.key.guiMiddleClick": "Средний Клик", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "Scroll Up", - "vivecraft.key.guiScrollDown": "Scroll Down", - "vivecraft.key.guiScrollAxis": "Scroll", - "vivecraft.key.keyboardClick": "Click", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "Когти Альпиниста", - "vivecraft.key.climbeyJump": "Прыжковые Ботинки", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "Движение на подъем", - "vivecraft.key.category.keyboard": "Клавиатура", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "В игре", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "Глобальный", - "vivecraft.actionset.mod": "Модифицированный", - "vivecraft.actionset.contextual": "Контекстный", - "vivecraft.actionset.keyboard": "Клавиатура", - "vivecraft.actionset.mixedReality": "Смешанная Реальность", - "vivecraft.actionset.technical": "Технический", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "Настройки VR", - "vivecraft.options.screen.freemove": "Параметры Свободного Перемещения", - "vivecraft.options.screen.gui": "Настройки Графического и Игрового Интерфейса", - "vivecraft.options.screen.menuworld": "Меню в игре", - "vivecraft.options.screen.guiother": "Чат/Прицел", - "vivecraft.options.screen.quickcommands": "Быстрые команды", - "vivecraft.options.screen.radialmenu": "Радиальное меню", - "vivecraft.options.screen.stereorendering": "Настройки Стерео Рендера", - "vivecraft.options.screen.roomscale": "Взаимодействие с комнатой", - "vivecraft.options.screen.seated": "Параметры Сидячего Режима", - "vivecraft.options.screen.standing": "Передвижение стоя", - "vivecraft.options.screen.teleport": "Параметры Телепортации", - "vivecraft.options.screen.controls": "Настройки Управления", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "Настройки VR...", - "vivecraft.options.screen.gui.button": "HUD и GUI...", - "vivecraft.options.screen.stereorendering.button": "Стерео рендер...", - "vivecraft.options.screen.quickcommands.button": "Быстрые команды...", - "vivecraft.options.screen.guiother.button": "Настройки чата и прицела...", - "vivecraft.options.screen.standing.button": "Настройки перемещения...", - "vivecraft.options.screen.roomscale.button": "Настройки взаимодействий...", - "vivecraft.options.screen.controls.button": "Настройки контроллера...", - "vivecraft.options.screen.radialmenu.button": "Радиальное меню...", - "vivecraft.options.screen.seated.button": "Настройки сидя...", - "vivecraft.options.screen.menuworld.button": "Меню в игре...", - "vivecraft.options.screen.teleport.button": "Настройки телепортации..", - "vivecraft.options.screen.freemove.button": "Свободное перемещение...", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "Размер HUD", - "vivecraft.options.HUD_DISTANCE": "Дистанция от HUD", - "vivecraft.options.HUD_LOCK_TO": "Фиксация HUD", - "vivecraft.options.HUD_OPACITY": "Прозрачность HUD", - "vivecraft.options.HUD_HIDE": "Спрятать Игровой Интерфейс (F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "Фон HUD/GUI", - "vivecraft.options.HUD_OCCLUSION": "Непрозрачность HUD", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Преследование меню", - "vivecraft.options.CROSSHAIR_OCCLUSION": "Непрозрачность прицела", - "vivecraft.options.CROSSHAIR_SCALE": "Размер Прицела", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "Размер Прицела в Меню", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "Показать Прицел", - "vivecraft.options.CHAT_NOTIFICATIONS": "Оповещения в чате", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Звук оповещения", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Маштаб прицела", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Обводка блоков", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "Статичная клавиатура", - "vivecraft.options.RADIAL_MODE_HOLD": "Режим радиального меню", - "vivecraft.options.PHYSICAL_KEYBOARD": "Тип Клавиатуры", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Размер Клавиатуры", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Положение над блоком", - "vivecraft.options.FSAA": "Фильтр Ланцоша", - "vivecraft.options.MIRROR_DISPLAY": "Отражение РС", - "vivecraft.options.MIRROR_EYE": "Отражение глаз", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Свет Кнопок", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Показывать Руки", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Слой", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Прямая передача", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Альфа-маска", - "vivecraft.options.MIXED_REALITY_FOV": "Поле зрения от третьего лица", - "vivecraft.options.WALK_UP_BLOCKS": "Хождение по блокам", - "vivecraft.options.MOVEMENT_MULTIPLIER": "Движение. Множитель скорости", - "vivecraft.options.INERTIA_FACTOR": "Инерция Игрока", - "vivecraft.options.SIMULATE_FALLING": "Симуляция падения", - "vivecraft.options.WEAPON_COLLISION": "Коллизия Оружия", - "vivecraft.options.ALLOW_CRAWLING": "Ползанье", - "vivecraft.options.LIMIT_TELEPORT": "Лимит в Выживании", - "vivecraft.options.REVERSE_HANDS": "Реверс рук", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "Использовать Трафарет Глаз", - "vivecraft.options.BCB_ON": "Показывать тело", - "vivecraft.options.WORLD_SCALE": "Маштаб мира", - "vivecraft.options.WORLD_ROTATION": "Ротация мира", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "Прирост ротации", - "vivecraft.options.TOUCH_HOTBAR": "Прикосновения к хотбару", - "vivecraft.options.PLAY_MODE_SEATED": "Режим Игры", - "vivecraft.options.RENDER_SCALEFACTOR": "Разрешение", - "vivecraft.options.MONO_FOV": "Неискажённый FOV", - "vivecraft.options.REALISTIC_JUMP": "Прыжки", - "vivecraft.options.REALISTIC_SNEAK": "Приседания", - "vivecraft.options.PHYSICAL_GUI": "Физические GUI", - "vivecraft.options.REALISTIC_CLIMB": "Взбирание", - "vivecraft.options.REALISTIC_SWIM": "Плавание", - "vivecraft.options.REALISTIC_ROW": "Гребля", - "vivecraft.options.WALK_MULTIPLIER": "Ускорение хода", - "vivecraft.options.FREEMOVE_MODE": "Тип Свободного Перемещения", - "vivecraft.options.VEHICLE_ROTATION": "Ротация транспорта", - "vivecraft.options.RESET_ORIGIN": "Перезагрузка источника", - "vivecraft.options.X_SENSITIVITY": "Скорость Поворота", - "vivecraft.options.Y_SENSITIVITY": "Чувствительность по оси Y", - "vivecraft.options.KEYHOLE": "Замочная скважина", - "vivecraft.options.FOV_REDUCTION": "Снижение комфорта FOV", - "vivecraft.options.FOV_REDUCTION_MIN": "Уменьшение размера FOV", - "vivecraft.options.FOV_REDUCTION_OFFSET": "Уменьшение смещения FOV", - "vivecraft.options.SEATED_HMD": "Прямое направление", - "vivecraft.options.SEATED_HUD_XHAIR": "Следование HUD", - "vivecraft.options.BACKPACK_SWITCH": "Выбор рюкзака", - "vivecraft.options.ANALOG_MOVEMENT": "Аналог движений", - "vivecraft.options.AUTO_SPRINT": "Автоматический Бег", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Предел Автоматического Бега", - "vivecraft.options.BOW_MODE": "Режим лука", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "Лимит низа", - "vivecraft.options.TELEPORT_UP_LIMIT": "Лимит верха", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Лимит дистанции", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Смещение координат", - "vivecraft.options.SEATED_FREE_MOVE": "Тип перемещания", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Свободное движение", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Глобальные бинды", - "vivecraft.options.MENU_WORLD_SELECTION": "Миры", - "vivecraft.options.HRTF_SELECTION": "Позиционируемый звук (VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Перезагрузка камеры", - "vivecraft.options.RIGHT_CLICK_DELAY": "Повтор ПКМ", - "vivecraft.options.ANIMAL_TOUCHING": "Прикосновения к животным", - "vivecraft.options.HANDHELD_CAMERA_FOV": "Поле Зрения Камеры", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Разрешение камеры", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Показать Модель Камеры", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Тема Клавиатуры", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "Относительный размер HUD в поле зрения.\nЕдиницы измерения относительны, и не имеют привязки к градусам и т.д.", - "vivecraft.options.HUD_DISTANCE.tooltip": "Расстояние до HUD находящегося перед вами.\nРазмер HUD от этого не изменится.\nДистанция в метрах (независимо от блоков).", - "vivecraft.options.HUD_LOCK_TO.tooltip": "Указывает установленную ориентацию HUD.\n Рука: HUD появится чуть выше вашей руки.\n Голова: HUD появляется прямо перед вами.\n Запястье: HUD будет со стороны основной руки. Оно появится при наведении.", - "vivecraft.options.HUD_OPACITY.tooltip": "Прозрачность HUD и UI.", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Показывает, имеет ли GUI прозрачность или нет.\n Вкл: Полупрозрачный фон внутриигрового меню.\n Выкл: Фон отсутствует.", - "vivecraft.options.HUD_OCCLUSION.tooltip": "Определяет отключение HUD приближёнными объектами.\n Вкл: HUD будет скрыт при взаимодействии. Может быть полностью скрыт в замкнутом пространстве!\n Выкл: HUD всегда виден. Возможны проблемы с глубиной.", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Определяет, когда главное меню следует вашему направлению взгляда.\n Сидя: Только в сидячем режиме.\n Всегда: Следует всегда.", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Устанавливает размер игрового прицела.", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Устанавливает размер прицела в меню.", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Режим отображения прицела.\n Всегда: Виден всегда, если выключен HUD.\n с HUD: Виден только вместе с HUD.\n Никогда: Прицел никогда не показывается.", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Действия происходящие при получении сообщения.\n Нет: Ничего\n Тактильно: Вибрация.\n Звук: Звуковое уведомление.\n Оба: Вибрация и звук.", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Установка уведомления в чате.", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Изменение прицела с расстоянием.\n Вкл: Увеличивается с приближением к поверхности.\n Выкл: Прицел всегда одного размера.", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Режим отображения контура блоков.\n Всегда: Контур всегда виден, если HUD выключен.\n с HUD: Контур виден только с HUD.\n Никогда: Контур не виден никогда.", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Если выключено, клавиатура открывается только по нажатию на чат или на текстовое поле.\n\nЕсли включено, то клавиатура открывается при любом фокусе на текстовые поля. Может иметь проблемы с другими модами.", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Поведение радиального меню при нажатии на кнопку.\n Удерживать: Зажмите кнопку наведитесь на выделение и отпустите.\n Нажать: Обычный нажатия, нажмите дважды на кнопку чтобы закрыть.", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Какой тип клавиатуры использовать.\n Физическая: Клавиатура подобная настоящей.\n Указатель: Выбор каждой буквы прицелом при помощи контроллера.", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Насколько большой должна быть физическая клавиатура, относительно базового размера.", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Если включено, GUI для блоков (сундуки и печки) будут располагаться над блоком. В противном случае - в обычном положении.", - "vivecraft.options.FSAA.tooltip": "Использует более оптимизированный ресемплинг игры перед отправлением HMD. Лучше всего работает при большом объеме рендера.", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "Отражает изображения для HMD для разделения окон.\nМожет быть установлено на Выкл, одиночный или двойной hmd-вид, 1-е лицо, 3-е лицо и смешанную реальность. FP, TP, MR обладают большей производительностью.", - "vivecraft.options.MIRROR_EYE.tooltip": "Какой глаз использовать в кадрированном и одиночном режимах.", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Цвет полупрозрачности для смешанной реальности. Другие цвета никак не взаимодействуют с этим.", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Рендер рук в смешанной реальности. Касается только рук, предметы в любом случае отображаются.", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Выбор между Unity стилями, 4-панельный слой или 2-панельный.", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Для неискажённого 4-х панельного слоя необходим сверх рендер. В противном случае будет использоваться вид HMD.", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "В Unity слое, если да, будет отображена серая градация альфа-маски в верхнем квадранте (как Unity) для использования при маскировке слоя переднего плана. В противном случае передний план будет отображаться с ключевым цветом.", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "FOV используется для смешанной реальности в зеркальном режиме.", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Даёт возможность взбираться вверх без прыжка. Hotkey: RCtrl+B\n§cВНИМАНИЕ: Могут возникнуть проблемы с анти-читом!\n Выкл: (Обычно) Нужно прыгать на блоки.\n Вкл: Вы можете подняться на отдельные блоки. Может помочь при тошноте.", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Устанавливает умножение скорости, разрешает более медленные движения. Может помочь при тошноте.\n§cВНИМАНИЕ: Могут возникнуть проблемы с анти-читом!\nОбычная скорость в майнкрафте равна 1.0.", - "vivecraft.options.INERTIA_FACTOR.tooltip": "станавливает инерцию движения игрока в одиночном режиме. Меньшая инерция означает более быстрое ускорение, более высокая инерция означает медленное ускорение. Высокая инерция может уменьшить укачивание у некоторых, но остерегайтесь краев обрывов!\n\n Нормально: (Default) Standard Minecraft player movement.\n Автоматически < Нормально < Много < Даже Больше. Не может влиять на воду, лаву и прыжки.", - "vivecraft.options.SIMULATE_FALLING.tooltip": "Если этот параметр включен, игрок упадет на землю в режиме телепорта, когда стоит над пустым пространством. Также позволяет прыгать.", - "vivecraft.options.WEAPON_COLLISION.tooltip": "Позволяет взаимодействовать с блоками и объектами в пределах комнаты.\nАвтоматически включено в выживании.", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "Если этот параметр включен, игрок сможет прятаться под блоком.", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "При включении ограничивает телепортацию. Игрок не сможет прыгать по сторонам блоков, это будет затрачивать еду и появится полоска энергии.", - "vivecraft.options.REVERSE_HANDS.tooltip": "Выбор доминантной руки.\n Вкл: Левая доминантная\n Выкл: Правая доминантная\n\nДля смены кнопок, перезагрузите игру, и убедитесь, что настройки SteamVR не изменены.", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "Скрывать области за пределами FOV.\nПовышает производительность.", - "vivecraft.options.BCB_ON.tooltip": "Показывает положения тела тенью на полу.\nЭто ваш Квадратный-Воображаемый-Друг-Тень™.\nНе потеряйте своего единственного друга...", - "vivecraft.options.WORLD_SCALE.tooltip": "Маштабирует игрока в мире.\nВыше 1 делает вас больше\nНиже - меньше\n1 как мать родила\nне трогай тут ничего, размер не главное.", - "vivecraft.options.WORLD_ROTATION.tooltip": "Увеличивает ротацию вашего HMD.\nПолезно использовать со стрелками.", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "На сколько градусов повернуть при вращении мира.", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "Если этот параметр включен, вы можете касаться панели быстрого доступа основной рукой, чтобы выбрать элемент.", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Режим игры стоя или сидя.\nСтоя - намного лучше.", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Масштаб внутреннего рендеринга игры относительно собственного дисплея HMD. Более высокие значения улучшают визуальное качество за счет производительности.", - "vivecraft.options.MONO_FOV.tooltip": "FOV используется для режима неискаженного зеркала.", - "vivecraft.options.REALISTIC_JUMP.tooltip": "Если включено, то ваш прыжок в игре эквивалентен реальному. Включает Ботинки-Прыгуны.", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "Если включено, то при приседании ваш персонаж начнёт красться.", - "vivecraft.options.PHYSICAL_GUI.tooltip": "Если этот параметр включен то GUI будут заменены интерактивными трехмерными моделями.\nЕсли включен рюкзак, то он послужит вашим инвентарём.", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "Если он включен, позволяйте подниматься по лестницам и лозам, дотрагиваясь до них. Также включает когти.", - "vivecraft.options.REALISTIC_SWIM.tooltip": "Если включено, то позволяет плавать при помощи гребли контроллерами.", - "vivecraft.options.REALISTIC_ROW.tooltip": "Греби как сумасшедший чтобы сдвинуться на этой чёртовой лодке.", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "Умножает ваше положение в комнате на коэффициент.\nПозволяет больше ходить, но может вызвать укачивание.", - "vivecraft.options.FREEMOVE_MODE.tooltip": "Источник управления.\n Контроллер: Главная рука управляется контроллером.\n HMD: Направление гарнитуры.\n Бег на месте: Трекинг движения контроллеров.\n Комната: Режим следования VR. Перемещение при помощи гарнитуры. Режим лучше всего подходит для 180 сетапов.", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "Езда на транспортном средстве будет вращать мир по мере вращения транспортного средства. Можно потеряться.", - "vivecraft.options.RESET_ORIGIN.tooltip": "Переносит игрока на высоту 1.62м от положения HMD. Для неабсолютных систем слежения или игры сидя.", - "vivecraft.options.X_SENSITIVITY.tooltip": "Ускорение при нажатии на край стика.", - "vivecraft.options.Y_SENSITIVITY.tooltip": "Вертикальная скорость прицела относительно мыши.", - "vivecraft.options.KEYHOLE.tooltip": "Количество градусов слева и справа от центра, откуда изображение начнет вращаться.", - "vivecraft.options.FOV_REDUCTION.tooltip": "Сужение поля зрения при движении. Может помочь с укачиванием.", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Окончательный размер сужения FOV.", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Смещает по горизонтали центр для сокращения FOV при нестандартных HMD.", - "vivecraft.options.SEATED_HMD.tooltip": "Направление (W) кнопки вперед.\nHMD направление взгляда или направление прицела.", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Направление, в котором будет размещен HUD.\nHMD направление взгляда или направление прицела.", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "Если включено, то при перемещении правого контролера за голову будет выбран первый слот, или возврат к предыдущему слоту. Эти же действия левым контроллером меняют положение левого и правого предметов.", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Скорость ходьбы будет определяться осью кнопки контроллера, если у кнопки есть такая возможность.\n\nДля полного аналогового управления лучше использовать \"Move/Strafe\" или \"Move/Rotate\".", - "vivecraft.options.AUTO_SPRINT.tooltip": "При использовании свободного перемещения, спринт автоматически активируется при достижении установленного порога.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Порог оси, при котором активируется авто-спринт.", - "vivecraft.options.BOW_MODE.tooltip": "Устанавливает, когда использовать стрельбу из лука в масштабе комнаты\n Выкл: Никогда.\n Стандартно: Только для ванильного лука.\n Вкл: Для любого предмета с механикой лука.", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Ограничение блоков телепортации вниз.", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Ограничение блоков телепортации вверх.", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Ограничение блоков телепортации на плоскости.", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Разрешает \"Reset Origin\" для использования в режиме стоя, для играющих сидя, используя контроллер отслеживания.", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Какой режим передвижения использовать в сидячем режиме.\n\n Телепорт: Нажмите в любом направлении.\n Свободное передвижение: WASD как в обычном майнкрафте.", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Заставляет использовать привязку перехода вперед (обычно левый триггер). Для больших опций, редактируйте SteamVR бинды.\n\nОбратите внимание, что это отключает привязку телепорта.", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Показывает дополнительные бинды SteamVR для климбинга, клавиатуры и смешанной реальности.\n\nДля результата необходима перезагрузка.", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Какие миры меню загружать при запуске.\n\nЕсли пользовательских миров не найдено, будут использоваться официальные миры.", - "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF для использования 3D аудио. Качество может отличаться в зависимости от оборудования.\n\n Выкл: Отключение HRTF.\n По умолчанию: Обычный режим HRTF.\n Остальное: Пользовательский HRTF.", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Перезагрузка конфигурации ExternalCamera.cfg", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Количество тиков в игре между \"ПКМ\" при удержании вниз.", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Если включено, при нажатии на животное (мирное) без оружия используйте ПКМ (взаимодействие) чтобы избежать атаки.\nВыключи, чтобы не бить по лицу поросят.", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Поле зрения портативной камеры", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Разрешение портативной камеры для скриншотов, позволяет делать скриншоты более высокого разрешения.\nИспользование невозможно если включены шейдеры.\n§cВНИМАНИЕ: Очень высокие значения могут уничтожить ваш компьютер!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Показать модель видеокамеры (только в видно в HMD), чтобы показать, где в настоящее время находится камера смешанной реальности или камера от третьего лица. Видеокамеру также можно схватить, чтобы переместить с помощью интерактивной привязки.", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Предустановка цветовой схемы для физической клавиатуры. Свою тему можно редактировать через keyboardtheme.txt в папке игры. Она будет перезагружаться каждый раз при открытии клавиатуры, чтобы можно было производить настройку в реальном времени.", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "Я не вижу", - "vivecraft.options.yes": "ДА", - "vivecraft.options.no": "НЕТ", - "vivecraft.options.weaponcollision.auto": "Авто", - "vivecraft.options.default": "По умолчанию", - "vivecraft.options.opaque": "Непрозрачный", - "vivecraft.options.mirrormode.off": "ВЫКЛ (быстро)", - "vivecraft.options.mirrormode.dual": "Двойной (быстро)", - "vivecraft.options.mirrormode.single": "Единичный (быстро)", - "vivecraft.options.mirrormode.firstperson": "1-е лицо (медленно)", - "vivecraft.options.mirrormode.thirdperson": "3-е лицо (медленно)", - "vivecraft.options.mirrormode.mixedreality": "Смешанная Реальность (медленно)", - "vivecraft.options.mirrormode.cropped": "Укороченно (быстро)", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "Лево", - "vivecraft.options.right": "Право", - "vivecraft.options.color.black": "Чёрный", - "vivecraft.options.color.red": "Красный", - "vivecraft.options.color.yellow": "Жёлтый", - "vivecraft.options.color.green": "Зеленый", - "vivecraft.options.color.cyan": "Бирюзовый", - "vivecraft.options.color.blue": "Синий", - "vivecraft.options.color.magenta": "Пурпурный", - "vivecraft.options.unity": "Единство", - "vivecraft.options.sidebyside": "Бок о бок", - "vivecraft.options.hudlock.hand": "Рука", - "vivecraft.options.hudlock.head": "Голова", - "vivecraft.options.hudlock.wrist": "Запястье", - "vivecraft.options.renderpointerelement.always": "Всегда", - "vivecraft.options.renderpointerelement.withhud": "с HUD", - "vivecraft.options.renderpointerelement.never": "Никогда", - "vivecraft.options.chatnotifications.none": "Нет", - "vivecraft.options.chatnotifications.haptic": "Тактильно", - "vivecraft.options.chatnotifications.sound": "Звук", - "vivecraft.options.chatnotifications.both": "Оба", - "vivecraft.options.always": "Всегда", - "vivecraft.options.seated": "Сидя", - "vivecraft.options.standing": "Стоя", - "vivecraft.options.inertiafactor.none": "Автоматически", - "vivecraft.options.inertiafactor.normal": "Нормально", - "vivecraft.options.inertiafactor.large": "Много", - "vivecraft.options.inertiafactor.massive": "Даже Больше", - "vivecraft.options.smooth": "Сглаженно", - "vivecraft.options.hmd": "HMD", - "vivecraft.options.crosshair": "Прицел", - "vivecraft.options.freemove.controller": "Контроллер", - "vivecraft.options.freemove.hmd": "HMD", - "vivecraft.options.freemove.runinplace": "Бег на месте", - "vivecraft.options.freemove.room": "Комната", - "vivecraft.options.hold": "Удерживать", - "vivecraft.options.press": "Нажать", - "vivecraft.options.keyboard.physical": "Физическая", - "vivecraft.options.keyboard.pointer": "Указатель", - "vivecraft.options.bowmode.vanilla": "Стандартно", - "vivecraft.options.teleportlimit": "%dБлоков", - "vivecraft.options.teleport": "Телепортация", - "vivecraft.options.freemove": "Свободное Перемещение", - "vivecraft.options.menuworld.both": "Официальный и Пользовательский", - "vivecraft.options.menuworld.custom": "Только Пользовательский", - "vivecraft.options.menuworld.official": "Только Официальный", - "vivecraft.options.menuworld.none": "Нет", - "vivecraft.options.rightclickdelay.vanilla": "Стандартно", - "vivecraft.options.rightclickdelay.slow": "Медленно", - "vivecraft.options.rightclickdelay.slower": "Очень медленно", - "vivecraft.options.rightclickdelay.slowest": "Самый медленный", - "vivecraft.options.keyboardtheme.default": "Белый", - "vivecraft.options.keyboardtheme.red": "Красный", - "vivecraft.options.keyboardtheme.green": "Зеленый", - "vivecraft.options.keyboardtheme.blue": "Синий", - "vivecraft.options.keyboardtheme.black": "Пустота", - "vivecraft.options.keyboardtheme.grass": "Блок Травы", - "vivecraft.options.keyboardtheme.bees": "Шмель", - "vivecraft.options.keyboardtheme.aesthetic": "§bЭ§dс§bт§dе§bт§dи§bк§dа", - "vivecraft.options.keyboardtheme.dose": "Медицина", - "vivecraft.options.keyboardtheme.custom": "Пользовательский", - "_comment12": "Button text", - "vivecraft.gui.ok": "Хорошо", - "vivecraft.gui.clear": "Очистить", - "vivecraft.gui.loaddefaults": "Сбросить", - "vivecraft.gui.menuworld.refresh": "Перезагрузить меню", - "vivecraft.gui.menuworld.loadnew": "Загрузить новое меню", - "vivecraft.gui.radialmenu.mainset": "Основной набор", - "vivecraft.gui.radialmenu.alternateset": "Альт-набор", - "vivecraft.gui.chat": "Чат", - "vivecraft.gui.commands": "Команды", - "vivecraft.gui.overlay": "Оверлей", - "vivecraft.gui.profiler": "Профайлер", - "vivecraft.gui.screenshot": "Скриншот", - "vivecraft.gui.calibrateheight": "Калибровка высоты", - "vivecraft.gui.alignkatwalk": "Выровняйте KAT WALK", - "vivecraft.gui.movethirdpersoncam": "Переместить камеру", - "vivecraft.gui.social": "Социальный", - "_comment13": "Items", - "vivecraft.item.jumpboots": "Ботинки Прыгуны", - "vivecraft.item.climbclaws": "Когти", - "vivecraft.item.telescope": "Глаз Провидца", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "Переход в сидячий режим отключит контроллер. Продолжить?", - "vivecraft.messages.radialmenubind.1": "Убедитесь, что Открытое Радиальное Меню привязано.", - "vivecraft.messages.radialmenubind.2": "Зажмите (на клавиатуре Shift) с открытым радиальным меню, чтобы переключиться на этот набор.", - "vivecraft.messages.controls.1": "Бинды обрабатываются SteamVR.", - "vivecraft.messages.controls.2": "Отправляйтесь в Настройки > Контроллеры > Управление Биндами Контроллера на панели инструментов.", - "vivecraft.messages.controls.3": "§6Steam должен быть запущен §oперед§r§6 SteamVR, иначе бинды не сохранятся.", - "vivecraft.messages.serverplugin": "Vivecraft обнаружил серверный мод: %s", - "vivecraft.messages.noserverplugin": "Vivecraft не обнаружен. Этот сервер может не поддерживать телепортацию. Включен режим ограниченного передвижения (возврат к свободному перемещению).", - "vivecraft.messages.calibrateheight": "Пожалуйста, откаллибруйте высоту в меню паузы.", - "vivecraft.messages.rendersetupfailed": "Ошибка рендера: %s", - "vivecraft.messages.intelgraphics": "Интегрированная графика Intel не поддерживается. Если это ноутбук, пожалуйста, установите высокопроизводительный GPU. Найденное GPU: %s", - "vivecraft.messages.nosteamvr": "OpenVR не обнаружен. Вы установили SteamVR?", - "vivecraft.messages.menuworldexportcomplete.1": "Экспорт завершен... размер области: %d", - "vivecraft.messages.menuworldexportcomplete.2": "Сохранено в %s", - "vivecraft.messages.menuworldexportclientwarning": "ВНИМАНИЕ: Сохранение мира с помощью клиентского мира может быть неполным, что приведет к утрате мира.", - "vivecraft.messages.teleportdisabled": "Ограниченное движение включено (без телепорта)", - "vivecraft.messages.teleportenabled": "Ограниченное движение выключено (с телепортом)", - "vivecraft.messages.walkupblocks": "Взобраться по блокам (RCTRL+B): %s", - "vivecraft.messages.showaim": "Показать цель (RCTRL+RSHIFT): включено", - "vivecraft.messages.playerinertia": "Инерция движения игрока (LCTRL+I): %s", - "vivecraft.messages.movementmodeswitch": "Режим движения переключен на: %s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "Наклон: %.1f Отклонение: %.1f Ролл: %.1f", - "vivecraft.messages.heightset": "Высота пользователя установлена на %d%%" -} \ No newline at end of file + "_comment0": "Contributors: link1107, Krays, Hu4uTa, Shinomasu, NikMe, Jonny_Bro, Timius100, sikamamikado, Turra, Pupokman, bakva, EgorBron", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "Следующий Слот", + "vivecraft.key.hotbarPrev": "Предыдущий Слот", + "vivecraft.key.hotbarScroll": "Прокрутка Слотов", + "vivecraft.key.hotbarSwipeX": "Свайп (Влево/Вправо)", + "vivecraft.key.hotbarSwipeY": "Свайп (Вверх/Вниз)", + "vivecraft.key.rotateLeft": "Повернуться Налево", + "vivecraft.key.rotateRight": "Повернуться Направо", + "vivecraft.key.rotateAxis": "Только Вращение", + "vivecraft.key.rotateFree": "Свободно Поворачиваться ", + "vivecraft.key.walkabout": "Прогулка", + "vivecraft.key.teleport": "Телепортироваться", + "vivecraft.key.teleportFallback": "Идти вперед когда телепортирование выключено", + "vivecraft.key.freeMoveRotate": "Двигаться/Поворачиваться", + "vivecraft.key.freeMoveStrafe": "Двигаться/Стрейфить", + "vivecraft.key.toggleMovement": "Переключить режим перемещения", + "vivecraft.key.quickTorch": "Быстрый Факел", + "vivecraft.key.ingameMenuButton": "Игровое Меню", + "vivecraft.key.exportWorld": "Экспорт Мира Меню", + "vivecraft.key.radialMenu": "Открыть Радиальное Меню", + "vivecraft.key.swapMirrorView": "Выбрать зеркальный вид", + "vivecraft.key.toggleKeyboard": "Показать/Скрыть Клавиатуру", + "vivecraft.key.moveThirdPersonCam": "Передвинуть Камеру Третьего Лица", + "vivecraft.key.togglePlayerList": "Переключить Список Игроков", + "vivecraft.key.toggleHandheldCam": "Переключить камеру", + "vivecraft.key.quickHandheldCam": "Временая камера", + "vivecraft.key.trackpadTouch": "Прикосновения к сенсорной панели", + "vivecraft.key.vrInteract": "Контекстное Взаимодействие", + "vivecraft.key.guiLeftClick": "Левый Клик", + "vivecraft.key.guiRightClick": "Правый Клик", + "vivecraft.key.guiMiddleClick": "Средний Клик", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "Scroll Up", + "vivecraft.key.guiScrollDown": "Scroll Down", + "vivecraft.key.guiScrollAxis": "Scroll", + "vivecraft.key.keyboardClick": "Click", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "Когти Альпиниста", + "vivecraft.key.climbeyJump": "Прыжковые Ботинки", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "Движение на подъем", + "vivecraft.key.category.keyboard": "Клавиатура", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "В игре", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "Глобальный", + "vivecraft.actionset.mod": "Модифицированный", + "vivecraft.actionset.contextual": "Контекстный", + "vivecraft.actionset.keyboard": "Клавиатура", + "vivecraft.actionset.mixedReality": "Смешанная Реальность", + "vivecraft.actionset.technical": "Технический", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "Настройки VR", + "vivecraft.options.screen.freemove": "Параметры Свободного Перемещения", + "vivecraft.options.screen.gui": "Настройки Графического и Игрового Интерфейса", + "vivecraft.options.screen.menuworld": "Меню в игре", + "vivecraft.options.screen.guiother": "Чат/Прицел", + "vivecraft.options.screen.quickcommands": "Быстрые команды", + "vivecraft.options.screen.radialmenu": "Радиальное меню", + "vivecraft.options.screen.stereorendering": "Настройки Стерео Рендера", + "vivecraft.options.screen.roomscale": "Взаимодействие с комнатой", + "vivecraft.options.screen.seated": "Параметры Сидячего Режима", + "vivecraft.options.screen.standing": "Передвижение стоя", + "vivecraft.options.screen.teleport": "Параметры Телепортации", + "vivecraft.options.screen.controls": "Настройки Управления", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "Настройки VR...", + "vivecraft.options.screen.gui.button": "HUD и GUI...", + "vivecraft.options.screen.stereorendering.button": "Стерео рендер...", + "vivecraft.options.screen.quickcommands.button": "Быстрые команды...", + "vivecraft.options.screen.guiother.button": "Настройки чата и прицела...", + "vivecraft.options.screen.standing.button": "Настройки перемещения...", + "vivecraft.options.screen.roomscale.button": "Настройки взаимодействий...", + "vivecraft.options.screen.controls.button": "Настройки контроллера...", + "vivecraft.options.screen.radialmenu.button": "Радиальное меню...", + "vivecraft.options.screen.seated.button": "Настройки сидя...", + "vivecraft.options.screen.menuworld.button": "Меню в игре...", + "vivecraft.options.screen.teleport.button": "Настройки телепортации..", + "vivecraft.options.screen.freemove.button": "Свободное перемещение...", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "Размер HUD", + "vivecraft.options.HUD_DISTANCE": "Дистанция от HUD", + "vivecraft.options.HUD_LOCK_TO": "Фиксация HUD", + "vivecraft.options.HUD_OPACITY": "Прозрачность HUD", + "vivecraft.options.HUD_HIDE": "Спрятать Игровой Интерфейс (F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "Фон HUD/GUI", + "vivecraft.options.HUD_OCCLUSION": "Непрозрачность HUD", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "Преследование меню", + "vivecraft.options.CROSSHAIR_OCCLUSION": "Непрозрачность прицела", + "vivecraft.options.CROSSHAIR_SCALE": "Размер Прицела", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "Размер Прицела в Меню", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "Показать Прицел", + "vivecraft.options.CHAT_NOTIFICATIONS": "Оповещения в чате", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "Звук оповещения", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "Маштаб прицела", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "Обводка блоков", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "Статичная клавиатура", + "vivecraft.options.RADIAL_MODE_HOLD": "Режим радиального меню", + "vivecraft.options.PHYSICAL_KEYBOARD": "Тип Клавиатуры", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "Размер Клавиатуры", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "Положение над блоком", + "vivecraft.options.FSAA": "Фильтр Ланцоша", + "vivecraft.options.MIRROR_DISPLAY": "Отражение РС", + "vivecraft.options.MIRROR_EYE": "Отражение глаз", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "Свет Кнопок", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "Показывать Руки", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "Слой", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "Прямая передача", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "Альфа-маска", + "vivecraft.options.MIXED_REALITY_FOV": "Поле зрения от третьего лица", + "vivecraft.options.WALK_UP_BLOCKS": "Хождение по блокам", + "vivecraft.options.MOVEMENT_MULTIPLIER": "Движение. Множитель скорости", + "vivecraft.options.INERTIA_FACTOR": "Инерция Игрока", + "vivecraft.options.SIMULATE_FALLING": "Симуляция падения", + "vivecraft.options.WEAPON_COLLISION": "Коллизия Оружия", + "vivecraft.options.ALLOW_CRAWLING": "Ползанье", + "vivecraft.options.LIMIT_TELEPORT": "Лимит в Выживании", + "vivecraft.options.REVERSE_HANDS": "Реверс рук", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "Использовать Трафарет Глаз", + "vivecraft.options.BCB_ON": "Показывать тело", + "vivecraft.options.WORLD_SCALE": "Маштаб мира", + "vivecraft.options.WORLD_ROTATION": "Ротация мира", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "Прирост ротации", + "vivecraft.options.TOUCH_HOTBAR": "Прикосновения к хотбару", + "vivecraft.options.PLAY_MODE_SEATED": "Режим Игры", + "vivecraft.options.RENDER_SCALEFACTOR": "Разрешение", + "vivecraft.options.MONO_FOV": "Неискажённый FOV", + "vivecraft.options.REALISTIC_JUMP": "Прыжки", + "vivecraft.options.REALISTIC_SNEAK": "Приседания", + "vivecraft.options.PHYSICAL_GUI": "Физические GUI", + "vivecraft.options.REALISTIC_CLIMB": "Взбирание", + "vivecraft.options.REALISTIC_SWIM": "Плавание", + "vivecraft.options.REALISTIC_ROW": "Гребля", + "vivecraft.options.WALK_MULTIPLIER": "Ускорение хода", + "vivecraft.options.FREEMOVE_MODE": "Тип Свободного Перемещения", + "vivecraft.options.VEHICLE_ROTATION": "Ротация транспорта", + "vivecraft.options.RESET_ORIGIN": "Перезагрузка источника", + "vivecraft.options.X_SENSITIVITY": "Скорость Поворота", + "vivecraft.options.Y_SENSITIVITY": "Чувствительность по оси Y", + "vivecraft.options.KEYHOLE": "Замочная скважина", + "vivecraft.options.FOV_REDUCTION": "Снижение комфорта FOV", + "vivecraft.options.FOV_REDUCTION_MIN": "Уменьшение размера FOV", + "vivecraft.options.FOV_REDUCTION_OFFSET": "Уменьшение смещения FOV", + "vivecraft.options.SEATED_HMD": "Прямое направление", + "vivecraft.options.SEATED_HUD_XHAIR": "Следование HUD", + "vivecraft.options.BACKPACK_SWITCH": "Выбор рюкзака", + "vivecraft.options.ANALOG_MOVEMENT": "Аналог движений", + "vivecraft.options.AUTO_SPRINT": "Автоматический Бег", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "Предел Автоматического Бега", + "vivecraft.options.BOW_MODE": "Режим лука", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "Лимит низа", + "vivecraft.options.TELEPORT_UP_LIMIT": "Лимит верха", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "Лимит дистанции", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "Смещение координат", + "vivecraft.options.SEATED_FREE_MOVE": "Тип перемещания", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "Свободное движение", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "Глобальные бинды", + "vivecraft.options.MENU_WORLD_SELECTION": "Миры", + "vivecraft.options.HRTF_SELECTION": "Позиционируемый звук (VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "Перезагрузка камеры", + "vivecraft.options.RIGHT_CLICK_DELAY": "Повтор ПКМ", + "vivecraft.options.ANIMAL_TOUCHING": "Прикосновения к животным", + "vivecraft.options.HANDHELD_CAMERA_FOV": "Поле Зрения Камеры", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "Разрешение камеры", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "Показать Модель Камеры", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "Тема Клавиатуры", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "Относительный размер HUD в поле зрения.\nЕдиницы измерения относительны, и не имеют привязки к градусам и т.д.", + "vivecraft.options.HUD_DISTANCE.tooltip": "Расстояние до HUD находящегося перед вами.\nРазмер HUD от этого не изменится.\nДистанция в метрах (независимо от блоков).", + "vivecraft.options.HUD_LOCK_TO.tooltip": "Указывает установленную ориентацию HUD.\n Рука: HUD появится чуть выше вашей руки.\n Голова: HUD появляется прямо перед вами.\n Запястье: HUD будет со стороны основной руки. Оно появится при наведении.", + "vivecraft.options.HUD_OPACITY.tooltip": "Прозрачность HUD и UI.", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "Показывает, имеет ли GUI прозрачность или нет.\n Вкл: Полупрозрачный фон внутриигрового меню.\n Выкл: Фон отсутствует.", + "vivecraft.options.HUD_OCCLUSION.tooltip": "Определяет отключение HUD приближёнными объектами.\n Вкл: HUD будет скрыт при взаимодействии. Может быть полностью скрыт в замкнутом пространстве!\n Выкл: HUD всегда виден. Возможны проблемы с глубиной.", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "Определяет, когда главное меню следует вашему направлению взгляда.\n Сидя: Только в сидячем режиме.\n Всегда: Следует всегда.", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "Устанавливает размер игрового прицела.", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "Устанавливает размер прицела в меню.", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "Режим отображения прицела.\n Всегда: Виден всегда, если выключен HUD.\n с HUD: Виден только вместе с HUD.\n Никогда: Прицел никогда не показывается.", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "Действия происходящие при получении сообщения.\n Нет: Ничего\n Тактильно: Вибрация.\n Звук: Звуковое уведомление.\n Оба: Вибрация и звук.", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "Установка уведомления в чате.", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "Изменение прицела с расстоянием.\n Вкл: Увеличивается с приближением к поверхности.\n Выкл: Прицел всегда одного размера.", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "Режим отображения контура блоков.\n Всегда: Контур всегда виден, если HUD выключен.\n с HUD: Контур виден только с HUD.\n Никогда: Контур не виден никогда.", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "Если выключено, клавиатура открывается только по нажатию на чат или на текстовое поле.\n\nЕсли включено, то клавиатура открывается при любом фокусе на текстовые поля. Может иметь проблемы с другими модами.", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "Поведение радиального меню при нажатии на кнопку.\n Удерживать: Зажмите кнопку наведитесь на выделение и отпустите.\n Нажать: Обычный нажатия, нажмите дважды на кнопку чтобы закрыть.", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "Какой тип клавиатуры использовать.\n Физическая: Клавиатура подобная настоящей.\n Указатель: Выбор каждой буквы прицелом при помощи контроллера.", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "Насколько большой должна быть физическая клавиатура, относительно базового размера.", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "Если включено, GUI для блоков (сундуки и печки) будут располагаться над блоком. В противном случае - в обычном положении.", + "vivecraft.options.FSAA.tooltip": "Использует более оптимизированный ресемплинг игры перед отправлением HMD. Лучше всего работает при большом объеме рендера.", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "Отражает изображения для HMD для разделения окон.\nМожет быть установлено на Выкл, одиночный или двойной hmd-вид, 1-е лицо, 3-е лицо и смешанную реальность. FP, TP, MR обладают большей производительностью.", + "vivecraft.options.MIRROR_EYE.tooltip": "Какой глаз использовать в кадрированном и одиночном режимах.", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "Цвет полупрозрачности для смешанной реальности. Другие цвета никак не взаимодействуют с этим.", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "Рендер рук в смешанной реальности. Касается только рук, предметы в любом случае отображаются.", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "Выбор между Unity стилями, 4-панельный слой или 2-панельный.", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "Для неискажённого 4-х панельного слоя необходим сверх рендер. В противном случае будет использоваться вид HMD.", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "В Unity слое, если да, будет отображена серая градация альфа-маски в верхнем квадранте (как Unity) для использования при маскировке слоя переднего плана. В противном случае передний план будет отображаться с ключевым цветом.", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "FOV используется для смешанной реальности в зеркальном режиме.", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "Даёт возможность взбираться вверх без прыжка. Hotkey: RCtrl+B\n§cВНИМАНИЕ: Могут возникнуть проблемы с анти-читом!\n Выкл: (Обычно) Нужно прыгать на блоки.\n Вкл: Вы можете подняться на отдельные блоки. Может помочь при тошноте.", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "Устанавливает умножение скорости, разрешает более медленные движения. Может помочь при тошноте.\n§cВНИМАНИЕ: Могут возникнуть проблемы с анти-читом!\nОбычная скорость в майнкрафте равна 1.0.", + "vivecraft.options.INERTIA_FACTOR.tooltip": "станавливает инерцию движения игрока в одиночном режиме. Меньшая инерция означает более быстрое ускорение, более высокая инерция означает медленное ускорение. Высокая инерция может уменьшить укачивание у некоторых, но остерегайтесь краев обрывов!\n\n Нормально: (Default) Standard Minecraft player movement.\n Автоматически < Нормально < Много < Даже Больше. Не может влиять на воду, лаву и прыжки.", + "vivecraft.options.SIMULATE_FALLING.tooltip": "Если этот параметр включен, игрок упадет на землю в режиме телепорта, когда стоит над пустым пространством. Также позволяет прыгать.", + "vivecraft.options.WEAPON_COLLISION.tooltip": "Позволяет взаимодействовать с блоками и объектами в пределах комнаты.\nАвтоматически включено в выживании.", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "Если этот параметр включен, игрок сможет прятаться под блоком.", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "При включении ограничивает телепортацию. Игрок не сможет прыгать по сторонам блоков, это будет затрачивать еду и появится полоска энергии.", + "vivecraft.options.REVERSE_HANDS.tooltip": "Выбор доминантной руки.\n Вкл: Левая доминантная\n Выкл: Правая доминантная\n\nДля смены кнопок, перезагрузите игру, и убедитесь, что настройки SteamVR не изменены.", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "Скрывать области за пределами FOV.\nПовышает производительность.", + "vivecraft.options.BCB_ON.tooltip": "Показывает положения тела тенью на полу.\nЭто ваш Квадратный-Воображаемый-Друг-Тень™.\nНе потеряйте своего единственного друга...", + "vivecraft.options.WORLD_SCALE.tooltip": "Маштабирует игрока в мире.\nВыше 1 делает вас больше\nНиже - меньше\n1 как мать родила\nне трогай тут ничего, размер не главное.", + "vivecraft.options.WORLD_ROTATION.tooltip": "Увеличивает ротацию вашего HMD.\nПолезно использовать со стрелками.", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "На сколько градусов повернуть при вращении мира.", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "Если этот параметр включен, вы можете касаться панели быстрого доступа основной рукой, чтобы выбрать элемент.", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "Режим игры стоя или сидя.\nСтоя - намного лучше.", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "Масштаб внутреннего рендеринга игры относительно собственного дисплея HMD. Более высокие значения улучшают визуальное качество за счет производительности.", + "vivecraft.options.MONO_FOV.tooltip": "FOV используется для режима неискаженного зеркала.", + "vivecraft.options.REALISTIC_JUMP.tooltip": "Если включено, то ваш прыжок в игре эквивалентен реальному. Включает Ботинки-Прыгуны.", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "Если включено, то при приседании ваш персонаж начнёт красться.", + "vivecraft.options.PHYSICAL_GUI.tooltip": "Если этот параметр включен то GUI будут заменены интерактивными трехмерными моделями.\nЕсли включен рюкзак, то он послужит вашим инвентарём.", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "Если он включен, позволяйте подниматься по лестницам и лозам, дотрагиваясь до них. Также включает когти.", + "vivecraft.options.REALISTIC_SWIM.tooltip": "Если включено, то позволяет плавать при помощи гребли контроллерами.", + "vivecraft.options.REALISTIC_ROW.tooltip": "Греби как сумасшедший чтобы сдвинуться на этой чёртовой лодке.", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "Умножает ваше положение в комнате на коэффициент.\nПозволяет больше ходить, но может вызвать укачивание.", + "vivecraft.options.FREEMOVE_MODE.tooltip": "Источник управления.\n Контроллер: Главная рука управляется контроллером.\n HMD: Направление гарнитуры.\n Бег на месте: Трекинг движения контроллеров.\n Комната: Режим следования VR. Перемещение при помощи гарнитуры. Режим лучше всего подходит для 180 сетапов.", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "Езда на транспортном средстве будет вращать мир по мере вращения транспортного средства. Можно потеряться.", + "vivecraft.options.RESET_ORIGIN.tooltip": "Переносит игрока на высоту 1.62м от положения HMD. Для неабсолютных систем слежения или игры сидя.", + "vivecraft.options.X_SENSITIVITY.tooltip": "Ускорение при нажатии на край стика.", + "vivecraft.options.Y_SENSITIVITY.tooltip": "Вертикальная скорость прицела относительно мыши.", + "vivecraft.options.KEYHOLE.tooltip": "Количество градусов слева и справа от центра, откуда изображение начнет вращаться.", + "vivecraft.options.FOV_REDUCTION.tooltip": "Сужение поля зрения при движении. Может помочь с укачиванием.", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "Окончательный размер сужения FOV.", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "Смещает по горизонтали центр для сокращения FOV при нестандартных HMD.", + "vivecraft.options.SEATED_HMD.tooltip": "Направление (W) кнопки вперед.\nHMD направление взгляда или направление прицела.", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "Направление, в котором будет размещен HUD.\nHMD направление взгляда или направление прицела.", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "Если включено, то при перемещении правого контролера за голову будет выбран первый слот, или возврат к предыдущему слоту. Эти же действия левым контроллером меняют положение левого и правого предметов.", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "Скорость ходьбы будет определяться осью кнопки контроллера, если у кнопки есть такая возможность.\n\nДля полного аналогового управления лучше использовать \"Move/Strafe\" или \"Move/Rotate\".", + "vivecraft.options.AUTO_SPRINT.tooltip": "При использовании свободного перемещения, спринт автоматически активируется при достижении установленного порога.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "Порог оси, при котором активируется авто-спринт.", + "vivecraft.options.BOW_MODE.tooltip": "Устанавливает, когда использовать стрельбу из лука в масштабе комнаты\n Выкл: Никогда.\n Стандартно: Только для ванильного лука.\n Вкл: Для любого предмета с механикой лука.", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "Ограничение блоков телепортации вниз.", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "Ограничение блоков телепортации вверх.", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "Ограничение блоков телепортации на плоскости.", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "Разрешает \"Reset Origin\" для использования в режиме стоя, для играющих сидя, используя контроллер отслеживания.", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "Какой режим передвижения использовать в сидячем режиме.\n\n Телепорт: Нажмите в любом направлении.\n Свободное передвижение: WASD как в обычном майнкрафте.", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "Заставляет использовать привязку перехода вперед (обычно левый триггер). Для больших опций, редактируйте SteamVR бинды.\n\nОбратите внимание, что это отключает привязку телепорта.", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "Показывает дополнительные бинды SteamVR для климбинга, клавиатуры и смешанной реальности.\n\nДля результата необходима перезагрузка.", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "Какие миры меню загружать при запуске.\n\nЕсли пользовательских миров не найдено, будут использоваться официальные миры.", + "vivecraft.options.HRTF_SELECTION.tooltip": "HRTF для использования 3D аудио. Качество может отличаться в зависимости от оборудования.\n\n Выкл: Отключение HRTF.\n По умолчанию: Обычный режим HRTF.\n Остальное: Пользовательский HRTF.", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "Перезагрузка конфигурации ExternalCamera.cfg", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "Количество тиков в игре между \"ПКМ\" при удержании вниз.", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "Если включено, при нажатии на животное (мирное) без оружия используйте ПКМ (взаимодействие) чтобы избежать атаки.\nВыключи, чтобы не бить по лицу поросят.", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "Поле зрения портативной камеры", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "Разрешение портативной камеры для скриншотов, позволяет делать скриншоты более высокого разрешения.\nИспользование невозможно если включены шейдеры.\n§cВНИМАНИЕ: Очень высокие значения могут уничтожить ваш компьютер!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "Показать модель видеокамеры (только в видно в HMD), чтобы показать, где в настоящее время находится камера смешанной реальности или камера от третьего лица. Видеокамеру также можно схватить, чтобы переместить с помощью интерактивной привязки.", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "Предустановка цветовой схемы для физической клавиатуры. Свою тему можно редактировать через keyboardtheme.txt в папке игры. Она будет перезагружаться каждый раз при открытии клавиатуры, чтобы можно было производить настройку в реальном времени.", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "Я не вижу", + "vivecraft.options.yes": "ДА", + "vivecraft.options.no": "НЕТ", + "vivecraft.options.weaponcollision.auto": "Авто", + "vivecraft.options.default": "По умолчанию", + "vivecraft.options.opaque": "Непрозрачный", + "vivecraft.options.mirrormode.off": "ВЫКЛ (быстро)", + "vivecraft.options.mirrormode.dual": "Двойной (быстро)", + "vivecraft.options.mirrormode.single": "Единичный (быстро)", + "vivecraft.options.mirrormode.firstperson": "1-е лицо (медленно)", + "vivecraft.options.mirrormode.thirdperson": "3-е лицо (медленно)", + "vivecraft.options.mirrormode.mixedreality": "Смешанная Реальность (медленно)", + "vivecraft.options.mirrormode.cropped": "Укороченно (быстро)", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "Лево", + "vivecraft.options.right": "Право", + "vivecraft.options.color.black": "Чёрный", + "vivecraft.options.color.red": "Красный", + "vivecraft.options.color.yellow": "Жёлтый", + "vivecraft.options.color.green": "Зеленый", + "vivecraft.options.color.cyan": "Бирюзовый", + "vivecraft.options.color.blue": "Синий", + "vivecraft.options.color.magenta": "Пурпурный", + "vivecraft.options.unity": "Единство", + "vivecraft.options.sidebyside": "Бок о бок", + "vivecraft.options.hudlock.hand": "Рука", + "vivecraft.options.hudlock.head": "Голова", + "vivecraft.options.hudlock.wrist": "Запястье", + "vivecraft.options.renderpointerelement.always": "Всегда", + "vivecraft.options.renderpointerelement.withhud": "с HUD", + "vivecraft.options.renderpointerelement.never": "Никогда", + "vivecraft.options.chatnotifications.none": "Нет", + "vivecraft.options.chatnotifications.haptic": "Тактильно", + "vivecraft.options.chatnotifications.sound": "Звук", + "vivecraft.options.chatnotifications.both": "Оба", + "vivecraft.options.always": "Всегда", + "vivecraft.options.seated": "Сидя", + "vivecraft.options.standing": "Стоя", + "vivecraft.options.inertiafactor.none": "Автоматически", + "vivecraft.options.inertiafactor.normal": "Нормально", + "vivecraft.options.inertiafactor.large": "Много", + "vivecraft.options.inertiafactor.massive": "Даже Больше", + "vivecraft.options.smooth": "Сглаженно", + "vivecraft.options.hmd": "HMD", + "vivecraft.options.crosshair": "Прицел", + "vivecraft.options.freemove.controller": "Контроллер", + "vivecraft.options.freemove.hmd": "HMD", + "vivecraft.options.freemove.runinplace": "Бег на месте", + "vivecraft.options.freemove.room": "Комната", + "vivecraft.options.hold": "Удерживать", + "vivecraft.options.press": "Нажать", + "vivecraft.options.keyboard.physical": "Физическая", + "vivecraft.options.keyboard.pointer": "Указатель", + "vivecraft.options.bowmode.vanilla": "Стандартно", + "vivecraft.options.teleportlimit": "%dБлоков", + "vivecraft.options.teleport": "Телепортация", + "vivecraft.options.freemove": "Свободное Перемещение", + "vivecraft.options.menuworld.both": "Официальный и Пользовательский", + "vivecraft.options.menuworld.custom": "Только Пользовательский", + "vivecraft.options.menuworld.official": "Только Официальный", + "vivecraft.options.menuworld.none": "Нет", + "vivecraft.options.rightclickdelay.vanilla": "Стандартно", + "vivecraft.options.rightclickdelay.slow": "Медленно", + "vivecraft.options.rightclickdelay.slower": "Очень медленно", + "vivecraft.options.rightclickdelay.slowest": "Самый медленный", + "vivecraft.options.keyboardtheme.default": "Белый", + "vivecraft.options.keyboardtheme.red": "Красный", + "vivecraft.options.keyboardtheme.green": "Зеленый", + "vivecraft.options.keyboardtheme.blue": "Синий", + "vivecraft.options.keyboardtheme.black": "Пустота", + "vivecraft.options.keyboardtheme.grass": "Блок Травы", + "vivecraft.options.keyboardtheme.bees": "Шмель", + "vivecraft.options.keyboardtheme.aesthetic": "§bЭ§dс§bт§dе§bт§dи§bк§dа", + "vivecraft.options.keyboardtheme.dose": "Медицина", + "vivecraft.options.keyboardtheme.custom": "Пользовательский", + "_comment12": "Button text", + "vivecraft.gui.ok": "Хорошо", + "vivecraft.gui.clear": "Очистить", + "vivecraft.gui.loaddefaults": "Сбросить", + "vivecraft.gui.menuworld.refresh": "Перезагрузить меню", + "vivecraft.gui.menuworld.loadnew": "Загрузить новое меню", + "vivecraft.gui.radialmenu.mainset": "Основной набор", + "vivecraft.gui.radialmenu.alternateset": "Альт-набор", + "vivecraft.gui.chat": "Чат", + "vivecraft.gui.commands": "Команды", + "vivecraft.gui.overlay": "Оверлей", + "vivecraft.gui.profiler": "Профайлер", + "vivecraft.gui.screenshot": "Скриншот", + "vivecraft.gui.calibrateheight": "Калибровка высоты", + "vivecraft.gui.alignkatwalk": "Выровняйте KAT WALK", + "vivecraft.gui.movethirdpersoncam": "Переместить камеру", + "vivecraft.gui.social": "Социальный", + "_comment13": "Items", + "vivecraft.item.jumpboots": "Ботинки Прыгуны", + "vivecraft.item.climbclaws": "Когти", + "vivecraft.item.telescope": "Глаз Провидца", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "Переход в сидячий режим отключит контроллер. Продолжить?", + "vivecraft.messages.radialmenubind.1": "Убедитесь, что Открытое Радиальное Меню привязано.", + "vivecraft.messages.radialmenubind.2": "Зажмите (на клавиатуре Shift) с открытым радиальным меню, чтобы переключиться на этот набор.", + "vivecraft.messages.controls.1": "Бинды обрабатываются SteamVR.", + "vivecraft.messages.controls.2": "Отправляйтесь в Настройки > Контроллеры > Управление Биндами Контроллера на панели инструментов.", + "vivecraft.messages.controls.3": "§6Steam должен быть запущен §oперед§r§6 SteamVR, иначе бинды не сохранятся.", + "vivecraft.messages.serverplugin": "Vivecraft обнаружил серверный мод: %s", + "vivecraft.messages.noserverplugin": "Vivecraft не обнаружен. Этот сервер может не поддерживать телепортацию. Включен режим ограниченного передвижения (возврат к свободному перемещению).", + "vivecraft.messages.calibrateheight": "Пожалуйста, откаллибруйте высоту в меню паузы.", + "vivecraft.messages.rendersetupfailed": "Ошибка рендера: %s", + "vivecraft.messages.intelgraphics": "Интегрированная графика Intel не поддерживается. Если это ноутбук, пожалуйста, установите высокопроизводительный GPU. Найденное GPU: %s", + "vivecraft.messages.nosteamvr": "OpenVR не обнаружен. Вы установили SteamVR?", + "vivecraft.messages.menuworldexportcomplete.1": "Экспорт завершен... размер области: %d", + "vivecraft.messages.menuworldexportcomplete.2": "Сохранено в %s", + "vivecraft.messages.menuworldexportclientwarning": "ВНИМАНИЕ: Сохранение мира с помощью клиентского мира может быть неполным, что приведет к утрате мира.", + "vivecraft.messages.teleportdisabled": "Ограниченное движение включено (без телепорта)", + "vivecraft.messages.teleportenabled": "Ограниченное движение выключено (с телепортом)", + "vivecraft.messages.walkupblocks": "Взобраться по блокам (RCTRL+B): %s", + "vivecraft.messages.showaim": "Показать цель (RCTRL+RSHIFT): включено", + "vivecraft.messages.playerinertia": "Инерция движения игрока (LCTRL+I): %s", + "vivecraft.messages.movementmodeswitch": "Режим движения переключен на: %s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "Наклон: %.1f Отклонение: %.1f Ролл: %.1f", + "vivecraft.messages.heightset": "Высота пользователя установлена на %d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/lang/zh_cn.json b/common/src/main/resources/assets/vivecraft/lang/zh_cn.json index bbc5c13be..ba49bc840 100644 --- a/common/src/main/resources/assets/vivecraft/lang/zh_cn.json +++ b/common/src/main/resources/assets/vivecraft/lang/zh_cn.json @@ -1,381 +1,381 @@ { - "_comment0": "Contributors: IceFairyCirno, Logan_Haiz, BKCake, xwdit, TEGTianFan, Gigahertz", - "_comment1": "Key bindings", - "vivecraft.key.hotbarNext": "物品栏后一格", - "vivecraft.key.hotbarPrev": "物品栏前一格", - "vivecraft.key.hotbarScroll": "物品栏快速选择", - "vivecraft.key.hotbarSwipeX": "滑动选择物品栏(向左/向右)", - "vivecraft.key.hotbarSwipeY": "滑动选择物品栏(向上/向下)", - "vivecraft.key.rotateLeft": "向左转动视角", - "vivecraft.key.rotateRight": "向右转动视角", - "vivecraft.key.rotateAxis": "仅保持旋转", - "vivecraft.key.rotateFree": "自由转动视角", - "vivecraft.key.walkabout": "走动", - "vivecraft.key.teleport": "传送移动", - "vivecraft.key.teleportFallback": "当传送移动禁用时使用向手柄朝向移动的移动方式", - "vivecraft.key.freeMoveRotate": "移动/旋转视角", - "vivecraft.key.freeMoveStrafe": "移动/扫描", - "vivecraft.key.toggleMovement": "切换移动模式", - "vivecraft.key.quickTorch": "快速火把", - "vivecraft.key.ingameMenuButton": "唤出暂停菜单", - "vivecraft.key.exportWorld": "导出主菜单背景世界", - "vivecraft.key.radialMenu": "打开扇形菜单", - "vivecraft.key.swapMirrorView": "切换桌面镜像", - "vivecraft.key.toggleKeyboard": "显示/隐藏虚拟键盘", - "vivecraft.key.moveThirdPersonCam": "移动第三人称摄像机", - "vivecraft.key.togglePlayerList": "切换显示玩家列表", - "vivecraft.key.toggleHandheldCam": "呼出/隐藏手持相机", - "vivecraft.key.quickHandheldCam": "松手即拍快速相机", - "vivecraft.key.trackpadTouch": "触摸触控板", - "vivecraft.key.vrInteract": "情景交互", - "vivecraft.key.guiLeftClick": "左键点击", - "vivecraft.key.guiRightClick": "右键点击", - "vivecraft.key.guiMiddleClick": "中键点击", - "vivecraft.key.guiShift": "Shift", - "vivecraft.key.guiCtrl": "Ctrl", - "vivecraft.key.guiAlt": "Alt", - "vivecraft.key.guiScrollUp": "滚轮向上滚动", - "vivecraft.key.guiScrollDown": "滚轮向下滚动", - "vivecraft.key.guiScrollAxis": "滚轮", - "vivecraft.key.keyboardClick": "点击", - "vivecraft.key.keyboardShift": "Shift", - "vivecraft.key.climbeyGrab": "攀爬爪", - "vivecraft.key.climbeyJump": "弹跳靴", - "_comment2": "Key binding categories", - "vivecraft.key.category.gui": "GUI", - "vivecraft.key.category.climbey": "攀爬动态", - "vivecraft.key.category.keyboard": "键盘", - "_comment3": "Action set names", - "vivecraft.actionset.ingame": "游戏内", - "vivecraft.actionset.gui": "GUI", - "vivecraft.actionset.global": "全局选项", - "vivecraft.actionset.mod": "模组化", - "vivecraft.actionset.contextual": "情景", - "vivecraft.actionset.keyboard": "键盘", - "vivecraft.actionset.mixedReality": "混合现实", - "vivecraft.actionset.technical": "技术性", - "_comment4": "Option screens", - "vivecraft.options.screen.main": "VR设置", - "vivecraft.options.screen.freemove": "自由移动选项", - "vivecraft.options.screen.gui": "HUD及GUI选项", - "vivecraft.options.screen.menuworld": "主菜单背景世界选项", - "vivecraft.options.screen.guiother": "聊天/鼠标指针选项", - "vivecraft.options.screen.quickcommands": "快捷命令", - "vivecraft.options.screen.radialmenu": "扇形菜单选项", - "vivecraft.options.screen.stereorendering": "相机和画面渲染选项", - "vivecraft.options.screen.roomscale": "动作识别交互选项", - "vivecraft.options.screen.seated": "就座选项", - "vivecraft.options.screen.standing": "站立移动选项", - "vivecraft.options.screen.teleport": "传送选项", - "vivecraft.options.screen.controls": "控制器选项", - "_comment5": "Buttons that lead to the screen", - "vivecraft.options.screen.main.button": "VR设置……", - "vivecraft.options.screen.gui.button": "游戏界面及图形界面选项……", - "vivecraft.options.screen.stereorendering.button": "相机和画面渲染……", - "vivecraft.options.screen.quickcommands.button": "快捷命令……", - "vivecraft.options.screen.guiother.button": "聊天和准心选项……", - "vivecraft.options.screen.standing.button": "移动选项……", - "vivecraft.options.screen.roomscale.button": "交互选项……", - "vivecraft.options.screen.controls.button": "控制器选项……", - "vivecraft.options.screen.radialmenu.button": "扇形菜单……", - "vivecraft.options.screen.seated.button": "就座选项……", - "vivecraft.options.screen.menuworld.button": "主世界选项……", - "vivecraft.options.screen.teleport.button": "传送选项……", - "vivecraft.options.screen.freemove.button": "自由移动选项……", - "_comment6": "Option names", - "vivecraft.options.HUD_SCALE": "头显模式HUD大小", - "vivecraft.options.HUD_DISTANCE": "头显模式HUD距离", - "vivecraft.options.HUD_LOCK_TO": "HUD位置", - "vivecraft.options.HUD_OPACITY": "HUD不透明度", - "vivecraft.options.HUD_HIDE": "隐藏HUD(F1)", - "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI背景", - "vivecraft.options.HUD_OCCLUSION": "HUD明暗度", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "主菜单跟随对象", - "vivecraft.options.CROSSHAIR_OCCLUSION": "准心明暗度", - "vivecraft.options.CROSSHAIR_SCALE": "准心大小", - "vivecraft.options.MENU_CROSSHAIR_SCALE": "菜单准心大小", - "vivecraft.options.RENDER_CROSSHAIR_MODE": "显示准心", - "vivecraft.options.CHAT_NOTIFICATIONS": "聊天提示", - "vivecraft.options.CHAT_NOTIFICATION_SOUND": "提示音", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "准心形状", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "显示方块轮廓", - "vivecraft.options.AUTO_OPEN_KEYBOARD": "常开启键盘", - "vivecraft.options.RADIAL_MODE_HOLD": "扇形菜单模式", - "vivecraft.options.PHYSICAL_KEYBOARD": "键盘种类", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "键盘大小", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "不被方块遮挡", - "vivecraft.options.FSAA": "全局抗锯齿(Lanczos Scaler)", - "vivecraft.options.MIRROR_DISPLAY": "桌面镜像", - "vivecraft.options.MIRROR_EYE": "镜像左右眼", - "vivecraft.options.MIXED_REALITY_KEY_COLOR": "关键色", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "显示双手", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "布局", - "vivecraft.options.MIXED_REALITY_UNDISTORTED": "不失真渲染(无形变)", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "透明度遮罩", - "vivecraft.options.MIXED_REALITY_FOV": "第三人称视野", - "vivecraft.options.WALK_UP_BLOCKS": "自动上方块", - "vivecraft.options.MOVEMENT_MULTIPLIER": "移动速度倍率", - "vivecraft.options.INERTIA_FACTOR": "玩家惯性", - "vivecraft.options.SIMULATE_FALLING": "拟真摔落", - "vivecraft.options.WEAPON_COLLISION": "武器攻击动作识别", - "vivecraft.options.ALLOW_CRAWLING": "匍匐动作识别", - "vivecraft.options.LIMIT_TELEPORT": "生存模式传送限制", - "vivecraft.options.REVERSE_HANDS": "切换主手", - "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", - "vivecraft.options.STENCIL_ON": "使用眼部模板", - "vivecraft.options.BCB_ON": "显示身体位置", - "vivecraft.options.WORLD_SCALE": "世界大小", - "vivecraft.options.WORLD_ROTATION": "世界旋转", - "vivecraft.options.WORLD_ROTATION_INCREMENT": "旋转增加", - "vivecraft.options.TOUCH_HOTBAR": "已启用可触摸的快捷栏", - "vivecraft.options.PLAY_MODE_SEATED": "游玩模式", - "vivecraft.options.RENDER_SCALEFACTOR": "VR渲染倍率", - "vivecraft.options.MONO_FOV": "视野(无形变模式)", - "vivecraft.options.REALISTIC_JUMP": "跳跃动作识别", - "vivecraft.options.REALISTIC_SNEAK": "潜行动作识别", - "vivecraft.options.PHYSICAL_GUI": "物理的GUI", - "vivecraft.options.REALISTIC_CLIMB": "攀爬动作识别", - "vivecraft.options.REALISTIC_SWIM": "游泳动作识别", - "vivecraft.options.REALISTIC_ROW": "划船动作识别", - "vivecraft.options.WALK_MULTIPLIER": "步行倍增器", - "vivecraft.options.FREEMOVE_MODE": "自由移动类型", - "vivecraft.options.VEHICLE_ROTATION": "载具旋转", - "vivecraft.options.RESET_ORIGIN": "复位", - "vivecraft.options.X_SENSITIVITY": "旋转速度", - "vivecraft.options.Y_SENSITIVITY": "Y轴灵敏度", - "vivecraft.options.KEYHOLE": "锁孔", - "vivecraft.options.FOV_REDUCTION": "FOV移动缓冲", - "vivecraft.options.FOV_REDUCTION_MIN": "FOV缓冲倍率", - "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV缓冲区域补正", - "vivecraft.options.SEATED_HMD": "向前方向", - "vivecraft.options.SEATED_HUD_XHAIR": "HUD跟随对象", - "vivecraft.options.BACKPACK_SWITCH": "背包切换", - "vivecraft.options.ANALOG_MOVEMENT": "模拟移动", - "vivecraft.options.AUTO_SPRINT": "自动疾跑", - "vivecraft.options.AUTO_SPRINT_THRESHOLD": "自动疾跑摇杆阈值", - "vivecraft.options.BOW_MODE": "射箭动作识别", - "vivecraft.options.TELEPORT_DOWN_LIMIT": "传送高度下限", - "vivecraft.options.TELEPORT_UP_LIMIT": "传送高度上限", - "vivecraft.options.TELEPORT_HORIZ_LIMIT": "传送距离限制", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "允许原始偏移", - "vivecraft.options.SEATED_FREE_MOVE": "移动类型", - "vivecraft.options.FORCE_STANDING_FREE_MOVE": "强制自由移动", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "显示高级按键设置", - "vivecraft.options.MENU_WORLD_SELECTION": "世界", - "vivecraft.options.HRTF_SELECTION": "定向音频(VR)", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "重载外部摄像机", - "vivecraft.options.RIGHT_CLICK_DELAY": "重复右键点击", - "vivecraft.options.ANIMAL_TOUCHING": "动物触摸识别", - "vivecraft.options.HANDHELD_CAMERA_FOV": "手持相机视野", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "手持相机显示屏解析度", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "显示相机型号", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "键盘主题", - "_comment8": "Option tooltips", - "vivecraft.options.HUD_SCALE.tooltip": "视野内状态栏(HUD)占据的相对大小。\n是相对单位,不是具体大小也不会影响FOV或者其它什么。", - "vivecraft.options.HUD_DISTANCE.tooltip": "悬浮的状态栏(HUD)与玩家身体之间的距离;HUD的相对大小不会被这个设置所改变。\n以现实中的米(m)为单位(而不是以一个方块为单位)\n[PS:在Vivecraft中,默认一个方块为1米,而Java版客户端可以通过改变视角调整观感。]", - "vivecraft.options.HUD_LOCK_TO.tooltip": "(HUD:状态栏,包括物品栏和生命值等内容)\n指定HUD的锁定位置!\n手柄上方:HUD会出现在你的副手(默认左手)上方。\n头部:HUD会出现并锁定在你的头显视野中!\n手臂(推荐):HUD被设置在你的副手手腕内侧。\n[转动你的手腕!当你看向它时它便会出现!]", - "vivecraft.options.HUD_OPACITY.tooltip": "调整状态栏(HUD)和用户界面(UI)在游戏内的透明度\n【0.15透明←[]→完全不透明(默认)】", - "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "设置游戏内呼出的菜单(GUI)是否有一个半透明的背景\n开:呼出的菜单会带有按钮和半透明的背景\n关:呼出游戏内菜单时,只会出现按钮(推荐)", - "vivecraft.options.HUD_OCCLUSION.tooltip": "设置状态栏(HUD)是否会被遮挡。\n开(默认):HUD会被游戏内的物体方块所遮挡,乃至完全隐藏。\n关:HUD不会被游戏内的物体方块所遮挡。", - "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "设定主菜单是否会跟随着你的视线而转动!\n就座:仅在就座游玩时,启用该功能。\n总是:主菜单总是会跟随你的视线转动!", - "vivecraft.options.CROSSHAIR_SCALE.tooltip": "设定游戏内十字指针的大小。", - "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "设置菜单页面中十字指针的大小。", - "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "设置游戏内指针的显示方式:\n总是:指针永远会显示,就算HUD被关闭了也是这样!\n仅启用状态栏时:指针只会在启用了HUD时显示\n从不:从不显示指针", - "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "设置当你收到一条聊天信息是将会发生什么【慎用】\n无:什么都不会发生~(欸嘿~) \n震动:你的手柄会通过震动提示你\n声音:收到消息时会播放信息提示音\n全部:不仅手柄会震动,你还会听到提示音", - "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "设置聊天信息提示音", - "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "这个设置决定着指针是否会因为距离而放大缩小。\n开:你视野中的指针将会一直保持同一个大小。\n关:你视野中的指针大小将会受到距离的影响而变大缩小。", - "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "设置当你指向一个方块时,方块边缘的显示方式:\n总是:方块边缘永远会加黑加粗显示,就算HUD被关闭了也是这样!\n仅启用状态栏时:方块边缘会加黑加粗只会在启用了HUD时显示\n从不:方块边缘从不加黑加粗显示", - "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "如果禁用该选项,则只有你单击聊天栏中的文字部分、或一直注视着一段文字时,才会呼出键盘。\n如果启用该选项,则每当你注视一段文字时,都会自动呼出键盘。\n【在安装了部分MOD的情况下,启用该选项可能会造成键盘的误呼出】", - "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "选择扇形菜单的使用方法:\n按住:按住扇形菜单按钮时显示扇形按钮菜单;呼出菜单期间把指针移动到选项上并松开按钮来做出选择。\n单击:按下扇形菜单按钮呼出菜单,再按一次隐藏;把指针移动到选项上,扣动扳机进行选择。", - "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "选择哪一种VR键盘来打字:\n物理碰撞键盘:呼出键盘时,双手会变成亮♂棒♂棒,用他们去戳戳戳、并享受带感的音效吧!【推荐】\n指针键盘:将你的手柄指向键盘上的按键,按动扳机就可以输入字符了!", - "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "设置物理碰撞键盘的大小,这个数值将改变它的基础大小。", - "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "如果启用这项设置,功能方块(比如箱子和熔炉)的\n用户操作界面(GUI)将会出现在那个方块的上方;\n不启用:GUI将会出现在原本的地方。", - "vivecraft.options.FSAA.tooltip": "[FSAA]在将画面送往头显之前,使用一种更注重质量的重采样(resampling)方法来处理游戏画面。\n最好搭配高渲染倍率使用。", - "vivecraft.options.MIRROR_DISPLAY.tooltip": "把头显中的画面镜像处理显示在桌面的游戏程式上。可以被设置为:\n关:无画面\n单眼:传输到头显左/右眼镜片的画面\n双眼:同时显示传输到头显左眼和右眼镜片的画面\n第一人称视角{影响帧数}:渲染整合双眼画面\n第三人称视角{影响帧数}:从侧后方45°向下俯视的视角\nMR混合现实模式{影响帧数}:【慎用】\n", - "vivecraft.options.MIRROR_EYE.tooltip": "(在裁切模式和单眼模式中)\n使用传输到头显里哪个镜片中的画面?", - "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "在MR混合现实模式中被填充到”透明“区域的颜色。\n系统会过滤掉游戏中和这个颜色相配的一些颜色,防止画面看起来怪怪的。", - "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "在MR混合现实模式中渲染你的双手。\n仅调整是否渲染你所使用的人物的双手;\n人物模型的双手皮肤和手中所持有的物品都会被渲染。", - "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "在以下两个选项中选择:\nUnity式的一分四窗口显示(例如:左下第三人称,右下第一人称)\n3+1(Side-by-Side)式的一分二窗口显示", - "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "把一个无形变的画面渲染到一分四的显示画面中需要【额外的】一次渲染过程;\n否则将使用头显某个镜片中的画面(带黑边)。\n", - "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "在Unity布局中:\n如果选择”是“,将绘制一个灰度alpha蒙版到右上象限(就像Unity应用界面那样)用于蒙版前景层。\n否则,前景色将以关键色绘制,以配合颜色关键效果使用。", - "vivecraft.options.MIXED_REALITY_FOV.tooltip": "在MR混合现实模式中使用的视野角度(FOV)", - "vivecraft.options.WALK_UP_BLOCKS.tooltip": "这个选项允许你设置角色不用跳就能上一格高的方块的能力。\n[快捷键:右侧Ctrl+B]\n§c警告!可能会触发多人服务器中的防作弊系统!\n关:(默认)你需要跳跃来登上一格高的方块\n开:你不用跳,只要行走就能上到一格高的方块。也许可以减轻一些自由移动模式带来的晕眩", - "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "调整这个数值,可以让你比默认设置移动地慢一些。这也许可以帮助你减轻一些自由移动模式带来的晕眩感。\n§c警告!改变这个设置可能会触发多人服务器防作弊程序!\n默认设置为Minecraft标准移动速度(1.0)", - "vivecraft.options.INERTIA_FACTOR.tooltip": "选项:\n无<一般<很大<更大\n设置玩家在单人模式中移动的惯性。惯性越低,加速度越大,移动灵敏度更高;反之亦然。\n高惯性也许可以减轻一些玩家在使用自由移动模式时的晕眩感,但在使用的时候请小心悬崖!\n默认设置为”一般“,即标准Minecraft玩家的移动方式\n该设置目前不会影响玩家在岩浆、水中的动作和跳跃动作。", - "vivecraft.options.SIMULATE_FALLING.tooltip": "启用该设置后,使用传送移动模式的玩家如果脚下没有方块的话,他们将会摔个嘴啃泥!\n不过与此同时,玩家也可以跳跃了。(是谁赢了呢emm)", - "vivecraft.options.WEAPON_COLLISION.tooltip": "启用后,你可以在Vivecraft中挥动手臂来采掘方块、攻击怪物!\n如果选择”自动“:在生存模式中该项被设置为启用,在创造模式中该项被设置为禁用", - "vivecraft.options.ALLOW_CRAWLING.tooltip": "如果启用这个功能,玩家将可以钻过仅有一格高的空间", - "vivecraft.options.LIMIT_TELEPORT.tooltip": "如果启用该设置,传送移动在生存模式中将会受到限制。你不能使用传送从你站立的方块边缘传送到你头顶的方块上;传送移动也会消耗食物;传送移动将会内置一个隐藏的、随时间回复的能量条,能量越多,可以传送的距离越远。", - "vivecraft.options.REVERSE_HANDS.tooltip": "切换主手(默认主手为右手)\n开:左手为主手\n关:右手为主手\n切换主手后,重启游戏以应用双手键位的互换;同时请确认你在SteamVR中选择了默认键位设置(default bindings)", - "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", - "vivecraft.options.STENCIL_ON.tooltip": "【屏幕黑边】\n开启后在频幕上显示镜片黑边,遮盖头显镜片外视野范围外的区域。\n可以略微增加帧数。", - "vivecraft.options.BCB_ON.tooltip": "通过在地面上显示一个方形的影子来显示你的位置判定。\n-它可是你的好♂兄♂弟\n-啊♂?乖♂乖♂站♂好♂", - "vivecraft.options.WORLD_SCALE.tooltip": "通过调整倍率来放大缩小玩家!\n数值调高会让你从巨人的视角看世界!\n调小来体验《格列佛游记(Gulliver's Travels)》里 小人国 的视角!\n娱乐功能,如果可以的话最好不要调整~", - "vivecraft.options.WORLD_ROTATION.tooltip": "微调所使用头显的旋转值\n如果能够跟某个按键绑定的话会更有用\n可以使用方向键”←“”→“进行调节", - "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "调整人物旋转时旋转的角度。", - "vivecraft.options.TOUCH_HOTBAR.tooltip": "如果启用这个设置,你将可以通过触摸物品栏的方式来选择上面的东西。", - "vivecraft.options.PLAY_MODE_SEATED.tooltip": "站立游玩或就座游玩\n站立游玩可高级多了(笑)", - "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "游戏的渲染倍率,只与头显镜片中的画面有关。\n更高的值将会带来更好的游戏体验,与此同时会吃掉大部分性能导致帧数下降。", - "vivecraft.options.MONO_FOV.tooltip": "调整视野角度(FOV)\n仅影响无形变(undistorted)模式下镜像处理出来显示在桌面上的画面", - "vivecraft.options.REALISTIC_JUMP.tooltip": "如果启用这个设置,当你在现实中起跳的时候,游戏中你的角色也会一起跳起来!\n同时在个人客户端中启用”弹跳靴“", - "vivecraft.options.REALISTIC_SNEAK.tooltip": "如果启用这个设置,当你在现实中弯腰低头(降低身体高度)的时候,游戏中你的角色会进入潜行模式!", - "vivecraft.options.PHYSICAL_GUI.tooltip": "如果启用这项设置,用户图形界面(GUI)将会被可互动的3D模型所取代。\n如果启用了背包追踪(Backpack tracking),把手伸向你的后背将会呼出物品背包。", - "vivecraft.options.REALISTIC_CLIMB.tooltip": "如果打开了该设置项,你就可以用你的双手去攀爬梯子和藤蔓了!\n(当个蜘蛛侠,请~)\n同时也会启用攀爬爪。", - "vivecraft.options.REALISTIC_SWIM.tooltip": "如果打开了这个设置,你就在三次元里体会到划水的乐趣了!\n(被水淹没,不知所措)", - "vivecraft.options.REALISTIC_ROW.tooltip": "如果想锻炼手臂的话可以试试\n*让我们荡起双桨~小船儿开到陆上~\n**也许人会先起飞或者手柄撞到东西上报废吧(笑)", - "vivecraft.options.WALK_MULTIPLIER.tooltip": "倍乘你现实中一步走出去后,在游戏中移动的距离;\n让你可以在不动用移动按键的前提下走得更远一些;\n但是可能会导致晕眩\n【不建议更改】", - "vivecraft.options.FREEMOVE_MODE.tooltip": "自由移动模式下人物移动的方向。\n控制器:副手(默认左手)手柄前端指向的方向【推荐】\n头显:你的VR头显看向的方向\n原地摆臂移动:左右转向(Yaw)取决于你的VR手柄(控制器)是怎么甩的,向上向下(Pitch)则取决于你的头显方向。\n房间:左右转向(Yaw)取决于你的VR游玩空间的正向。向上向下(Pitch)取决于你的头显。这个设置只适合那些无法追踪到背后、或者只有180度追踪/视野的人(比如不想转身的站立模式玩家)", - "vivecraft.options.VEHICLE_ROTATION.tooltip": "在载具(如船和矿车)中,玩家视角会随着载具旋转而旋转。\n别玩太狠了,这个可能会使人失去方向感", - "vivecraft.options.RESET_ORIGIN.tooltip": "把玩家现在的位置校准为游戏区域中心,并将玩家身高设定为1.62m,稍低于正在使用的头显的高度。\n这个设置对于那些就座游玩和使用”不那么精准“的定位系统的玩家来说很有用。", - "vivecraft.options.X_SENSITIVITY.tooltip": "当你把摇杆(左/右)推到底时,视野旋转的速度", - "vivecraft.options.Y_SENSITIVITY.tooltip": "垂直鼠标灵敏度", - "vivecraft.options.KEYHOLE.tooltip": "设定每一次视角旋转时向左/向右旋转的角度大小", - "vivecraft.options.FOV_REDUCTION.tooltip": "在移动时,头衔镜片画面中将出现黑边,限制视野范围。\n可以明显缓解移动时的眩晕感!", - "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "移动时视野范围(FOV)的倍率\n(默认0.25,数值越高,移动时的视野范围越大)", - "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "水平补正值\n对于某些不同寻常的VR来说,如果开启了FOV移动缓冲的话,请一定要调整这个\n把移动时仅存的画面调整到看着舒服就行了!", - "vivecraft.options.SEATED_HMD.tooltip": "按下W键后人物移动的方向:\n可设置为跟随头显看向的方向,或指针指向的方向。", - "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "状态栏(HUD)跟随的对象\n选择”头显“时,状态栏将跟随头显视线,始终保持在头显视野内。\n选择”指针“时,状态栏将跟随鼠标控制的指针移动。", - "vivecraft.options.BACKPACK_SWITCH.tooltip": "如果启用这个设置:\n把你的右控制器伸向脑后,即可快速切换出物品栏的第一个物品,或者切换到你上一次切换的格子!\n而用你的左控制器这样做,则可以快速交换你双手所持有的物品!\n【是个好功能,请善用!】", - "vivecraft.options.ANALOG_MOVEMENT.tooltip": "如果VR手柄(控制器)上“与移动绑定的键(自由移动模式下是摇杆)”有“可变行程(可变角度)”的话,将根据对应按键(摇杆)的可变行程(可变角度)来控制行走速度。\n\n为了充分地模拟对于行走的控制,最好使用”移动/扫描(Strafe)“或者”移动/旋转视角(Rotate)“设置", - "vivecraft.options.AUTO_SPRINT.tooltip": "使用自由移动模式时,摇杆角度一旦达到设定的阈值便会自动触发冲刺。\nWhile using freemove, sprint will automatically activate when the axis reaches the configured threshold.", - "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "设置激活自动冲刺的摇杆角度阈值\n超过即激发\n\nThe axis threshold at which auto-sprint activates.", - "vivecraft.options.BOW_MODE.tooltip": "你可以设置在什么情况下进行射箭的动作识别\n关:从不。(我就是要做按键英雄!)\n原版:仅在使用原版弓(Bow)时使用射箭动作识别;不识别MOD道具。\n开:对所有使用\"弓(BOW)\"的蓄力动作的物品都启用射箭动作识别。\n【请注意该设置最好只用于那些有可交互拉弓、蓄力、射击动作的弓类武器】\n【虽然可以上膛,但弩和枪械(+MOD)没有弓(BOW)那样的蓄力射击动作】", - "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "限制你每次传送能把你送往多低的地方\n以方块(blocks)为单位", - "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "限制你每次传送能把你送上多高的地方\n以方块(blocks)为单位", - "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "限制你传送的水平距离\n以方块(blocks)为单位", - "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "允许玩家在”站立游玩模式“下使用”复位“按钮。\n这个选项通常是给那些在站立模式下游玩,却又想坐搬个椅子坐着的玩家。\n(-说到底就是条懒狗……-懒狗怎么了?看不起懒狗啊?)", - "vivecraft.options.SEATED_FREE_MOVE.tooltip": "选择在就座游玩模式中,你想使用的移动方式\n\n传送移动:按下→松开!使用WASD四键中任意一个键即可进行传送移动!键盘上的”←“”→“方向键可以控制人物视角向左向右旋转!\n自由移动:操作方法与JAVA版Minecraft客户端相同。", - "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "强制使用备用的自由移动模式绑定按键(默认启用按键为左扳机)。\n如果想使用更多的移动选项,请在SteamVR设置中”控制器“栏目的”管理控制器按键设置“中进行编辑。\n\n请注意,启用这项设置将禁用传送模式中绑定的触发按键。", - "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "显示可以通过SteamVR绑定的额外按键!\n可用于绑定攀爬、显示键盘和MR混合显示相关功能!\n\n需要重启SteamVR让改动生效。", - "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "选择想要作为主菜单背景显示出来的世界!\n如果系统没有找到任何自订世界的话,会强制使用官方世界。", - "vivecraft.options.HRTF_SELECTION.tooltip": "【HRTF=Head Related Transfer Function (3D Audio)】\n选择你想使用的HRTF配置文件。HRTF技术可以允许你聆听3D空间音效。\n声音质量可能会因为设备和驱动而产生差别。\n关:完全禁用HRTF\n默认:使用默认的HRTF配置文件\n其它:使用某个特殊的HRTF配置文件", - "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "读取ExternalCamera.cfg文件并重新载入相机配置", - "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "按住扳机时,作右键连击判定,此设置更改右键连击之间游戏刻(tick)的数量\n1刻(tick)=1/20秒(sec)", - "vivecraft.options.ANIMAL_TOUCHING.tooltip": "如果开启了这个设置,在你手上未持有武器时,触碰一只被动(passive)的生物(mob)的动作将会判定为鼠标右键(使用物品),而不是鼠标左键(攻击)。\n——妈妈再也不用担心我一巴掌掴死半个农场的动物了(草)", - "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "手持摄像机视野", - "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "设定手持摄像机的解析度,越大的设置会导致更大的图片大小。\n当光影启用时不可使用。\n§c警告:过高的设置可能会烧坏你的显卡!", - "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "显示摄像机的模型(仅在 HMD 视图中)以表示混合现实或第三人称摄像机当前所在的位置。 也可以使用交互绑定来抓取它来移动它。", - "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "为物理键盘预设的配色方案。 自定义主题可以通过游戏目录中的keyboardtheme.txt 进行编辑。 每次打开键盘时都会重新加载,以允许实时调整。", - "_comment10": "Option values", - "vivecraft.options.gamma.cantseeshitcaptain": "黑不拉几", - "vivecraft.options.yes": "是", - "vivecraft.options.no": "否", - "vivecraft.options.weaponcollision.auto": "自动", - "vivecraft.options.default": "默认", - "vivecraft.options.opaque": "不透明", - "vivecraft.options.mirrormode.off": "关[帧数+++]", - "vivecraft.options.mirrormode.dual": "双眼[帧数+]", - "vivecraft.options.mirrormode.single": "单眼[帧数++]", - "vivecraft.options.mirrormode.firstperson": "第一人称视角[帧数-]", - "vivecraft.options.mirrormode.thirdperson": "第三人称视角[帧数-]", - "vivecraft.options.mirrormode.mixedreality": "MR混合现实渲染[帧数-]", - "vivecraft.options.mirrormode.cropped": "适应屏幕(裁切)[帧数++]", - "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", - "vivecraft.options.left": "左", - "vivecraft.options.right": "右", - "vivecraft.options.color.black": "黑色", - "vivecraft.options.color.red": "红色", - "vivecraft.options.color.yellow": "黄色", - "vivecraft.options.color.green": "绿色", - "vivecraft.options.color.cyan": "青色", - "vivecraft.options.color.blue": "蓝色", - "vivecraft.options.color.magenta": "品红", - "vivecraft.options.unity": "Unity", - "vivecraft.options.sidebyside": "3rd+1st", - "vivecraft.options.hudlock.hand": "手柄上方", - "vivecraft.options.hudlock.head": "头部", - "vivecraft.options.hudlock.wrist": "手臂(推荐)", - "vivecraft.options.renderpointerelement.always": "总是", - "vivecraft.options.renderpointerelement.withhud": "仅启用状态栏时", - "vivecraft.options.renderpointerelement.never": "从不", - "vivecraft.options.chatnotifications.none": "无", - "vivecraft.options.chatnotifications.haptic": "震动", - "vivecraft.options.chatnotifications.sound": "声音", - "vivecraft.options.chatnotifications.both": "全部", - "vivecraft.options.always": "总是", - "vivecraft.options.seated": "就座", - "vivecraft.options.standing": "站立", - "vivecraft.options.inertiafactor.none": "无", - "vivecraft.options.inertiafactor.normal": "一般", - "vivecraft.options.inertiafactor.large": "很大", - "vivecraft.options.inertiafactor.massive": "更大", - "vivecraft.options.smooth": "平滑", - "vivecraft.options.hmd": "头显", - "vivecraft.options.crosshair": "指针", - "vivecraft.options.freemove.controller": "控制器", - "vivecraft.options.freemove.hmd": "头显", - "vivecraft.options.freemove.runinplace": "原地摆臂移动", - "vivecraft.options.freemove.room": "房间", - "vivecraft.options.hold": "按住", - "vivecraft.options.press": "单击", - "vivecraft.options.keyboard.physical": "物理碰撞键盘", - "vivecraft.options.keyboard.pointer": "指针键盘", - "vivecraft.options.bowmode.vanilla": "原版", - "vivecraft.options.teleportlimit": "%d个方块", - "vivecraft.options.teleport": "传送", - "vivecraft.options.freemove": "自由移动", - "vivecraft.options.menuworld.both": "官方&自订世界", - "vivecraft.options.menuworld.custom": "仅自订世界", - "vivecraft.options.menuworld.official": "仅官方世界", - "vivecraft.options.menuworld.none": "无", - "vivecraft.options.rightclickdelay.vanilla": "原版", - "vivecraft.options.rightclickdelay.slow": "慢", - "vivecraft.options.rightclickdelay.slower": "更慢", - "vivecraft.options.rightclickdelay.slowest": "最慢", - "vivecraft.options.keyboardtheme.default": "白色的", - "vivecraft.options.keyboardtheme.red": "红色", - "vivecraft.options.keyboardtheme.green": "绿色", - "vivecraft.options.keyboardtheme.blue": "蓝色", - "vivecraft.options.keyboardtheme.black": "空白", - "vivecraft.options.keyboardtheme.grass": "草方块", - "vivecraft.options.keyboardtheme.bees": "熊蜂", - "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", - "vivecraft.options.keyboardtheme.dose": "药品", - "vivecraft.options.keyboardtheme.custom": "风俗", - "_comment12": "Button text", - "vivecraft.gui.ok": "确认", - "vivecraft.gui.clear": "清除", - "vivecraft.gui.loaddefaults": "加载默认设置", - "vivecraft.gui.menuworld.refresh": "刷新主菜单世界背景", - "vivecraft.gui.menuworld.loadnew": "加载新的主菜单世界背景", - "vivecraft.gui.radialmenu.mainset": "默认菜单设置", - "vivecraft.gui.radialmenu.alternateset": "额外菜单设置", - "vivecraft.gui.chat": "聊天栏", - "vivecraft.gui.commands": "快速聊天/指令", - "vivecraft.gui.overlay": "系统信息", - "vivecraft.gui.profiler": "系统性能图", - "vivecraft.gui.screenshot": "截屏", - "vivecraft.gui.calibrateheight": "校准身高", - "vivecraft.gui.alignkatwalk": "校准KAT WALK", - "vivecraft.gui.movethirdpersoncam": "移动第三人称摄像头", - "vivecraft.gui.social": "社交菜单", - "_comment13": "Items", - "vivecraft.item.jumpboots": "弹跳靴", - "vivecraft.item.climbclaws": "攀岩爪", - "vivecraft.item.telescope": "千里眼", - "_comment14": "Messages", - "vivecraft.messages.seatedmode": "切换至就座游玩模式将会关闭VR手柄输入。确定要继续吗?", - "vivecraft.messages.radialmenubind.1": "请确认“打开扇形菜单”的功能已经跟手柄的某个键位绑定。", - "vivecraft.messages.radialmenubind.2": "在扇形菜单打开的时候按住(键盘上的Shift键)来切换到这一套配置。", - "vivecraft.messages.controls.1": "键位绑定由SteamVR输入(Input)来控制。", - "vivecraft.messages.controls.2": "请在SteamVR中的“设置”→“控制器”→“管理控制器按键设置”中进行修改(SteamVR 快捷菜单中也可修改)", - "vivecraft.messages.controls.3": " 必须在SteamVR启动 §o之前 §r§6 运行Steam,§o§6否则键位的绑定和更改不会被保存。", - "vivecraft.messages.serverplugin": "检测到Vivecraft服务器适应插件(MOD)%s", - "vivecraft.messages.noserverplugin": "没有检测到Vivecraft服务器适应插件(MOD),这个服务器也许不支持使用传送移动!已启用有限移动模式!(如果完全无法传送,将切换到备用的自由移动模式!)", - "vivecraft.messages.calibrateheight": "请在按下菜单键呼出的暂停菜单中校准您的身高。", - "vivecraft.messages.rendersetupfailed": "客户端启动/渲染失败(Render setup failed):%s", - "vivecraft.messages.intelgraphics": "不支持Intel核芯显卡!如果你使用的使笔记本电脑,请在设置中强制JAVA程序使用“高性能GPU”!已检测到的GPU有:%s", - "vivecraft.messages.nosteamvr": "未检测到OpenVR. 您安装SteamVR了吗?", - "vivecraft.messages.menuworldexportcomplete.1": "世界文件导出完成!区域大小:%d", - "vivecraft.messages.menuworldexportcomplete.2": "保存至%s", - "vivecraft.messages.menuworldexportclientwarning": "警告!正在使用客户端世界渲染器保存主菜单背景世界!数据可能不完整!我们推荐您将主菜单背景世界保存到单人游戏中。", - "vivecraft.messages.teleportdisabled": "有限移动模式已启用(禁止传送移动)", - "vivecraft.messages.teleportenabled": "有限移动模式已禁用(允许传送移动)", - "vivecraft.messages.walkupblocks": "进入方块(右Ctrl+B):%s", - "vivecraft.messages.showaim": "显示瞄准位置(右Ctrl+右Shift):启用", - "vivecraft.messages.playerinertia": "玩家移动惯性(左CTRL+I):%s", - "vivecraft.messages.movementmodeswitch": "设置移动模式为:%s", - "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", - "vivecraft.messages.angles": "俯仰:%.1f 偏航:%.1f 横滚:%.1f", - "vivecraft.messages.heightset": "设置玩家自身身高为%d%%" -} \ No newline at end of file + "_comment0": "Contributors: IceFairyCirno, Logan_Haiz, BKCake, xwdit, TEGTianFan, Gigahertz", + "_comment1": "Key bindings", + "vivecraft.key.hotbarNext": "物品栏后一格", + "vivecraft.key.hotbarPrev": "物品栏前一格", + "vivecraft.key.hotbarScroll": "物品栏快速选择", + "vivecraft.key.hotbarSwipeX": "滑动选择物品栏(向左/向右)", + "vivecraft.key.hotbarSwipeY": "滑动选择物品栏(向上/向下)", + "vivecraft.key.rotateLeft": "向左转动视角", + "vivecraft.key.rotateRight": "向右转动视角", + "vivecraft.key.rotateAxis": "仅保持旋转", + "vivecraft.key.rotateFree": "自由转动视角", + "vivecraft.key.walkabout": "走动", + "vivecraft.key.teleport": "传送移动", + "vivecraft.key.teleportFallback": "当传送移动禁用时使用向手柄朝向移动的移动方式", + "vivecraft.key.freeMoveRotate": "移动/旋转视角", + "vivecraft.key.freeMoveStrafe": "移动/扫描", + "vivecraft.key.toggleMovement": "切换移动模式", + "vivecraft.key.quickTorch": "快速火把", + "vivecraft.key.ingameMenuButton": "唤出暂停菜单", + "vivecraft.key.exportWorld": "导出主菜单背景世界", + "vivecraft.key.radialMenu": "打开扇形菜单", + "vivecraft.key.swapMirrorView": "切换桌面镜像", + "vivecraft.key.toggleKeyboard": "显示/隐藏虚拟键盘", + "vivecraft.key.moveThirdPersonCam": "移动第三人称摄像机", + "vivecraft.key.togglePlayerList": "切换显示玩家列表", + "vivecraft.key.toggleHandheldCam": "呼出/隐藏手持相机", + "vivecraft.key.quickHandheldCam": "松手即拍快速相机", + "vivecraft.key.trackpadTouch": "触摸触控板", + "vivecraft.key.vrInteract": "情景交互", + "vivecraft.key.guiLeftClick": "左键点击", + "vivecraft.key.guiRightClick": "右键点击", + "vivecraft.key.guiMiddleClick": "中键点击", + "vivecraft.key.guiShift": "Shift", + "vivecraft.key.guiCtrl": "Ctrl", + "vivecraft.key.guiAlt": "Alt", + "vivecraft.key.guiScrollUp": "滚轮向上滚动", + "vivecraft.key.guiScrollDown": "滚轮向下滚动", + "vivecraft.key.guiScrollAxis": "滚轮", + "vivecraft.key.keyboardClick": "点击", + "vivecraft.key.keyboardShift": "Shift", + "vivecraft.key.climbeyGrab": "攀爬爪", + "vivecraft.key.climbeyJump": "弹跳靴", + "_comment2": "Key binding categories", + "vivecraft.key.category.gui": "GUI", + "vivecraft.key.category.climbey": "攀爬动态", + "vivecraft.key.category.keyboard": "键盘", + "_comment3": "Action set names", + "vivecraft.actionset.ingame": "游戏内", + "vivecraft.actionset.gui": "GUI", + "vivecraft.actionset.global": "全局选项", + "vivecraft.actionset.mod": "模组化", + "vivecraft.actionset.contextual": "情景", + "vivecraft.actionset.keyboard": "键盘", + "vivecraft.actionset.mixedReality": "混合现实", + "vivecraft.actionset.technical": "技术性", + "_comment4": "Option screens", + "vivecraft.options.screen.main": "VR设置", + "vivecraft.options.screen.freemove": "自由移动选项", + "vivecraft.options.screen.gui": "HUD及GUI选项", + "vivecraft.options.screen.menuworld": "主菜单背景世界选项", + "vivecraft.options.screen.guiother": "聊天/鼠标指针选项", + "vivecraft.options.screen.quickcommands": "快捷命令", + "vivecraft.options.screen.radialmenu": "扇形菜单选项", + "vivecraft.options.screen.stereorendering": "相机和画面渲染选项", + "vivecraft.options.screen.roomscale": "动作识别交互选项", + "vivecraft.options.screen.seated": "就座选项", + "vivecraft.options.screen.standing": "站立移动选项", + "vivecraft.options.screen.teleport": "传送选项", + "vivecraft.options.screen.controls": "控制器选项", + "_comment5": "Buttons that lead to the screen", + "vivecraft.options.screen.main.button": "VR设置……", + "vivecraft.options.screen.gui.button": "游戏界面及图形界面选项……", + "vivecraft.options.screen.stereorendering.button": "相机和画面渲染……", + "vivecraft.options.screen.quickcommands.button": "快捷命令……", + "vivecraft.options.screen.guiother.button": "聊天和准心选项……", + "vivecraft.options.screen.standing.button": "移动选项……", + "vivecraft.options.screen.roomscale.button": "交互选项……", + "vivecraft.options.screen.controls.button": "控制器选项……", + "vivecraft.options.screen.radialmenu.button": "扇形菜单……", + "vivecraft.options.screen.seated.button": "就座选项……", + "vivecraft.options.screen.menuworld.button": "主世界选项……", + "vivecraft.options.screen.teleport.button": "传送选项……", + "vivecraft.options.screen.freemove.button": "自由移动选项……", + "_comment6": "Option names", + "vivecraft.options.HUD_SCALE": "头显模式HUD大小", + "vivecraft.options.HUD_DISTANCE": "头显模式HUD距离", + "vivecraft.options.HUD_LOCK_TO": "HUD位置", + "vivecraft.options.HUD_OPACITY": "HUD不透明度", + "vivecraft.options.HUD_HIDE": "隐藏HUD(F1)", + "vivecraft.options.RENDER_MENU_BACKGROUND": "HUD/GUI背景", + "vivecraft.options.HUD_OCCLUSION": "HUD明暗度", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE": "主菜单跟随对象", + "vivecraft.options.CROSSHAIR_OCCLUSION": "准心明暗度", + "vivecraft.options.CROSSHAIR_SCALE": "准心大小", + "vivecraft.options.MENU_CROSSHAIR_SCALE": "菜单准心大小", + "vivecraft.options.RENDER_CROSSHAIR_MODE": "显示准心", + "vivecraft.options.CHAT_NOTIFICATIONS": "聊天提示", + "vivecraft.options.CHAT_NOTIFICATION_SOUND": "提示音", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE": "准心形状", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE": "显示方块轮廓", + "vivecraft.options.AUTO_OPEN_KEYBOARD": "常开启键盘", + "vivecraft.options.RADIAL_MODE_HOLD": "扇形菜单模式", + "vivecraft.options.PHYSICAL_KEYBOARD": "键盘种类", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE": "键盘大小", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK": "不被方块遮挡", + "vivecraft.options.FSAA": "全局抗锯齿(Lanczos Scaler)", + "vivecraft.options.MIRROR_DISPLAY": "桌面镜像", + "vivecraft.options.MIRROR_EYE": "镜像左右眼", + "vivecraft.options.MIXED_REALITY_KEY_COLOR": "关键色", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS": "显示双手", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE": "布局", + "vivecraft.options.MIXED_REALITY_UNDISTORTED": "不失真渲染(无形变)", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK": "透明度遮罩", + "vivecraft.options.MIXED_REALITY_FOV": "第三人称视野", + "vivecraft.options.WALK_UP_BLOCKS": "自动上方块", + "vivecraft.options.MOVEMENT_MULTIPLIER": "移动速度倍率", + "vivecraft.options.INERTIA_FACTOR": "玩家惯性", + "vivecraft.options.SIMULATE_FALLING": "拟真摔落", + "vivecraft.options.WEAPON_COLLISION": "武器攻击动作识别", + "vivecraft.options.ALLOW_CRAWLING": "匍匐动作识别", + "vivecraft.options.LIMIT_TELEPORT": "生存模式传送限制", + "vivecraft.options.REVERSE_HANDS": "切换主手", + "_comment7": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS=Raw Item Positions", + "vivecraft.options.STENCIL_ON": "使用眼部模板", + "vivecraft.options.BCB_ON": "显示身体位置", + "vivecraft.options.WORLD_SCALE": "世界大小", + "vivecraft.options.WORLD_ROTATION": "世界旋转", + "vivecraft.options.WORLD_ROTATION_INCREMENT": "旋转增加", + "vivecraft.options.TOUCH_HOTBAR": "已启用可触摸的快捷栏", + "vivecraft.options.PLAY_MODE_SEATED": "游玩模式", + "vivecraft.options.RENDER_SCALEFACTOR": "VR渲染倍率", + "vivecraft.options.MONO_FOV": "视野(无形变模式)", + "vivecraft.options.REALISTIC_JUMP": "跳跃动作识别", + "vivecraft.options.REALISTIC_SNEAK": "潜行动作识别", + "vivecraft.options.PHYSICAL_GUI": "物理的GUI", + "vivecraft.options.REALISTIC_CLIMB": "攀爬动作识别", + "vivecraft.options.REALISTIC_SWIM": "游泳动作识别", + "vivecraft.options.REALISTIC_ROW": "划船动作识别", + "vivecraft.options.WALK_MULTIPLIER": "步行倍增器", + "vivecraft.options.FREEMOVE_MODE": "自由移动类型", + "vivecraft.options.VEHICLE_ROTATION": "载具旋转", + "vivecraft.options.RESET_ORIGIN": "复位", + "vivecraft.options.X_SENSITIVITY": "旋转速度", + "vivecraft.options.Y_SENSITIVITY": "Y轴灵敏度", + "vivecraft.options.KEYHOLE": "锁孔", + "vivecraft.options.FOV_REDUCTION": "FOV移动缓冲", + "vivecraft.options.FOV_REDUCTION_MIN": "FOV缓冲倍率", + "vivecraft.options.FOV_REDUCTION_OFFSET": "FOV缓冲区域补正", + "vivecraft.options.SEATED_HMD": "向前方向", + "vivecraft.options.SEATED_HUD_XHAIR": "HUD跟随对象", + "vivecraft.options.BACKPACK_SWITCH": "背包切换", + "vivecraft.options.ANALOG_MOVEMENT": "模拟移动", + "vivecraft.options.AUTO_SPRINT": "自动疾跑", + "vivecraft.options.AUTO_SPRINT_THRESHOLD": "自动疾跑摇杆阈值", + "vivecraft.options.BOW_MODE": "射箭动作识别", + "vivecraft.options.TELEPORT_DOWN_LIMIT": "传送高度下限", + "vivecraft.options.TELEPORT_UP_LIMIT": "传送高度上限", + "vivecraft.options.TELEPORT_HORIZ_LIMIT": "传送距离限制", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET": "允许原始偏移", + "vivecraft.options.SEATED_FREE_MOVE": "移动类型", + "vivecraft.options.FORCE_STANDING_FREE_MOVE": "强制自由移动", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS": "显示高级按键设置", + "vivecraft.options.MENU_WORLD_SELECTION": "世界", + "vivecraft.options.HRTF_SELECTION": "定向音频(VR)", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA": "重载外部摄像机", + "vivecraft.options.RIGHT_CLICK_DELAY": "重复右键点击", + "vivecraft.options.ANIMAL_TOUCHING": "动物触摸识别", + "vivecraft.options.HANDHELD_CAMERA_FOV": "手持相机视野", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE": "手持相机显示屏解析度", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL": "显示相机型号", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME": "键盘主题", + "_comment8": "Option tooltips", + "vivecraft.options.HUD_SCALE.tooltip": "视野内状态栏(HUD)占据的相对大小。\n是相对单位,不是具体大小也不会影响FOV或者其它什么。", + "vivecraft.options.HUD_DISTANCE.tooltip": "悬浮的状态栏(HUD)与玩家身体之间的距离;HUD的相对大小不会被这个设置所改变。\n以现实中的米(m)为单位(而不是以一个方块为单位)\n[PS:在Vivecraft中,默认一个方块为1米,而Java版客户端可以通过改变视角调整观感。]", + "vivecraft.options.HUD_LOCK_TO.tooltip": "(HUD:状态栏,包括物品栏和生命值等内容)\n指定HUD的锁定位置!\n手柄上方:HUD会出现在你的副手(默认左手)上方。\n头部:HUD会出现并锁定在你的头显视野中!\n手臂(推荐):HUD被设置在你的副手手腕内侧。\n[转动你的手腕!当你看向它时它便会出现!]", + "vivecraft.options.HUD_OPACITY.tooltip": "调整状态栏(HUD)和用户界面(UI)在游戏内的透明度\n【0.15透明←[]→完全不透明(默认)】", + "vivecraft.options.RENDER_MENU_BACKGROUND.tooltip": "设置游戏内呼出的菜单(GUI)是否有一个半透明的背景\n开:呼出的菜单会带有按钮和半透明的背景\n关:呼出游戏内菜单时,只会出现按钮(推荐)", + "vivecraft.options.HUD_OCCLUSION.tooltip": "设置状态栏(HUD)是否会被遮挡。\n开(默认):HUD会被游戏内的物体方块所遮挡,乃至完全隐藏。\n关:HUD不会被游戏内的物体方块所遮挡。", + "vivecraft.options.MENU_ALWAYS_FOLLOW_FACE.tooltip": "设定主菜单是否会跟随着你的视线而转动!\n就座:仅在就座游玩时,启用该功能。\n总是:主菜单总是会跟随你的视线转动!", + "vivecraft.options.CROSSHAIR_SCALE.tooltip": "设定游戏内十字指针的大小。", + "vivecraft.options.MENU_CROSSHAIR_SCALE.tooltip": "设置菜单页面中十字指针的大小。", + "vivecraft.options.RENDER_CROSSHAIR_MODE.tooltip": "设置游戏内指针的显示方式:\n总是:指针永远会显示,就算HUD被关闭了也是这样!\n仅启用状态栏时:指针只会在启用了HUD时显示\n从不:从不显示指针", + "vivecraft.options.CHAT_NOTIFICATIONS.tooltip": "设置当你收到一条聊天信息是将会发生什么【慎用】\n无:什么都不会发生~(欸嘿~) \n震动:你的手柄会通过震动提示你\n声音:收到消息时会播放信息提示音\n全部:不仅手柄会震动,你还会听到提示音", + "vivecraft.options.CHAT_NOTIFICATION_SOUND.tooltip": "设置聊天信息提示音", + "vivecraft.options.CROSSHAIR_SCALES_WITH_DISTANCE.tooltip": "这个设置决定着指针是否会因为距离而放大缩小。\n开:你视野中的指针将会一直保持同一个大小。\n关:你视野中的指针大小将会受到距离的影响而变大缩小。", + "vivecraft.options.RENDER_BLOCK_OUTLINE_MODE.tooltip": "设置当你指向一个方块时,方块边缘的显示方式:\n总是:方块边缘永远会加黑加粗显示,就算HUD被关闭了也是这样!\n仅启用状态栏时:方块边缘会加黑加粗只会在启用了HUD时显示\n从不:方块边缘从不加黑加粗显示", + "vivecraft.options.AUTO_OPEN_KEYBOARD.tooltip": "如果禁用该选项,则只有你单击聊天栏中的文字部分、或一直注视着一段文字时,才会呼出键盘。\n如果启用该选项,则每当你注视一段文字时,都会自动呼出键盘。\n【在安装了部分MOD的情况下,启用该选项可能会造成键盘的误呼出】", + "vivecraft.options.RADIAL_MODE_HOLD.tooltip": "选择扇形菜单的使用方法:\n按住:按住扇形菜单按钮时显示扇形按钮菜单;呼出菜单期间把指针移动到选项上并松开按钮来做出选择。\n单击:按下扇形菜单按钮呼出菜单,再按一次隐藏;把指针移动到选项上,扣动扳机进行选择。", + "vivecraft.options.PHYSICAL_KEYBOARD.tooltip": "选择哪一种VR键盘来打字:\n物理碰撞键盘:呼出键盘时,双手会变成亮♂棒♂棒,用他们去戳戳戳、并享受带感的音效吧!【推荐】\n指针键盘:将你的手柄指向键盘上的按键,按动扳机就可以输入字符了!", + "vivecraft.options.PHYSICAL_KEYBOARD_SCALE.tooltip": "设置物理碰撞键盘的大小,这个数值将改变它的基础大小。", + "vivecraft.options.GUI_APPEAR_OVER_BLOCK.tooltip": "如果启用这项设置,功能方块(比如箱子和熔炉)的\n用户操作界面(GUI)将会出现在那个方块的上方;\n不启用:GUI将会出现在原本的地方。", + "vivecraft.options.FSAA.tooltip": "[FSAA]在将画面送往头显之前,使用一种更注重质量的重采样(resampling)方法来处理游戏画面。\n最好搭配高渲染倍率使用。", + "vivecraft.options.MIRROR_DISPLAY.tooltip": "把头显中的画面镜像处理显示在桌面的游戏程式上。可以被设置为:\n关:无画面\n单眼:传输到头显左/右眼镜片的画面\n双眼:同时显示传输到头显左眼和右眼镜片的画面\n第一人称视角{影响帧数}:渲染整合双眼画面\n第三人称视角{影响帧数}:从侧后方45°向下俯视的视角\nMR混合现实模式{影响帧数}:【慎用】\n", + "vivecraft.options.MIRROR_EYE.tooltip": "(在裁切模式和单眼模式中)\n使用传输到头显里哪个镜片中的画面?", + "vivecraft.options.MIXED_REALITY_KEY_COLOR.tooltip": "在MR混合现实模式中被填充到”透明“区域的颜色。\n系统会过滤掉游戏中和这个颜色相配的一些颜色,防止画面看起来怪怪的。", + "vivecraft.options.MIXED_REALITY_RENDER_HANDS.tooltip": "在MR混合现实模式中渲染你的双手。\n仅调整是否渲染你所使用的人物的双手;\n人物模型的双手皮肤和手中所持有的物品都会被渲染。", + "vivecraft.options.MIXED_REALITY_UNITY_LIKE.tooltip": "在以下两个选项中选择:\nUnity式的一分四窗口显示(例如:左下第三人称,右下第一人称)\n3+1(Side-by-Side)式的一分二窗口显示", + "vivecraft.options.MIXED_REALITY_UNDISTORTED.tooltip": "把一个无形变的画面渲染到一分四的显示画面中需要【额外的】一次渲染过程;\n否则将使用头显某个镜片中的画面(带黑边)。\n", + "vivecraft.options.MIXED_REALITY_ALPHA_MASK.tooltip": "在Unity布局中:\n如果选择”是“,将绘制一个灰度alpha蒙版到右上象限(就像Unity应用界面那样)用于蒙版前景层。\n否则,前景色将以关键色绘制,以配合颜色关键效果使用。", + "vivecraft.options.MIXED_REALITY_FOV.tooltip": "在MR混合现实模式中使用的视野角度(FOV)", + "vivecraft.options.WALK_UP_BLOCKS.tooltip": "这个选项允许你设置角色不用跳就能上一格高的方块的能力。\n[快捷键:右侧Ctrl+B]\n§c警告!可能会触发多人服务器中的防作弊系统!\n关:(默认)你需要跳跃来登上一格高的方块\n开:你不用跳,只要行走就能上到一格高的方块。也许可以减轻一些自由移动模式带来的晕眩", + "vivecraft.options.MOVEMENT_MULTIPLIER.tooltip": "调整这个数值,可以让你比默认设置移动地慢一些。这也许可以帮助你减轻一些自由移动模式带来的晕眩感。\n§c警告!改变这个设置可能会触发多人服务器防作弊程序!\n默认设置为Minecraft标准移动速度(1.0)", + "vivecraft.options.INERTIA_FACTOR.tooltip": "选项:\n无<一般<很大<更大\n设置玩家在单人模式中移动的惯性。惯性越低,加速度越大,移动灵敏度更高;反之亦然。\n高惯性也许可以减轻一些玩家在使用自由移动模式时的晕眩感,但在使用的时候请小心悬崖!\n默认设置为”一般“,即标准Minecraft玩家的移动方式\n该设置目前不会影响玩家在岩浆、水中的动作和跳跃动作。", + "vivecraft.options.SIMULATE_FALLING.tooltip": "启用该设置后,使用传送移动模式的玩家如果脚下没有方块的话,他们将会摔个嘴啃泥!\n不过与此同时,玩家也可以跳跃了。(是谁赢了呢emm)", + "vivecraft.options.WEAPON_COLLISION.tooltip": "启用后,你可以在Vivecraft中挥动手臂来采掘方块、攻击怪物!\n如果选择”自动“:在生存模式中该项被设置为启用,在创造模式中该项被设置为禁用", + "vivecraft.options.ALLOW_CRAWLING.tooltip": "如果启用这个功能,玩家将可以钻过仅有一格高的空间", + "vivecraft.options.LIMIT_TELEPORT.tooltip": "如果启用该设置,传送移动在生存模式中将会受到限制。你不能使用传送从你站立的方块边缘传送到你头顶的方块上;传送移动也会消耗食物;传送移动将会内置一个隐藏的、随时间回复的能量条,能量越多,可以传送的距离越远。", + "vivecraft.options.REVERSE_HANDS.tooltip": "切换主手(默认主手为右手)\n开:左手为主手\n关:右手为主手\n切换主手后,重启游戏以应用双手键位的互换;同时请确认你在SteamVR中选择了默认键位设置(default bindings)", + "_comment9": "vivecraft.options.THIRDPERSON_ITEMTRANSFORMS.tooltip=Determines how held items are transformed.\\n ON: Use thirdperson transforms unmodified\\n OFF: Use firstperson transforms customized\\n\\nthirdperson transforms may be better for modded items.", + "vivecraft.options.STENCIL_ON.tooltip": "【屏幕黑边】\n开启后在频幕上显示镜片黑边,遮盖头显镜片外视野范围外的区域。\n可以略微增加帧数。", + "vivecraft.options.BCB_ON.tooltip": "通过在地面上显示一个方形的影子来显示你的位置判定。\n-它可是你的好♂兄♂弟\n-啊♂?乖♂乖♂站♂好♂", + "vivecraft.options.WORLD_SCALE.tooltip": "通过调整倍率来放大缩小玩家!\n数值调高会让你从巨人的视角看世界!\n调小来体验《格列佛游记(Gulliver's Travels)》里 小人国 的视角!\n娱乐功能,如果可以的话最好不要调整~", + "vivecraft.options.WORLD_ROTATION.tooltip": "微调所使用头显的旋转值\n如果能够跟某个按键绑定的话会更有用\n可以使用方向键”←“”→“进行调节", + "vivecraft.options.WORLD_ROTATION_INCREMENT.tooltip": "调整人物旋转时旋转的角度。", + "vivecraft.options.TOUCH_HOTBAR.tooltip": "如果启用这个设置,你将可以通过触摸物品栏的方式来选择上面的东西。", + "vivecraft.options.PLAY_MODE_SEATED.tooltip": "站立游玩或就座游玩\n站立游玩可高级多了(笑)", + "vivecraft.options.RENDER_SCALEFACTOR.tooltip": "游戏的渲染倍率,只与头显镜片中的画面有关。\n更高的值将会带来更好的游戏体验,与此同时会吃掉大部分性能导致帧数下降。", + "vivecraft.options.MONO_FOV.tooltip": "调整视野角度(FOV)\n仅影响无形变(undistorted)模式下镜像处理出来显示在桌面上的画面", + "vivecraft.options.REALISTIC_JUMP.tooltip": "如果启用这个设置,当你在现实中起跳的时候,游戏中你的角色也会一起跳起来!\n同时在个人客户端中启用”弹跳靴“", + "vivecraft.options.REALISTIC_SNEAK.tooltip": "如果启用这个设置,当你在现实中弯腰低头(降低身体高度)的时候,游戏中你的角色会进入潜行模式!", + "vivecraft.options.PHYSICAL_GUI.tooltip": "如果启用这项设置,用户图形界面(GUI)将会被可互动的3D模型所取代。\n如果启用了背包追踪(Backpack tracking),把手伸向你的后背将会呼出物品背包。", + "vivecraft.options.REALISTIC_CLIMB.tooltip": "如果打开了该设置项,你就可以用你的双手去攀爬梯子和藤蔓了!\n(当个蜘蛛侠,请~)\n同时也会启用攀爬爪。", + "vivecraft.options.REALISTIC_SWIM.tooltip": "如果打开了这个设置,你就在三次元里体会到划水的乐趣了!\n(被水淹没,不知所措)", + "vivecraft.options.REALISTIC_ROW.tooltip": "如果想锻炼手臂的话可以试试\n*让我们荡起双桨~小船儿开到陆上~\n**也许人会先起飞或者手柄撞到东西上报废吧(笑)", + "vivecraft.options.WALK_MULTIPLIER.tooltip": "倍乘你现实中一步走出去后,在游戏中移动的距离;\n让你可以在不动用移动按键的前提下走得更远一些;\n但是可能会导致晕眩\n【不建议更改】", + "vivecraft.options.FREEMOVE_MODE.tooltip": "自由移动模式下人物移动的方向。\n控制器:副手(默认左手)手柄前端指向的方向【推荐】\n头显:你的VR头显看向的方向\n原地摆臂移动:左右转向(Yaw)取决于你的VR手柄(控制器)是怎么甩的,向上向下(Pitch)则取决于你的头显方向。\n房间:左右转向(Yaw)取决于你的VR游玩空间的正向。向上向下(Pitch)取决于你的头显。这个设置只适合那些无法追踪到背后、或者只有180度追踪/视野的人(比如不想转身的站立模式玩家)", + "vivecraft.options.VEHICLE_ROTATION.tooltip": "在载具(如船和矿车)中,玩家视角会随着载具旋转而旋转。\n别玩太狠了,这个可能会使人失去方向感", + "vivecraft.options.RESET_ORIGIN.tooltip": "把玩家现在的位置校准为游戏区域中心,并将玩家身高设定为1.62m,稍低于正在使用的头显的高度。\n这个设置对于那些就座游玩和使用”不那么精准“的定位系统的玩家来说很有用。", + "vivecraft.options.X_SENSITIVITY.tooltip": "当你把摇杆(左/右)推到底时,视野旋转的速度", + "vivecraft.options.Y_SENSITIVITY.tooltip": "垂直鼠标灵敏度", + "vivecraft.options.KEYHOLE.tooltip": "设定每一次视角旋转时向左/向右旋转的角度大小", + "vivecraft.options.FOV_REDUCTION.tooltip": "在移动时,头衔镜片画面中将出现黑边,限制视野范围。\n可以明显缓解移动时的眩晕感!", + "vivecraft.options.FOV_REDUCTION_MIN.tooltip": "移动时视野范围(FOV)的倍率\n(默认0.25,数值越高,移动时的视野范围越大)", + "vivecraft.options.FOV_REDUCTION_OFFSET.tooltip": "水平补正值\n对于某些不同寻常的VR来说,如果开启了FOV移动缓冲的话,请一定要调整这个\n把移动时仅存的画面调整到看着舒服就行了!", + "vivecraft.options.SEATED_HMD.tooltip": "按下W键后人物移动的方向:\n可设置为跟随头显看向的方向,或指针指向的方向。", + "vivecraft.options.SEATED_HUD_XHAIR.tooltip": "状态栏(HUD)跟随的对象\n选择”头显“时,状态栏将跟随头显视线,始终保持在头显视野内。\n选择”指针“时,状态栏将跟随鼠标控制的指针移动。", + "vivecraft.options.BACKPACK_SWITCH.tooltip": "如果启用这个设置:\n把你的右控制器伸向脑后,即可快速切换出物品栏的第一个物品,或者切换到你上一次切换的格子!\n而用你的左控制器这样做,则可以快速交换你双手所持有的物品!\n【是个好功能,请善用!】", + "vivecraft.options.ANALOG_MOVEMENT.tooltip": "如果VR手柄(控制器)上“与移动绑定的键(自由移动模式下是摇杆)”有“可变行程(可变角度)”的话,将根据对应按键(摇杆)的可变行程(可变角度)来控制行走速度。\n\n为了充分地模拟对于行走的控制,最好使用”移动/扫描(Strafe)“或者”移动/旋转视角(Rotate)“设置", + "vivecraft.options.AUTO_SPRINT.tooltip": "使用自由移动模式时,摇杆角度一旦达到设定的阈值便会自动触发冲刺。\nWhile using freemove, sprint will automatically activate when the axis reaches the configured threshold.", + "vivecraft.options.AUTO_SPRINT_THRESHOLD.tooltip": "设置激活自动冲刺的摇杆角度阈值\n超过即激发\n\nThe axis threshold at which auto-sprint activates.", + "vivecraft.options.BOW_MODE.tooltip": "你可以设置在什么情况下进行射箭的动作识别\n关:从不。(我就是要做按键英雄!)\n原版:仅在使用原版弓(Bow)时使用射箭动作识别;不识别MOD道具。\n开:对所有使用\"弓(BOW)\"的蓄力动作的物品都启用射箭动作识别。\n【请注意该设置最好只用于那些有可交互拉弓、蓄力、射击动作的弓类武器】\n【虽然可以上膛,但弩和枪械(+MOD)没有弓(BOW)那样的蓄力射击动作】", + "vivecraft.options.TELEPORT_DOWN_LIMIT.tooltip": "限制你每次传送能把你送往多低的地方\n以方块(blocks)为单位", + "vivecraft.options.TELEPORT_UP_LIMIT.tooltip": "限制你每次传送能把你送上多高的地方\n以方块(blocks)为单位", + "vivecraft.options.TELEPORT_HORIZ_LIMIT.tooltip": "限制你传送的水平距离\n以方块(blocks)为单位", + "vivecraft.options.ALLOW_STANDING_ORIGIN_OFFSET.tooltip": "允许玩家在”站立游玩模式“下使用”复位“按钮。\n这个选项通常是给那些在站立模式下游玩,却又想坐搬个椅子坐着的玩家。\n(-说到底就是条懒狗……-懒狗怎么了?看不起懒狗啊?)", + "vivecraft.options.SEATED_FREE_MOVE.tooltip": "选择在就座游玩模式中,你想使用的移动方式\n\n传送移动:按下→松开!使用WASD四键中任意一个键即可进行传送移动!键盘上的”←“”→“方向键可以控制人物视角向左向右旋转!\n自由移动:操作方法与JAVA版Minecraft客户端相同。", + "vivecraft.options.FORCE_STANDING_FREE_MOVE.tooltip": "强制使用备用的自由移动模式绑定按键(默认启用按键为左扳机)。\n如果想使用更多的移动选项,请在SteamVR设置中”控制器“栏目的”管理控制器按键设置“中进行编辑。\n\n请注意,启用这项设置将禁用传送模式中绑定的触发按键。", + "vivecraft.options.ALLOW_ADVANCED_BINDINGS.tooltip": "显示可以通过SteamVR绑定的额外按键!\n可用于绑定攀爬、显示键盘和MR混合显示相关功能!\n\n需要重启SteamVR让改动生效。", + "vivecraft.options.MENU_WORLD_SELECTION.tooltip": "选择想要作为主菜单背景显示出来的世界!\n如果系统没有找到任何自订世界的话,会强制使用官方世界。", + "vivecraft.options.HRTF_SELECTION.tooltip": "【HRTF=Head Related Transfer Function (3D Audio)】\n选择你想使用的HRTF配置文件。HRTF技术可以允许你聆听3D空间音效。\n声音质量可能会因为设备和驱动而产生差别。\n关:完全禁用HRTF\n默认:使用默认的HRTF配置文件\n其它:使用某个特殊的HRTF配置文件", + "vivecraft.options.RELOAD_EXTERNAL_CAMERA.tooltip": "读取ExternalCamera.cfg文件并重新载入相机配置", + "vivecraft.options.RIGHT_CLICK_DELAY.tooltip": "按住扳机时,作右键连击判定,此设置更改右键连击之间游戏刻(tick)的数量\n1刻(tick)=1/20秒(sec)", + "vivecraft.options.ANIMAL_TOUCHING.tooltip": "如果开启了这个设置,在你手上未持有武器时,触碰一只被动(passive)的生物(mob)的动作将会判定为鼠标右键(使用物品),而不是鼠标左键(攻击)。\n——妈妈再也不用担心我一巴掌掴死半个农场的动物了(草)", + "vivecraft.options.HANDHELD_CAMERA_FOV.tooltip": "手持摄像机视野", + "vivecraft.options.HANDHELD_CAMERA_RENDER_SCALE.tooltip": "设定手持摄像机的解析度,越大的设置会导致更大的图片大小。\n当光影启用时不可使用。\n§c警告:过高的设置可能会烧坏你的显卡!", + "vivecraft.options.MIXED_REALITY_RENDER_CAMERA_MODEL.tooltip": "显示摄像机的模型(仅在 HMD 视图中)以表示混合现实或第三人称摄像机当前所在的位置。 也可以使用交互绑定来抓取它来移动它。", + "vivecraft.options.PHYSICAL_KEYBOARD_THEME.tooltip": "为物理键盘预设的配色方案。 自定义主题可以通过游戏目录中的keyboardtheme.txt 进行编辑。 每次打开键盘时都会重新加载,以允许实时调整。", + "_comment10": "Option values", + "vivecraft.options.gamma.cantseeshitcaptain": "黑不拉几", + "vivecraft.options.yes": "是", + "vivecraft.options.no": "否", + "vivecraft.options.weaponcollision.auto": "自动", + "vivecraft.options.default": "默认", + "vivecraft.options.opaque": "不透明", + "vivecraft.options.mirrormode.off": "关[帧数+++]", + "vivecraft.options.mirrormode.dual": "双眼[帧数+]", + "vivecraft.options.mirrormode.single": "单眼[帧数++]", + "vivecraft.options.mirrormode.firstperson": "第一人称视角[帧数-]", + "vivecraft.options.mirrormode.thirdperson": "第三人称视角[帧数-]", + "vivecraft.options.mirrormode.mixedreality": "MR混合现实渲染[帧数-]", + "vivecraft.options.mirrormode.cropped": "适应屏幕(裁切)[帧数++]", + "_comment11": "vivecraft.options.mirrormode.gui=2D GUI", + "vivecraft.options.left": "左", + "vivecraft.options.right": "右", + "vivecraft.options.color.black": "黑色", + "vivecraft.options.color.red": "红色", + "vivecraft.options.color.yellow": "黄色", + "vivecraft.options.color.green": "绿色", + "vivecraft.options.color.cyan": "青色", + "vivecraft.options.color.blue": "蓝色", + "vivecraft.options.color.magenta": "品红", + "vivecraft.options.unity": "Unity", + "vivecraft.options.sidebyside": "3rd+1st", + "vivecraft.options.hudlock.hand": "手柄上方", + "vivecraft.options.hudlock.head": "头部", + "vivecraft.options.hudlock.wrist": "手臂(推荐)", + "vivecraft.options.renderpointerelement.always": "总是", + "vivecraft.options.renderpointerelement.withhud": "仅启用状态栏时", + "vivecraft.options.renderpointerelement.never": "从不", + "vivecraft.options.chatnotifications.none": "无", + "vivecraft.options.chatnotifications.haptic": "震动", + "vivecraft.options.chatnotifications.sound": "声音", + "vivecraft.options.chatnotifications.both": "全部", + "vivecraft.options.always": "总是", + "vivecraft.options.seated": "就座", + "vivecraft.options.standing": "站立", + "vivecraft.options.inertiafactor.none": "无", + "vivecraft.options.inertiafactor.normal": "一般", + "vivecraft.options.inertiafactor.large": "很大", + "vivecraft.options.inertiafactor.massive": "更大", + "vivecraft.options.smooth": "平滑", + "vivecraft.options.hmd": "头显", + "vivecraft.options.crosshair": "指针", + "vivecraft.options.freemove.controller": "控制器", + "vivecraft.options.freemove.hmd": "头显", + "vivecraft.options.freemove.runinplace": "原地摆臂移动", + "vivecraft.options.freemove.room": "房间", + "vivecraft.options.hold": "按住", + "vivecraft.options.press": "单击", + "vivecraft.options.keyboard.physical": "物理碰撞键盘", + "vivecraft.options.keyboard.pointer": "指针键盘", + "vivecraft.options.bowmode.vanilla": "原版", + "vivecraft.options.teleportlimit": "%d个方块", + "vivecraft.options.teleport": "传送", + "vivecraft.options.freemove": "自由移动", + "vivecraft.options.menuworld.both": "官方&自订世界", + "vivecraft.options.menuworld.custom": "仅自订世界", + "vivecraft.options.menuworld.official": "仅官方世界", + "vivecraft.options.menuworld.none": "无", + "vivecraft.options.rightclickdelay.vanilla": "原版", + "vivecraft.options.rightclickdelay.slow": "慢", + "vivecraft.options.rightclickdelay.slower": "更慢", + "vivecraft.options.rightclickdelay.slowest": "最慢", + "vivecraft.options.keyboardtheme.default": "白色的", + "vivecraft.options.keyboardtheme.red": "红色", + "vivecraft.options.keyboardtheme.green": "绿色", + "vivecraft.options.keyboardtheme.blue": "蓝色", + "vivecraft.options.keyboardtheme.black": "空白", + "vivecraft.options.keyboardtheme.grass": "草方块", + "vivecraft.options.keyboardtheme.bees": "熊蜂", + "vivecraft.options.keyboardtheme.aesthetic": "§bA§de§bs§dt§bh§de§bt§di§bc", + "vivecraft.options.keyboardtheme.dose": "药品", + "vivecraft.options.keyboardtheme.custom": "风俗", + "_comment12": "Button text", + "vivecraft.gui.ok": "确认", + "vivecraft.gui.clear": "清除", + "vivecraft.gui.loaddefaults": "加载默认设置", + "vivecraft.gui.menuworld.refresh": "刷新主菜单世界背景", + "vivecraft.gui.menuworld.loadnew": "加载新的主菜单世界背景", + "vivecraft.gui.radialmenu.mainset": "默认菜单设置", + "vivecraft.gui.radialmenu.alternateset": "额外菜单设置", + "vivecraft.gui.chat": "聊天栏", + "vivecraft.gui.commands": "快速聊天/指令", + "vivecraft.gui.overlay": "系统信息", + "vivecraft.gui.profiler": "系统性能图", + "vivecraft.gui.screenshot": "截屏", + "vivecraft.gui.calibrateheight": "校准身高", + "vivecraft.gui.alignkatwalk": "校准KAT WALK", + "vivecraft.gui.movethirdpersoncam": "移动第三人称摄像头", + "vivecraft.gui.social": "社交菜单", + "_comment13": "Items", + "vivecraft.item.jumpboots": "弹跳靴", + "vivecraft.item.climbclaws": "攀岩爪", + "vivecraft.item.telescope": "千里眼", + "_comment14": "Messages", + "vivecraft.messages.seatedmode": "切换至就座游玩模式将会关闭VR手柄输入。确定要继续吗?", + "vivecraft.messages.radialmenubind.1": "请确认“打开扇形菜单”的功能已经跟手柄的某个键位绑定。", + "vivecraft.messages.radialmenubind.2": "在扇形菜单打开的时候按住(键盘上的Shift键)来切换到这一套配置。", + "vivecraft.messages.controls.1": "键位绑定由SteamVR输入(Input)来控制。", + "vivecraft.messages.controls.2": "请在SteamVR中的“设置”→“控制器”→“管理控制器按键设置”中进行修改(SteamVR 快捷菜单中也可修改)", + "vivecraft.messages.controls.3": " 必须在SteamVR启动 §o之前 §r§6 运行Steam,§o§6否则键位的绑定和更改不会被保存。", + "vivecraft.messages.serverplugin": "检测到Vivecraft服务器适应插件(MOD)%s", + "vivecraft.messages.noserverplugin": "没有检测到Vivecraft服务器适应插件(MOD),这个服务器也许不支持使用传送移动!已启用有限移动模式!(如果完全无法传送,将切换到备用的自由移动模式!)", + "vivecraft.messages.calibrateheight": "请在按下菜单键呼出的暂停菜单中校准您的身高。", + "vivecraft.messages.rendersetupfailed": "客户端启动/渲染失败(Render setup failed):%s", + "vivecraft.messages.intelgraphics": "不支持Intel核芯显卡!如果你使用的使笔记本电脑,请在设置中强制JAVA程序使用“高性能GPU”!已检测到的GPU有:%s", + "vivecraft.messages.nosteamvr": "未检测到OpenVR. 您安装SteamVR了吗?", + "vivecraft.messages.menuworldexportcomplete.1": "世界文件导出完成!区域大小:%d", + "vivecraft.messages.menuworldexportcomplete.2": "保存至%s", + "vivecraft.messages.menuworldexportclientwarning": "警告!正在使用客户端世界渲染器保存主菜单背景世界!数据可能不完整!我们推荐您将主菜单背景世界保存到单人游戏中。", + "vivecraft.messages.teleportdisabled": "有限移动模式已启用(禁止传送移动)", + "vivecraft.messages.teleportenabled": "有限移动模式已禁用(允许传送移动)", + "vivecraft.messages.walkupblocks": "进入方块(右Ctrl+B):%s", + "vivecraft.messages.showaim": "显示瞄准位置(右Ctrl+右Shift):启用", + "vivecraft.messages.playerinertia": "玩家移动惯性(左CTRL+I):%s", + "vivecraft.messages.movementmodeswitch": "设置移动模式为:%s", + "vivecraft.messages.coords": "X: %.2f Y: %.2f Z: %.2f", + "vivecraft.messages.angles": "俯仰:%.1f 偏航:%.1f 横滚:%.1f", + "vivecraft.messages.heightset": "设置玩家自身身高为%d%%" +} diff --git a/common/src/main/resources/assets/vivecraft/models/bag.json b/common/src/main/resources/assets/vivecraft/models/bag.json index ac5e491b2..5f06c9ca0 100644 --- a/common/src/main/resources/assets/vivecraft/models/bag.json +++ b/common/src/main/resources/assets/vivecraft/models/bag.json @@ -1,671 +1,671 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/bag", - "particle": "vivecraft:blocks/bag" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/bag", + "particle": "vivecraft:blocks/bag" + }, + "elements": [ + { + "name": "cube", + "from": [3.5, 0.5, 2.5], + "to": [12.5, 7.5, 3.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 0.5, 12.5], + "to": [12.5, 7.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 0.5, 3.5], + "to": [3.5, 7.5, 12.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [3, 4, 8] + }, + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 0.5, 3.5], + "to": [13.5, 7.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, -0.5, 3.5], + "to": [12.5, 0.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 4.5], + "to": [12.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 4.5], + "to": [4.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 3.5], + "to": [11.5, 10.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 11.5], + "to": [11.5, 10.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 3.5], + "to": [4.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 3.5], + "to": [12.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 11.5], + "to": [12.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 11.5], + "to": [4.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 2.5], + "to": [11.5, 11.5, 3.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 12.5], + "to": [11.5, 11.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 9.5, 4.5], + "to": [13.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 9.5, 4.5], + "to": [3.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 9.5, 3.5], + "to": [12.5, 11.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 9.5, 11.5], + "to": [12.5, 11.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } }, - "elements": [ - { - "name": "cube", - "from": [3.5, 0.5, 2.5], - "to": [12.5, 7.5, 3.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 0.5, 12.5], - "to": [12.5, 7.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 0.5, 3.5], - "to": [3.5, 7.5, 12.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [3, 4, 8] - }, - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 0.5, 3.5], - "to": [13.5, 7.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, -0.5, 3.5], - "to": [12.5, 0.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 4.5], - "to": [12.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 4.5], - "to": [4.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 3.5], - "to": [11.5, 10.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 11.5], - "to": [11.5, 10.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 3.5], - "to": [4.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 3.5], - "to": [12.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 11.5], - "to": [12.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 11.5], - "to": [4.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 2.5], - "to": [11.5, 11.5, 3.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 12.5], - "to": [11.5, 11.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 9.5, 4.5], - "to": [13.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 9.5, 4.5], - "to": [3.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 9.5, 3.5], - "to": [12.5, 11.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 9.5, 11.5], - "to": [12.5, 11.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 9.5, 11.5], - "to": [4.5, 11.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 9.5, 3.5], - "to": [4.5, 11.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } + { + "name": "cube", + "from": [3.5, 9.5, 11.5], + "to": [4.5, 11.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } - ], - "display": { - "thirdperson_righthand": { - "translation": [-4.5, 5.5, -2.5], - "rotation": [88, 0, 0] + } + }, + { + "name": "cube", + "from": [3.5, 9.5, 3.5], + "to": [4.5, 11.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [-4.5, 5.5, -2.5], + "rotation": [88, 0, 0] } + } } diff --git a/common/src/main/resources/assets/vivecraft/models/bag_closed.json b/common/src/main/resources/assets/vivecraft/models/bag_closed.json index f51eec561..07cf1fc51 100644 --- a/common/src/main/resources/assets/vivecraft/models/bag_closed.json +++ b/common/src/main/resources/assets/vivecraft/models/bag_closed.json @@ -1,789 +1,789 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/bag", - "particle": "vivecraft:blocks/bag" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/bag", + "particle": "vivecraft:blocks/bag" + }, + "elements": [ + { + "name": "cube", + "from": [3.5, 0.5, 12.5], + "to": [12.5, 7.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 0.5, 3.5], + "to": [3.5, 7.5, 12.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [3, 4, 8] + }, + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 0.5, 3.5], + "to": [13.5, 7.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, -0.5, 3.5], + "to": [12.5, 0.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 9], + "texture": "#0" + } + } }, - "elements": [ - { - "name": "cube", - "from": [3.5, 0.5, 12.5], - "to": [12.5, 7.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 0.5, 3.5], - "to": [3.5, 7.5, 12.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [3, 4, 8] - }, - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 0.5, 3.5], - "to": [13.5, 7.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, -0.5, 3.5], - "to": [12.5, 0.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 4.5], - "to": [12.5, 9.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 3.5], - "to": [12.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [10.5, 9.5, 5.5], - "to": [11.5, 11.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 5], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 5], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [10.5, 8.5, 4.5], - "to": [11.5, 10.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 11.5], - "to": [12.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [3.5, 0.5, 2.5], - "to": [12.5, 7.5, 3.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [8, 4, 3] - }, - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 11.5], - "to": [11.5, 9.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 9.5, 10.5], - "to": [10.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 5, 2], - "texture": "#0", - "rotation": 90 - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0", - "rotation": 180 - }, - "south": { - "uv": [0, 0, 5, 2], - "texture": "#0", - "rotation": 180 - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0", - "rotation": 90 - }, - "up": { - "uv": [0, 0, 5, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 5, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [10.5, 8.5, 10.5], - "to": [11.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 11.5, 5.5], - "to": [10.5, 12.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 4, 4], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 4, 4], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 13.5, 5.5], - "to": [10.5, 14.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 4, 4], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 4, 4], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [6.5, 12.5, 6.5], - "to": [9.5, 13.5, 9.5], - "faces": { - "north": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 2, 2], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 2, 2], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 4.5], - "to": [4.5, 9.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 5.5], - "to": [5.5, 11.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 5], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 5], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 11.5], - "to": [4.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [4.5, 8.5, 10.5], - "to": [5.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 3.5], - "to": [4.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 3.5], - "to": [11.5, 9.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [5.5, 9.5, 4.5], - "to": [10.5, 11.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 5, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 5, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [4.5, 8.5, 4.5], - "to": [5.5, 10.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 90 - } - } + { + "name": "cube", + "from": [11.5, 7.5, 4.5], + "to": [12.5, 9.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" } - ], - "display": { - "thirdperson_righthand": { - "translation": [-4.5, 5.5, -2.5], - "rotation": [88, 0, 0] + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 3.5], + "to": [12.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } + } + }, + { + "name": "cube", + "from": [10.5, 9.5, 5.5], + "to": [11.5, 11.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 5], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 5], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [10.5, 8.5, 4.5], + "to": [11.5, 10.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 11.5], + "to": [12.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [3.5, 0.5, 2.5], + "to": [12.5, 7.5, 3.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [8, 4, 3] + }, + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 11.5], + "to": [11.5, 9.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 9.5, 10.5], + "to": [10.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 5, 2], + "texture": "#0", + "rotation": 90 + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0", + "rotation": 180 + }, + "south": { + "uv": [0, 0, 5, 2], + "texture": "#0", + "rotation": 180 + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0", + "rotation": 90 + }, + "up": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [10.5, 8.5, 10.5], + "to": [11.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 11.5, 5.5], + "to": [10.5, 12.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 4], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 13.5, 5.5], + "to": [10.5, 14.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 4], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [6.5, 12.5, 6.5], + "to": [9.5, 13.5, 9.5], + "faces": { + "north": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 2, 2], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 2, 2], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 4.5], + "to": [4.5, 9.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 5.5], + "to": [5.5, 11.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 5], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 5], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 11.5], + "to": [4.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [4.5, 8.5, 10.5], + "to": [5.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 3.5], + "to": [4.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 3.5], + "to": [11.5, 9.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [5.5, 9.5, 4.5], + "to": [10.5, 11.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [4.5, 8.5, 4.5], + "to": [5.5, 10.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 90 + } + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [-4.5, 5.5, -2.5], + "rotation": [88, 0, 0] } + } } diff --git a/common/src/main/resources/assets/vivecraft/models/bag_gold.json b/common/src/main/resources/assets/vivecraft/models/bag_gold.json index a1aa157a0..450dae30e 100644 --- a/common/src/main/resources/assets/vivecraft/models/bag_gold.json +++ b/common/src/main/resources/assets/vivecraft/models/bag_gold.json @@ -1,671 +1,671 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/bag_gold", - "particle": "vivecraft:blocks/bag_gold" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/bag_gold", + "particle": "vivecraft:blocks/bag_gold" + }, + "elements": [ + { + "name": "cube", + "from": [3.5, 0.5, 2.5], + "to": [12.5, 7.5, 3.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 0.5, 12.5], + "to": [12.5, 7.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 0.5, 3.5], + "to": [3.5, 7.5, 12.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [3, 4, 8] + }, + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 0.5, 3.5], + "to": [13.5, 7.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, -0.5, 3.5], + "to": [12.5, 0.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 4.5], + "to": [12.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 4.5], + "to": [4.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 3.5], + "to": [11.5, 10.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 11.5], + "to": [11.5, 10.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 3], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 3], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 3.5], + "to": [4.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 3.5], + "to": [12.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 11.5], + "to": [12.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 11.5], + "to": [4.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 2.5], + "to": [11.5, 11.5, 3.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 12.5], + "to": [11.5, 11.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 9.5, 4.5], + "to": [13.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 9.5, 4.5], + "to": [3.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 9.5, 3.5], + "to": [12.5, 11.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 9.5, 11.5], + "to": [12.5, 11.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } }, - "elements": [ - { - "name": "cube", - "from": [3.5, 0.5, 2.5], - "to": [12.5, 7.5, 3.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 0.5, 12.5], - "to": [12.5, 7.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 0.5, 3.5], - "to": [3.5, 7.5, 12.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [3, 4, 8] - }, - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 0.5, 3.5], - "to": [13.5, 7.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, -0.5, 3.5], - "to": [12.5, 0.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 4.5], - "to": [12.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 4.5], - "to": [4.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 3.5], - "to": [11.5, 10.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 11.5], - "to": [11.5, 10.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 3], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 3], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 3.5], - "to": [4.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 3.5], - "to": [12.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 11.5], - "to": [12.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 11.5], - "to": [4.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 2.5], - "to": [11.5, 11.5, 3.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 12.5], - "to": [11.5, 11.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 9.5, 4.5], - "to": [13.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 9.5, 4.5], - "to": [3.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 9.5, 3.5], - "to": [12.5, 11.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 9.5, 11.5], - "to": [12.5, 11.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 9.5, 11.5], - "to": [4.5, 11.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, 9.5, 3.5], - "to": [4.5, 11.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } + { + "name": "cube", + "from": [3.5, 9.5, 11.5], + "to": [4.5, 11.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } - ], - "display": { - "thirdperson_righthand": { - "translation": [-4.5, 5.5, -2.5], - "rotation": [88, 0, 0] + } + }, + { + "name": "cube", + "from": [3.5, 9.5, 3.5], + "to": [4.5, 11.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [-4.5, 5.5, -2.5], + "rotation": [88, 0, 0] } + } } diff --git a/common/src/main/resources/assets/vivecraft/models/bag_gold_closed.json b/common/src/main/resources/assets/vivecraft/models/bag_gold_closed.json index f3ab4a6f1..f6ff0ee9b 100644 --- a/common/src/main/resources/assets/vivecraft/models/bag_gold_closed.json +++ b/common/src/main/resources/assets/vivecraft/models/bag_gold_closed.json @@ -1,789 +1,789 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/bag_gold", - "particle": "vivecraft:blocks/bag_gold" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/bag_gold", + "particle": "vivecraft:blocks/bag_gold" + }, + "elements": [ + { + "name": "cube", + "from": [3.5, 0.5, 12.5], + "to": [12.5, 7.5, 13.5], + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [2.5, 0.5, 3.5], + "to": [3.5, 7.5, 12.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [3, 4, 8] + }, + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [12.5, 0.5, 3.5], + "to": [13.5, 7.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 9], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [3.5, -0.5, 3.5], + "to": [12.5, 0.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 9], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 9], + "texture": "#0" + } + } }, - "elements": [ - { - "name": "cube", - "from": [3.5, 0.5, 12.5], - "to": [12.5, 7.5, 13.5], - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [2.5, 0.5, 3.5], - "to": [3.5, 7.5, 12.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [3, 4, 8] - }, - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [12.5, 0.5, 3.5], - "to": [13.5, 7.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [3.5, -0.5, 3.5], - "to": [12.5, 0.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 9], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 9], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 4.5], - "to": [12.5, 9.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 3.5], - "to": [12.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [10.5, 9.5, 5.5], - "to": [11.5, 11.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 5], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 5], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [10.5, 8.5, 4.5], - "to": [11.5, 10.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [11.5, 7.5, 11.5], - "to": [12.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [3.5, 0.5, 2.5], - "to": [12.5, 7.5, 3.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [8, 4, 3] - }, - "faces": { - "north": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 9, 7], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 9, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 9, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 11.5], - "to": [11.5, 9.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 9.5, 10.5], - "to": [10.5, 11.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 5, 2], - "texture": "#0", - "rotation": 90 - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0", - "rotation": 180 - }, - "south": { - "uv": [0, 0, 5, 2], - "texture": "#0", - "rotation": 180 - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0", - "rotation": 90 - }, - "up": { - "uv": [0, 0, 5, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 5, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [10.5, 8.5, 10.5], - "to": [11.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 11.5, 5.5], - "to": [10.5, 12.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 4, 4], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 4, 4], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [5.5, 13.5, 5.5], - "to": [10.5, 14.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 4, 4], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 4, 4], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [6.5, 12.5, 6.5], - "to": [9.5, 13.5, 9.5], - "faces": { - "north": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 2, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 2, 2], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 2, 2], - "texture": "#0", - "rotation": 270 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 4.5], - "to": [4.5, 9.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 7], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [4.5, 9.5, 5.5], - "to": [5.5, 11.5, 10.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 5], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 5], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 11.5], - "to": [4.5, 8.5, 12.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [4.5, 8.5, 10.5], - "to": [5.5, 10.5, 11.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [3.5, 7.5, 3.5], - "to": [4.5, 8.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [4.5, 7.5, 3.5], - "to": [11.5, 9.5, 4.5], - "faces": { - "north": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 7, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 7, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 7, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [5.5, 9.5, 4.5], - "to": [10.5, 11.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 5, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 5, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 5, 1], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [4.5, 8.5, 4.5], - "to": [5.5, 10.5, 5.5], - "faces": { - "north": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 1, 2], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 1, 1], - "texture": "#0" - }, - "down": { - "uv": [0, 0, 1, 1], - "texture": "#0", - "rotation": 90 - } - } + { + "name": "cube", + "from": [11.5, 7.5, 4.5], + "to": [12.5, 9.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0" } - ], - "display": { - "thirdperson_righthand": { - "translation": [-4.5, 5.5, -2.5], - "rotation": [88, 0, 0] + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 3.5], + "to": [12.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" } + } + }, + { + "name": "cube", + "from": [10.5, 9.5, 5.5], + "to": [11.5, 11.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 5], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 5], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [10.5, 8.5, 4.5], + "to": [11.5, 10.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [11.5, 7.5, 11.5], + "to": [12.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [3.5, 0.5, 2.5], + "to": [12.5, 7.5, 3.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [8, 4, 3] + }, + "faces": { + "north": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 9, 7], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 9, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 9, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 11.5], + "to": [11.5, 9.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 9.5, 10.5], + "to": [10.5, 11.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 5, 2], + "texture": "#0", + "rotation": 90 + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0", + "rotation": 180 + }, + "south": { + "uv": [0, 0, 5, 2], + "texture": "#0", + "rotation": 180 + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0", + "rotation": 90 + }, + "up": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [10.5, 8.5, 10.5], + "to": [11.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 11.5, 5.5], + "to": [10.5, 12.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 4], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [5.5, 13.5, 5.5], + "to": [10.5, 14.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4, 4], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 4, 4], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [6.5, 12.5, 6.5], + "to": [9.5, 13.5, 9.5], + "faces": { + "north": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 2, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 2, 2], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 2, 2], + "texture": "#0", + "rotation": 270 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 4.5], + "to": [4.5, 9.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 7], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [4.5, 9.5, 5.5], + "to": [5.5, 11.5, 10.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 5], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 5], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 11.5], + "to": [4.5, 8.5, 12.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [4.5, 8.5, 10.5], + "to": [5.5, 10.5, 11.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [3.5, 7.5, 3.5], + "to": [4.5, 8.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [4.5, 7.5, 3.5], + "to": [11.5, 9.5, 4.5], + "faces": { + "north": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 7, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 7, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 7, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [5.5, 9.5, 4.5], + "to": [10.5, 11.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 5, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 5, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 5, 1], + "texture": "#0", + "rotation": 90 + } + } + }, + { + "name": "cube", + "from": [4.5, 8.5, 4.5], + "to": [5.5, 10.5, 5.5], + "faces": { + "north": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 1, 2], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 1, 1], + "texture": "#0" + }, + "down": { + "uv": [0, 0, 1, 1], + "texture": "#0", + "rotation": 90 + } + } + } + ], + "display": { + "thirdperson_righthand": { + "translation": [-4.5, 5.5, -2.5], + "rotation": [88, 0, 0] } + } } diff --git a/common/src/main/resources/assets/vivecraft/models/camcorder.json b/common/src/main/resources/assets/vivecraft/models/camcorder.json index d6563d97f..133f64193 100644 --- a/common/src/main/resources/assets/vivecraft/models/camcorder.json +++ b/common/src/main/resources/assets/vivecraft/models/camcorder.json @@ -1,521 +1,521 @@ { - "credit": "Made with Blockbench", - "texture_size": [64, 64], - "textures": { - "0": "vivecraft:blocks/camcorder", - "particle": "vivecraft:blocks/camcorder" + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "0": "vivecraft:blocks/camcorder", + "particle": "vivecraft:blocks/camcorder" + }, + "elements": [ + { + "from": [10, 5.2, 1], + "to": [10.8, 8.8, 2.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [18, 13, 0.5] + }, + "faces": { + "north": { + "uv": [2.25, 0.25, 2.25, 1], + "texture": "#0" + }, + "east": { + "uv": [2, 0.25, 2.25, 1], + "texture": "#0" + }, + "south": { + "uv": [2.25, 0.25, 2.375, 1], + "texture": "#0" + }, + "west": { + "uv": [2.25, 0.25, 2.5, 1], + "texture": "#0" + }, + "up": { + "uv": [2.25, 0.25, 2.25, 0], + "texture": "#0" + }, + "down": { + "uv": [2.25, 0, 2.25, 0.25], + "texture": "#0" + } + } + }, + { + "from": [10, 5, 3], + "to": [14, 9, 13], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 13, 12] + }, + "faces": { + "north": { + "uv": [2.5, 2.5, 3.5, 3.5], + "texture": "#0" + }, + "east": { + "uv": [0, 2.5, 2.5, 3.5], + "texture": "#0" + }, + "south": { + "uv": [6, 2.5, 7, 3.5], + "texture": "#0" + }, + "west": { + "uv": [3.5, 2.5, 6, 3.5], + "texture": "#0" + }, + "up": { + "uv": [3.5, 2.5, 2.5, 0], + "texture": "#0" + }, + "down": { + "uv": [4.5, 0, 3.5, 2.5], + "texture": "#0" + } + } + }, + { + "from": [11, 9, 12], + "to": [13, 11, 15], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 18, 12] + }, + "faces": { + "north": { + "uv": [6, 6.5, 6.5, 7], + "texture": "#0" + }, + "east": { + "uv": [3.75, 6.5, 4.5, 7], + "texture": "#0" + }, + "south": { + "uv": [8.75, 6.5, 9.25, 7], + "texture": "#0" + }, + "west": { + "uv": [8, 6.5, 8.75, 7], + "texture": "#0" + }, + "up": { + "uv": [6.5, 5, 6, 4.25], + "texture": "#0" + }, + "down": { + "uv": [7, 4.25, 6.5, 5], + "texture": "#0" + } + } + }, + { + "from": [11, 10, 7.5], + "to": [13, 11, 12], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 18, 12] + }, + "faces": { + "east": { + "uv": [4.5, 6.5, 5.625, 6.75], + "texture": "#0" + }, + "west": { + "uv": [6.875, 6.5, 8, 6.75], + "texture": "#0" + }, + "up": { + "uv": [6.5, 6.125, 6, 5], + "texture": "#0" + }, + "down": { + "uv": [7, 5, 6.5, 6.125], + "texture": "#0" + } + } + }, + { + "from": [11, 9, 6], + "to": [13, 11, 7.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 18, 12] + }, + "faces": { + "north": { + "uv": [6, 6.5, 6.5, 7], + "texture": "#0" + }, + "east": { + "uv": [5.625, 6.5, 6, 7], + "texture": "#0" + }, + "south": { + "uv": [6, 6.5, 6.5, 7], + "texture": "#0" + }, + "west": { + "uv": [6.5, 6.5, 6.875, 7], + "texture": "#0" + }, + "up": { + "uv": [6.5, 6.5, 6, 6.125], + "texture": "#0" + } + } + }, + { + "from": [12, 11, 7.7], + "to": [12, 13, 16.8], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21.9, 20, 13.8] + }, + "faces": { + "north": { + "uv": [5.75, 3.5, 5.75, 4], + "texture": "#0" + }, + "east": { + "uv": [3.5, 3.5, 5.75, 4], + "texture": "#0" + }, + "south": { + "uv": [8, 3.5, 8, 4], + "texture": "#0" + }, + "west": { + "uv": [5.75, 3.5, 8, 4], + "texture": "#0" + }, + "up": { + "uv": [5.75, 3.5, 5.75, 1.25], + "texture": "#0" + }, + "down": { + "uv": [5.75, 1.25, 5.75, 3.5], + "texture": "#0" + } + } + }, + { + "from": [10.75, 12, 0.2], + "to": [13.25, 14.5, 10.2], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21.1, 21, 13.2] + }, + "faces": { + "north": { + "uv": [2.5, 6, 3, 6.5], + "texture": "#0" + }, + "east": { + "uv": [0, 6, 2.5, 6.5], + "texture": "#0" + }, + "south": { + "uv": [5.5, 6, 6, 6.5], + "texture": "#0" + }, + "west": { + "uv": [3, 6, 5.5, 6.5], + "texture": "#0" + }, + "up": { + "uv": [3, 6, 2.5, 3.5], + "texture": "#0" + }, + "down": { + "uv": [3.5, 3.5, 3, 6], + "texture": "#0" + } + } + }, + { + "from": [-0.3, 9.5, 6], + "to": [9.7, 10, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [16.7, 13, 12] + }, + "faces": { + "north": { + "uv": [4.75, 0.25, 7.25, 0.375], + "texture": "#0" + }, + "east": { + "uv": [4.5, 0.25, 4.75, 0.375], + "texture": "#0" + }, + "south": { + "uv": [7.5, 0.25, 10, 0.375], + "texture": "#0" + }, + "west": { + "uv": [7.25, 0.25, 7.5, 0.375], + "texture": "#0" + }, + "up": { + "uv": [7.25, 0.25, 4.75, 0], + "texture": "#0" + } + } + }, + { + "from": [-0.3, 4, 6], + "to": [9.7, 4.5, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [16.7, 13, 12] + }, + "faces": { + "north": { + "uv": [4.75, 1.625, 7.25, 1.75], + "texture": "#0" + }, + "east": { + "uv": [4.5, 1.625, 4.75, 1.75], + "texture": "#0" + }, + "south": { + "uv": [7.5, 1.625, 10, 1.75], + "texture": "#0" + }, + "west": { + "uv": [7.25, 1.625, 7.5, 1.75], + "texture": "#0" + }, + "down": { + "uv": [9.75, 0, 7.25, 0.25], + "texture": "#0" + } + } + }, + { + "from": [9.2, 4.5, 6], + "to": [9.7, 9.5, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [16.7, 13, 12] + }, + "faces": { + "north": { + "uv": [4.75, 0.375, 4.875, 1.625], + "texture": "#0" + }, + "east": { + "uv": [7.25, 0.375, 7.5, 1.625], + "texture": "#0" + }, + "south": { + "uv": [7.5, 0.375, 7.625, 1.625], + "texture": "#0" + } + } + }, + { + "from": [-0.3, 4.5, 6], + "to": [0.2, 9.5, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [16.7, 13, 12] + }, + "faces": { + "north": { + "uv": [7.125, 0.25, 7.25, 1.75], + "texture": "#0" + }, + "south": { + "uv": [9.875, 0.25, 10, 1.75], + "texture": "#0" + }, + "west": { + "uv": [7.25, 0.375, 7.5, 1.625], + "texture": "#0" + } + } }, - "elements": [ - { - "from": [10, 5.2, 1], - "to": [10.8, 8.8, 2.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [18, 13, 0.5] - }, - "faces": { - "north": { - "uv": [2.25, 0.25, 2.25, 1], - "texture": "#0" - }, - "east": { - "uv": [2, 0.25, 2.25, 1], - "texture": "#0" - }, - "south": { - "uv": [2.25, 0.25, 2.375, 1], - "texture": "#0" - }, - "west": { - "uv": [2.25, 0.25, 2.5, 1], - "texture": "#0" - }, - "up": { - "uv": [2.25, 0.25, 2.25, 0], - "texture": "#0" - }, - "down": { - "uv": [2.25, 0, 2.25, 0.25], - "texture": "#0" - } - } - }, - { - "from": [10, 5, 3], - "to": [14, 9, 13], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 13, 12] - }, - "faces": { - "north": { - "uv": [2.5, 2.5, 3.5, 3.5], - "texture": "#0" - }, - "east": { - "uv": [0, 2.5, 2.5, 3.5], - "texture": "#0" - }, - "south": { - "uv": [6, 2.5, 7, 3.5], - "texture": "#0" - }, - "west": { - "uv": [3.5, 2.5, 6, 3.5], - "texture": "#0" - }, - "up": { - "uv": [3.5, 2.5, 2.5, 0], - "texture": "#0" - }, - "down": { - "uv": [4.5, 0, 3.5, 2.5], - "texture": "#0" - } - } - }, - { - "from": [11, 9, 12], - "to": [13, 11, 15], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 18, 12] - }, - "faces": { - "north": { - "uv": [6, 6.5, 6.5, 7], - "texture": "#0" - }, - "east": { - "uv": [3.75, 6.5, 4.5, 7], - "texture": "#0" - }, - "south": { - "uv": [8.75, 6.5, 9.25, 7], - "texture": "#0" - }, - "west": { - "uv": [8, 6.5, 8.75, 7], - "texture": "#0" - }, - "up": { - "uv": [6.5, 5, 6, 4.25], - "texture": "#0" - }, - "down": { - "uv": [7, 4.25, 6.5, 5], - "texture": "#0" - } - } - }, - { - "from": [11, 10, 7.5], - "to": [13, 11, 12], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 18, 12] - }, - "faces": { - "east": { - "uv": [4.5, 6.5, 5.625, 6.75], - "texture": "#0" - }, - "west": { - "uv": [6.875, 6.5, 8, 6.75], - "texture": "#0" - }, - "up": { - "uv": [6.5, 6.125, 6, 5], - "texture": "#0" - }, - "down": { - "uv": [7, 5, 6.5, 6.125], - "texture": "#0" - } - } - }, - { - "from": [11, 9, 6], - "to": [13, 11, 7.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 18, 12] - }, - "faces": { - "north": { - "uv": [6, 6.5, 6.5, 7], - "texture": "#0" - }, - "east": { - "uv": [5.625, 6.5, 6, 7], - "texture": "#0" - }, - "south": { - "uv": [6, 6.5, 6.5, 7], - "texture": "#0" - }, - "west": { - "uv": [6.5, 6.5, 6.875, 7], - "texture": "#0" - }, - "up": { - "uv": [6.5, 6.5, 6, 6.125], - "texture": "#0" - } - } - }, - { - "from": [12, 11, 7.7], - "to": [12, 13, 16.8], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21.9, 20, 13.8] - }, - "faces": { - "north": { - "uv": [5.75, 3.5, 5.75, 4], - "texture": "#0" - }, - "east": { - "uv": [3.5, 3.5, 5.75, 4], - "texture": "#0" - }, - "south": { - "uv": [8, 3.5, 8, 4], - "texture": "#0" - }, - "west": { - "uv": [5.75, 3.5, 8, 4], - "texture": "#0" - }, - "up": { - "uv": [5.75, 3.5, 5.75, 1.25], - "texture": "#0" - }, - "down": { - "uv": [5.75, 1.25, 5.75, 3.5], - "texture": "#0" - } - } - }, - { - "from": [10.75, 12, 0.2], - "to": [13.25, 14.5, 10.2], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21.1, 21, 13.2] - }, - "faces": { - "north": { - "uv": [2.5, 6, 3, 6.5], - "texture": "#0" - }, - "east": { - "uv": [0, 6, 2.5, 6.5], - "texture": "#0" - }, - "south": { - "uv": [5.5, 6, 6, 6.5], - "texture": "#0" - }, - "west": { - "uv": [3, 6, 5.5, 6.5], - "texture": "#0" - }, - "up": { - "uv": [3, 6, 2.5, 3.5], - "texture": "#0" - }, - "down": { - "uv": [3.5, 3.5, 3, 6], - "texture": "#0" - } - } - }, - { - "from": [-0.3, 9.5, 6], - "to": [9.7, 10, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [16.7, 13, 12] - }, - "faces": { - "north": { - "uv": [4.75, 0.25, 7.25, 0.375], - "texture": "#0" - }, - "east": { - "uv": [4.5, 0.25, 4.75, 0.375], - "texture": "#0" - }, - "south": { - "uv": [7.5, 0.25, 10, 0.375], - "texture": "#0" - }, - "west": { - "uv": [7.25, 0.25, 7.5, 0.375], - "texture": "#0" - }, - "up": { - "uv": [7.25, 0.25, 4.75, 0], - "texture": "#0" - } - } - }, - { - "from": [-0.3, 4, 6], - "to": [9.7, 4.5, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [16.7, 13, 12] - }, - "faces": { - "north": { - "uv": [4.75, 1.625, 7.25, 1.75], - "texture": "#0" - }, - "east": { - "uv": [4.5, 1.625, 4.75, 1.75], - "texture": "#0" - }, - "south": { - "uv": [7.5, 1.625, 10, 1.75], - "texture": "#0" - }, - "west": { - "uv": [7.25, 1.625, 7.5, 1.75], - "texture": "#0" - }, - "down": { - "uv": [9.75, 0, 7.25, 0.25], - "texture": "#0" - } - } - }, - { - "from": [9.2, 4.5, 6], - "to": [9.7, 9.5, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [16.7, 13, 12] - }, - "faces": { - "north": { - "uv": [4.75, 0.375, 4.875, 1.625], - "texture": "#0" - }, - "east": { - "uv": [7.25, 0.375, 7.5, 1.625], - "texture": "#0" - }, - "south": { - "uv": [7.5, 0.375, 7.625, 1.625], - "texture": "#0" - } - } - }, - { - "from": [-0.3, 4.5, 6], - "to": [0.2, 9.5, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [16.7, 13, 12] - }, - "faces": { - "north": { - "uv": [7.125, 0.25, 7.25, 1.75], - "texture": "#0" - }, - "south": { - "uv": [9.875, 0.25, 10, 1.75], - "texture": "#0" - }, - "west": { - "uv": [7.25, 0.375, 7.5, 1.625], - "texture": "#0" - } - } - }, - { - "from": [9.7, 5.5, 6], - "to": [10, 8.5, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [17, 13.5, 12] - }, - "faces": { - "north": { - "uv": [2, 1, 2, 1.75], - "texture": "#0" - }, - "south": { - "uv": [2.25, 1, 2.25, 1.75], - "texture": "#0" - }, - "up": { - "uv": [2, 1, 2, 0.75], - "texture": "#0" - }, - "down": { - "uv": [2, 0.75, 2, 1], - "texture": "#0" - } - } - }, - { - "from": [10.4, 5.35, 1.5], - "to": [13.6, 8.65, 3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 13, 2] - }, - "faces": { - "north": { - "uv": [0.25, 0.25, 1, 1], - "texture": "#0" - }, - "east": { - "uv": [0, 0.25, 0.25, 1], - "texture": "#0" - }, - "west": { - "uv": [1, 0.25, 1.25, 1], - "texture": "#0" - }, - "up": { - "uv": [1, 0.25, 0.25, 0], - "texture": "#0" - }, - "down": { - "uv": [1.75, 0, 1, 0.25], - "texture": "#0" - } - } - }, - { - "from": [10.8, 8.2, 1], - "to": [13.2, 8.8, 2.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 13, 0.5] - }, - "faces": { - "north": { - "uv": [0.25, 1.5, 0.75, 1.5], - "texture": "#0" - }, - "east": { - "uv": [0, 1.5, 0.25, 1.5], - "texture": "#0" - }, - "south": { - "uv": [1, 1.5, 1.5, 1.5], - "texture": "#0" - }, - "west": { - "uv": [0.75, 1.5, 1, 1.5], - "texture": "#0" - }, - "up": { - "uv": [0.75, 1.5, 0.25, 1.25], - "texture": "#0" - }, - "down": { - "uv": [1.25, 1.25, 0.75, 1.5], - "texture": "#0" - } - } - }, - { - "from": [10.8, 5.2, 1], - "to": [13.2, 5.8, 2.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 10, 0.5] - }, - "faces": { - "north": { - "uv": [0.25, 1.25, 1, 1.375], - "texture": "#0" - }, - "east": { - "uv": [0, 1.25, 0.25, 1.25], - "texture": "#0" - }, - "south": { - "uv": [1.25, 1.25, 2, 1.25], - "texture": "#0" - }, - "west": { - "uv": [1, 1.25, 1.25, 1.25], - "texture": "#0" - }, - "up": { - "uv": [1, 1.25, 0.25, 1], - "texture": "#0" - }, - "down": { - "uv": [1.75, 1, 1, 1.25], - "texture": "#0" - } - } - }, - { - "from": [13.2, 5.2, 1], - "to": [14, 8.8, 2.5], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [21, 13, 0.5] - }, - "faces": { - "north": { - "uv": [1.75, 1.75, 1.875, 2.5], - "texture": "#0" - }, - "east": { - "uv": [1.5, 1.75, 1.75, 2.5], - "texture": "#0" - }, - "south": { - "uv": [2, 1.75, 2, 2.5], - "texture": "#0" - }, - "west": { - "uv": [1.75, 1.75, 2, 2.5], - "texture": "#0" - }, - "up": { - "uv": [1.75, 1.75, 1.75, 1.5], - "texture": "#0" - }, - "down": { - "uv": [1.75, 1.5, 1.75, 1.75], - "texture": "#0" - } - } + { + "from": [9.7, 5.5, 6], + "to": [10, 8.5, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [17, 13.5, 12] + }, + "faces": { + "north": { + "uv": [2, 1, 2, 1.75], + "texture": "#0" + }, + "south": { + "uv": [2.25, 1, 2.25, 1.75], + "texture": "#0" + }, + "up": { + "uv": [2, 1, 2, 0.75], + "texture": "#0" + }, + "down": { + "uv": [2, 0.75, 2, 1], + "texture": "#0" } - ], - "groups": [ - { - "name": "group", - "origin": [21, 13, 12], - "children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + } + }, + { + "from": [10.4, 5.35, 1.5], + "to": [13.6, 8.65, 3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 13, 2] + }, + "faces": { + "north": { + "uv": [0.25, 0.25, 1, 1], + "texture": "#0" + }, + "east": { + "uv": [0, 0.25, 0.25, 1], + "texture": "#0" + }, + "west": { + "uv": [1, 0.25, 1.25, 1], + "texture": "#0" + }, + "up": { + "uv": [1, 0.25, 0.25, 0], + "texture": "#0" + }, + "down": { + "uv": [1.75, 0, 1, 0.25], + "texture": "#0" + } + } + }, + { + "from": [10.8, 8.2, 1], + "to": [13.2, 8.8, 2.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 13, 0.5] + }, + "faces": { + "north": { + "uv": [0.25, 1.5, 0.75, 1.5], + "texture": "#0" + }, + "east": { + "uv": [0, 1.5, 0.25, 1.5], + "texture": "#0" + }, + "south": { + "uv": [1, 1.5, 1.5, 1.5], + "texture": "#0" + }, + "west": { + "uv": [0.75, 1.5, 1, 1.5], + "texture": "#0" + }, + "up": { + "uv": [0.75, 1.5, 0.25, 1.25], + "texture": "#0" + }, + "down": { + "uv": [1.25, 1.25, 0.75, 1.5], + "texture": "#0" + } + } + }, + { + "from": [10.8, 5.2, 1], + "to": [13.2, 5.8, 2.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 10, 0.5] + }, + "faces": { + "north": { + "uv": [0.25, 1.25, 1, 1.375], + "texture": "#0" + }, + "east": { + "uv": [0, 1.25, 0.25, 1.25], + "texture": "#0" + }, + "south": { + "uv": [1.25, 1.25, 2, 1.25], + "texture": "#0" + }, + "west": { + "uv": [1, 1.25, 1.25, 1.25], + "texture": "#0" + }, + "up": { + "uv": [1, 1.25, 0.25, 1], + "texture": "#0" + }, + "down": { + "uv": [1.75, 1, 1, 1.25], + "texture": "#0" + } + } + }, + { + "from": [13.2, 5.2, 1], + "to": [14, 8.8, 2.5], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [21, 13, 0.5] + }, + "faces": { + "north": { + "uv": [1.75, 1.75, 1.875, 2.5], + "texture": "#0" + }, + "east": { + "uv": [1.5, 1.75, 1.75, 2.5], + "texture": "#0" + }, + "south": { + "uv": [2, 1.75, 2, 2.5], + "texture": "#0" + }, + "west": { + "uv": [1.75, 1.75, 2, 2.5], + "texture": "#0" + }, + "up": { + "uv": [1.75, 1.75, 1.75, 1.5], + "texture": "#0" + }, + "down": { + "uv": [1.75, 1.5, 1.75, 1.75], + "texture": "#0" } - ] + } + } + ], + "groups": [ + { + "name": "group", + "origin": [21, 13, 12], + "children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/camcorder_display.json b/common/src/main/resources/assets/vivecraft/models/camcorder_display.json index b3ffa6832..648d02da6 100644 --- a/common/src/main/resources/assets/vivecraft/models/camcorder_display.json +++ b/common/src/main/resources/assets/vivecraft/models/camcorder_display.json @@ -1,36 +1,36 @@ { - "credit": "Made with Blockbench", - "texture_size": [64, 64], - "textures": { - "1": "vivecraft:transparent", - "particle": "vivecraft:transparent" - }, - "elements": [ - { - "from": [0.2, 4.5, 6], - "to": [9.2, 9.5, 7], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [8.25, 12.5, 14] - }, - "faces": { - "north": { - "uv": [0, 0, 16, 16], - "texture": "#1" - }, - "south": { - "uv": [0, 0, 16, 16], - "texture": "#1" - } - } + "credit": "Made with Blockbench", + "texture_size": [64, 64], + "textures": { + "1": "vivecraft:transparent", + "particle": "vivecraft:transparent" + }, + "elements": [ + { + "from": [0.2, 4.5, 6], + "to": [9.2, 9.5, 7], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [8.25, 12.5, 14] + }, + "faces": { + "north": { + "uv": [0, 0, 16, 16], + "texture": "#1" + }, + "south": { + "uv": [0, 0, 16, 16], + "texture": "#1" } - ], - "groups": [ - { - "name": "group", - "origin": [21, 13, 12], - "children": [0] - } - ] + } + } + ], + "groups": [ + { + "name": "group", + "origin": [21, 13, 12], + "children": [0] + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/camera.json b/common/src/main/resources/assets/vivecraft/models/camera.json index 4b01858a0..a6943640a 100644 --- a/common/src/main/resources/assets/vivecraft/models/camera.json +++ b/common/src/main/resources/assets/vivecraft/models/camera.json @@ -1,270 +1,270 @@ { - "credit": "Made with Blockbench", - "ambientocclusion": false, - "texture_size": [64, 64], - "textures": { - "0": "vivecraft:blocks/camera", - "particle": "vivecraft:transparent" + "credit": "Made with Blockbench", + "ambientocclusion": false, + "texture_size": [64, 64], + "textures": { + "0": "vivecraft:blocks/camera", + "particle": "vivecraft:transparent" + }, + "elements": [ + { + "from": [5, 1, 4], + "to": [11, 7, 6], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [14, 9, 12] + }, + "faces": { + "north": { + "uv": [6, 6, 7.5, 7.5], + "texture": "#0" + }, + "east": { + "uv": [5.5, 6, 6, 7.5], + "texture": "#0" + }, + "west": { + "uv": [7.5, 6, 8, 7.5], + "texture": "#0" + }, + "up": { + "uv": [7.5, 6, 6, 5.5], + "texture": "#0" + }, + "down": { + "uv": [9, 5.5, 7.5, 6], + "texture": "#0" + } + } + }, + { + "from": [1.9, 0, 5.9], + "to": [14.1, 1, 10.1], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [15, 8, 14] + }, + "faces": { + "north": { + "uv": [1, 4.75, 4, 5], + "texture": "#0" + }, + "east": { + "uv": [0, 4.75, 1, 5], + "texture": "#0" + }, + "south": { + "uv": [5, 4.75, 8, 5], + "texture": "#0" + }, + "west": { + "uv": [4, 4.75, 5, 5], + "texture": "#0" + }, + "up": { + "uv": [4, 4.75, 1, 3.75], + "texture": "#0" + }, + "down": { + "uv": [7, 3.75, 4, 4.75], + "texture": "#0", + "cullface": "down" + } + } }, - "elements": [ - { - "from": [5, 1, 4], - "to": [11, 7, 6], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [14, 9, 12] - }, - "faces": { - "north": { - "uv": [6, 6, 7.5, 7.5], - "texture": "#0" - }, - "east": { - "uv": [5.5, 6, 6, 7.5], - "texture": "#0" - }, - "west": { - "uv": [7.5, 6, 8, 7.5], - "texture": "#0" - }, - "up": { - "uv": [7.5, 6, 6, 5.5], - "texture": "#0" - }, - "down": { - "uv": [9, 5.5, 7.5, 6], - "texture": "#0" - } - } + { + "from": [1.9, 7, 5.9], + "to": [14.1, 8, 10.1], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [15, 15, 14] + }, + "faces": { + "north": { + "uv": [1, 3.5, 4, 3.75], + "texture": "#0" }, - { - "from": [1.9, 0, 5.9], - "to": [14.1, 1, 10.1], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [15, 8, 14] - }, - "faces": { - "north": { - "uv": [1, 4.75, 4, 5], - "texture": "#0" - }, - "east": { - "uv": [0, 4.75, 1, 5], - "texture": "#0" - }, - "south": { - "uv": [5, 4.75, 8, 5], - "texture": "#0" - }, - "west": { - "uv": [4, 4.75, 5, 5], - "texture": "#0" - }, - "up": { - "uv": [4, 4.75, 1, 3.75], - "texture": "#0" - }, - "down": { - "uv": [7, 3.75, 4, 4.75], - "texture": "#0", - "cullface": "down" - } - } + "east": { + "uv": [0, 3.5, 1, 3.75], + "texture": "#0" }, - { - "from": [1.9, 7, 5.9], - "to": [14.1, 8, 10.1], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [15, 15, 14] - }, - "faces": { - "north": { - "uv": [1, 3.5, 4, 3.75], - "texture": "#0" - }, - "east": { - "uv": [0, 3.5, 1, 3.75], - "texture": "#0" - }, - "south": { - "uv": [5, 3.5, 8, 3.75], - "texture": "#0" - }, - "west": { - "uv": [4, 3.5, 5, 3.75], - "texture": "#0" - }, - "up": { - "uv": [4, 3.5, 1, 2.5], - "texture": "#0" - }, - "down": { - "uv": [7, 2.5, 4, 3.5], - "texture": "#0" - } - } + "south": { + "uv": [5, 3.5, 8, 3.75], + "texture": "#0" }, - { - "from": [2.9, 8, 6.9], - "to": [5.1, 9, 9.1], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [16, 16, 14] - }, - "faces": { - "north": { - "uv": [0.5, 6.75, 1, 7], - "texture": "#0" - }, - "east": { - "uv": [0, 6.75, 0.5, 7], - "texture": "#0" - }, - "south": { - "uv": [1.5, 6.75, 2, 7], - "texture": "#0" - }, - "west": { - "uv": [1, 6.75, 1.5, 7], - "texture": "#0" - }, - "up": { - "uv": [1, 6.75, 0.5, 6.25], - "texture": "#0" - } - } + "west": { + "uv": [4, 3.5, 5, 3.75], + "texture": "#0" }, - { - "from": [2, 1, 6], - "to": [14, 7, 10], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [14, 9, 16] - }, - "faces": { - "north": { - "uv": [1, 1, 4, 2.5], - "texture": "#0" - }, - "east": { - "uv": [0, 1, 1, 2.5], - "texture": "#0" - }, - "south": { - "uv": [5, 1, 8, 2.5], - "texture": "#0" - }, - "west": { - "uv": [4, 1, 5, 2.5], - "texture": "#0" - } - } + "up": { + "uv": [4, 3.5, 1, 2.5], + "texture": "#0" }, - { - "from": [3.533, 1.6, 10], - "to": [3.733, 6.4, 10.3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [15.133, 9, 20] - }, - "faces": { - "south": { - "uv": [2.75, 5, 2.875, 6.25], - "texture": "#0" - }, - "west": { - "uv": [2.625, 5, 2.75, 6.25], - "texture": "#0" - } - } + "down": { + "uv": [7, 2.5, 4, 3.5], + "texture": "#0" + } + } + }, + { + "from": [2.9, 8, 6.9], + "to": [5.1, 9, 9.1], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [16, 16, 14] + }, + "faces": { + "north": { + "uv": [0.5, 6.75, 1, 7], + "texture": "#0" }, - { - "from": [12.266, 1.6, 10], - "to": [12.466, 6.4, 10.3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [12.866, 8.8, 20] - }, - "faces": { - "east": { - "uv": [0, 5, 0.125, 6.25], - "texture": "#0" - }, - "south": { - "uv": [5.375, 5, 5.5, 6.25], - "texture": "#0" - } - } + "east": { + "uv": [0, 6.75, 0.5, 7], + "texture": "#0" }, - { - "from": [3.533, 6.4, 10], - "to": [12.466, 6.6, 10.3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [14, 9, 20] - }, - "faces": { - "east": { - "uv": [0, 5, 0.125, 6.25], - "texture": "#0" - }, - "south": { - "uv": [2.75, 5, 5.5, 5.125], - "texture": "#0" - }, - "west": { - "uv": [2.625, 5, 2.75, 6.25], - "texture": "#0" - }, - "up": { - "uv": [2.75, 5, 0, 5.125], - "texture": "#0" - } - } + "south": { + "uv": [1.5, 6.75, 2, 7], + "texture": "#0" }, - { - "from": [3.533, 1.4, 10], - "to": [12.466, 1.6, 10.3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [14, 9, 20] - }, - "faces": { - "east": { - "uv": [0, 5, 0.125, 6.25], - "texture": "#0" - }, - "south": { - "uv": [2.75, 6.125, 5.5, 6.25], - "texture": "#0" - }, - "west": { - "uv": [2.625, 5, 2.75, 6.25], - "texture": "#0" - }, - "down": { - "uv": [5.5, 5, 2.75, 5.125], - "texture": "#0" - } - } + "west": { + "uv": [1, 6.75, 1.5, 7], + "texture": "#0" + }, + "up": { + "uv": [1, 6.75, 0.5, 6.25], + "texture": "#0" } - ], - "groups": [ - { - "name": "camera", - "origin": [14, 9, 20], - "children": [0, 1, 2, 3, 4, 5, 6, 7, 8] + } + }, + { + "from": [2, 1, 6], + "to": [14, 7, 10], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [14, 9, 16] + }, + "faces": { + "north": { + "uv": [1, 1, 4, 2.5], + "texture": "#0" + }, + "east": { + "uv": [0, 1, 1, 2.5], + "texture": "#0" + }, + "south": { + "uv": [5, 1, 8, 2.5], + "texture": "#0" + }, + "west": { + "uv": [4, 1, 5, 2.5], + "texture": "#0" + } + } + }, + { + "from": [3.533, 1.6, 10], + "to": [3.733, 6.4, 10.3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [15.133, 9, 20] + }, + "faces": { + "south": { + "uv": [2.75, 5, 2.875, 6.25], + "texture": "#0" + }, + "west": { + "uv": [2.625, 5, 2.75, 6.25], + "texture": "#0" + } + } + }, + { + "from": [12.266, 1.6, 10], + "to": [12.466, 6.4, 10.3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [12.866, 8.8, 20] + }, + "faces": { + "east": { + "uv": [0, 5, 0.125, 6.25], + "texture": "#0" + }, + "south": { + "uv": [5.375, 5, 5.5, 6.25], + "texture": "#0" + } + } + }, + { + "from": [3.533, 6.4, 10], + "to": [12.466, 6.6, 10.3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [14, 9, 20] + }, + "faces": { + "east": { + "uv": [0, 5, 0.125, 6.25], + "texture": "#0" + }, + "south": { + "uv": [2.75, 5, 5.5, 5.125], + "texture": "#0" + }, + "west": { + "uv": [2.625, 5, 2.75, 6.25], + "texture": "#0" + }, + "up": { + "uv": [2.75, 5, 0, 5.125], + "texture": "#0" + } + } + }, + { + "from": [3.533, 1.4, 10], + "to": [12.466, 1.6, 10.3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [14, 9, 20] + }, + "faces": { + "east": { + "uv": [0, 5, 0.125, 6.25], + "texture": "#0" + }, + "south": { + "uv": [2.75, 6.125, 5.5, 6.25], + "texture": "#0" + }, + "west": { + "uv": [2.625, 5, 2.75, 6.25], + "texture": "#0" + }, + "down": { + "uv": [5.5, 5, 2.75, 5.125], + "texture": "#0" } - ] + } + } + ], + "groups": [ + { + "name": "camera", + "origin": [14, 9, 20], + "children": [0, 1, 2, 3, 4, 5, 6, 7, 8] + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/camera_display.json b/common/src/main/resources/assets/vivecraft/models/camera_display.json index 866a2ea82..1466ee182 100644 --- a/common/src/main/resources/assets/vivecraft/models/camera_display.json +++ b/common/src/main/resources/assets/vivecraft/models/camera_display.json @@ -1,33 +1,33 @@ { - "credit": "Made with Blockbench", - "ambientocclusion": false, - "texture_size": [64, 64], - "textures": { - "1": "vivecraft:transparent", - "particle": "vivecraft:transparent" - }, - "elements": [ - { - "from": [3.733, 1.6, 10], - "to": [12.266, 6.4, 10.3], - "rotation": { - "angle": 0, - "axis": "y", - "origin": [14.2, 9.2, 20] - }, - "faces": { - "south": { - "uv": [0, 0, 16, 16], - "texture": "#1" - } - } + "credit": "Made with Blockbench", + "ambientocclusion": false, + "texture_size": [64, 64], + "textures": { + "1": "vivecraft:transparent", + "particle": "vivecraft:transparent" + }, + "elements": [ + { + "from": [3.733, 1.6, 10], + "to": [12.266, 6.4, 10.3], + "rotation": { + "angle": 0, + "axis": "y", + "origin": [14.2, 9.2, 20] + }, + "faces": { + "south": { + "uv": [0, 0, 16, 16], + "texture": "#1" } - ], - "groups": [ - { - "name": "camera", - "origin": [14, 9, 20], - "children": [0] - } - ] + } + } + ], + "groups": [ + { + "name": "camera", + "origin": [14, 9, 20], + "children": [0] + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/item/spyglass_in_hand.json b/common/src/main/resources/assets/vivecraft/models/item/spyglass_in_hand.json index 5d3f0884b..ce491e646 100644 --- a/common/src/main/resources/assets/vivecraft/models/item/spyglass_in_hand.json +++ b/common/src/main/resources/assets/vivecraft/models/item/spyglass_in_hand.json @@ -1,85 +1,85 @@ { - "textures": { - "spyglass": "vivecraft:item/spyglass_model" - }, - "elements": [ - { - "from": [7, 8.5, 7], - "to": [9, 13.5, 9], - "faces": { - "north": { - "uv": [0, 2, 2, 7], - "texture": "#spyglass" - }, - "east": { - "uv": [0, 2, 2, 7], - "texture": "#spyglass" - }, - "south": { - "uv": [0, 2, 2, 7], - "texture": "#spyglass" - }, - "west": { - "uv": [0, 2, 2, 7], - "texture": "#spyglass" - }, - "up": { - "uv": [0, 0, 2, 2], - "texture": "#spyglass" - } - } + "textures": { + "spyglass": "vivecraft:item/spyglass_model" + }, + "elements": [ + { + "from": [7, 8.5, 7], + "to": [9, 13.5, 9], + "faces": { + "north": { + "uv": [0, 2, 2, 7], + "texture": "#spyglass" + }, + "east": { + "uv": [0, 2, 2, 7], + "texture": "#spyglass" + }, + "south": { + "uv": [0, 2, 2, 7], + "texture": "#spyglass" }, - { - "from": [6.9, 2.4, 6.9], - "to": [9.1, 8.6, 9.1], - "faces": { - "north": { - "uv": [0, 7, 2, 13], - "texture": "#spyglass" - }, - "east": { - "uv": [0, 7, 2, 13], - "texture": "#spyglass" - }, - "south": { - "uv": [0, 7, 2, 13], - "texture": "#spyglass" - }, - "west": { - "uv": [0, 7, 2, 13], - "texture": "#spyglass" - }, - "up": { - "uv": [0, 5, 2, 7], - "texture": "#spyglass" - }, - "down": { - "uv": [0, 13, 2, 15], - "texture": "#spyglass" - } - } + "west": { + "uv": [0, 2, 2, 7], + "texture": "#spyglass" + }, + "up": { + "uv": [0, 0, 2, 2], + "texture": "#spyglass" } - ], - "gui_light": "front", - "display": { - "thirdperson_righthand": { - "translation": [0, -2, 0] + } + }, + { + "from": [6.9, 2.4, 6.9], + "to": [9.1, 8.6, 9.1], + "faces": { + "north": { + "uv": [0, 7, 2, 13], + "texture": "#spyglass" + }, + "east": { + "uv": [0, 7, 2, 13], + "texture": "#spyglass" }, - "ground": { - "rotation": [90, 0, 0] + "south": { + "uv": [0, 7, 2, 13], + "texture": "#spyglass" }, - "gui": { - "rotation": [-67.5, 0, 45], - "scale": [1.5, 1.5, 1.5] + "west": { + "uv": [0, 7, 2, 13], + "texture": "#spyglass" }, - "head": { - "rotation": [90, 0, 0], - "translation": [0, 0, -16], - "scale": [1.6, 1.6, 1.6] + "up": { + "uv": [0, 5, 2, 7], + "texture": "#spyglass" }, - "fixed": { - "translation": [0, 0, -1.5], - "scale": [1.5, 1.5, 1.5] + "down": { + "uv": [0, 13, 2, 15], + "texture": "#spyglass" } + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "translation": [0, -2, 0] + }, + "ground": { + "rotation": [90, 0, 0] + }, + "gui": { + "rotation": [-67.5, 0, 45], + "scale": [1.5, 1.5, 1.5] + }, + "head": { + "rotation": [90, 0, 0], + "translation": [0, 0, -16], + "scale": [1.6, 1.6, 1.6] + }, + "fixed": { + "translation": [0, 0, -1.5], + "scale": [1.5, 1.5, 1.5] } + } } diff --git a/common/src/main/resources/assets/vivecraft/models/mini_crafting.json b/common/src/main/resources/assets/vivecraft/models/mini_crafting.json index a499e3912..c079a4747 100644 --- a/common/src/main/resources/assets/vivecraft/models/mini_crafting.json +++ b/common/src/main/resources/assets/vivecraft/models/mini_crafting.json @@ -1,40 +1,40 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/mini_crafting", - "particle": "vivecraft:blocks/mini_crafting" - }, - "elements": [ - { - "name": "cube", - "from": [0, 0, 0], - "to": [7, 2, 7], - "faces": { - "north": { - "uv": [0, 4.5, 4.5, 5.5], - "texture": "#0" - }, - "east": { - "uv": [0, 4.5, 4.5, 5.5], - "texture": "#0" - }, - "south": { - "uv": [0, 4.5, 4.5, 5.5], - "texture": "#0" - }, - "west": { - "uv": [0, 4.5, 4.5, 5.5], - "texture": "#0" - }, - "up": { - "uv": [0, 0, 4.5, 4.5], - "texture": "#0" - }, - "down": { - "uv": [4.5, 0, 9, 4.5], - "texture": "#0" - } - } + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/mini_crafting", + "particle": "vivecraft:blocks/mini_crafting" + }, + "elements": [ + { + "name": "cube", + "from": [0, 0, 0], + "to": [7, 2, 7], + "faces": { + "north": { + "uv": [0, 4.5, 4.5, 5.5], + "texture": "#0" + }, + "east": { + "uv": [0, 4.5, 4.5, 5.5], + "texture": "#0" + }, + "south": { + "uv": [0, 4.5, 4.5, 5.5], + "texture": "#0" + }, + "west": { + "uv": [0, 4.5, 4.5, 5.5], + "texture": "#0" + }, + "up": { + "uv": [0, 0, 4.5, 4.5], + "texture": "#0" + }, + "down": { + "uv": [4.5, 0, 9, 4.5], + "texture": "#0" } - ] + } + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/telescope.json b/common/src/main/resources/assets/vivecraft/models/telescope.json index 517ef6cef..43c35652c 100644 --- a/common/src/main/resources/assets/vivecraft/models/telescope.json +++ b/common/src/main/resources/assets/vivecraft/models/telescope.json @@ -1,170 +1,170 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/trashbin", - "particle": "vivecraft:blocks/trashbin" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/trashbin", + "particle": "vivecraft:blocks/trashbin" + }, + "elements": [ + { + "name": "cube", + "from": [6, 0, 6], + "to": [11, 1, 11], + "faces": { + "north": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "east": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "south": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "west": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "up": { + "uv": [9, 6, 13.5, 10.5], + "texture": "#0" + }, + "down": { + "uv": [4.5, 6, 9, 10.5], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [6, 1, 5], + "to": [11, 7, 6], + "faces": { + "north": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "east": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "south": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "west": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [6, 1, 11], + "to": [11, 7, 12], + "faces": { + "north": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "east": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "west": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 180 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [5, 1, 6], + "to": [6, 7, 11], + "faces": { + "north": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "east": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "south": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 270 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 90 + } + } }, - "elements": [ - { - "name": "cube", - "from": [6, 0, 6], - "to": [11, 1, 11], - "faces": { - "north": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "east": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "south": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "west": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "up": { - "uv": [9, 6, 13.5, 10.5], - "texture": "#0" - }, - "down": { - "uv": [4.5, 6, 9, 10.5], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [6, 1, 5], - "to": [11, 7, 6], - "faces": { - "north": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "east": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "south": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "west": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [6, 1, 11], - "to": [11, 7, 12], - "faces": { - "north": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "east": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "west": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 180 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [5, 1, 6], - "to": [6, 7, 11], - "faces": { - "north": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "east": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "south": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 270 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [11, 1, 6], - "to": [12, 7, 11], - "faces": { - "north": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "south": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "west": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 90 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 270 - } - } + { + "name": "cube", + "from": [11, 1, 6], + "to": [12, 7, 11], + "faces": { + "north": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "south": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "west": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 90 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 270 } - ] + } + } + ] } diff --git a/common/src/main/resources/assets/vivecraft/models/trashbin.json b/common/src/main/resources/assets/vivecraft/models/trashbin.json index 073af6592..be25148b0 100644 --- a/common/src/main/resources/assets/vivecraft/models/trashbin.json +++ b/common/src/main/resources/assets/vivecraft/models/trashbin.json @@ -1,170 +1,170 @@ { - "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", - "textures": { - "0": "vivecraft:blocks/telescope", - "particle": "vivecraft:blocks/telescope" + "credit": "Made with Blockbench, a free, modern block model editor by JannisX11", + "textures": { + "0": "vivecraft:blocks/telescope", + "particle": "vivecraft:blocks/telescope" + }, + "elements": [ + { + "name": "cube", + "from": [6, 0, 6], + "to": [11, 1, 11], + "faces": { + "north": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "east": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "south": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "west": { + "uv": [4.5, 10.5, 9, 11.5], + "texture": "#0" + }, + "up": { + "uv": [9, 6, 13.5, 10.5], + "texture": "#0" + }, + "down": { + "uv": [4.5, 6, 9, 10.5], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [6, 1, 5], + "to": [11, 7, 6], + "faces": { + "north": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "east": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "south": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "west": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0" + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0" + } + } + }, + { + "name": "cube", + "from": [6, 1, 11], + "to": [11, 7, 12], + "faces": { + "north": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "east": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "south": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "west": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 180 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 180 + } + } + }, + { + "name": "cube", + "from": [5, 1, 6], + "to": [6, 7, 11], + "faces": { + "north": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "east": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "south": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "west": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 270 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 90 + } + } }, - "elements": [ - { - "name": "cube", - "from": [6, 0, 6], - "to": [11, 1, 11], - "faces": { - "north": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "east": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "south": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "west": { - "uv": [4.5, 10.5, 9, 11.5], - "texture": "#0" - }, - "up": { - "uv": [9, 6, 13.5, 10.5], - "texture": "#0" - }, - "down": { - "uv": [4.5, 6, 9, 10.5], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [6, 1, 5], - "to": [11, 7, 6], - "faces": { - "north": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "east": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "south": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "west": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0" - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0" - } - } - }, - { - "name": "cube", - "from": [6, 1, 11], - "to": [11, 7, 12], - "faces": { - "north": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "east": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "south": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "west": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 180 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 180 - } - } - }, - { - "name": "cube", - "from": [5, 1, 6], - "to": [6, 7, 11], - "faces": { - "north": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "east": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "south": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "west": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 270 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 90 - } - } - }, - { - "name": "cube", - "from": [11, 1, 6], - "to": [12, 7, 11], - "faces": { - "north": { - "uv": [4.5, 0, 5.5, 6], - "texture": "#0" - }, - "east": { - "uv": [0, 0, 4.5, 6], - "texture": "#0" - }, - "south": { - "uv": [5.5, 0, 6.5, 6], - "texture": "#0" - }, - "west": { - "uv": [6.5, 0, 11, 6], - "texture": "#0" - }, - "up": { - "uv": [0, 6, 4.5, 7], - "texture": "#0", - "rotation": 90 - }, - "down": { - "uv": [0, 7, 4.5, 8], - "texture": "#0", - "rotation": 270 - } - } + { + "name": "cube", + "from": [11, 1, 6], + "to": [12, 7, 11], + "faces": { + "north": { + "uv": [4.5, 0, 5.5, 6], + "texture": "#0" + }, + "east": { + "uv": [0, 0, 4.5, 6], + "texture": "#0" + }, + "south": { + "uv": [5.5, 0, 6.5, 6], + "texture": "#0" + }, + "west": { + "uv": [6.5, 0, 11, 6], + "texture": "#0" + }, + "up": { + "uv": [0, 6, 4.5, 7], + "texture": "#0", + "rotation": 90 + }, + "down": { + "uv": [0, 7, 4.5, 8], + "texture": "#0", + "rotation": 270 } - ] + } + } + ] } diff --git a/common/src/main/resources/data/vivecraft/recipes/climbclaws.json b/common/src/main/resources/data/vivecraft/recipes/climbclaws.json index de55a1835..da1b82050 100644 --- a/common/src/main/resources/data/vivecraft/recipes/climbclaws.json +++ b/common/src/main/resources/data/vivecraft/recipes/climbclaws.json @@ -1,22 +1,22 @@ { - "type": "minecraft:crafting_shaped", - "pattern": [ - "E E", - "S S" - ], - "key": { - "E": { - "item": "minecraft:spider_eye" - }, - "S": { - "item": "minecraft:shears" - } + "type": "minecraft:crafting_shaped", + "pattern": [ + "E E", + "S S" + ], + "key": { + "E": { + "item": "minecraft:spider_eye" }, - "result": { - "item": "vivecraft:climbclaws", - "vanillaitem": "minecraft:shears", - "name": "vivecraft.item.climbclaws", - "hideflags": 4, - "unbreakable": true + "S": { + "item": "minecraft:shears" } + }, + "result": { + "item": "vivecraft:climbclaws", + "vanillaitem": "minecraft:shears", + "name": "vivecraft.item.climbclaws", + "hideflags": 4, + "unbreakable": true + } } diff --git a/common/src/main/resources/data/vivecraft/recipes/jumpboots.json b/common/src/main/resources/data/vivecraft/recipes/jumpboots.json index 2ac6f4229..969322352 100644 --- a/common/src/main/resources/data/vivecraft/recipes/jumpboots.json +++ b/common/src/main/resources/data/vivecraft/recipes/jumpboots.json @@ -1,22 +1,22 @@ { - "type": "minecraft:crafting_shaped", - "pattern": [ - "B", - "S" - ], - "key": { - "B": { - "item": "minecraft:leather_boots" - }, - "S": { - "item": "minecraft:slime_block" - } + "type": "minecraft:crafting_shaped", + "pattern": [ + "B", + "S" + ], + "key": { + "B": { + "item": "minecraft:leather_boots" }, - "result": { - "item": "vivecraft:jumpboots", - "vanillaitem": "minecraft:leather_boots", - "name": "vivecraft.item.jumpboots", - "hideflags": 4, - "unbreakable": true + "S": { + "item": "minecraft:slime_block" } + }, + "result": { + "item": "vivecraft:jumpboots", + "vanillaitem": "minecraft:leather_boots", + "name": "vivecraft.item.jumpboots", + "hideflags": 4, + "unbreakable": true + } } diff --git a/common/src/main/resources/data/vivecraft/tags/blocks/climbable.json b/common/src/main/resources/data/vivecraft/tags/blocks/climbable.json index d91148e1c..17a1f9312 100644 --- a/common/src/main/resources/data/vivecraft/tags/blocks/climbable.json +++ b/common/src/main/resources/data/vivecraft/tags/blocks/climbable.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "#minecraft:climbable" - ] + "replace": false, + "values": [ + "#minecraft:climbable" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/blocks/crops.json b/common/src/main/resources/data/vivecraft/tags/blocks/crops.json index 238e4029c..517a53eec 100644 --- a/common/src/main/resources/data/vivecraft/tags/blocks/crops.json +++ b/common/src/main/resources/data/vivecraft/tags/blocks/crops.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "#minecraft:crops" - ] + "replace": false, + "values": [ + "#minecraft:crops" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/blocks/music_blocks.json b/common/src/main/resources/data/vivecraft/tags/blocks/music_blocks.json index 83c1d7734..db64b4868 100644 --- a/common/src/main/resources/data/vivecraft/tags/blocks/music_blocks.json +++ b/common/src/main/resources/data/vivecraft/tags/blocks/music_blocks.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:note_block" - ] + "replace": false, + "values": [ + "minecraft:note_block" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/arrows.json b/common/src/main/resources/data/vivecraft/tags/items/arrows.json index df0198386..20dce0aa6 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/arrows.json +++ b/common/src/main/resources/data/vivecraft/tags/items/arrows.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "#minecraft:arrows" - ] + "replace": false, + "values": [ + "#minecraft:arrows" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/brushes.json b/common/src/main/resources/data/vivecraft/tags/items/brushes.json index 3d8d0d997..773e1cf4c 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/brushes.json +++ b/common/src/main/resources/data/vivecraft/tags/items/brushes.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:brush" - ] + "replace": false, + "values": [ + "minecraft:brush" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/compasses.json b/common/src/main/resources/data/vivecraft/tags/items/compasses.json index 621c62f1e..1b6b9da17 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/compasses.json +++ b/common/src/main/resources/data/vivecraft/tags/items/compasses.json @@ -1,11 +1,11 @@ { - "replace": false, - "values": [ - { - "id": "#minecraft:compasses", - "required": false - }, - "minecraft:clock", - "minecraft:compass" - ] + "replace": false, + "values": [ + { + "id": "#minecraft:compasses", + "required": false + }, + "minecraft:clock", + "minecraft:compass" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/crossbows.json b/common/src/main/resources/data/vivecraft/tags/items/crossbows.json index 8c15d84f2..ddf5dbf53 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/crossbows.json +++ b/common/src/main/resources/data/vivecraft/tags/items/crossbows.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:crossbow" - ] + "replace": false, + "values": [ + "minecraft:crossbow" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/fishing_rods.json b/common/src/main/resources/data/vivecraft/tags/items/fishing_rods.json index fe27d7c60..47eb972a9 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/fishing_rods.json +++ b/common/src/main/resources/data/vivecraft/tags/items/fishing_rods.json @@ -1,12 +1,12 @@ { - "replace": false, - "values": [ - { - "id": "#forge:tools/fishing_rods", - "required": false - }, + "replace": false, + "values": [ + { + "id": "#forge:tools/fishing_rods", + "required": false + }, - "minecraft:fishing_rod", - "#vivecraft:food_sticks" - ] + "minecraft:fishing_rod", + "#vivecraft:food_sticks" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/food_sticks.json b/common/src/main/resources/data/vivecraft/tags/items/food_sticks.json index d77b8f4f8..661be7918 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/food_sticks.json +++ b/common/src/main/resources/data/vivecraft/tags/items/food_sticks.json @@ -1,7 +1,7 @@ { - "replace": false, - "values": [ - "minecraft:carrot_on_a_stick", - "minecraft:warped_fungus_on_a_stick" - ] + "replace": false, + "values": [ + "minecraft:carrot_on_a_stick", + "minecraft:warped_fungus_on_a_stick" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/hoes.json b/common/src/main/resources/data/vivecraft/tags/items/hoes.json index e31f3a853..5e3e7859c 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/hoes.json +++ b/common/src/main/resources/data/vivecraft/tags/items/hoes.json @@ -1,53 +1,53 @@ { - "replace": false, - "values": [ - { - "id": "#forge:tools/hoes", - "required": false - }, - { - "id": "#c:hoes", - "required": false - }, + "replace": false, + "values": [ + { + "id": "#forge:tools/hoes", + "required": false + }, + { + "id": "#c:hoes", + "required": false + }, - "minecraft:wooden_hoe", - "minecraft:stone_hoe", - "minecraft:iron_hoe", - "minecraft:diamond_hoe", - "minecraft:golden_hoe", - "minecraft:netherite_hoe", - { - "id": "tconstruct:scythe", - "required": false - }, + "minecraft:wooden_hoe", + "minecraft:stone_hoe", + "minecraft:iron_hoe", + "minecraft:diamond_hoe", + "minecraft:golden_hoe", + "minecraft:netherite_hoe", + { + "id": "tconstruct:scythe", + "required": false + }, - { - "id": "harvest_scythes:wooden_scythe", - "required": false - }, - { - "id": "harvest_scythes:stone_scythe", - "required": false - }, - { - "id": "harvest_scythes:iron_scythe", - "required": false - }, - { - "id": "harvest_scythes:golden_scythe", - "required": false - }, - { - "id": "harvest_scythes:diamond_scythe", - "required": false - }, - { - "id": "harvest_scythes:netherite_scythe", - "required": false - }, - { - "id": "harvest_scythes:creative_scythe", - "required": false - } - ] + { + "id": "harvest_scythes:wooden_scythe", + "required": false + }, + { + "id": "harvest_scythes:stone_scythe", + "required": false + }, + { + "id": "harvest_scythes:iron_scythe", + "required": false + }, + { + "id": "harvest_scythes:golden_scythe", + "required": false + }, + { + "id": "harvest_scythes:diamond_scythe", + "required": false + }, + { + "id": "harvest_scythes:netherite_scythe", + "required": false + }, + { + "id": "harvest_scythes:creative_scythe", + "required": false + } + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/maps.json b/common/src/main/resources/data/vivecraft/tags/items/maps.json index 2dbb2ca39..81d6a0c78 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/maps.json +++ b/common/src/main/resources/data/vivecraft/tags/items/maps.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:filled_map" - ] + "replace": false, + "values": [ + "minecraft:filled_map" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/scythes.json b/common/src/main/resources/data/vivecraft/tags/items/scythes.json index 55687ccb7..edd8d1e52 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/scythes.json +++ b/common/src/main/resources/data/vivecraft/tags/items/scythes.json @@ -1,68 +1,68 @@ { - "replace": false, - "values": [ - { - "id": "#forge:tools/scythe", - "required": false - }, + "replace": false, + "values": [ + { + "id": "#forge:tools/scythe", + "required": false + }, - { - "id": "tconstruct:scythe", - "required": false - }, - { - "id": "tconstruct:kama", - "required": false - }, + { + "id": "tconstruct:scythe", + "required": false + }, + { + "id": "tconstruct:kama", + "required": false + }, - { - "id": "harvest_scythes:wooden_scythe", - "required": false - }, - { - "id": "harvest_scythes:stone_scythe", - "required": false - }, - { - "id": "harvest_scythes:iron_scythe", - "required": false - }, - { - "id": "harvest_scythes:golden_scythe", - "required": false - }, - { - "id": "harvest_scythes:diamond_scythe", - "required": false - }, - { - "id": "harvest_scythes:netherite_scythe", - "required": false - }, - { - "id": "harvest_scythes:creative_scythe", - "required": false - }, + { + "id": "harvest_scythes:wooden_scythe", + "required": false + }, + { + "id": "harvest_scythes:stone_scythe", + "required": false + }, + { + "id": "harvest_scythes:iron_scythe", + "required": false + }, + { + "id": "harvest_scythes:golden_scythe", + "required": false + }, + { + "id": "harvest_scythes:diamond_scythe", + "required": false + }, + { + "id": "harvest_scythes:netherite_scythe", + "required": false + }, + { + "id": "harvest_scythes:creative_scythe", + "required": false + }, - { - "id": "scythes:diamond_scythe", - "required": false - }, - { - "id": "scythes:gold_scythe", - "required": false - }, - { - "id": "scythes:iron_scythe", - "required": false - }, - { - "id": "scythes:netherite_scythe", - "required": false - }, - { - "id": "scythes:wood_scythe", - "required": false - } - ] + { + "id": "scythes:diamond_scythe", + "required": false + }, + { + "id": "scythes:gold_scythe", + "required": false + }, + { + "id": "scythes:iron_scythe", + "required": false + }, + { + "id": "scythes:netherite_scythe", + "required": false + }, + { + "id": "scythes:wood_scythe", + "required": false + } + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/shields.json b/common/src/main/resources/data/vivecraft/tags/items/shields.json index 7372bfa42..c2ecb84fb 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/shields.json +++ b/common/src/main/resources/data/vivecraft/tags/items/shields.json @@ -1,10 +1,10 @@ { - "replace": false, - "values": [ - { - "id": "#forge:tools/shields", - "required": false - }, - "minecraft:shield" - ] + "replace": false, + "values": [ + { + "id": "#forge:tools/shields", + "required": false + }, + "minecraft:shield" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/spears.json b/common/src/main/resources/data/vivecraft/tags/items/spears.json index 9d17e5030..d8ba621a1 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/spears.json +++ b/common/src/main/resources/data/vivecraft/tags/items/spears.json @@ -1,14 +1,14 @@ { - "replace": false, - "values": [ - { - "id": "#c:spears", - "required": false - }, - { - "id": "#forge:tools/tridents", - "required": false - }, - "minecraft:trident" - ] + "replace": false, + "values": [ + { + "id": "#c:spears", + "required": false + }, + { + "id": "#forge:tools/tridents", + "required": false + }, + "minecraft:trident" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/swords.json b/common/src/main/resources/data/vivecraft/tags/items/swords.json index adce7278b..76a5627a6 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/swords.json +++ b/common/src/main/resources/data/vivecraft/tags/items/swords.json @@ -1,31 +1,31 @@ { - "replace": false, - "values": [ - { - "id": "#c:swords", - "required": false - }, - { - "id": "#forge:tools/swords", - "required": false - }, - "minecraft:wooden_sword", - "minecraft:stone_sword", - "minecraft:iron_sword", - "minecraft:diamond_sword", - "minecraft:golden_sword", - "minecraft:netherite_sword", - { - "id": "tconstruct:dagger", - "required": false - }, - { - "id": "tconstruct:sword", - "required": false - }, - { - "id": "tconstruct:cleaver", - "required": false - } - ] + "replace": false, + "values": [ + { + "id": "#c:swords", + "required": false + }, + { + "id": "#forge:tools/swords", + "required": false + }, + "minecraft:wooden_sword", + "minecraft:stone_sword", + "minecraft:iron_sword", + "minecraft:diamond_sword", + "minecraft:golden_sword", + "minecraft:netherite_sword", + { + "id": "tconstruct:dagger", + "required": false + }, + { + "id": "tconstruct:sword", + "required": false + }, + { + "id": "tconstruct:cleaver", + "required": false + } + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/telescope.json b/common/src/main/resources/data/vivecraft/tags/items/telescope.json index 11081e727..09e28acb6 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/telescope.json +++ b/common/src/main/resources/data/vivecraft/tags/items/telescope.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "minecraft:spyglass" - ] + "replace": false, + "values": [ + "minecraft:spyglass" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/throw_items.json b/common/src/main/resources/data/vivecraft/tags/items/throw_items.json index a3ca3c488..3bbcdaad8 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/throw_items.json +++ b/common/src/main/resources/data/vivecraft/tags/items/throw_items.json @@ -1,9 +1,9 @@ { - "replace": false, - "values": [ - "minecraft:egg", - "minecraft:snowball", - "minecraft:splash_potion", - "minecraft:lingering_potion" - ] + "replace": false, + "values": [ + "minecraft:egg", + "minecraft:snowball", + "minecraft:splash_potion", + "minecraft:lingering_potion" + ] } diff --git a/common/src/main/resources/data/vivecraft/tags/items/tools.json b/common/src/main/resources/data/vivecraft/tags/items/tools.json index c4db1a1dd..641a08c1f 100644 --- a/common/src/main/resources/data/vivecraft/tags/items/tools.json +++ b/common/src/main/resources/data/vivecraft/tags/items/tools.json @@ -1,84 +1,84 @@ { - "replace": false, - "values": [ - { - "id": "#forge:tools/axes", - "required": false - }, - { - "id": "#c:axes", - "required": false - }, - { - "id": "#forge:tools/shovels", - "required": false - }, - { - "id": "#c:shovels", - "required": false - }, + "replace": false, + "values": [ + { + "id": "#forge:tools/axes", + "required": false + }, + { + "id": "#c:axes", + "required": false + }, + { + "id": "#forge:tools/shovels", + "required": false + }, + { + "id": "#c:shovels", + "required": false + }, - "#vivecraft:hoes", - "#vivecraft:scythes", - "#vivecraft:fishing_rods", - "#vivecraft:brushes", + "#vivecraft:hoes", + "#vivecraft:scythes", + "#vivecraft:fishing_rods", + "#vivecraft:brushes", - { - "id": "#forge:tools/pickaxes", - "required": false - }, - { - "id": "#c:pickaxes", - "required": false - }, - { - "id": "#forge:shears", - "required": false - }, - { - "id": "#c:shears", - "required": false - }, - { - "id": "#forge:rods", - "required": false - }, - "#minecraft:arrows", + { + "id": "#forge:tools/pickaxes", + "required": false + }, + { + "id": "#c:pickaxes", + "required": false + }, + { + "id": "#forge:shears", + "required": false + }, + { + "id": "#c:shears", + "required": false + }, + { + "id": "#forge:rods", + "required": false + }, + "#minecraft:arrows", - "minecraft:bone", - "minecraft:stick", - "minecraft:blaze_rod", - "minecraft:bamboo", - "minecraft:torch", - "minecraft:redstone_torch", - "minecraft:soul_torch", - "minecraft:flint_and_steel", - "minecraft:debug_stick", + "minecraft:bone", + "minecraft:stick", + "minecraft:blaze_rod", + "minecraft:bamboo", + "minecraft:torch", + "minecraft:redstone_torch", + "minecraft:soul_torch", + "minecraft:flint_and_steel", + "minecraft:debug_stick", - "minecraft:wooden_shovel", - "minecraft:stone_shovel", - "minecraft:iron_shovel", - "minecraft:diamond_shovel", - "minecraft:golden_shovel", - "minecraft:netherite_shovel", + "minecraft:wooden_shovel", + "minecraft:stone_shovel", + "minecraft:iron_shovel", + "minecraft:diamond_shovel", + "minecraft:golden_shovel", + "minecraft:netherite_shovel", - "minecraft:wooden_axe", - "minecraft:stone_axe", - "minecraft:iron_axe", - "minecraft:diamond_axe", - "minecraft:golden_axe", - "minecraft:netherite_axe", + "minecraft:wooden_axe", + "minecraft:stone_axe", + "minecraft:iron_axe", + "minecraft:diamond_axe", + "minecraft:golden_axe", + "minecraft:netherite_axe", - "minecraft:wooden_pickaxe", - "minecraft:stone_pickaxe", - "minecraft:iron_pickaxe", - "minecraft:diamond_pickaxe", - "minecraft:golden_pickaxe", - "minecraft:netherite_pickaxe", + "minecraft:wooden_pickaxe", + "minecraft:stone_pickaxe", + "minecraft:iron_pickaxe", + "minecraft:diamond_pickaxe", + "minecraft:golden_pickaxe", + "minecraft:netherite_pickaxe", - { - "id": "#tconstruct:modifiable", - "required": false - } - ] + { + "id": "#tconstruct:modifiable", + "required": false + } + ] } diff --git a/common/src/main/resources/vivecraft.dynamicfps.mixins.json b/common/src/main/resources/vivecraft.dynamicfps.mixins.json index 44ead6235..131eabc85 100644 --- a/common/src/main/resources/vivecraft.dynamicfps.mixins.json +++ b/common/src/main/resources/vivecraft.dynamicfps.mixins.json @@ -1,11 +1,11 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.dynamicfps.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "DynamicFPSModVRMixin", - "DynamicFPSScreenVRMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.dynamicfps.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "DynamicFPSModVRMixin", + "DynamicFPSScreenVRMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.fabric.sodium.mixins.json b/common/src/main/resources/vivecraft.fabric.sodium.mixins.json index 25dc95eec..f1f7c8939 100644 --- a/common/src/main/resources/vivecraft.fabric.sodium.mixins.json +++ b/common/src/main/resources/vivecraft.fabric.sodium.mixins.json @@ -1,10 +1,10 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.sodium.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "FabricSodiumGameOptionPagesVRMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.sodium.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "FabricSodiumGameOptionPagesVRMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.forge.sodium.mixins.json b/common/src/main/resources/vivecraft.forge.sodium.mixins.json index 82f46eae7..e07ff18d3 100644 --- a/common/src/main/resources/vivecraft.forge.sodium.mixins.json +++ b/common/src/main/resources/vivecraft.forge.sodium.mixins.json @@ -1,10 +1,10 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.sodium.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "ForgeSodiumGameOptionPagesVRMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.sodium.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "ForgeSodiumGameOptionPagesVRMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.iris.mixins.json b/common/src/main/resources/vivecraft.iris.mixins.json index 4c26bffa6..b4d7653c7 100644 --- a/common/src/main/resources/vivecraft.iris.mixins.json +++ b/common/src/main/resources/vivecraft.iris.mixins.json @@ -1,22 +1,22 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.iris.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "IrisBeginFrameHack", - "IrisChunkProgramOverridesMixin", - "IrisChunkProgramOverridesMixinSodium_0_4_11", - "IrisChunkProgramOverridesMixinSodium_0_4_9", - "IrisHandRendererVRMixin", - "IrisNewWorldRenderingPipelineVRMixin", - "IrisPipelineManagerVRMixin", - "IrisProgramUniformsMixin", - "IrisRenderSystemVRMixin", - "IrisShadowMatricesMixin", - "IrisShadowRendererMixin" - ], - "minVersion": "0.8.4", - "mixins": [ - ] + "required": false, + "package": "org.vivecraft.mod_compat_vr.iris.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "IrisBeginFrameHack", + "IrisChunkProgramOverridesMixin", + "IrisChunkProgramOverridesMixinSodium_0_4_11", + "IrisChunkProgramOverridesMixinSodium_0_4_9", + "IrisHandRendererVRMixin", + "IrisNewWorldRenderingPipelineVRMixin", + "IrisPipelineManagerVRMixin", + "IrisProgramUniformsMixin", + "IrisRenderSystemVRMixin", + "IrisShadowMatricesMixin", + "IrisShadowRendererMixin" + ], + "minVersion": "0.8.4", + "mixins": [ + ] } diff --git a/common/src/main/resources/vivecraft.mixins.json b/common/src/main/resources/vivecraft.mixins.json index abe32438e..fdf23d1d5 100644 --- a/common/src/main/resources/vivecraft.mixins.json +++ b/common/src/main/resources/vivecraft.mixins.json @@ -1,91 +1,91 @@ { - "required": true, - "package": "org.vivecraft.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "client.blaze3d.RenderSystemAccessor", - "client.blaze3d.RenderTargetMixin", - "client.gui.screens.ScreenMixin", - "client.gui.screens.TitleScreenMixin", - "client.main.MainMixin", - "client.player.AbstractClientPlayerMixin", - "client.renderer.block.LiquidBlockRendererMixin", - "client.renderer.entity.EntityRenderDispatcherMixin", - "client.renderer.entity.PlayerRendererMixin", - "client.renderer.entity.layers.RenderLayerMixin", - "client_vr.ClientBrandRetrieverVRMixin", - "client_vr.KeyboardHandlerVRMixin", - "client_vr.KeyboardInputVRMixin", - "client_vr.MinecraftVRMixin", - "client_vr.MouseHandlerVRMixin", - "client_vr.OptionsVRMixin", - "client_vr.blaze3d.audio.LibraryVRMixin", - "client_vr.blaze3d.platform.GlStateManagerVRMixin", - "client_vr.blaze3d.platform.InputConstantsVRMixin", - "client_vr.blaze3d.platform.WindowVRMixin", - "client_vr.blaze3d.systems.RenderSystemVRMixin", - "client_vr.gui.EditBoxVRMixin", - "client_vr.gui.GuiComponentVRMixin", - "client_vr.gui.GuiVRMixin", - "client_vr.gui.TutorialToastVRMixin", - "client_vr.gui.screens.OptionsScreenVRMixin", - "client_vr.gui.screens.PauseScreenVRMixin", - "client_vr.gui.screens.ScreenVRMixin", - "client_vr.gui.screens.SoundOptionsScreenVRMixin", - "client_vr.gui.screens.WinScreenVRMixin", - "client_vr.gui.screens.inventory.AbstractContainerScreenVRMixin", - "client_vr.gui.screens.inventory.AbstractSignEditScreenVRMixin", - "client_vr.gui.screens.inventory.BookEditScreenVRMixin", - "client_vr.gui.screens.inventory.CreativeModeInventoryScreenVRMixin", - "client_vr.multiplayer.ClientPacketListenerVRMixin", - "client_vr.multiplayer.MultiPlayerGameModeVRMixin", - "client_vr.particle.ItemPickupParticleVRMixin", - "client_vr.player.LocalPlayerVRMixin", - "client_vr.renderer.GameRendererVRMixin", - "client_vr.renderer.ItemInHandRendererVRMixin", - "client_vr.renderer.ItemPropertiesVRMixin", - "client_vr.renderer.LevelRendererVRMixin", - "client_vr.renderer.NoSodiumLevelRendererVRMixin", - "client_vr.renderer.PostChainVRMixin", - "client_vr.renderer.blockentity.TheEndGatewayRendererVRMixin", - "client_vr.renderer.blockentity.TheEndPortalRendererVRMixin", - "client_vr.renderer.entity.EntityRenderDispatcherVRMixin", - "client_vr.renderer.entity.EntityRendererVRMixin", - "client_vr.renderer.entity.FishingHookRendererVRMixin", - "client_vr.renderer.entity.GuardianRendererVRMixin", - "client_vr.renderer.entity.MobRendererVRMixin", - "client_vr.tutorial.MovementTutorialStepInstanceVRMixin", - "client_vr.tutorial.OpenInventoryTutorialStepVRMixin", - "client_vr.tutorial.PunchTreeTutorialStepInstanceVRMixin", - "client_vr.world.BoatMixin", - "client_vr.world.FishingHookVRMixin", - "client_vr.world.ItemVRMixin", - "client_vr.world.PotionItemVRMixin", - "client_vr.world.entity.player.PlayerVRMixin", - "client_vr.world.entity.projectile.FireworkRocketEntityVRMixin", - "client_vr.world.level.block.DoorBlockVRMixin", - "client_vr.world.level.block.FenceGateBlockVRMixin", - "client_vr.world.level.block.TrapDoorBlockVRMixin" - ], - "minVersion": "0.8.4", - "mixins": [ - "server.ChunkMapAccessor", - "server.MinecraftServerMixin", - "server.ServerGamePacketListenerImplMixin", - "server.ServerLoginPacketListenerImplMixin", - "server.ServerPlayerMixin", - "server.TrackedEntityAccessor", - "world.entity.ai.goal.SwellGoalMixin", - "world.entity.monster.EndermanFreezeWhenLookedAtMixin", - "world.entity.monster.EndermanMixin", - "world.entity.projectile.AbstractArrowMixin", - "world.entity.projectile.AbstractHurtingProjectileMixin", - "world.entity.projectile.FishingHookMixin", - "world.entity.projectile.ProjectileMixin", - "world.entity.projectile.ThrowableProjectileMixin", - "world.entity.projectile.ThrownTridentMixin", - "world.item.CrossbowItemMixin", - "world.item.crafting.ShapedRecipeMixin" - ] + "required": true, + "package": "org.vivecraft.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "client.blaze3d.RenderSystemAccessor", + "client.blaze3d.RenderTargetMixin", + "client.gui.screens.ScreenMixin", + "client.gui.screens.TitleScreenMixin", + "client.main.MainMixin", + "client.player.AbstractClientPlayerMixin", + "client.renderer.block.LiquidBlockRendererMixin", + "client.renderer.entity.EntityRenderDispatcherMixin", + "client.renderer.entity.PlayerRendererMixin", + "client.renderer.entity.layers.RenderLayerMixin", + "client_vr.ClientBrandRetrieverVRMixin", + "client_vr.KeyboardHandlerVRMixin", + "client_vr.KeyboardInputVRMixin", + "client_vr.MinecraftVRMixin", + "client_vr.MouseHandlerVRMixin", + "client_vr.OptionsVRMixin", + "client_vr.blaze3d.audio.LibraryVRMixin", + "client_vr.blaze3d.platform.GlStateManagerVRMixin", + "client_vr.blaze3d.platform.InputConstantsVRMixin", + "client_vr.blaze3d.platform.WindowVRMixin", + "client_vr.blaze3d.systems.RenderSystemVRMixin", + "client_vr.gui.EditBoxVRMixin", + "client_vr.gui.GuiComponentVRMixin", + "client_vr.gui.GuiVRMixin", + "client_vr.gui.TutorialToastVRMixin", + "client_vr.gui.screens.OptionsScreenVRMixin", + "client_vr.gui.screens.PauseScreenVRMixin", + "client_vr.gui.screens.ScreenVRMixin", + "client_vr.gui.screens.SoundOptionsScreenVRMixin", + "client_vr.gui.screens.WinScreenVRMixin", + "client_vr.gui.screens.inventory.AbstractContainerScreenVRMixin", + "client_vr.gui.screens.inventory.AbstractSignEditScreenVRMixin", + "client_vr.gui.screens.inventory.BookEditScreenVRMixin", + "client_vr.gui.screens.inventory.CreativeModeInventoryScreenVRMixin", + "client_vr.multiplayer.ClientPacketListenerVRMixin", + "client_vr.multiplayer.MultiPlayerGameModeVRMixin", + "client_vr.particle.ItemPickupParticleVRMixin", + "client_vr.player.LocalPlayerVRMixin", + "client_vr.renderer.GameRendererVRMixin", + "client_vr.renderer.ItemInHandRendererVRMixin", + "client_vr.renderer.ItemPropertiesVRMixin", + "client_vr.renderer.LevelRendererVRMixin", + "client_vr.renderer.NoSodiumLevelRendererVRMixin", + "client_vr.renderer.PostChainVRMixin", + "client_vr.renderer.blockentity.TheEndGatewayRendererVRMixin", + "client_vr.renderer.blockentity.TheEndPortalRendererVRMixin", + "client_vr.renderer.entity.EntityRenderDispatcherVRMixin", + "client_vr.renderer.entity.EntityRendererVRMixin", + "client_vr.renderer.entity.FishingHookRendererVRMixin", + "client_vr.renderer.entity.GuardianRendererVRMixin", + "client_vr.renderer.entity.MobRendererVRMixin", + "client_vr.tutorial.MovementTutorialStepInstanceVRMixin", + "client_vr.tutorial.OpenInventoryTutorialStepVRMixin", + "client_vr.tutorial.PunchTreeTutorialStepInstanceVRMixin", + "client_vr.world.BoatMixin", + "client_vr.world.FishingHookVRMixin", + "client_vr.world.ItemVRMixin", + "client_vr.world.PotionItemVRMixin", + "client_vr.world.entity.player.PlayerVRMixin", + "client_vr.world.entity.projectile.FireworkRocketEntityVRMixin", + "client_vr.world.level.block.DoorBlockVRMixin", + "client_vr.world.level.block.FenceGateBlockVRMixin", + "client_vr.world.level.block.TrapDoorBlockVRMixin" + ], + "minVersion": "0.8.4", + "mixins": [ + "server.ChunkMapAccessor", + "server.MinecraftServerMixin", + "server.ServerGamePacketListenerImplMixin", + "server.ServerLoginPacketListenerImplMixin", + "server.ServerPlayerMixin", + "server.TrackedEntityAccessor", + "world.entity.ai.goal.SwellGoalMixin", + "world.entity.monster.EndermanFreezeWhenLookedAtMixin", + "world.entity.monster.EndermanMixin", + "world.entity.projectile.AbstractArrowMixin", + "world.entity.projectile.AbstractHurtingProjectileMixin", + "world.entity.projectile.FishingHookMixin", + "world.entity.projectile.ProjectileMixin", + "world.entity.projectile.ThrowableProjectileMixin", + "world.entity.projectile.ThrownTridentMixin", + "world.item.CrossbowItemMixin", + "world.item.crafting.ShapedRecipeMixin" + ] } diff --git a/common/src/main/resources/vivecraft.optifine.mixins.json b/common/src/main/resources/vivecraft.optifine.mixins.json index 7e3731f46..d9290efd5 100644 --- a/common/src/main/resources/vivecraft.optifine.mixins.json +++ b/common/src/main/resources/vivecraft.optifine.mixins.json @@ -1,14 +1,14 @@ { - "required": true, - "package": "org.vivecraft.mod_compat_vr.optifine.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "OptifineGamerRendererVRMixin", - "ShadersRenderVRMixin", - "ShadersVRMixin" - ], - "minVersion": "0.8.4", - "mixins": [ - ] + "required": true, + "package": "org.vivecraft.mod_compat_vr.optifine.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "OptifineGamerRendererVRMixin", + "ShadersRenderVRMixin", + "ShadersVRMixin" + ], + "minVersion": "0.8.4", + "mixins": [ + ] } diff --git a/common/src/main/resources/vivecraft.physicsmod.mixins.json b/common/src/main/resources/vivecraft.physicsmod.mixins.json index 16ee6256e..dcb7a33dc 100644 --- a/common/src/main/resources/vivecraft.physicsmod.mixins.json +++ b/common/src/main/resources/vivecraft.physicsmod.mixins.json @@ -1,10 +1,10 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.physicsmod.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "OptionsScreenMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.physicsmod.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "OptionsScreenMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.rei.mixins.json b/common/src/main/resources/vivecraft.rei.mixins.json index 20ca435da..7137ab9e9 100644 --- a/common/src/main/resources/vivecraft.rei.mixins.json +++ b/common/src/main/resources/vivecraft.rei.mixins.json @@ -1,10 +1,10 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.rei.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "reiTextFieldWidgetMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.rei.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "reiTextFieldWidgetMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.resolutioncontrol.mixins.json b/common/src/main/resources/vivecraft.resolutioncontrol.mixins.json index bef629e2a..301f98a7a 100644 --- a/common/src/main/resources/vivecraft.resolutioncontrol.mixins.json +++ b/common/src/main/resources/vivecraft.resolutioncontrol.mixins.json @@ -1,10 +1,10 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.resolutioncontrol.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "ResolutionControlModMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.resolutioncontrol.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "ResolutionControlModMixin" + ], + "minVersion": "0.8.4" } diff --git a/common/src/main/resources/vivecraft.sodium.mixins.json b/common/src/main/resources/vivecraft.sodium.mixins.json index d80038fb4..85ad2cadf 100644 --- a/common/src/main/resources/vivecraft.sodium.mixins.json +++ b/common/src/main/resources/vivecraft.sodium.mixins.json @@ -1,11 +1,11 @@ { - "required": false, - "package": "org.vivecraft.mod_compat_vr.sodium.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "RenderSectionManagerVRMixin", - "SodiumWorldRendererVRMixin" - ], - "minVersion": "0.8.4" + "required": false, + "package": "org.vivecraft.mod_compat_vr.sodium.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "RenderSectionManagerVRMixin", + "SodiumWorldRendererVRMixin" + ], + "minVersion": "0.8.4" } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index be736c91c..737ba5bdb 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,64 +1,64 @@ { - "schemaVersion": 1, - "id": "vivecraft", - "version": "${version}", + "schemaVersion": 1, + "id": "vivecraft", + "version": "${version}", - "name": "Vivecraft", - "description": "The VR mod for any loader!", - "icon": "vivecraft_icon.png", - "authors": [ - "fayer3", - "Ferri_Arnus", - "IMS", - "jrbudda", - "minecraft player", - "NicBOMB" - ], + "name": "Vivecraft", + "description": "The VR mod for any loader!", + "icon": "vivecraft_icon.png", + "authors": [ + "fayer3", + "Ferri_Arnus", + "IMS", + "jrbudda", + "minecraft player", + "NicBOMB" + ], - "license": "LGPLv3", + "license": "LGPLv3", - "environment": "*", - "entrypoints": { - "mm:early_risers": [ - "org.vivecraft.VivecraftEarlyEntryForOptifabric" - ], - "main": [ - "org.vivecraft.fabric.VivecraftMod" - ], - "modmenu": [ - "org.vivecraft.client.fabric.VivecraftModMenuApiImpl" - ] - }, - "mixins": [ - "vivecraft.mixins.json", - "vivecraft.dynamicfps.mixins.json", - "vivecraft.sodium.mixins.json", - "vivecraft.fabric.sodium.mixins.json", - "vivecraft.iris.mixins.json", - "vivecraft.physicsmod.mixins.json", - "vivecraft.rei.mixins.json", - "vivecraft.fabric.mixins.json" + "environment": "*", + "entrypoints": { + "mm:early_risers": [ + "org.vivecraft.VivecraftEarlyEntryForOptifabric" + ], + "main": [ + "org.vivecraft.fabric.VivecraftMod" ], - "depends": { - "fabricloader": ">=0.14.14", - "minecraft": ["1.20", "1.20.1"], - "java": ">=17" - }, - "suggests": { - "another-mod": "*" - }, - "contact": { - "homepage": "https://modrinth.com/mod/vivecraft", - "issues": "https://github.com/Vivecraft/VivecraftMod/issues", - "sources": "https://github.com/Vivecraft/VivecraftMod" - }, - "custom": { - "modmenu": { - "links": { - "modmenu.discord": "https://discord.gg/jYyyv7zhSW", - "vivecraft.message.kofi": "https://ko-fi.com/vivecraft" - }, - "update_checker": true - } + "modmenu": [ + "org.vivecraft.client.fabric.VivecraftModMenuApiImpl" + ] + }, + "mixins": [ + "vivecraft.mixins.json", + "vivecraft.dynamicfps.mixins.json", + "vivecraft.sodium.mixins.json", + "vivecraft.fabric.sodium.mixins.json", + "vivecraft.iris.mixins.json", + "vivecraft.physicsmod.mixins.json", + "vivecraft.rei.mixins.json", + "vivecraft.fabric.mixins.json" + ], + "depends": { + "fabricloader": ">=0.14.14", + "minecraft": ["1.20", "1.20.1"], + "java": ">=17" + }, + "suggests": { + "another-mod": "*" + }, + "contact": { + "homepage": "https://modrinth.com/mod/vivecraft", + "issues": "https://github.com/Vivecraft/VivecraftMod/issues", + "sources": "https://github.com/Vivecraft/VivecraftMod" + }, + "custom": { + "modmenu": { + "links": { + "modmenu.discord": "https://discord.gg/jYyyv7zhSW", + "vivecraft.message.kofi": "https://ko-fi.com/vivecraft" + }, + "update_checker": true } + } } diff --git a/fabric/src/main/resources/vivecraft.fabric.mixins.json b/fabric/src/main/resources/vivecraft.fabric.mixins.json index 8fbcb8fb0..edc2e79ea 100644 --- a/fabric/src/main/resources/vivecraft.fabric.mixins.json +++ b/fabric/src/main/resources/vivecraft.fabric.mixins.json @@ -1,13 +1,13 @@ { - "required": true, - "package": "org.vivecraft.fabric.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": [ - "FabricGameRendererVRMixin", - "client.resources.model.FabricModelBakeryMixin", - "screenhandler.client.FabricClientNetworkingVRMixin", - "world.level.biome.BiomeAccessor" - ], - "minVersion": "0.8.4" + "required": true, + "package": "org.vivecraft.fabric.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": [ + "FabricGameRendererVRMixin", + "client.resources.model.FabricModelBakeryMixin", + "screenhandler.client.FabricClientNetworkingVRMixin", + "world.level.biome.BiomeAccessor" + ], + "minVersion": "0.8.4" } diff --git a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java index 559617feb..9e021167e 100644 --- a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java +++ b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java @@ -1,6 +1,7 @@ package org.vivecraft.forge; import net.minecraftforge.client.ConfigScreenHandler; +import net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import org.vivecraft.client.gui.settings.VivecraftMainSettings; @@ -14,6 +15,6 @@ public Vivecraft() { // init server config ServerConfig.init(null); - ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((mc, screen) -> new VivecraftMainSettings(screen))); + ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class, () -> new ConfigScreenFactory((mc, screen) -> new VivecraftMainSettings(screen))); } } diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index 03858bef5..5d0155f9d 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { - "pack": { - "description": "The VR mod for any loader!", - "pack_format": 10 - } + "pack": { + "description": "The VR mod for any loader!", + "pack_format": 10 + } } diff --git a/forge/src/main/resources/vivecraft.forge.mixins.json b/forge/src/main/resources/vivecraft.forge.mixins.json index fdf289d2b..4f0872ea4 100644 --- a/forge/src/main/resources/vivecraft.forge.mixins.json +++ b/forge/src/main/resources/vivecraft.forge.mixins.json @@ -1,8 +1,8 @@ { - "required": true, - "package": "org.vivecraft.forge.mixin", - "plugin": "org.vivecraft.MixinConfig", - "compatibilityLevel": "JAVA_17", - "client": ["ForgeGameRendererVRMixin", "ForgeIngameGuiVRMixin", "network.ForgeOpenContainerVRMixin"], - "minVersion": "0.8.4" + "required": true, + "package": "org.vivecraft.forge.mixin", + "plugin": "org.vivecraft.MixinConfig", + "compatibilityLevel": "JAVA_17", + "client": ["ForgeGameRendererVRMixin", "ForgeIngameGuiVRMixin", "network.ForgeOpenContainerVRMixin"], + "minVersion": "0.8.4" } From 5b8a1c4ac4ca5876fb0ab58675a353ea4ad81ceb Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Sun, 1 Oct 2023 10:12:39 -0700 Subject: [PATCH 03/12] merge main/Multiloader-1.20.2 into Multiloader-1.20.2-skeletal-input ran code cleanup --- .../main/java/org/vivecraft/client/Xplat.java | 6 + .../gui/framework/GuiVROptionsBase.java | 8 +- .../client/gui/screens/ErrorScreen.java | 2 +- .../client/gui/screens/UpdateScreen.java | 2 +- .../client/gui/settings/GuiListScreen.java | 8 +- .../gui/settings/GuiQuickCommandsInGame.java | 2 +- .../gui/settings/GuiQuickCommandsList.java | 8 +- .../client/gui/widgets/TextScrollWidget.java | 8 +- .../client/network/ClientNetworking.java | 22 +-- .../org/vivecraft/client/render/HMDLayer.java | 3 +- .../client/render/VRPlayerModel.java | 9 +- .../client/render/VRPlayerModel_WithArms.java | 5 +- .../gameplay/screenhandlers/GuiHandler.java | 2 +- .../gameplay/trackers/BowTracker.java | 2 +- .../gameplay/trackers/ClimbTracker.java | 37 ++--- .../gameplay/trackers/CrawlTracker.java | 2 +- .../gameplay/trackers/TeleportTracker.java | 1 - .../vivecraft/client_vr/gui/GuiKeyboard.java | 2 +- .../vivecraft/client_vr/gui/GuiRadial.java | 2 +- .../menuworlds/MenuWorldExporter.java | 2 +- .../client_vr/render/VRArmRenderer.java | 4 +- .../render/helpers/VREffectsHelper.java | 11 +- .../render/helpers/VRWidgetHelper.java | 2 +- .../vivecraft/common/CustomShapedRecipe.java | 43 ++++++ .../network/packets/VivecraftDataPacket.java | 18 +++ .../client/blaze3d/RenderTargetMixin.java | 1 - .../entity/EntityRenderDispatcherMixin.java | 2 +- .../mixin/client_vr/MinecraftVRMixin.java | 140 +++++++++--------- .../mixin/client_vr/MouseHandlerVRMixin.java | 6 +- .../mixin/client_vr/gui/GuiVRMixin.java | 37 ++--- .../client_vr/gui/TutorialToastVRMixin.java | 8 +- .../gui/screens/PauseScreenVRMixin.java | 8 +- .../client_vr/gui/screens/ScreenVRMixin.java | 11 +- ...ClientCommonPacketListenerImplVRMixin.java | 25 ++++ .../ClientPacketListenerVRMixin.java | 41 +++-- .../client_vr/player/LocalPlayerVRMixin.java | 2 +- .../renderer/ItemInHandRendererVRMixin.java | 6 +- .../NoSodiumLevelRendererVRMixin.java | 16 +- .../MovementTutorialStepInstanceVRMixin.java | 24 +-- .../ClientboundCustomPayloadPacketMixin.java | 24 +++ .../ServerboundCustomPayloadPacketMixin.java | 24 +++ .../ServerCommonPacketListenerImplMixin.java | 39 +++++ .../ServerGamePacketListenerImplMixin.java | 47 +----- .../mixin/server/ServerPlayerMixin.java | 29 ++-- .../PlayerListMixin.java} | 12 +- .../item/crafting/ShapedRecipeMixin.java | 61 ++------ .../vivecraft/server/ServerNetworking.java | 13 +- .../vivecraft/server/config/ServerConfig.java | 5 + .../main/resources/vivecraft.accesswidener | 8 +- .../src/main/resources/vivecraft.mixins.json | 6 +- .../resources/vivecraft.optifine.mixins.json | 2 +- fabric/build.gradle | 22 +-- .../vivecraft/client/fabric/XplatImpl.java | 21 +++ fabric/src/main/resources/fabric.mod.json | 2 +- forge/build.gradle | 4 +- .../org/vivecraft/client/forge/XplatImpl.java | 7 + .../java/org/vivecraft/forge/Vivecraft.java | 1 - .../network/ForgeOpenContainerVRMixin.java | 8 +- forge/src/main/resources/META-INF/mods.toml | 6 +- gradle.properties | 6 +- 60 files changed, 510 insertions(+), 375 deletions(-) create mode 100644 common/src/main/java/org/vivecraft/common/CustomShapedRecipe.java create mode 100644 common/src/main/java/org/vivecraft/common/network/packets/VivecraftDataPacket.java create mode 100644 common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java create mode 100644 common/src/main/java/org/vivecraft/mixin/network/ClientboundCustomPayloadPacketMixin.java create mode 100644 common/src/main/java/org/vivecraft/mixin/network/ServerboundCustomPayloadPacketMixin.java create mode 100644 common/src/main/java/org/vivecraft/mixin/server/ServerCommonPacketListenerImplMixin.java rename common/src/main/java/org/vivecraft/mixin/server/{ServerLoginPacketListenerImplMixin.java => players/PlayerListMixin.java} (54%) diff --git a/common/src/main/java/org/vivecraft/client/Xplat.java b/common/src/main/java/org/vivecraft/client/Xplat.java index f2ebf839b..c375aa596 100644 --- a/common/src/main/java/org/vivecraft/client/Xplat.java +++ b/common/src/main/java/org/vivecraft/client/Xplat.java @@ -2,8 +2,10 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome.ClimateSettings; @@ -85,4 +87,8 @@ static ClimateSettings getBiomeClimateSettings(Biome biome) { static BiomeSpecialEffects getBiomeEffects(Biome biome) { return null; } + + @ExpectPlatform + static void addNetworkChannel(ClientPacketListener listener, ResourceLocation resourceLocation) { + } } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java index 5e8b6aab2..e05cea5d4 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java @@ -272,7 +272,7 @@ public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, flo this.init(); } - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, mouseX, mouseY, partialTick); if (this.visibleList != null) { this.visibleList.render(guiGraphics, mouseX, mouseY, partialTick); @@ -331,12 +331,12 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double dra } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) { + public boolean mouseScrolled(double mouseX, double mouseY, double scrollAmountX, double scrollAmountY) { if (this.visibleList != null) { - this.visibleList.mouseScrolled(mouseX, mouseY, delta); + this.visibleList.mouseScrolled(mouseX, mouseY, scrollAmountX, scrollAmountY); } - return super.mouseScrolled(mouseX, mouseY, delta); + return super.mouseScrolled(mouseX, mouseY, scrollAmountX, scrollAmountY); } @Override diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java index 49d62c2cd..372ea7a6d 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/ErrorScreen.java @@ -39,7 +39,7 @@ protected void init() { @Override public void render(@Nonnull GuiGraphics guiGraphics, int i, int j, float f) { - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, i, j, f); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); super.render(guiGraphics, i, j, f); diff --git a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java index 79f734396..d62f6f395 100644 --- a/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/screens/UpdateScreen.java @@ -64,7 +64,7 @@ protected void init() { @Override public void render(@Nonnull GuiGraphics guiGraphics, int i, int j, float f) { - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, i, j, f); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215); super.render(guiGraphics, i, j, f); } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java index 608938b6d..42cfc88cb 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java @@ -41,15 +41,19 @@ public void onClose() { this.minecraft.setScreen(lastScreen); } + @Override + public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) { + this.renderDirtBackground(guiGraphics); + } + @Override public void render(GuiGraphics guiGraphics, int i, int j, float f) { if (reinit) { init(); reinit = false; } - this.renderBackground(guiGraphics); + this.render(guiGraphics, i, j, f); list.render(guiGraphics, i, j, f); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 0xFFFFFF); - super.render(guiGraphics, i, j, f); } } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java index 91b9f0c0b..0ff0dd598 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsInGame.java @@ -51,7 +51,7 @@ public void init() { @Override public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) { - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, pMouseX, pMouseY, pPartialTicks); guiGraphics.drawCenteredString(this.font, "Quick Commands", this.width / 2, 16, 16777215); super.render(guiGraphics, pMouseX, pMouseY, pPartialTicks); } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java index f9ba68500..0f52d05c9 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiQuickCommandsList.java @@ -70,11 +70,11 @@ public boolean mouseReleased(double pMouseX, double p_94754_, int pMouseY) { } @Override - public boolean mouseScrolled(double pMouseX, double p_94735_, double pMouseY) { + public boolean mouseScrolled(double x, double y, double scrollAmountX, double scrollAmountY) { return ( - this.btnDelete.mouseScrolled(pMouseX, p_94735_, pMouseY) || - this.txt.mouseScrolled(pMouseX, p_94735_, pMouseY) || - super.mouseScrolled(pMouseX, p_94735_, pMouseY) + this.btnDelete.mouseScrolled(x, y, scrollAmountX, scrollAmountY) || + this.txt.mouseScrolled(x, y, scrollAmountX, scrollAmountY) || + super.mouseScrolled(x, y, scrollAmountX, scrollAmountY) ); } diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java index 89e453c06..b2aed79ae 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/TextScrollWidget.java @@ -140,10 +140,10 @@ private void setCurrentLineFromYPos(double y) { } @Override - public boolean mouseScrolled(double x, double y, double scrollAmount) { - if (scrollAmount < 0.0 && currentLine < scrollSteps) { + public boolean mouseScrolled(double x, double y, double scrollAmountX, double scrollAmountY) { + if (scrollAmountX < 0.0 && currentLine < scrollSteps) { currentLine++; - } else if (scrollAmount > 0.0 && currentLine > 0) { + } else if (scrollAmountX > 0.0 && currentLine > 0) { currentLine--; } else { // scroll bar on limit, didn't consume the input @@ -155,7 +155,7 @@ public boolean mouseScrolled(double x, double y, double scrollAmount) { @Override public boolean keyPressed(int key, int scancode, int mods) { if (key == GLFW_KEY_UP || key == GLFW_KEY_DOWN) { - if (mouseScrolled(0, 0, key == GLFW_KEY_UP ? 1 : -1)) { + if (mouseScrolled(0, 0, key == GLFW_KEY_UP ? 1 : -1, 0)) { return true; } } diff --git a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java index f63057337..a59d11570 100644 --- a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java +++ b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java @@ -7,7 +7,7 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.Rot; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Pose; @@ -16,6 +16,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; import org.vivecraft.client.VRPlayersClient; +import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.settings.AutoCalibration; import org.vivecraft.client_vr.settings.VRSettings.ChatServerPluginMessage; @@ -26,6 +27,7 @@ import org.vivecraft.common.network.CommonNetworkHelper; import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; import org.vivecraft.common.network.VRPlayerState; +import org.vivecraft.common.network.packets.VivecraftDataPacket; import java.util.UUID; @@ -58,14 +60,14 @@ public static ServerboundCustomPayloadPacket getVivecraftClientPacket(PacketDisc FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeBytes(payload); - return new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, friendlybytebuf); + return new ServerboundCustomPayloadPacket(new VivecraftDataPacket(friendlybytebuf)); } public static ServerboundCustomPayloadPacket createVRActivePacket(boolean vrActive) { FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer()); buffer.writeByte(PacketDiscriminators.IS_VR_ACTIVE.ordinal()); buffer.writeBoolean(vrActive); - return new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); + return new ServerboundCustomPayloadPacket(new VivecraftDataPacket(buffer)); } public static void resetServerSettings() { @@ -81,10 +83,8 @@ public static void resetServerSettings() { } public static void sendVersionInfo() { - String s = CommonNetworkHelper.CHANNEL.toString(); - FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); - friendlybytebuf.writeBytes(s.getBytes()); - mc.getConnection().send(new ServerboundCustomPayloadPacket(new ResourceLocation("minecraft:register"), friendlybytebuf)); + //mc.getConnection().send(new ServerboundCustomPayloadPacket(new ChannelRegisterPacket(CommonNetworkHelper.CHANNEL.toString()))); + Xplat.addNetworkChannel(mc.getConnection(), CommonNetworkHelper.CHANNEL); // send version string, with currently running mc.getConnection().send(getVivecraftClientPacket(PacketDiscriminators.VERSION, (CommonDataHolder.getInstance().versionIdentifier + (vrRunning ? " VR" : " NONVR") @@ -137,7 +137,7 @@ public static ServerboundCustomPayloadPacket createVrPlayerStatePacket(VRPlayerS FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.buffer()); buffer.writeByte(PacketDiscriminators.VR_PLAYER_STATE.ordinal()); vrPlayerState.serialize(buffer); - return new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); + return new ServerboundCustomPayloadPacket(new VivecraftDataPacket(buffer)); } public static void sendLegacyPackets(ClientPacketListener connection, VRPlayerState vrPlayerState) { @@ -146,21 +146,21 @@ public static void sendLegacyPackets(ClientPacketListener connection, VRPlayerSt controller0Buffer.writeByte(PacketDiscriminators.CONTROLLER0DATA.ordinal()); controller0Buffer.writeBoolean(dh.vrSettings.reverseHands); vrPlayerState.controller0().serialize(controller0Buffer); - connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, controller0Buffer)); + connection.send(new ServerboundCustomPayloadPacket(new VivecraftDataPacket(controller0Buffer))); // right controller packet FriendlyByteBuf controller1Buffer = new FriendlyByteBuf(Unpooled.buffer()); controller1Buffer.writeByte(PacketDiscriminators.CONTROLLER1DATA.ordinal()); controller1Buffer.writeBoolean(dh.vrSettings.reverseHands); vrPlayerState.controller1().serialize(controller1Buffer); - connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, controller1Buffer)); + connection.send(new ServerboundCustomPayloadPacket(new VivecraftDataPacket(controller1Buffer))); // hmd packet FriendlyByteBuf headBuffer = new FriendlyByteBuf(Unpooled.buffer()); headBuffer.writeByte(PacketDiscriminators.HEADDATA.ordinal()); headBuffer.writeBoolean(dh.vrSettings.seated); vrPlayerState.hmd().serialize(headBuffer); - connection.send(new ServerboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, headBuffer)); + connection.send(new ServerboundCustomPayloadPacket(new VivecraftDataPacket(headBuffer))); } public static boolean isLimitedSurvivalTeleport() { diff --git a/common/src/main/java/org/vivecraft/client/render/HMDLayer.java b/common/src/main/java/org/vivecraft/client/render/HMDLayer.java index df461d04f..5c4f12852 100644 --- a/common/src/main/java/org/vivecraft/client/render/HMDLayer.java +++ b/common/src/main/java/org/vivecraft/client/render/HMDLayer.java @@ -10,7 +10,6 @@ import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; import org.vivecraft.client.VRPlayersClient; public class HMDLayer extends RenderLayer> { @@ -25,7 +24,7 @@ public HMDLayer(RenderLayerParent this.BLACK_HMD; case 2 -> this.GOLD_HMD; case 3, 4 -> this.DIAMOND_HMD; diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java index 583e0b17b..d4ab21609 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel.java @@ -10,7 +10,6 @@ import net.minecraft.client.model.geom.builders.MeshDefinition; import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import org.vivecraft.client.VRPlayersClient; import org.vivecraft.client.VRPlayersClient.RotInfo; @@ -39,8 +38,8 @@ public static MeshDefinition createMesh(CubeDeformation cubeDeformation, boolean @Override public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); - this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player) pEntity).getUUID()); - RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player) pEntity).getUUID()); + this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer((pEntity).getUUID()); + RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer((pEntity).getUUID()); if (rotinfo == null) { return; //how @@ -48,8 +47,8 @@ public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float double d0 = -1.501F * rotinfo.heightScale; float f = toRadians(pEntity.getYRot()); - float f1 = (float) atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); - float f2 = (float) asin(rotinfo.headRot.y / rotinfo.headRot.length()); + float f1 = atan2(-rotinfo.headRot.x, -rotinfo.headRot.z); + float f2 = asin(rotinfo.headRot.y / rotinfo.headRot.length()); double d1 = rotinfo.getBodyYawRadians(); this.head.xRot = -f2; this.head.yRot = (float) (PI - (double) f1 - d1); diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java index cadaa4091..aeb11cc68 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java @@ -12,7 +12,6 @@ import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.world.entity.HumanoidArm; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.player.Player; import org.joml.Vector3f; import org.vivecraft.client.VRPlayersClient; import org.vivecraft.client.VRPlayersClient.RotInfo; @@ -114,8 +113,8 @@ protected Iterable bodyParts() { @Override public void setupAnim(T pEntity, float pLimbSwing, float pLimbSwingAmount, float pAgeInTicks, float pNetHeadYaw, float pHeadPitch) { super.setupAnim(pEntity, pLimbSwing, pLimbSwingAmount, pAgeInTicks, pNetHeadYaw, pHeadPitch); - this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player) pEntity).getUUID()); - RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(((Player) pEntity).getUUID()); + this.rotInfo = VRPlayersClient.getInstance().getRotationsForPlayer((pEntity).getUUID()); + RotInfo rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer((pEntity).getUUID()); if (rotinfo == null) { return; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java index b8acf56af..11ea2d520 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java @@ -411,7 +411,7 @@ public static Vector3f applyGUIModelView(RenderPass currentPass, PoseStack pMatr scale = 0.4F; guilocal.set( hand * -0.136F * dh.vrPlayer.vrdata_world_render.worldScale, - ("slim".equals(mc.player.getModelName()) ? 0.13F : 0.12F) * dh.vrPlayer.vrdata_world_render.worldScale, + ("slim".equals(mc.player.getSkin().model().id()) ? 0.13F : 0.12F) * dh.vrPlayer.vrdata_world_render.worldScale, 0.06F * dh.vrPlayer.vrdata_world_render.worldScale ); guirot.rotateY(((float) PI / 5F) * hand); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java index b1859e9e9..9fc84e622 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java @@ -1,7 +1,7 @@ package org.vivecraft.client_vr.gameplay.trackers; import net.minecraft.Util; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java index 774d07486..bdcc3a8d7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java @@ -1,9 +1,8 @@ package org.vivecraft.client_vr.gameplay.trackers; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.network.chat.contents.TranslatableContents; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.ItemStack; @@ -218,33 +217,25 @@ public void doProcess() { List list = new ArrayList<>(); if (block instanceof LadderBlock) { - switch ((Direction) blockstate.getValue(LadderBlock.FACING)) { - case DOWN: - flag4 = false; - break; - - case EAST: + switch (blockstate.getValue(LadderBlock.FACING)) { + case EAST -> { list.add(this.eastBB); - break; - - case NORTH: + } + case NORTH -> { list.add(this.northbb); - break; - - case SOUTH: + } + case SOUTH -> { list.add(this.southBB); - break; - - case UP: + } + case UP -> { list.add(this.upBB); - break; - - case WEST: + } + case WEST -> { list.add(this.westBB); - break; - - default: + } + default -> { flag4 = false; + } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java index 9836a1b92..d0b875f56 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CrawlTracker.java @@ -1,6 +1,6 @@ package org.vivecraft.client_vr.gameplay.trackers; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.world.entity.Pose; import org.joml.Vector3f; import org.vivecraft.client.Xplat; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java index d3da7f49c..c3ac89511 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java @@ -22,7 +22,6 @@ import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.BlockTags; -import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client_vr.gameplay.VRMovementStyle; import org.vivecraft.client_vr.render.helpers.RenderHelper; diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java b/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java index 72b2e6c66..dd86eb010 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/GuiKeyboard.java @@ -163,7 +163,7 @@ public void setShift(boolean shift) { @Override public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) { - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, pMouseX, pMouseY, pPartialTicks); guiGraphics.drawCenteredString(this.font, "Keyboard", this.width / 2, 2, 16777215); super.render(guiGraphics, 0, 0, pPartialTicks); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java b/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java index d39ebbc1f..43d28f79b 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/GuiRadial.java @@ -99,7 +99,7 @@ public void setShift(boolean shift) { @Override public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPartialTicks) { - this.renderBackground(guiGraphics); + this.renderBackground(guiGraphics, pMouseX, pMouseY, pPartialTicks); super.render(guiGraphics, 0, 0, pPartialTicks); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java index f15aa5f46..fdd181781 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldExporter.java @@ -396,7 +396,7 @@ void readPalette(DataInputStream dis, int dataVersion) throws IOException { int size = dis.readInt(); for (int i = 0; i < size; i++) { - CompoundTag tag = CompoundTag.TYPE.load(dis, 0, NbtAccounter.UNLIMITED); + CompoundTag tag = CompoundTag.TYPE.load(dis, NbtAccounter.unlimitedHeap()); tag = (CompoundTag) dataFixer.update(References.BLOCK_STATE, new Dynamic<>(NbtOps.INSTANCE, tag), dataVersion, SharedConstants.getCurrentVersion().getDataVersion().getVersion()).getValue(); this.paletteMap.add(NbtUtils.readBlockState(BuiltInRegistries.BLOCK.asLookup(), tag)); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java b/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java index 439f1495f..66ad4357e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRArmRenderer.java @@ -45,9 +45,9 @@ private void renderItem(ControllerType side, PoseStack matrixStackIn, MultiBuffe playermodel.leftSleeve.copyFrom(playermodel.leftArm); playermodel.rightSleeve.copyFrom(playermodel.rightArm); float f = dh.swingTracker.getItemFade(ItemStack.EMPTY); - rendererArmIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkinTextureLocation())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); + rendererArmIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkin().texture())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); rendererArmwearIn.xRot = 0.0F; - rendererArmwearIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkinTextureLocation())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); + rendererArmwearIn.render(matrixStackIn, bufferIn.getBuffer(RenderType.entityTranslucent(playerIn.getSkin().texture())), combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, f); RenderSystem.disableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java index 37a40bece..dbfb7acb9 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java @@ -898,7 +898,8 @@ public static void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseSta brightness = 0.5F; } - RenderSystem.setShaderTexture(0, Gui.GUI_ICONS_LOCATION); + TextureAtlasSprite crosshairSprite = mc.getGuiSprites().getSprite(Gui.CROSSHAIR_SPRITE); + RenderSystem.setShaderTexture(0, crosshairSprite.atlasLocation()); float uMax = 15.0F / 256.0F; float vMax = 15.0F / 256.0F; @@ -908,13 +909,13 @@ public static void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseSta bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.NEW_ENTITY); bufferbuilder.vertex(poseStack.last().pose(), -1.0F, 1.0F, 0.0F).color(brightness, brightness, brightness, 1.0F) - .uv(0.0F, vMax).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); + .uv(crosshairSprite.getU0(), crosshairSprite.getV1()).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); bufferbuilder.vertex(poseStack.last().pose(), 1.0F, 1.0F, 0.0F).color(brightness, brightness, brightness, 1.0F) - .uv(uMax, vMax).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); + .uv(crosshairSprite.getU1(), crosshairSprite.getV1()).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); bufferbuilder.vertex(poseStack.last().pose(), 1.0F, -1.0F, 0.0F).color(brightness, brightness, brightness, 1.0F) - .uv(uMax, 0.0F).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); + .uv(crosshairSprite.getU1(), crosshairSprite.getV0()).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); bufferbuilder.vertex(poseStack.last().pose(), -1.0F, -1.0F, 0.0F).color(brightness, brightness, brightness, 1.0F) - .uv(0.0F, 0.0F).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); + .uv(crosshairSprite.getU0(), crosshairSprite.getV0()).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(0.0F, 0.0F, 1.0F).endVertex(); BufferUploader.drawWithShader(bufferbuilder.end()); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java index 629577113..bce574bc7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java @@ -70,7 +70,7 @@ public static void renderVRHandheldCameraWidget() { renderVRCameraWidget(-0.5F, -0.25F, -0.22F, f, RenderPass.CAMERA, CameraTracker.cameraModel, CameraTracker.cameraDisplayModel, () -> { - if (VREffectsHelper.getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(), (double) ((GameRendererExtension) mc.gameRenderer).vivecraft$getMinClipDistance()) == null) { + if (VREffectsHelper.getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(), ((GameRendererExtension) mc.gameRenderer).vivecraft$getMinClipDistance()) == null) { dh.vrRenderer.cameraFramebuffer.bindRead(); RenderSystem.setShaderTexture(0, dh.vrRenderer.cameraFramebuffer.getColorTextureId()); } else { diff --git a/common/src/main/java/org/vivecraft/common/CustomShapedRecipe.java b/common/src/main/java/org/vivecraft/common/CustomShapedRecipe.java new file mode 100644 index 000000000..95759011c --- /dev/null +++ b/common/src/main/java/org/vivecraft/common/CustomShapedRecipe.java @@ -0,0 +1,43 @@ +package org.vivecraft.common; + +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.util.ExtraCodecs; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipeCodecs; + +public class CustomShapedRecipe { + public static final Codec VIVECRAFT_ITEMSTACK_OBJECT_CODEC = RecordCodecBuilder.create((instance) -> + instance.group( + BuiltInRegistries.ITEM.byNameCodec() + .fieldOf("vanillaitem") + .forGetter(ItemStack::getItem), + ExtraCodecs + .strictOptionalField(ExtraCodecs.POSITIVE_INT, "count", 1) + .forGetter(ItemStack::getCount), + ExtraCodecs + .strictOptionalField(ExtraCodecs.COMPONENT, "name", Component.empty()) + .forGetter(ItemStack::getHoverName), + ExtraCodecs + .strictOptionalField(Codec.BOOL, "unbreakable", false) + .forGetter(itemStack -> itemStack.getOrCreateTag().getBoolean("Unbreakable")), + ExtraCodecs + .strictOptionalField(ExtraCodecs.POSITIVE_INT, "hideflags", 0) + .forGetter(itemStack -> itemStack.getOrCreateTag().getInt("HideFlags")) + ).apply(instance, (vanillaitem, count, name, unbreakable, hideflags) -> { + ItemStack itemStack = new ItemStack(vanillaitem, count); + if (!name.getString().isEmpty()) { + itemStack.setHoverName(Component.translatable(name.getString())); + } + itemStack.getOrCreateTag().putInt("HideFlags", hideflags); + itemStack.getOrCreateTag().putBoolean("Unbreakable", unbreakable); + return itemStack; + }) + ); + + public static final Codec CODEC = ExtraCodecs.either(VIVECRAFT_ITEMSTACK_OBJECT_CODEC, CraftingRecipeCodecs.ITEMSTACK_OBJECT_CODEC) + .xmap(itemStackItemStackEither -> itemStackItemStackEither.map(stack -> stack, stack -> stack), Either::right); +} diff --git a/common/src/main/java/org/vivecraft/common/network/packets/VivecraftDataPacket.java b/common/src/main/java/org/vivecraft/common/network/packets/VivecraftDataPacket.java new file mode 100644 index 000000000..5e30616d1 --- /dev/null +++ b/common/src/main/java/org/vivecraft/common/network/packets/VivecraftDataPacket.java @@ -0,0 +1,18 @@ +package org.vivecraft.common.network.packets; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; +import org.vivecraft.common.network.CommonNetworkHelper; + +public record VivecraftDataPacket(FriendlyByteBuf buffer) implements CustomPacketPayload { + @Override + public void write(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeBytes(buffer); + } + + @Override + public ResourceLocation id() { + return CommonNetworkHelper.CHANNEL; + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java index df96e8fff..6bbee2ad9 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java @@ -7,7 +7,6 @@ import net.minecraft.client.renderer.ShaderInstance; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11C; -//import org.lwjgl.opengl.GL12C; import org.lwjgl.opengl.GL30C; import org.spongepowered.asm.mixin.Debug; import org.spongepowered.asm.mixin.Mixin; diff --git a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java index e5ed32042..06b7dcbb9 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/renderer/entity/EntityRenderDispatcherMixin.java @@ -68,7 +68,7 @@ public abstract class EntityRenderDispatcherMixin implements ResourceManagerRelo @Inject(at = @At("HEAD"), method = "getRenderer(Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/client/renderer/entity/EntityRenderer;", cancellable = true) public void vivecraft$renderer(Entity pEntity, CallbackInfoReturnable> info) { if (pEntity instanceof AbstractClientPlayer) { - String s = ((AbstractClientPlayer) pEntity).getModelName(); + String s = ((AbstractClientPlayer) pEntity).getSkin().model().id(); RotInfo playermodelcontroller$rotinfo = VRPlayersClient.getInstance().getRotationsForPlayer(pEntity.getUUID()); if (playermodelcontroller$rotinfo != null) { VRPlayerRenderer vrplayerrenderer; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 1afeaef8d..fbaa82af4 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -60,6 +60,7 @@ import org.vivecraft.client.gui.screens.UpdateScreen; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client.utils.UpdateChecker; +import org.vivecraft.client_vr.VRState; import org.vivecraft.client_vr.extensions.*; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.gameplay.screenhandlers.KeyboardHandler; @@ -164,9 +165,6 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Shadow protected abstract void renderFpsMeter(GuiGraphics guiGraphics, ProfileResults profileResults); - @Shadow - static Minecraft instance; - @WrapOperation( method = "", at = @At( @@ -176,7 +174,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { ) ) private void vivecraft$captureMinecraftInstance(Minecraft value, Operation original) { - original.call(mc = value); // Assign early to ensure subsequent accesses are safe. + original.call(VRState.mc = value); // Assign early to ensure subsequent accesses are safe. } @WrapOperation( @@ -216,8 +214,8 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { // on first resource load finished @Inject(at = @At("HEAD"), method = { - "method_24040", // fabric - "lambda$new$4"} // forge + "method_53522", // fabric + "lambda$new$6"} // forge , remap = false) public void vivecraft$initVROnLaunch(CallbackInfo ci) { // init vr after resource loading @@ -236,10 +234,10 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (OptifineHelper.isOptifineLoaded() && dh.menuWorldRenderer != null && dh.menuWorldRenderer.isReady()) { // with optifine this texture somehow fails to load, so manually reload it try { - this.textureManager.getTexture(Gui.GUI_ICONS_LOCATION).load(this.resourceManager); + this.textureManager.getTexture(Gui.CROSSHAIR_SPRITE).load(this.resourceManager); } catch (IOException e) { // if there was an error, just reload everything - instance.reloadResourcePacks(); + mc.reloadResourcePacks(); } } } @@ -265,15 +263,15 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { return; } boolean vrActive = !dh.vrSettings.vrHotswitchingEnabled || dh.vr.isActive(); - if (vrRunning != vrActive && (ClientNetworking.serverAllowsVrSwitching || instance.player == null)) { + if (vrRunning != vrActive && (ClientNetworking.serverAllowsVrSwitching || mc.player == null)) { this.vivecraft$switchVRState(vrActive); } if (vrRunning) { ++dh.frameIndex; // reset camera position, if there is one, since it only gets set at the start of rendering, and the last renderpass can be anywhere - if (instance.gameRenderer != null && instance.gameRenderer.getMainCamera() != null && instance.level != null && instance.getCameraEntity() != null) { - instance.gameRenderer.getMainCamera().setup(instance.level, instance.getCameraEntity(), false, false, this.pause ? this.pausePartialTick : this.timer.partialTick); + if (mc.gameRenderer != null && mc.gameRenderer.getMainCamera() != null && mc.level != null && mc.getCameraEntity() != null) { + mc.gameRenderer.getMainCamera().setup(mc.level, mc.getCameraEntity(), false, false, this.pause ? this.pausePartialTick : this.timer.partialTick); } this.profiler.push("VR Poll/VSync"); @@ -319,7 +317,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } catch (RenderConfigException renderConfigException) { this.vivecraft$switchVRState(false); destroyVR(true); - instance.setScreen(new ErrorScreen("VR Render Error", renderConfigException.error)); + mc.setScreen(new ErrorScreen("VR Render Error", renderConfigException.error)); this.profiler.pop(); return renderLevel; } catch (Exception exception2) { @@ -330,14 +328,14 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { RenderPassManager.setGUIRenderPass(); RenderSystem.depthMask(true); RenderSystem.colorMask(true, true, true, true); - instance.mainRenderTarget.clear(ON_OSX); - instance.mainRenderTarget.bindWrite(true); + mc.mainRenderTarget.clear(ON_OSX); + mc.mainRenderTarget.bindWrite(true); // draw screen/gui to buffer RenderSystem.getModelViewStack().pushPose(); - ((GameRendererExtension) instance.gameRenderer).vivecraft$setShouldDrawScreen(true); + ((GameRendererExtension) mc.gameRenderer).vivecraft$setShouldDrawScreen(true); // only draw the gui when the level was rendered once, since some mods expect that - ((GameRendererExtension) instance.gameRenderer).vivecraft$setShouldDrawGui(renderLevel && this.entityRenderDispatcher.camera != null); + ((GameRendererExtension) mc.gameRenderer).vivecraft$setShouldDrawGui(renderLevel && this.entityRenderDispatcher.camera != null); return false; } else { return renderLevel; @@ -349,16 +347,16 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (vrRunning) { // draw cursor on Gui Layer - if (instance.screen != null) { + if (mc.screen != null) { PoseStack poseStack = RenderSystem.getModelViewStack(); poseStack.pushPose(); poseStack.setIdentity(); poseStack.last().pose().translate(0.0F, 0.0F, -2000.0F); RenderSystem.applyModelViewMatrix(); - int x = (int) (instance.mouseHandler.xpos() * instance.getWindow().getGuiScaledWidth() / instance.getWindow().getScreenWidth()); - int y = (int) (instance.mouseHandler.ypos() * instance.getWindow().getGuiScaledHeight() / instance.getWindow().getScreenHeight()); - ((GuiExtension) instance.gui).vivecraft$drawMouseMenuQuad(x, y); + int x = (int) (mc.mouseHandler.xpos() * mc.getWindow().getGuiScaledWidth() / mc.getWindow().getScreenWidth()); + int y = (int) (mc.mouseHandler.ypos() * mc.getWindow().getGuiScaledHeight() / mc.getWindow().getScreenHeight()); + ((GuiExtension) mc.gui).vivecraft$drawMouseMenuQuad(x, y); poseStack.popPose(); RenderSystem.applyModelViewMatrix(); @@ -371,26 +369,26 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { // generate mipmaps // TODO: does this do anything? - instance.mainRenderTarget.bindRead(); - ((RenderTargetExtension) instance.mainRenderTarget).vivecraft$genMipMaps(); - instance.mainRenderTarget.unbindRead(); + mc.mainRenderTarget.bindRead(); + ((RenderTargetExtension) mc.mainRenderTarget).vivecraft$genMipMaps(); + mc.mainRenderTarget.unbindRead(); this.profiler.popPush("2D Keyboard"); float actualPartialTicks = this.pause ? this.pausePartialTick : this.timer.partialTick; - GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); + GuiGraphics guiGraphics = new GuiGraphics(mc, this.renderBuffers.bufferSource()); if (KeyboardHandler.isShowing() && !dh.vrSettings.physicalKeyboard) { - instance.mainRenderTarget = KeyboardHandler.Framebuffer; - instance.mainRenderTarget.clear(ON_OSX); - instance.mainRenderTarget.bindWrite(true); + mc.mainRenderTarget = KeyboardHandler.Framebuffer; + mc.mainRenderTarget.clear(ON_OSX); + mc.mainRenderTarget.bindWrite(true); RenderHelper.drawScreen(actualPartialTicks, KeyboardHandler.UI, guiGraphics); guiGraphics.flush(); } this.profiler.popPush("Radial Menu"); if (RadialHandler.isShowing()) { - instance.mainRenderTarget = RadialHandler.Framebuffer; - instance.mainRenderTarget.clear(ON_OSX); - instance.mainRenderTarget.bindWrite(true); + mc.mainRenderTarget = RadialHandler.Framebuffer; + mc.mainRenderTarget.clear(ON_OSX); + mc.mainRenderTarget.bindWrite(true); RenderHelper.drawScreen(actualPartialTicks, RadialHandler.UI, guiGraphics); guiGraphics.flush(); } @@ -426,7 +424,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { this.profiler.push("Eye:" + renderpass); this.profiler.push("setup"); - instance.mainRenderTarget.bindWrite(true); + mc.mainRenderTarget.bindWrite(true); this.profiler.pop(); VRPassHelper.renderSingleView(renderpass, actualPartialTicks, nanoTime, renderLevel); this.profiler.pop(); @@ -447,11 +445,11 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } } ) { - instance.mainRenderTarget.unbindWrite(); + mc.mainRenderTarget.unbindWrite(); takeScreenshot( renderpass == RenderPass.CAMERA ? dh.vrRenderer.cameraFramebuffer : - instance.mainRenderTarget + mc.mainRenderTarget ); this.window.updateDisplay(); dh.grabScreenShot = false; @@ -498,8 +496,8 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { void vivecraft$restoreVanillaState(CallbackInfo ci) { if (vrInitialized) { // restore vanilla post chains before the resize, or it will resize the wrong ones - if (instance.levelRenderer != null) { - ((LevelRendererExtension) instance.levelRenderer).vivecraft$restoreVanillaPostChains(); + if (mc.levelRenderer != null) { + ((LevelRendererExtension) mc.levelRenderer).vivecraft$restoreVanillaPostChains(); } RenderPassManager.setVanillaRenderPass(); } @@ -517,7 +515,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;stopDestroyBlock()V"), method = "continueAttack(Z)V") public void vivecraft$destroyseated(MultiPlayerGameMode gm) { if (!vrRunning || dh.vrSettings.seated || this.vivecraft$lastClick) { - instance.gameMode.stopDestroyBlock(); + mc.gameMode.stopDestroyBlock(); this.vivecraft$lastClick = false; } } @@ -532,7 +530,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (vrRunning) { this.rightClickDelay = switch (dh.vrSettings.rightclickDelay) { case SLOW -> { - yield 6; + yield 6; } case SLOWER -> { yield 8; @@ -583,7 +581,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { ++dh.tickCounter; // general chat notifications - if (instance.level != null) { + if (mc.level != null) { if (!dh.showedUpdateNotification && UpdateChecker.hasUpdate && (dh.vrSettings.alwaysShowUpdates || !UpdateChecker.newestVersion.equals(dh.vrSettings.lastUpdate))) { dh.vrSettings.lastUpdate = UpdateChecker.newestVersion; dh.vrSettings.saveOptions(); @@ -596,7 +594,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } // VR enabled only chat notifications - if (vrInitialized && instance.level != null && dh.vrPlayer != null) { + if (vrInitialized && mc.level != null && dh.vrPlayer != null) { if (dh.vrPlayer.chatWarningTimer >= 0 && --dh.vrPlayer.chatWarningTimer == 0) { boolean showMessage = !ClientNetworking.displayedChatWarning || dh.vrSettings.showServerPluginMissingMessageAlways; @@ -623,7 +621,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (dh.menuWorldRenderer.isReady()) { // update textures in the menu - if (instance.level == null) { + if (mc.level == null) { this.textureManager.tick(); } dh.menuWorldRenderer.tick(); @@ -643,7 +641,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { VRHotkeys.handleMRKeys(); } - if (instance.level != null && dh.vrPlayer != null) { + if (mc.level != null && dh.vrPlayer != null) { dh.vrPlayer.updateFreeMove(); } this.profiler.pop(); @@ -653,10 +651,10 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { VRPlayersClient.getInstance().tick(); - if (VivecraftVRMod.keyExportWorld.consumeClick() && instance.level != null && instance.player != null) { + if (VivecraftVRMod.keyExportWorld.consumeClick() && mc.level != null && mc.player != null) { Throwable error = null; try { - final BlockPos blockpos = instance.player.blockPosition(); + final BlockPos blockpos = mc.player.blockPosition(); int size = 320; int offset = size / 2; File file1 = new File(MenuWorldDownloader.customWorldFolder); @@ -670,9 +668,9 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { logger.info("Exporting world... area size: " + size); logger.info("Saving to " + file2.getAbsolutePath()); - if (instance.isLocalServer()) { - final Level level = instance.getSingleplayerServer().getLevel(instance.player.level().dimension()); - CompletableFuture completablefuture = instance.getSingleplayerServer().submit(() -> { + if (mc.isLocalServer()) { + final Level level = mc.getSingleplayerServer().getLevel(mc.player.level().dimension()); + CompletableFuture completablefuture = mc.getSingleplayerServer().submit(() -> { try { MenuWorldExporter.saveAreaToFile(level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); } catch (Throwable throwable) { @@ -684,7 +682,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { error = completablefuture.get(); } else { - MenuWorldExporter.saveAreaToFile(instance.level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); + MenuWorldExporter.saveAreaToFile(mc.level, blockpos.getX() - offset, blockpos.getZ() - offset, size, size, blockpos.getY(), file2); message(Component.translatable("vivecraft.messages.menuworldexportclientwarning")); } @@ -734,7 +732,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;swing(Lnet/minecraft/world/InteractionHand;)V"), method = "handleKeybinds()V") public void vivecraft$swingArmhandleKeybinds(LocalPlayer player, InteractionHand interactionHand) { if (vrRunning) { - ((PlayerExtension) instance.player).vivecraft$swingArm(InteractionHand.MAIN_HAND, VRFirstPersonArmSwing.Attack); + ((PlayerExtension) mc.player).vivecraft$swingArm(InteractionHand.MAIN_HAND, VRFirstPersonArmSwing.Attack); } else { player.swing(interactionHand); } @@ -748,7 +746,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;releaseUsingItem(Lnet/minecraft/world/entity/player/Player;)V", shift = Shift.BEFORE), method = "handleKeybinds") public void vivecraft$activeHand(CallbackInfo ci) { if (vrRunning) { - ClientNetworking.sendActiveHand((byte) instance.player.getUsedItemHand().ordinal()); + ClientNetworking.sendActiveHand((byte) mc.player.getUsedItemHand().ordinal()); } } @@ -772,12 +770,12 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Inject(at = @At(value = "FIELD", opcode = PUTFIELD, target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;", shift = Shift.BEFORE, ordinal = 0), method = "setScreen(Lnet/minecraft/client/gui/screens/Screen;)V") public void vivecraft$onOpenScreen(Screen pGuiScreen, CallbackInfo info) { - GuiHandler.onScreenChanged(instance.screen, pGuiScreen, true); + GuiHandler.onScreenChanged(mc.screen, pGuiScreen, true); } @Inject(at = @At("TAIL"), method = "setOverlay") public void vivecraft$onOverlaySet(Overlay overlay, CallbackInfo ci) { - GuiHandler.onScreenChanged(instance.screen, instance.screen, true); + GuiHandler.onScreenChanged(mc.screen, mc.screen, true); } @Inject(method = "setScreen", at = @At("HEAD")) @@ -829,9 +827,9 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { int j = 1; int k = 12; - GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); + GuiGraphics guiGraphics = new GuiGraphics(mc, this.renderBuffers.bufferSource()); for (String s : arraylist) { - guiGraphics.drawString(instance.font, s, 1, j, 16777215); + guiGraphics.drawString(mc.font, s, 1, j, 16777215); j += 12; } guiGraphics.flush(); @@ -843,50 +841,50 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { private void vivecraft$switchVRState(boolean vrActive) { vrRunning = vrActive; if (vrActive) { - if (instance.player != null) { + if (mc.player != null) { dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); } // release mouse when switching to standing if (!dh.vrSettings.seated) { - instance.mouseHandler.releaseMouse(); - InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, instance.mouseHandler.xpos(), instance.mouseHandler.ypos()); + mc.mouseHandler.releaseMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, mc.mouseHandler.xpos(), mc.mouseHandler.ypos()); } } else { GuiHandler.guiPos_room = null; GuiHandler.guiRotation_room = null; GuiHandler.guiScale = 1.0F; - if (instance.player != null) { - VRPlayersClient.getInstance().disableVR(instance.player.getUUID()); + if (mc.player != null) { + VRPlayersClient.getInstance().disableVR(mc.player.getUUID()); } - if (instance.gameRenderer != null) { - instance.gameRenderer.checkEntityPostEffect(instance.options.getCameraType().isFirstPerson() ? instance.getCameraEntity() : null); + if (mc.gameRenderer != null) { + mc.gameRenderer.checkEntityPostEffect(mc.options.getCameraType().isFirstPerson() ? mc.getCameraEntity() : null); } // grab/release mouse - if (instance.screen != null || instance.level == null) { - instance.mouseHandler.releaseMouse(); - InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, instance.mouseHandler.xpos(), instance.mouseHandler.ypos()); + if (mc.screen != null || mc.level == null) { + mc.mouseHandler.releaseMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_NORMAL, mc.mouseHandler.xpos(), mc.mouseHandler.ypos()); } else { - instance.mouseHandler.grabMouse(); - InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_DISABLED, instance.mouseHandler.xpos(), instance.mouseHandler.ypos()); + mc.mouseHandler.grabMouse(); + InputConstants.grabOrReleaseMouse(this.window.getWindow(), GLFW_CURSOR_DISABLED, mc.mouseHandler.xpos(), mc.mouseHandler.ypos()); } } - ClientPacketListener connection = instance.getConnection(); + ClientPacketListener connection = mc.getConnection(); if (connection != null) { connection.send(ClientNetworking.createVRActivePacket(vrActive)); } // reload sound manager, to toggle HRTF between VR and NONVR one - if (!instance.getSoundManager().getAvailableSounds().isEmpty()) { - instance.getSoundManager().reload(); + if (!mc.getSoundManager().getAvailableSounds().isEmpty()) { + mc.getSoundManager().reload(); } - instance.resizeDisplay(); + mc.resizeDisplay(); } @Unique private void vivecraft$drawProfiler() { if (this.fpsPieResults != null) { this.profiler.push("fpsPie"); - GuiGraphics guiGraphics = new GuiGraphics(instance, this.renderBuffers.bufferSource()); + GuiGraphics guiGraphics = new GuiGraphics(mc, this.renderBuffers.bufferSource()); this.renderFpsMeter(guiGraphics, this.fpsPieResults); guiGraphics.flush(); this.profiler.pop(); @@ -996,7 +994,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot() .subtract(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); Vector3f vector3 = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix().transformProject(forward, new Vector3f()); - VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) instance.gameRenderer).vivecraft$getThirdPassProjectionMatrix()); + VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) mc.gameRenderer).vivecraft$getThirdPassProjectionMatrix()); VRShaders._DepthMask_viewMatrix.set(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix()); VRShaders._DepthMask_hmdViewPosition.set((float) vec3.x, (float) vec3.y, (float) vec3.z); VRShaders._DepthMask_hmdPlaneNormal.set(-vector3.x, 0.0F, -vector3.z); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java index 7c2d5211a..32a7d383d 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MouseHandlerVRMixin.java @@ -19,11 +19,11 @@ public class MouseHandlerVRMixin { private boolean mouseGrabbed; // TODO, this seems unnecessary, and wrong - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDD)Z", shift = Shift.BEFORE), method = "onScroll", cancellable = true) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseScrolled(DDDD)Z", shift = Shift.BEFORE), method = "onScroll", cancellable = true) public void vivecraft$cancelScroll(long g, double h, double f, CallbackInfo ci) { - if (mc.screen.mouseScrolled(g, h, f)) { + /*if (mc.screen.mouseScrolled(g, h, f)) { ci.cancel(); - } + }*/ } @Redirect(method = "onPress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;isSpectator()Z")) diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java index 8ca1282fc..b2ed8ebde 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/GuiVRMixin.java @@ -45,10 +45,10 @@ public abstract class GuiVRMixin implements org.vivecraft.client_vr.extensions.G @Final @Shadow - private static ResourceLocation WIDGETS_LOCATION; + private static ResourceLocation CROSSHAIR_SPRITE; @Final @Shadow - private static ResourceLocation GUI_ICONS_LOCATION; + private static ResourceLocation HOTBAR_SELECTION_SPRITE; @Shadow protected abstract Player getCameraPlayer(); @@ -99,12 +99,12 @@ public abstract class GuiVRMixin implements org.vivecraft.client_vr.extensions.G return instance.isDown() || this.vivecraft$showPlayerList; } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 1, shift = Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", ordinal = 1, shift = Shift.AFTER), method = "renderHotbar") public void vivecraft$hotbarContext(float f, GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.interactTracker.hotbar >= 0 && dh.interactTracker.hotbar < 9 && this.getCameraPlayer().getInventory().selected != dh.interactTracker.hotbar && dh.interactTracker.isActive()) { int i = this.screenWidth / 2; RenderSystem.setShaderColor(0.0F, 1.0F, 0.0F, 1.0F); - guiGraphics.blit(WIDGETS_LOCATION, i - 91 - 1 + dh.interactTracker.hotbar * 20, this.screenHeight - 22 - 1, 0, 22, 24, 22); + guiGraphics.blitSprite(HOTBAR_SELECTION_SPRITE, i - 91 - 1 + dh.interactTracker.hotbar * 20, this.screenHeight - 22 - 1, 24, 23); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } @@ -121,28 +121,28 @@ public abstract class GuiVRMixin implements org.vivecraft.client_vr.extensions.G } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = Shift.BEFORE), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", ordinal = 2, shift = Shift.BEFORE), method = "renderHotbar") public void vivecraft$renderVRHotbarLeft(float f, GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.interactTracker.hotbar == 9 && dh.interactTracker.isActive()) { RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 2, shift = Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", ordinal = 2, shift = Shift.AFTER), method = "renderHotbar") public void vivecraft$renderVRHotbarLeftReset(float f, GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.interactTracker.hotbar == 9) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = Shift.BEFORE), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", ordinal = 3, shift = Shift.BEFORE), method = "renderHotbar") public void vivecraft$renderVRHotbarRight(float f, GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.interactTracker.hotbar == 9 && dh.interactTracker.isActive()) { RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F); } } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", ordinal = 3, shift = Shift.AFTER), method = "renderHotbar") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", ordinal = 3, shift = Shift.AFTER), method = "renderHotbar") public void vivecraft$renderVRHotbarRightReset(float f, GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.interactTracker.hotbar == 9) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); @@ -225,24 +225,27 @@ public abstract class GuiVRMixin implements org.vivecraft.client_vr.extensions.G //uhhhh //RenderSystem.disableLighting(); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShaderTexture(0, GUI_ICONS_LOCATION); + TextureAtlasSprite crosshairSprite = mc.getGuiSprites().getSprite(CROSSHAIR_SPRITE); + RenderSystem.setShaderTexture(0, crosshairSprite.atlasLocation()); float f = 16.0F * dh.vrSettings.menuCrosshairScale; RenderSystem.blendFuncSeparate(SourceFactor.ONE_MINUS_DST_COLOR, DestFactor.ZERO, SourceFactor.ONE, DestFactor.ONE); - this.vivecraft$drawCentredTexturedModalRect(mouseX, mouseY, f, f, 0, 0, 15, 15); + this.vivecraft$drawCentredTexturedModalRect(mouseX, mouseY, f, f, crosshairSprite.getU0(), crosshairSprite.getV0(), crosshairSprite.getU1(), crosshairSprite.getV1()); RenderSystem.disableBlend(); RenderSystem.defaultBlendFunc(); } @Unique - public void vivecraft$drawCentredTexturedModalRect(int centreX, int centreY, float width, float height, int u, int v, int texWidth, int texHeight) { - float f = 0.00390625F; - float f1 = 0.00390625F; + public void vivecraft$drawCentredTexturedModalRect(int centreX, int centreY, float width, float height, float uMin, float vMin, float uMax, float vMax) { BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); bufferbuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferbuilder.vertex(centreX - width / 2.0F, centreY + height / 2.0F, 0).uv((u) * f, (v + texHeight) * f1).endVertex(); - bufferbuilder.vertex(centreX + width / 2.0F, centreY + height / 2.0F, 0).uv((u + texWidth) * f, (v + texHeight) * f1).endVertex(); - bufferbuilder.vertex(centreX + width / 2.0F, centreY - height / 2.0F, 0).uv((u + texWidth) * f, v * f1).endVertex(); - bufferbuilder.vertex(centreX - width / 2.0F, centreY - height / 2.0F, 0).uv(u * f, v * f1).endVertex(); + bufferbuilder.vertex((float) centreX - width / 2.0F, (float) centreY + height / 2.0F, 0) + .uv(uMin, vMin).endVertex(); + bufferbuilder.vertex((float) centreX + width / 2.0F, (float) centreY + height / 2.0F, 0) + .uv(uMin, vMax).endVertex(); + bufferbuilder.vertex((float) centreX + width / 2.0F, (float) centreY - height / 2.0F, 0) + .uv(uMax, vMax).endVertex(); + bufferbuilder.vertex((float) centreX - width / 2.0F, (float) centreY - height / 2.0F, 0) + .uv(uMax, vMin).endVertex(); BufferUploader.drawWithShader(bufferbuilder.end()); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java index 99d59eab4..dec8b3b42 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/TutorialToastVRMixin.java @@ -5,6 +5,7 @@ import net.minecraft.client.gui.components.toasts.ToastComponent; import net.minecraft.client.gui.components.toasts.TutorialToast; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -29,17 +30,20 @@ public abstract class TutorialToastVRMixin implements Toast { @Final private Component message; + @Shadow + @Final + private static ResourceLocation BACKGROUND_SPRITE; @Unique private int vivecraft$offset; - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blit(Lnet/minecraft/resources/ResourceLocation;IIIIII)V", shift = Shift.AFTER), method = "render") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/resources/ResourceLocation;IIII)V", shift = Shift.AFTER), method = "render") private void vivecraft$extendToast(GuiGraphics guiGraphics, ToastComponent toastComponent, long l, CallbackInfoReturnable cir) { int width = max(toastComponent.getMinecraft().font.width(this.title), this.message != null ? toastComponent.getMinecraft().font.width(this.message) : 0) + 34; this.vivecraft$offset = min(this.width() - width, 0); if (this.vivecraft$offset < 0) { // draw a bigger toast from right to left, to override the left border for (int i = this.vivecraft$offset - (this.width() - 8) * (this.vivecraft$offset / (this.width() - 8)); i >= this.vivecraft$offset; i -= this.width() - 8) { - guiGraphics.blit(TEXTURE, i, 0, 0, 96, this.width() - 4, this.height()); + guiGraphics.blit(BACKGROUND_SPRITE, i, 0, 0, 96, this.width() - 4, this.height()); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java index 75074a5cf..7347af0b0 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/PauseScreenVRMixin.java @@ -85,17 +85,13 @@ protected PauseScreenVRMixin(Component component) { RowHelper rowHelperOverlay_Profiler = gridWidgetOverlay_Profiler.createRowHelper(2); rowHelperOverlay_Profiler.addChild(new Builder(Component.translatable("vivecraft.gui.overlay"), (p) -> { - mc.options.renderDebug = !mc.options.renderDebug; + mc.gui.getDebugOverlay().toggleOverlay(); mc.setScreen(null); }).width(48).build()); rowHelperOverlay_Profiler.addChild(new Builder(Component.translatable("vivecraft.gui.profiler"), (p) -> { - if (!mc.options.renderDebug) { - mc.options.renderDebugCharts = false; - } - mc.options.renderDebugCharts = !mc.options.renderDebugCharts; - mc.options.renderDebug = mc.options.renderDebugCharts; + mc.gui.getDebugOverlay().toggleProfilerChart(); mc.setScreen(null); }).width(48).pos(50, 0).build()); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java index 857cdc288..be59ac4eb 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/gui/screens/ScreenVRMixin.java @@ -3,7 +3,8 @@ import net.minecraft.client.gui.GuiGraphics; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.vrRunning; @@ -12,12 +13,10 @@ public abstract class ScreenVRMixin extends net.minecraft.client.gui.components.events.AbstractContainerEventHandler implements net.minecraft.client.gui.components.Renderable { - @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fillGradient(IIIIII)V"), method = "renderBackground") - public void vivecraft$vrBackground(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, int n) { + @Inject(at = @At("HEAD"), method = "renderTransparentBackground", cancellable = true) + public void vivecraft$vrBackground(GuiGraphics guiGraphics, CallbackInfo ci) { if (vrRunning && dh.vrSettings != null && !dh.vrSettings.menuBackground) { - guiGraphics.fillGradient(i, j, k, l, 0, 0); - } else { - guiGraphics.fillGradient(i, j, k, l, m, n); + ci.cancel(); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java new file mode 100644 index 000000000..6d886ac08 --- /dev/null +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java @@ -0,0 +1,25 @@ +package org.vivecraft.mixin.client_vr.multiplayer; + +import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; +import net.minecraft.network.chat.Component; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.vivecraft.client_vr.ClientDataHolderVR; +import org.vivecraft.client_vr.VRState; +import org.vivecraft.common.VRServerPerms; + +@Mixin(ClientCommonPacketListenerImpl.class) +public class ClientCommonPacketListenerImplVRMixin { + + + @Inject(at = @At("TAIL"), method = "onDisconnect") + public void vivecraft$disconnect(Component component, CallbackInfo ci) { + VRServerPerms.INSTANCE.setTeleportSupported(false); + if (VRState.vrInitialized) { + ClientDataHolderVR.getInstance().vrPlayer.setTeleportOverride(false); + } + ClientDataHolderVR.getInstance().vrSettings.overrides.resetAll(); + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java index ea31e910b..0367e5338 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java @@ -1,13 +1,11 @@ package org.vivecraft.mixin.client_vr.multiplayer; -import com.mojang.authlib.GameProfile; -import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.client.telemetry.WorldSessionTelemetryManager; +import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl; +import net.minecraft.client.multiplayer.CommonListenerCookie; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.Connection; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.game.*; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; @@ -24,17 +22,23 @@ import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.settings.VRSettings.ChatNotifications; -import org.vivecraft.common.VRServerPerms; -import org.vivecraft.common.network.CommonNetworkHelper; import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; +import org.vivecraft.common.network.packets.VivecraftDataPacket; import static org.vivecraft.client_vr.VRState.*; @Mixin(net.minecraft.client.multiplayer.ClientPacketListener.class) -public class ClientPacketListenerVRMixin { +public abstract class ClientPacketListenerVRMixin extends ClientCommonPacketListenerImpl { + + @Unique + String vivecraft$lastMsg = null; + + protected ClientPacketListenerVRMixin(net.minecraft.client.Minecraft minecraft, Connection connection, CommonListenerCookie commonListenerCookie) { + super(minecraft, connection, commonListenerCookie); + } @Inject(at = @At("TAIL"), method = "") - public void vivecraft$init(net.minecraft.client.Minecraft minecraft, Screen screen, Connection connection, ServerData serverData, GameProfile gameProfile, WorldSessionTelemetryManager worldSessionTelemetryManager, CallbackInfo ci) { + public void vivecraft$init(net.minecraft.client.Minecraft minecraft, Connection connection, CommonListenerCookie commonListenerCookie, CallbackInfo ci) { if (ClientNetworking.needsReset) { dh.vrSettings.overrides.resetAll(); ClientNetworking.resetServerSettings(); @@ -57,23 +61,11 @@ public class ClientPacketListenerVRMixin { } } - @Inject(at = @At("TAIL"), method = "onDisconnect") - public void vivecraft$disconnect(Component component, CallbackInfo ci) { - VRServerPerms.setTeleportSupported(false); - if (vrInitialized) { - dh.vrPlayer.setTeleportOverride(false); - } - dh.vrSettings.overrides.resetAll(); - } - @Inject(at = @At("TAIL"), method = "close") public void vivecraft$cleanup(CallbackInfo ci) { ClientNetworking.needsReset = true; } - @Unique - String vivecraft$lastMsg; - @Inject(at = @At("TAIL"), method = "sendChat") public void vivecraft$chatMsg(String string, CallbackInfo ci) { this.vivecraft$lastMsg = string; @@ -131,9 +123,10 @@ public class ClientPacketListenerVRMixin { dh.vrSettings.overrides.resetAll(); } - @Inject(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;getData()Lnet/minecraft/network/FriendlyByteBuf;"), method = "handleCustomPayload(Lnet/minecraft/network/protocol/game/ClientboundCustomPayloadPacket;)V", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) - public void vivecraft$handlepacket(ClientboundCustomPayloadPacket packet, CallbackInfo info, ResourceLocation channelID, FriendlyByteBuf buffer) { - if (channelID.equals(CommonNetworkHelper.CHANNEL)) { + @Inject(at = @At(value = "HEAD"), method = "handleCustomPayload", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD) + public void vivecraft$handlepacket(CustomPacketPayload packet, CallbackInfo info) { + if (packet instanceof VivecraftDataPacket dataPacket) { + FriendlyByteBuf buffer = dataPacket.buffer(); var packetID = PacketDiscriminators.values()[buffer.readByte()]; ClientNetworking.handlePacket(packetID, buffer); buffer.release(); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java index 47fdbef02..967c1583b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java @@ -11,7 +11,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.sounds.SoundEvent; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java index 85d3f26b8..a5a9a3aa8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java @@ -187,8 +187,8 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt boolean flag = humanoidArm != HumanoidArm.LEFT; float h = flag ? 1.0F : -1.0F; AbstractClientPlayer abstractclientplayer = this.minecraft.player; - RenderSystem.setShaderTexture(0, abstractclientplayer.getSkinTextureLocation()); - VRArmRenderer vrarmrenderer = ((EntityRenderDispatcherVRExtension) this.entityRenderDispatcher).vivecraft$getArmSkinMap().get(abstractclientplayer.getModelName()); + RenderSystem.setShaderTexture(0, abstractclientplayer.getSkin().texture()); + VRArmRenderer vrarmrenderer = ((EntityRenderDispatcherVRExtension) this.entityRenderDispatcher).vivecraft$getArmSkinMap().get(abstractclientplayer.getSkin().model().id()); poseStack.pushPose(); if (abstractclientplayer.swingingArm == InteractionHand.MAIN_HAND && flag) { @@ -200,7 +200,7 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt } poseStack.scale(0.4f, 0.4F, 0.4F); - boolean slim = "slim".equals(abstractclientplayer.getModelName()); + boolean slim = "slim".equals(abstractclientplayer.getSkin().model().id()); /* x offset: (arm x origin + arm x offset + arm x dimension * 0.5) / 16 diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java index 0bf5b2267..48bd633f6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/NoSodiumLevelRendererVRMixin.java @@ -1,42 +1,36 @@ package org.vivecraft.mixin.client_vr.renderer; import net.minecraft.client.Camera; +import net.minecraft.client.renderer.SectionOcclusionGraph; import net.minecraft.client.renderer.culling.Frustum; import org.spongepowered.asm.mixin.Final; 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.At.Shift; import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyConstant; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.vivecraft.mixin.client.blaze3d.RenderSystemAccessor; -import java.util.concurrent.atomic.AtomicBoolean; - import static org.vivecraft.client_vr.VRState.vrRunning; @Mixin(net.minecraft.client.renderer.LevelRenderer.class) public class NoSodiumLevelRendererVRMixin { - @Shadow - private boolean needsFullRenderChunkUpdate; - @Shadow @Final - private AtomicBoolean needsFrustumUpdate; + private SectionOcclusionGraph sectionOcclusionGraph; - @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/LevelRenderer;needsFullRenderChunkUpdate:Z", ordinal = 1, shift = Shift.AFTER), method = "setupRender(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/culling/Frustum;ZZ)V") + @Inject(at = @At("HEAD"), method = "setupRender(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/culling/Frustum;ZZ)V") public void vivecraft$alwaysUpdateCull(Camera camera, Frustum frustum, boolean bl, boolean bl2, CallbackInfo info) { if (vrRunning) { - this.needsFullRenderChunkUpdate = true; // if VR is on, always update the frustum, to fix flickering chunks between eyes - this.needsFrustumUpdate.set(true); + this.sectionOcclusionGraph.invalidate(); } } - @ModifyConstant(method = "renderChunkLayer", constant = @Constant(intValue = 12)) + @ModifyConstant(method = "renderSectionLayer", constant = @Constant(intValue = 12)) public int vivecraft$moreTextures(int constant) { return RenderSystemAccessor.getShaderTextures().length; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java index c5b693913..a0b1943d6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/tutorial/MovementTutorialStepInstanceVRMixin.java @@ -103,11 +103,11 @@ public class MovementTutorialStepInstanceVRMixin { !vrRunning || dh.vrSettings.seated || !dh.vr.getInputAction(mc.options.keyJump).isActive() ? description : Component.translatable( - "tutorial.move.description", - Component.literal( - dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyJump).getLastOrigin()) - ).withStyle(ChatFormatting.BOLD) - ) + "tutorial.move.description", + Component.literal( + dh.vr.getOriginName(dh.vr.getInputAction(mc.options.keyJump).getLastOrigin()) + ).withStyle(ChatFormatting.BOLD) + ) ); } @@ -117,13 +117,13 @@ public class MovementTutorialStepInstanceVRMixin { !vrRunning || dh.vrSettings.seated ? title : Component.translatable( - "vivecraft.toasts.point_controller", - Component.translatable( - dh.vrSettings.reverseHands ? - "vivecraft.toasts.point_controller.left" : - "vivecraft.toasts.point_controller.right" - ).withStyle(ChatFormatting.BOLD) - ) + "vivecraft.toasts.point_controller", + Component.translatable( + dh.vrSettings.reverseHands ? + "vivecraft.toasts.point_controller.left" : + "vivecraft.toasts.point_controller.right" + ).withStyle(ChatFormatting.BOLD) + ) ); } diff --git a/common/src/main/java/org/vivecraft/mixin/network/ClientboundCustomPayloadPacketMixin.java b/common/src/main/java/org/vivecraft/mixin/network/ClientboundCustomPayloadPacketMixin.java new file mode 100644 index 000000000..ad45d297c --- /dev/null +++ b/common/src/main/java/org/vivecraft/mixin/network/ClientboundCustomPayloadPacketMixin.java @@ -0,0 +1,24 @@ +package org.vivecraft.mixin.network; + +import io.netty.buffer.Unpooled; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.packets.VivecraftDataPacket; + +@Mixin(value = {ClientboundCustomPayloadPacket.class}) +public class ClientboundCustomPayloadPacketMixin { + + @Inject(at = @At("HEAD"), method = "readPayload", cancellable = true) + private static void vivecraft$catchVivecraftPackets(ResourceLocation resourceLocation, FriendlyByteBuf friendlyByteBuf, CallbackInfoReturnable cir) { + if (CommonNetworkHelper.CHANNEL.equals(resourceLocation)) { + cir.setReturnValue(new VivecraftDataPacket(new FriendlyByteBuf(Unpooled.buffer()).writeBytes(friendlyByteBuf))); + } + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/network/ServerboundCustomPayloadPacketMixin.java b/common/src/main/java/org/vivecraft/mixin/network/ServerboundCustomPayloadPacketMixin.java new file mode 100644 index 000000000..d9b2f4be3 --- /dev/null +++ b/common/src/main/java/org/vivecraft/mixin/network/ServerboundCustomPayloadPacketMixin.java @@ -0,0 +1,24 @@ +package org.vivecraft.mixin.network; + +import io.netty.buffer.Unpooled; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.common.network.packets.VivecraftDataPacket; + +@Mixin(value = {ServerboundCustomPayloadPacket.class}) +public class ServerboundCustomPayloadPacketMixin { + + @Inject(at = @At("HEAD"), method = "readPayload", cancellable = true) + private static void vivecraft$catchVivecraftPackets(ResourceLocation resourceLocation, FriendlyByteBuf friendlyByteBuf, CallbackInfoReturnable cir) { + if (CommonNetworkHelper.CHANNEL.equals(resourceLocation)) { + cir.setReturnValue(new VivecraftDataPacket(new FriendlyByteBuf(Unpooled.buffer()).writeBytes(friendlyByteBuf))); + } + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerCommonPacketListenerImplMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerCommonPacketListenerImplMixin.java new file mode 100644 index 000000000..a649627d3 --- /dev/null +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerCommonPacketListenerImplMixin.java @@ -0,0 +1,39 @@ +package org.vivecraft.mixin.server; + +import net.minecraft.network.protocol.PacketUtils; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.ServerCommonPacketListenerImpl; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import org.spongepowered.asm.mixin.Final; +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.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; +import org.vivecraft.common.network.packets.VivecraftDataPacket; +import org.vivecraft.server.ServerNetworking; + +@Mixin(ServerCommonPacketListenerImpl.class) +public abstract class ServerCommonPacketListenerImplMixin { + + @Shadow + @Final + protected MinecraftServer server; + + @Inject(at = @At("TAIL"), method = "handleCustomPayload") + public void vivecraft$handleVivecraftPackets(ServerboundCustomPayloadPacket payloadPacket, CallbackInfo ci) { + if (payloadPacket.payload() instanceof VivecraftDataPacket dataPacket && + (Object) this instanceof ServerGamePacketListenerImpl gamePacketListener) { + var buffer = dataPacket.buffer(); + PacketUtils.ensureRunningOnSameThread(payloadPacket, (ServerCommonPacketListenerImpl) (Object) this, this.server); + PacketDiscriminators packetDiscriminator = PacketDiscriminators.values()[buffer.readByte()]; + ServerNetworking.handlePacket(packetDiscriminator, buffer, gamePacketListener); + + if (packetDiscriminator == PacketDiscriminators.CLIMBING) { + gamePacketListener.aboveGroundTickCount = 0; + } + } + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java index 3bca36cdd..c6ddf9f40 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerGamePacketListenerImplMixin.java @@ -1,50 +1,34 @@ package org.vivecraft.mixin.server; import net.minecraft.network.Connection; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.PacketUtils; -import net.minecraft.network.protocol.game.ServerGamePacketListener; -import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.CommonListenerCookie; +import net.minecraft.server.network.ServerCommonPacketListenerImpl; import net.minecraft.server.network.ServerGamePacketListenerImpl; -import net.minecraft.server.network.ServerPlayerConnection; -import org.spongepowered.asm.mixin.Final; 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.vivecraft.common.network.CommonNetworkHelper; -import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; import org.vivecraft.server.AimFixHandler; import org.vivecraft.server.ServerNetworking; import org.vivecraft.server.ServerVRPlayers; import org.vivecraft.server.config.ServerConfig; -import static org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators.CLIMBING; - @Mixin(ServerGamePacketListenerImpl.class) -public abstract class ServerGamePacketListenerImplMixin implements ServerPlayerConnection, ServerGamePacketListener { - - @Shadow - @Final - private Connection connection; - - @Shadow - @Final - private MinecraftServer server; +public abstract class ServerGamePacketListenerImplMixin extends ServerCommonPacketListenerImpl { @Shadow public ServerPlayer player; - @Shadow - private int aboveGroundTickCount; + public ServerGamePacketListenerImplMixin(MinecraftServer minecraftServer, Connection connection, CommonListenerCookie commonListenerCookie) { + super(minecraftServer, connection, commonListenerCookie); + } - @Inject(at = @At("TAIL"), method = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V") - public void vivecraft$init(MinecraftServer minecraftServer, Connection connection, ServerPlayer serverPlayer, CallbackInfo info) { + @Inject(at = @At("TAIL"), method = "") + public void vivecraft$init(MinecraftServer minecraftServer, Connection connection, ServerPlayer serverPlayer, CommonListenerCookie commonListenerCookie, CallbackInfo ci) { // Vivecraft if (this.connection.channel != null && this.connection.channel.pipeline().get("packet_handler") != null) { //fake player fix this.connection.channel.pipeline().addBefore("packet_handler", "vr_aim_fix", @@ -57,21 +41,6 @@ public abstract class ServerGamePacketListenerImplMixin implements ServerPlayerC ServerNetworking.sendVrPlayerStateToClients(this.player); } - @Inject(at = @At("TAIL"), method = "handleCustomPayload(Lnet/minecraft/network/protocol/game/ServerboundCustomPayloadPacket;)V") - public void vivecraft$handleVivecraftPackets(ServerboundCustomPayloadPacket pPacket, CallbackInfo info) { - FriendlyByteBuf buffer = pPacket.getData(); - ResourceLocation channelID = pPacket.getIdentifier(); - - if (channelID.equals(CommonNetworkHelper.CHANNEL)) { - PacketUtils.ensureRunningOnSameThread(pPacket, this, this.player.serverLevel()); - PacketDiscriminators packetDiscriminator = PacketDiscriminators.values()[buffer.readByte()]; - ServerNetworking.handlePacket(packetDiscriminator, buffer, (ServerGamePacketListenerImpl) (Object) this); - if (packetDiscriminator == CLIMBING) { - this.aboveGroundTickCount = 0; - } - } - } - @Inject(at = @At("TAIL"), method = "onDisconnect") public void vivecraft$doLeaveMessage(Component component, CallbackInfo ci) { if (ServerConfig.messagesEnabled.get()) { diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java b/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java index 0d110457c..4e81321e0 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/ServerPlayerMixin.java @@ -176,39 +176,48 @@ protected void triggerItemUseEffects(ItemStack pStack, int pCount) { thisVive = new ServerVivePlayer((ServerPlayer) (Object) this); } + boolean blockedDamage = false; + String blockedDamageCase = ""; + if ((!otherVive.isVR() && thisVive.isVR() && thisVive.isSeated()) || (!thisVive.isVR() && otherVive.isVR() && otherVive.isSeated())) { // nonvr vs Seated if (!ServerConfig.pvpSEATEDVRvsNONVR.get()) { - this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs seat"), false); - cir.setReturnValue(false); + blockedDamage = true; + blockedDamageCase = "canceled nonvr vs seated VR damage"; } } else if ((!otherVive.isVR() && thisVive.isVR() && !thisVive.isSeated()) || (!thisVive.isVR() && otherVive.isVR() && !otherVive.isSeated())) { // nonvr vs Standing if (!ServerConfig.pvpVRvsNONVR.get()) { - this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled non vs stand"), false); - cir.setReturnValue(false); + blockedDamage = true; + blockedDamageCase = "canceled nonvr vs standing VR damage"; } } else if ((otherVive.isVR() && otherVive.isSeated() && thisVive.isVR() && !thisVive.isSeated()) || (thisVive.isVR() && thisVive.isSeated() && otherVive.isVR() && !otherVive.isSeated())) { // Standing vs Seated if (!ServerConfig.pvpVRvsSEATEDVR.get()) { - this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs stand"), false); - cir.setReturnValue(false); + blockedDamage = true; + blockedDamageCase = "canceled seated VR vs standing VR damage"; } } else if (otherVive.isVR() && !otherVive.isSeated() && thisVive.isVR() && !thisVive.isSeated()) { // Standing vs Standing if (!ServerConfig.pvpVRvsVR.get()) { - this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled stand vs stand"), false); - cir.setReturnValue(false); + blockedDamage = true; + blockedDamageCase = "canceled standing VR vs standing VR damage"; } } else if (otherVive.isVR() && otherVive.isSeated() && thisVive.isVR() && thisVive.isSeated()) { // Seated vs Seated if (!ServerConfig.pvpSEATEDVRvsSEATEDVR.get()) { - this.server.getPlayerList().broadcastSystemMessage(Component.literal("canceled seat vs seat"), false); - cir.setReturnValue(false); + blockedDamage = true; + blockedDamageCase = "canceled seated VR vs seated VR damage"; + } + } + if (blockedDamage) { + if (ServerConfig.pvpNotifyBlockedDamage.get()) { + other.sendSystemMessage(Component.literal(blockedDamageCase)); } + cir.setReturnValue(false); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java b/common/src/main/java/org/vivecraft/mixin/server/players/PlayerListMixin.java similarity index 54% rename from common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java rename to common/src/main/java/org/vivecraft/mixin/server/players/PlayerListMixin.java index 3f5553415..0934830c3 100644 --- a/common/src/main/java/org/vivecraft/mixin/server/ServerLoginPacketListenerImplMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/server/players/PlayerListMixin.java @@ -1,18 +1,20 @@ -package org.vivecraft.mixin.server; +package org.vivecraft.mixin.server.players; +import net.minecraft.network.Connection; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.network.ServerLoginPacketListenerImpl; +import net.minecraft.server.network.CommonListenerCookie; +import net.minecraft.server.players.PlayerList; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.vivecraft.server.ServerUtil; -@Mixin(ServerLoginPacketListenerImpl.class) -public class ServerLoginPacketListenerImplMixin { +@Mixin(PlayerList.class) +public class PlayerListMixin { @Inject(at = @At("HEAD"), method = "placeNewPlayer") - private void vivecraft$scheduleLoginMessages(ServerPlayer serverPlayer, CallbackInfo ci) { + private void vivecraft$scheduleLoginMessages(Connection connection, ServerPlayer serverPlayer, CommonListenerCookie commonListenerCookie, CallbackInfo ci) { ServerUtil.scheduleWelcomeMessageOrKick(serverPlayer); ServerUtil.sendUpdateNotificationIfOP(serverPlayer); } diff --git a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java index 5da7ee4f0..efa7c902c 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/item/crafting/ShapedRecipeMixin.java @@ -1,60 +1,17 @@ package org.vivecraft.mixin.world.item.crafting; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.item.Item; +import com.mojang.serialization.Codec; import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.vivecraft.common.CustomShapedRecipe; -@Mixin(net.minecraft.world.item.crafting.ShapedRecipe.class) -public class ShapedRecipeMixin { - @Inject(method = "itemFromJson", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/DefaultedRegistry;getOptional(Lnet/minecraft/resources/ResourceLocation;)Ljava/util/Optional;", shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) - private static void vivecraft$getVivecraftVanillaItemInject(JsonObject jsonObject, CallbackInfoReturnable cir, String resourceLocation) { - if (resourceLocation.startsWith("vivecraft")) { - cir.setReturnValue(vivecraft$getVivecraftVanillaItem(jsonObject, resourceLocation)); - } - } - - @Unique - private static Item vivecraft$getVivecraftVanillaItem(JsonObject jsonObject, String resourceLocation) { - String vanillaItem = GsonHelper.getAsString(jsonObject, "vanillaitem"); - return BuiltInRegistries.ITEM.getOptional(new ResourceLocation(vanillaItem)).orElseThrow(() -> new JsonSyntaxException("Unknown item '" + vanillaItem + "'")); - } - - @Inject(method = "itemStackFromJson", at = @At("HEAD"), cancellable = true) - private static void vivecraft$customizeVanillaItemStackFabric(JsonObject jsonObject, CallbackInfoReturnable cir) { - if (GsonHelper.getAsString(jsonObject, "item").startsWith("vivecraft")) { - Item vanillaItem = vivecraft$getVivecraftVanillaItem(jsonObject, GsonHelper.getAsString(jsonObject, "item")); - cir.setReturnValue(vivecraft$customizeVanillaItemStack(jsonObject, vanillaItem)); - } - } - - @Unique - private static ItemStack vivecraft$customizeVanillaItemStack(JsonObject jsonObject, Item vanillaItem) { - if (jsonObject.has("data")) { - throw new JsonParseException("Disallowed data tag found"); - } else { - int i = GsonHelper.getAsInt(jsonObject, "count", 1); - if (i < 1) { - throw new JsonSyntaxException("Invalid output count: " + i); - } else { - ItemStack itemStack = new ItemStack(vanillaItem, i); - itemStack.setHoverName(Component.translatable(jsonObject.get("name").getAsString())); - itemStack.getOrCreateTag().putBoolean("Unbreakable", GsonHelper.getAsBoolean(jsonObject, "unbreakable", false)); - itemStack.getOrCreateTag().putInt("HideFlags", GsonHelper.getAsInt(jsonObject, "hideflags", 0)); - return itemStack; - } - } +@Mixin(targets = "net.minecraft.world.item.crafting.ShapedRecipe$Serializer$RawShapedRecipe") +public abstract class ShapedRecipeMixin { + @Redirect(at = @At(value = "FIELD", target = "Lnet/minecraft/world/item/crafting/CraftingRecipeCodecs;ITEMSTACK_OBJECT_CODEC:Lcom/mojang/serialization/Codec;"), method = "method_53750") + private static Codec vivecraft$handleVivecraftRecipe() { + // CODEC needs to be external, or it isn't initialized, when the other static codec want's to access it + return CustomShapedRecipe.CODEC; } } diff --git a/common/src/main/java/org/vivecraft/server/ServerNetworking.java b/common/src/main/java/org/vivecraft/server/ServerNetworking.java index 78da318b3..f7ca7daeb 100644 --- a/common/src/main/java/org/vivecraft/server/ServerNetworking.java +++ b/common/src/main/java/org/vivecraft/server/ServerNetworking.java @@ -3,7 +3,7 @@ import io.netty.buffer.Unpooled; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; @@ -15,6 +15,7 @@ import org.vivecraft.common.network.CommonNetworkHelper; import org.vivecraft.common.network.CommonNetworkHelper.PacketDiscriminators; import org.vivecraft.common.network.VRPlayerState; +import org.vivecraft.common.network.packets.VivecraftDataPacket; import org.vivecraft.mixin.server.ChunkMapAccessor; import org.vivecraft.server.config.ServerConfig; @@ -228,7 +229,7 @@ public static ClientboundCustomPayloadPacket createVRActivePlayerPacket(boolean buffer.writeByte(PacketDiscriminators.IS_VR_ACTIVE.ordinal()); buffer.writeBoolean(vrActive); buffer.writeUUID(playerID); - return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); + return new ClientboundCustomPayloadPacket(new VivecraftDataPacket(buffer)); } public static ClientboundCustomPayloadPacket createUberPacket(Player player, VRPlayerState vrPlayerState, float worldScale, float heightScale) { @@ -238,14 +239,14 @@ public static ClientboundCustomPayloadPacket createUberPacket(Player player, VRP vrPlayerState.serialize(buffer); buffer.writeFloat(worldScale); buffer.writeFloat(heightScale); - return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, buffer); + return new ClientboundCustomPayloadPacket(new VivecraftDataPacket(buffer)); } public static ClientboundCustomPayloadPacket getVivecraftServerPacket(PacketDiscriminators command, byte[] payload) { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeBytes(payload); - return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, friendlybytebuf); + return new ClientboundCustomPayloadPacket(new VivecraftDataPacket(friendlybytebuf)); } public static ClientboundCustomPayloadPacket getClimbeyServerPacket() { @@ -265,14 +266,14 @@ public static ClientboundCustomPayloadPacket getClimbeyServerPacket() { // no block list friendlybytebuf.writeByte(0); } - return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, friendlybytebuf); + return new ClientboundCustomPayloadPacket(new VivecraftDataPacket(friendlybytebuf)); } public static ClientboundCustomPayloadPacket getVivecraftServerPacket(PacketDiscriminators command, String payload) { FriendlyByteBuf friendlybytebuf = new FriendlyByteBuf(Unpooled.buffer()); friendlybytebuf.writeByte(command.ordinal()); friendlybytebuf.writeUtf(payload); - return new ClientboundCustomPayloadPacket(CommonNetworkHelper.CHANNEL, friendlybytebuf); + return new ClientboundCustomPayloadPacket(new VivecraftDataPacket(friendlybytebuf)); } public static void sendVrPlayerStateToClients(ServerPlayer vrPlayerEntity) { diff --git a/common/src/main/java/org/vivecraft/server/config/ServerConfig.java b/common/src/main/java/org/vivecraft/server/config/ServerConfig.java index f11435cec..953f375c5 100644 --- a/common/src/main/java/org/vivecraft/server/config/ServerConfig.java +++ b/common/src/main/java/org/vivecraft/server/config/ServerConfig.java @@ -47,6 +47,7 @@ public class ServerConfig { public static BooleanValue pvpVRvsNONVR; public static BooleanValue pvpSEATEDVRvsNONVR; public static BooleanValue pvpVRvsSEATEDVR; + public static BooleanValue pvpNotifyBlockedDamage; public static BooleanValue climbeyEnabled; public static InListValue climbeyBlockmode; @@ -206,6 +207,10 @@ private static void fixConfig(CommentedConfig config, CorrectionListener listene builder .push("pvp") .comment("VR vs. non-VR vs. seated player PVP settings"); + pvpNotifyBlockedDamage = builder + .push("notifyBlockedDamage") + .comment("Notifies the player that would cause damage, that it was blocked.") + .define(false); pvpVRvsVR = builder .push("VRvsVR") .comment("Allows Standing VR players to damage each other.") diff --git a/common/src/main/resources/vivecraft.accesswidener b/common/src/main/resources/vivecraft.accesswidener index 1d61305e9..866b61e0e 100644 --- a/common/src/main/resources/vivecraft.accesswidener +++ b/common/src/main/resources/vivecraft.accesswidener @@ -82,7 +82,7 @@ accessible field net/minecraft/world/item/CreativeModeTabs TOOLS_AND_UTILITIES L accessible field net/minecraft/world/item/CreativeModeTabs FOOD_AND_DRINKS Lnet/minecraft/resources/ResourceKey; # to render crosshair -accessible field net/minecraft/client/gui/Gui GUI_ICONS_LOCATION Lnet/minecraft/resources/ResourceLocation; +accessible field net/minecraft/client/gui/Gui CROSSHAIR_SPRITE Lnet/minecraft/resources/ResourceLocation; # for menuworlds accessible field net/minecraft/client/multiplayer/ClientLevel$ClientLevelData isFlat Z @@ -91,3 +91,9 @@ accessible class net/minecraft/world/level/biome/Biome$ClimateSettings accessible field net/minecraft/world/level/biome/AmbientParticleSettings probability F extendable class net/minecraft/world/level/material/FluidState accessible field net/minecraft/world/level/block/state/StateHolder propertiesCodec Lcom/mojang/serialization/MapCodec; + +# to spawn brush particles +accessible method net/minecraft/world/item/BrushItem spawnDustParticles (Lnet/minecraft/world/level/Level;Lnet/minecraft/world/phys/BlockHitResult;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/phys/Vec3;Lnet/minecraft/world/entity/HumanoidArm;)V + +# do not kick climbing players +accessible field net/minecraft/server/network/ServerGamePacketListenerImpl aboveGroundTickCount I diff --git a/common/src/main/resources/vivecraft.mixins.json b/common/src/main/resources/vivecraft.mixins.json index fdf23d1d5..6a91a5cb1 100644 --- a/common/src/main/resources/vivecraft.mixins.json +++ b/common/src/main/resources/vivecraft.mixins.json @@ -38,6 +38,7 @@ "client_vr.gui.screens.inventory.AbstractSignEditScreenVRMixin", "client_vr.gui.screens.inventory.BookEditScreenVRMixin", "client_vr.gui.screens.inventory.CreativeModeInventoryScreenVRMixin", + "client_vr.multiplayer.ClientCommonPacketListenerImplVRMixin", "client_vr.multiplayer.ClientPacketListenerVRMixin", "client_vr.multiplayer.MultiPlayerGameModeVRMixin", "client_vr.particle.ItemPickupParticleVRMixin", @@ -70,12 +71,15 @@ ], "minVersion": "0.8.4", "mixins": [ + "network.ClientboundCustomPayloadPacketMixin", + "network.ServerboundCustomPayloadPacketMixin", "server.ChunkMapAccessor", "server.MinecraftServerMixin", + "server.ServerCommonPacketListenerImplMixin", "server.ServerGamePacketListenerImplMixin", - "server.ServerLoginPacketListenerImplMixin", "server.ServerPlayerMixin", "server.TrackedEntityAccessor", + "server.players.PlayerListMixin", "world.entity.ai.goal.SwellGoalMixin", "world.entity.monster.EndermanFreezeWhenLookedAtMixin", "world.entity.monster.EndermanMixin", diff --git a/common/src/main/resources/vivecraft.optifine.mixins.json b/common/src/main/resources/vivecraft.optifine.mixins.json index d9290efd5..528162e66 100644 --- a/common/src/main/resources/vivecraft.optifine.mixins.json +++ b/common/src/main/resources/vivecraft.optifine.mixins.json @@ -1,5 +1,5 @@ { - "required": true, + "required": false, "package": "org.vivecraft.mod_compat_vr.optifine.mixin", "plugin": "org.vivecraft.MixinConfig", "compatibilityLevel": "JAVA_17", diff --git a/fabric/build.gradle b/fabric/build.gradle index 21c35a382..00480662d 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -29,41 +29,41 @@ dependencies { modApi("dev.architectury:architectury-fabric:${rootProject.architectury_version}") // for sodium compat - modRuntimeOnly "maven.modrinth:sodium:mc1.20.1-0.5.2" + modRuntimeOnly "maven.modrinth:sodium:mc1.20.2-0.5.3" // for iris compat - modRuntimeOnly "maven.modrinth:iris:1.6.8+1.20.1" + modRuntimeOnly "maven.modrinth:iris:1.6.9+1.20.2" modRuntimeOnly 'org.anarres:jcpp:1.4.14' //temp iris modRuntimeOnly 'io.github.douira:glsl-transformer:2.0.0-pre13' //temp iris // for REI compat - modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:12.0.634" + modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:13.0.661" // for Pehkui compat - modRuntimeOnly("com.github.Virtuoel:Pehkui:3.7.7", { exclude group: "net.fabricmc.fabric-api" }) + modCompileOnly("com.github.Virtuoel:Pehkui:3.7.7", { exclude group: "net.fabricmc.fabric-api" }) // other mods // modRuntimeOnly("com.simibubi.create:create-fabric-1.19.2:0.5.0.i-969+1.19.2") - modCompileOnly "maven.modrinth:lithium:mc1.20.1-0.11.2" - modCompileOnly "maven.modrinth:indium:1.0.21+mc1.20.1" + modCompileOnly "maven.modrinth:lithium:mc1.20.2-0.12.0" + modCompileOnly "maven.modrinth:indium:1.0.27+mc1.20.1" //mod menu - modApi("com.terraformersmc:modmenu:7.2.2") + modApi("com.terraformersmc:modmenu:8.0.0") // for immersive portals compat - modRuntimeOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v3.3.1-mc1.20.1') { + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:v3.3.1-mc1.20.1') { exclude(group: "net.fabricmc.fabric-api") transitive(false) } - modRuntimeOnly('com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:v3.3.1-mc1.20.1') { + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:v3.3.1-mc1.20.1') { exclude(group: "net.fabricmc.fabric-api") transitive(false) } - modRuntimeOnly('com.github.iPortalTeam.ImmersivePortalsMod:build:v3.3.1-mc1.20.1') { + modCompileOnly('com.github.iPortalTeam.ImmersivePortalsMod:build:v3.3.1-mc1.20.1') { exclude(group: "net.fabricmc.fabric-api") transitive(false) } - modRuntimeOnly("com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9") + modCompileOnly("com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9") // needed for resource loading include(modImplementation(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version))) diff --git a/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java b/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java index 5ea47dc49..278d374c1 100644 --- a/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java +++ b/fabric/src/main/java/org/vivecraft/client/fabric/XplatImpl.java @@ -4,9 +4,14 @@ import net.fabricmc.api.EnvType; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.FluidTags; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; @@ -96,4 +101,20 @@ public static ClimateSettings getBiomeClimateSettings(Biome biome) { public static BiomeSpecialEffects getBiomeEffects(Biome biome) { return biome.getSpecialEffects(); } + + public static void addNetworkChannel(ClientPacketListener listener, ResourceLocation resourceLocation) { + listener.send(new ServerboundCustomPayloadPacket(new CustomPacketPayload() { + public static final ResourceLocation ID = new ResourceLocation("minecraft:register"); + + @Override + public void write(FriendlyByteBuf friendlyByteBuf) { + friendlyByteBuf.writeBytes(resourceLocation.toString().getBytes()); + } + + @Override + public ResourceLocation id() { + return ID; + } + })); + } } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 737ba5bdb..2fdd24c12 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -41,7 +41,7 @@ ], "depends": { "fabricloader": ">=0.14.14", - "minecraft": ["1.20", "1.20.1"], + "minecraft": ["1.20.2"], "java": ">=17" }, "suggests": { diff --git a/forge/build.gradle b/forge/build.gradle index 875c53b46..a65f6cf6b 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -47,8 +47,8 @@ dependencies { common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } - modRuntimeOnly("maven.modrinth:rubidium:0.6.5") - modRuntimeOnly("maven.modrinth:oculus:1.20-1.6.4") + modCompileOnly("maven.modrinth:rubidium:0.6.5") + modCompileOnly("maven.modrinth:oculus:1.20-1.6.4") forgeRuntimeLibrary("org.lwjgl:lwjgl-openvr:3.3.1") forgeRuntimeLibrary("org.lwjgl:lwjgl-openvr:3.3.1:natives-linux") diff --git a/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java b/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java index 82d935eee..9f2fc9a25 100644 --- a/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java +++ b/forge/src/main/java/org/vivecraft/client/forge/XplatImpl.java @@ -1,8 +1,10 @@ package org.vivecraft.client.forge; import com.mojang.blaze3d.pipeline.RenderTarget; +import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome.ClimateSettings; @@ -14,6 +16,7 @@ import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; +import net.minecraftforge.network.ChannelListManager; import java.nio.file.Path; @@ -78,4 +81,8 @@ public static ClimateSettings getBiomeClimateSettings(Biome biome) { public static BiomeSpecialEffects getBiomeEffects(Biome biome) { return biome.getModifiedSpecialEffects(); } + + public static void addNetworkChannel(ClientPacketListener listener, ResourceLocation resourceLocation) { + ChannelListManager.addChannels(listener.getConnection(), resourceLocation); + } } diff --git a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java index 9e021167e..82b9f0e9f 100644 --- a/forge/src/main/java/org/vivecraft/forge/Vivecraft.java +++ b/forge/src/main/java/org/vivecraft/forge/Vivecraft.java @@ -1,6 +1,5 @@ package org.vivecraft.forge; -import net.minecraftforge.client.ConfigScreenHandler; import net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; diff --git a/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java b/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java index 3036aa800..7ae37d887 100644 --- a/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java +++ b/forge/src/main/java/org/vivecraft/forge/mixin/network/ForgeOpenContainerVRMixin.java @@ -1,19 +1,17 @@ package org.vivecraft.forge.mixin.network; -import net.minecraftforge.network.NetworkEvent.Context; -import net.minecraftforge.network.PlayMessages.OpenContainer; +import net.minecraftforge.event.network.CustomPayloadEvent.Context; +import net.minecraftforge.network.packets.OpenContainer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.vivecraft.client_vr.gameplay.screenhandlers.GuiHandler; -import java.util.function.Supplier; - @Mixin(OpenContainer.class) public class ForgeOpenContainerVRMixin { @Inject(at = @At("HEAD"), method = "handle", remap = false) - private static void markScreenActiveForge(OpenContainer msg, Supplier ctx, CallbackInfo ci) { + private static void markScreenActiveForge(OpenContainer msg, Context ctx, CallbackInfo ci) { GuiHandler.guiAppearOverBlockActive = true; } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index c89ab8cb8..afc3a1015 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader = "javafml" -loaderVersion = "[46,48)" +loaderVersion = "[48,)" issueTrackerURL = "https://github.com/Vivecraft/VivecraftMod/issues" license = "LGPLv3" @@ -23,13 +23,13 @@ updateJSONURL = "https://raw.githubusercontent.com/Vivecraft/VivecraftMod/forge- [[dependencies.vivecraft]] modId = "forge" mandatory = true -versionRange = "[46,48)" +versionRange = "[48,)" ordering = "NONE" side = "BOTH" [[dependencies.vivecraft]] modId = "minecraft" mandatory = true -versionRange = "[1.20,1.20.1]" +versionRange = "[1.20.2]" ordering = "NONE" side = "BOTH" diff --git a/gradle.properties b/gradle.properties index 8f6a9b229..ab37a000e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx4G -minecraft_version=1.20.1 +minecraft_version=1.20.2 enabled_platforms=fabric,forge archives_base_name=vivecraft @@ -10,9 +10,9 @@ maven_group=org.vivecraft architectury_version=9.0.5 fabric_loader_version=0.14.21 -fabric_api_version=0.87.0+1.20.1 +fabric_api_version=0.89.2+1.20.2 -forge_version=1.20.1-47.1.43 +forge_version=1.20.2-48.0.10 From 4d7ace7b8cebe8492130a7f2570835602bd557fb Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:47:43 -0700 Subject: [PATCH 04/12] cleanup accesswidener --- .../mixin/client_vr/KeyMappingVRMixin.java | 23 +++++++++++ .../mixin/client_vr/MinecraftVRMixin.java | 38 ++++++++++--------- .../mixin/client_vr/OptionsVRMixin.java | 4 +- .../platform/GlStateManagerVRMixin.java | 8 +++- ...ClientCommonPacketListenerImplVRMixin.java | 9 +++-- .../optifine/mixin/ShadersRenderVRMixin.java | 4 +- .../main/resources/vivecraft.accesswidener | 10 +---- .../src/main/resources/vivecraft.mixins.json | 1 + 8 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java new file mode 100644 index 000000000..abd300fc1 --- /dev/null +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java @@ -0,0 +1,23 @@ +package org.vivecraft.mixin.client_vr; + +import net.minecraft.client.KeyMapping; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.Map; + +@Mixin(KeyMapping.class) +public abstract class KeyMappingVRMixin { + + @Final + @Shadow + private static Map CATEGORY_SORT_ORDER; + + // inject custom controls categories + static { + CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", 8); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", 9); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", 10); + } +} diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index fbaa82af4..e55f71a60 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -43,10 +43,7 @@ import org.joml.Vector3f; import org.lwjgl.opengl.GL11C; import org.lwjgl.opengl.GL13C; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -162,6 +159,11 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Final private ReloadableResourceManager resourceManager; + @Mutable + @Final + @Shadow + private RenderTarget mainRenderTarget; + @Shadow protected abstract void renderFpsMeter(GuiGraphics guiGraphics, ProfileResults profileResults); @@ -328,8 +330,8 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { RenderPassManager.setGUIRenderPass(); RenderSystem.depthMask(true); RenderSystem.colorMask(true, true, true, true); - mc.mainRenderTarget.clear(ON_OSX); - mc.mainRenderTarget.bindWrite(true); + this.mainRenderTarget.clear(ON_OSX); + this.mainRenderTarget.bindWrite(true); // draw screen/gui to buffer RenderSystem.getModelViewStack().pushPose(); @@ -369,26 +371,26 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { // generate mipmaps // TODO: does this do anything? - mc.mainRenderTarget.bindRead(); - ((RenderTargetExtension) mc.mainRenderTarget).vivecraft$genMipMaps(); - mc.mainRenderTarget.unbindRead(); + this.mainRenderTarget.bindRead(); + ((RenderTargetExtension) this.mainRenderTarget).vivecraft$genMipMaps(); + this.mainRenderTarget.unbindRead(); this.profiler.popPush("2D Keyboard"); float actualPartialTicks = this.pause ? this.pausePartialTick : this.timer.partialTick; GuiGraphics guiGraphics = new GuiGraphics(mc, this.renderBuffers.bufferSource()); if (KeyboardHandler.isShowing() && !dh.vrSettings.physicalKeyboard) { - mc.mainRenderTarget = KeyboardHandler.Framebuffer; - mc.mainRenderTarget.clear(ON_OSX); - mc.mainRenderTarget.bindWrite(true); + this.mainRenderTarget = KeyboardHandler.Framebuffer; + this.mainRenderTarget.clear(ON_OSX); + this.mainRenderTarget.bindWrite(true); RenderHelper.drawScreen(actualPartialTicks, KeyboardHandler.UI, guiGraphics); guiGraphics.flush(); } this.profiler.popPush("Radial Menu"); if (RadialHandler.isShowing()) { - mc.mainRenderTarget = RadialHandler.Framebuffer; - mc.mainRenderTarget.clear(ON_OSX); - mc.mainRenderTarget.bindWrite(true); + this.mainRenderTarget = RadialHandler.Framebuffer; + this.mainRenderTarget.clear(ON_OSX); + this.mainRenderTarget.bindWrite(true); RenderHelper.drawScreen(actualPartialTicks, RadialHandler.UI, guiGraphics); guiGraphics.flush(); } @@ -424,7 +426,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { this.profiler.push("Eye:" + renderpass); this.profiler.push("setup"); - mc.mainRenderTarget.bindWrite(true); + this.mainRenderTarget.bindWrite(true); this.profiler.pop(); VRPassHelper.renderSingleView(renderpass, actualPartialTicks, nanoTime, renderLevel); this.profiler.pop(); @@ -445,11 +447,11 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { } } ) { - mc.mainRenderTarget.unbindWrite(); + this.mainRenderTarget.unbindWrite(); takeScreenshot( renderpass == RenderPass.CAMERA ? dh.vrRenderer.cameraFramebuffer : - mc.mainRenderTarget + this.mainRenderTarget ); this.window.updateDisplay(); dh.grabScreenShot = false; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java index 28abb55b8..9efacc2e3 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/OptionsVRMixin.java @@ -29,11 +29,9 @@ public abstract class OptionsVRMixin { void processOptionsMixin(Options instance, KeyMapping[] keyMappings, Operation original) { if (keyMappings != null) { if (keyMappings.length > 0) { + // inject custom key mappings keyMappings = Stream.concat(Arrays.stream(keyMappings), userKeyBindingSet.stream()).toArray(KeyMapping[]::new); vanillaBindingSet.addAll(Arrays.asList(keyMappings)); - KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", 8); - KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", 9); - KeyMapping.CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", 10); original.call(instance, keyMappings); } else { throw new MissingResourceException( diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java index 32605c5cd..cf639426b 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/blaze3d/platform/GlStateManagerVRMixin.java @@ -1,19 +1,25 @@ package org.vivecraft.mixin.client_vr.blaze3d.platform; +import com.mojang.blaze3d.platform.GlStateManager.BlendState; import com.mojang.blaze3d.platform.GlStateManager.DestFactor; import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import com.mojang.blaze3d.systems.RenderSystem; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; -import static com.mojang.blaze3d.platform.GlStateManager.BLEND; import static com.mojang.blaze3d.platform.GlStateManager.glBlendFuncSeparate; @Mixin(com.mojang.blaze3d.platform.GlStateManager.class) public class GlStateManagerVRMixin { + @Final + @Shadow + public static BlendState BLEND; + //Change the limit of textures to 32 @ModifyArg(at = @At(value = "INVOKE", target = "Ljava/util/stream/IntStream;range(II)Ljava/util/stream/IntStream;"), index = 1, method = "") private static int vivecraft$size(int i) { diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java index 6d886ac08..2d9ebab4c 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientCommonPacketListenerImplVRMixin.java @@ -6,20 +6,21 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.VRState; import org.vivecraft.common.VRServerPerms; +import static org.vivecraft.client_vr.VRState.dh; + @Mixin(ClientCommonPacketListenerImpl.class) public class ClientCommonPacketListenerImplVRMixin { @Inject(at = @At("TAIL"), method = "onDisconnect") public void vivecraft$disconnect(Component component, CallbackInfo ci) { - VRServerPerms.INSTANCE.setTeleportSupported(false); + VRServerPerms.setTeleportSupported(false); if (VRState.vrInitialized) { - ClientDataHolderVR.getInstance().vrPlayer.setTeleportOverride(false); + dh.vrPlayer.setTeleportOverride(false); } - ClientDataHolderVR.getInstance().vrSettings.overrides.resetAll(); + dh.vrSettings.overrides.resetAll(); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java index e4c652509..660cf39c4 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersRenderVRMixin.java @@ -70,7 +70,7 @@ public static void updateActiveRenderInfo(Camera activeRenderInfo, net.minecraft @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = Shift.BEFORE), ordinal = 0, method = "renderShadowMap", remap = false) private static Entity vivecraft$fixPlayerPos(Entity entity, GameRenderer gameRenderer, Camera activeRenderInfo) { - if (!RenderPassType.isVanilla() && entity == activeRenderInfo.entity) { + if (!RenderPassType.isVanilla() && entity == activeRenderInfo.getEntity()) { ((GameRendererExtension) gameRenderer).vivecraft$restoreRVEPos((LivingEntity) entity); } return entity; @@ -78,7 +78,7 @@ public static void updateActiveRenderInfo(Camera activeRenderInfo, net.minecraft @ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/LevelRenderer;renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V", remap = true, shift = Shift.AFTER), ordinal = 0, method = "renderShadowMap", remap = false) private static Entity vivecraft$restorePlayerPos(Entity entity, GameRenderer gameRenderer, Camera activeRenderInfo) { - if (!RenderPassType.isVanilla() && entity == activeRenderInfo.entity) { + if (!RenderPassType.isVanilla() && entity == activeRenderInfo.getEntity()) { ((GameRendererExtension) gameRenderer).vivecraft$cacheRVEPos((LivingEntity) entity); ((GameRendererExtension) gameRenderer).vivecraft$setupRVE(); } diff --git a/common/src/main/resources/vivecraft.accesswidener b/common/src/main/resources/vivecraft.accesswidener index 866b61e0e..4f54df7b5 100644 --- a/common/src/main/resources/vivecraft.accesswidener +++ b/common/src/main/resources/vivecraft.accesswidener @@ -28,7 +28,7 @@ accessible field net/minecraft/network/Connection channel Lio/netty/channel/Chan # for quicktorch accessible method net/minecraft/client/Minecraft startUseItem ()V -# to switch rendrtargetrs for VR passes +# to switch render targets for VR passes in VRRenderer and RenderPassManager mutable field net/minecraft/client/Minecraft mainRenderTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; accessible field net/minecraft/client/Minecraft mainRenderTarget Lcom/mojang/blaze3d/pipeline/RenderTarget; @@ -39,17 +39,9 @@ accessible field net/minecraft/client/Camera entity Lnet/minecraft/world/entity/ accessible field net/minecraft/client/Camera xRot F accessible field net/minecraft/client/Camera yRot F -# to set reset camera before tick -accessible method net/minecraft/client/Camera setPosition (Lnet/minecraft/world/phys/Vec3;)V - # for pausemenu buttons accessible method net/minecraft/client/Minecraft isMultiplayerServer ()Z -# to add custom key mappings -mutable field net/minecraft/client/Options keyMappings [Lnet/minecraft/client/KeyMapping; -# to add custom controls categories -accessible field net/minecraft/client/KeyMapping CATEGORY_SORT_ORDER Ljava/util/Map; -mutable field net/minecraft/client/KeyMapping CATEGORY_SORT_ORDER Ljava/util/Map; # to check key inputs accessible field net/minecraft/client/KeyMapping clickCount I accessible method net/minecraft/client/KeyMapping release ()V diff --git a/common/src/main/resources/vivecraft.mixins.json b/common/src/main/resources/vivecraft.mixins.json index 6a91a5cb1..6c725a98e 100644 --- a/common/src/main/resources/vivecraft.mixins.json +++ b/common/src/main/resources/vivecraft.mixins.json @@ -17,6 +17,7 @@ "client_vr.ClientBrandRetrieverVRMixin", "client_vr.KeyboardHandlerVRMixin", "client_vr.KeyboardInputVRMixin", + "client_vr.KeyMappingVRMixin", "client_vr.MinecraftVRMixin", "client_vr.MouseHandlerVRMixin", "client_vr.OptionsVRMixin", From 2360c29939acd1045e41f02806e23d997d3a9bd2 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:03:11 -0700 Subject: [PATCH 05/12] revert RenderPass.VANILLA no longer needed --- .../org/vivecraft/client/VivecraftVRMod.java | 42 ++++++++++++++++++- .../client_vr/ClientDataHolderVR.java | 5 +-- .../client_vr/provider/HandedKeyBinding.java | 4 +- .../vivecraft/client_vr/provider/MCVR.java | 20 +++++++++ .../provider/openvr_lwjgl/VRInputAction.java | 5 ++- .../client_vr/render/RenderPass.java | 3 +- .../render_pass/RenderPassManager.java | 2 +- .../mixin/client_vr/KeyMappingVRMixin.java | 1 + .../mixin/IrisPipelineManagerVRMixin.java | 2 +- .../assets/vivecraft/lang/en_us.json | 1 + 10 files changed, 72 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java index b988008b9..b4878b310 100644 --- a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java +++ b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java @@ -42,6 +42,26 @@ public class VivecraftVRMod { public static final KeyMapping keyToggleMovement = new KeyMapping("vivecraft.key.toggleMovement", GLFW_KEY_UNKNOWN, "key.categories.movement"); public static final KeyMapping keyTogglePlayerList = new KeyMapping("vivecraft.key.togglePlayerList", GLFW_KEY_UNKNOWN, "key.categories.multiplayer"); public static final HandedKeyBinding keyTrackpadTouch = new HandedKeyBinding("vivecraft.key.trackpadTouch", GLFW_KEY_UNKNOWN, "key.categories.misc"); + public static final HandedKeyBinding keyCurlMainThumb = new HandedKeyBinding("vivecraft.key.mainThumb", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlMainIndex = new HandedKeyBinding("vivecraft.key.mainIndex", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlMainMiddle = new HandedKeyBinding("vivecraft.key.mainMiddle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlMainRing = new HandedKeyBinding("vivecraft.key.mainRing", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlMainLittle = new HandedKeyBinding("vivecraft.key.mainLittle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlOffThumb = new HandedKeyBinding("vivecraft.key.offThumb", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlOffIndex = new HandedKeyBinding("vivecraft.key.offIndex", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlOffMiddle = new HandedKeyBinding("vivecraft.key.offMiddle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlOffRing = new HandedKeyBinding("vivecraft.key.offRing", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyCurlOffLittle = new HandedKeyBinding("vivecraft.key.offLittle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionMainThumb = new HandedKeyBinding("vivecraft.key.mainThumb", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionMainIndex = new HandedKeyBinding("vivecraft.key.mainIndex", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionMainMiddle = new HandedKeyBinding("vivecraft.key.mainMiddle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionMainRing = new HandedKeyBinding("vivecraft.key.mainRing", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionMainLittle = new HandedKeyBinding("vivecraft.key.mainLittle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionOffThumb = new HandedKeyBinding("vivecraft.key.offThumb", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionOffIndex = new HandedKeyBinding("vivecraft.key.offIndex", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionOffMiddle = new HandedKeyBinding("vivecraft.key.offMiddle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionOffRing = new HandedKeyBinding("vivecraft.key.offRing", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); + public static final HandedKeyBinding keyExtensionOffLittle = new HandedKeyBinding("vivecraft.key.offLittle", GLFW_KEY_UNKNOWN, "vivecraft.key.category.skeletal_input"); public static final HandedKeyBinding keyVRInteract = new HandedKeyBinding("vivecraft.key.vrInteract", GLFW_KEY_UNKNOWN, "key.categories.gameplay"); public static final KeyMapping keyWalkabout = new KeyMapping("vivecraft.key.walkabout", GLFW_KEY_UNKNOWN, "key.categories.movement"); @@ -58,7 +78,27 @@ public class VivecraftVRMod { keyMoveThirdPersonCam, keyTogglePlayerList, keyToggleHandheldCam, - keyQuickHandheldCam + keyQuickHandheldCam, + keyCurlMainThumb, + keyCurlMainIndex, + keyCurlMainMiddle, + keyCurlMainRing, + keyCurlMainLittle, + keyCurlOffThumb, + keyCurlOffIndex, + keyCurlOffMiddle, + keyCurlOffRing, + keyCurlOffLittle, + keyExtensionMainThumb, + keyExtensionMainIndex, + keyExtensionMainMiddle, + keyExtensionMainRing, + keyExtensionMainLittle, + keyExtensionOffThumb, + keyExtensionOffIndex, + keyExtensionOffMiddle, + keyExtensionOffRing, + keyExtensionOffLittle )); /** Key binds internal to vivecraft, which the player may not bind. */ diff --git a/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java b/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java index b1d7818ec..704204256 100644 --- a/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/ClientDataHolderVR.java @@ -9,8 +9,6 @@ import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.settings.VRSettings; -import javax.annotation.Nonnull; - public class ClientDataHolderVR { public static boolean kiosk; @@ -46,8 +44,7 @@ public class ClientDataHolderVR { public boolean integratedServerLaunchInProgress = false; public boolean grabScreenShot = false; public long frameIndex = 0L; - @Nonnull - public RenderPass currentPass = RenderPass.VANILLA; + public RenderPass currentPass; public int tickCounter; public float watereffect; public float portaleffect; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java b/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java index bb6fb5459..0f8cd1443 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/HandedKeyBinding.java @@ -5,8 +5,8 @@ import java.util.Arrays; public class HandedKeyBinding extends KeyMapping { - private boolean[] pressed = new boolean[ControllerType.values().length]; - private int[] pressTime = new int[ControllerType.values().length]; + private final boolean[] pressed = new boolean[ControllerType.values().length]; + private final int[] pressTime = new int[ControllerType.values().length]; public HandedKeyBinding(String string, int i, String string2) { super(string, i, string2); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index dda70fd9d..39a5c6ad8 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -912,6 +912,26 @@ public Map getSpecialActionParams() { this.addActionParams(map, VivecraftVRMod.keyToggleHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); this.addActionParams(map, VivecraftVRMod.keyQuickHandheldCam, "optional", "boolean", VRInputActionSet.GLOBAL); this.addActionParams(map, VivecraftVRMod.keyTrackpadTouch, "optional", "boolean", VRInputActionSet.TECHNICAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionMainThumb, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionMainIndex, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionMainMiddle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionMainRing, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionMainLittle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionOffThumb, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionOffIndex, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionOffMiddle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionOffRing, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyExtensionOffLittle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlMainThumb, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlMainIndex, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlMainMiddle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlMainRing, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlMainLittle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlOffThumb, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlOffIndex, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlOffMiddle, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlOffRing, "optional", "boolean", VRInputActionSet.GLOBAL); +// this.addActionParams(map, VivecraftVRMod.keyCurlOffLittle, "optional", "boolean", VRInputActionSet.GLOBAL); this.addActionParams(map, VivecraftVRMod.keyVRInteract, "suggested", "boolean", VRInputActionSet.CONTEXTUAL); this.addActionParams(map, VivecraftVRMod.keyClimbeyGrab, "suggested", "boolean", null); this.addActionParams(map, VivecraftVRMod.keyClimbeyJump, "suggested", "boolean", null); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java index e548f52ae..862bb06d6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/VRInputAction.java @@ -18,6 +18,7 @@ import static com.mojang.blaze3d.platform.InputConstants.Key; import static com.mojang.blaze3d.platform.InputConstants.Type; import static org.joml.Math.abs; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_UNKNOWN; import static org.lwjgl.openvr.VR.k_ulInvalidInputValueHandle; import static org.vivecraft.client_vr.VRState.dh; @@ -388,7 +389,7 @@ public static void setKeyBindState(KeyMapping kb, boolean pressed) { private void pressKey() { Key inputconstants$key = this.keyBinding.key; - if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.isSafeBinding(this.keyBinding)) //&& (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) + if (inputconstants$key.getValue() != GLFW_KEY_UNKNOWN && !VivecraftVRMod.isSafeBinding(this.keyBinding)) //&& (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) { if (inputconstants$key.getType() == Type.KEYSYM) { InputSimulator.pressKey(inputconstants$key.getValue()); @@ -407,7 +408,7 @@ private void pressKey() { public void unpressKey() { Key inputconstants$key = this.keyBinding.key; - if (inputconstants$key.getValue() != -1 && !VivecraftVRMod.isSafeBinding(this.keyBinding)) // && (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) + if (inputconstants$key.getValue() != GLFW_KEY_UNKNOWN && !VivecraftVRMod.isSafeBinding(this.keyBinding)) // && (!Reflector.ForgeKeyBinding_getKeyModifier.exists() || Reflector.call(this.keyBinding, Reflector.ForgeKeyBinding_getKeyModifier) == Reflector.getFieldValue(Reflector.KeyModifier_NONE))) { if (inputconstants$key.getType() == Type.KEYSYM) { InputSimulator.releaseKey(inputconstants$key.getValue()); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java b/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java index 511b50057..19e46264f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/RenderPass.java @@ -8,6 +8,5 @@ public enum RenderPass { GUI, SCOPER, SCOPEL, - CAMERA, - VANILLA + CAMERA } diff --git a/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java b/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java index 42a18134f..4fbbf31ac 100644 --- a/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java +++ b/common/src/main/java/org/vivecraft/client_xr/render_pass/RenderPassManager.java @@ -40,7 +40,7 @@ public static void setGUIRenderPass() { } public static void setVanillaRenderPass() { - dh.currentPass = RenderPass.VANILLA; + dh.currentPass = null; RenderPassManager.wrp = null; renderPassType = RenderPassType.VANILLA; mc.mainRenderTarget = INSTANCE.vanillaRenderTarget; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java index abd300fc1..0e361522e 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java @@ -19,5 +19,6 @@ public abstract class KeyMappingVRMixin { CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", 8); CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", 9); CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", 10); + //CATEGORY_SORT_ORDER.put("vivecraft.key.category.skeletal_input", 11); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java index 9488b02fd..c0ee1bdf7 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java @@ -135,7 +135,7 @@ private void resetTextureState() { vivecraft$vrPipelinesCurrentDimension = vivecraft$vrPipelinesPerDimension.get(newDimension); if (!RenderPassType.isVanilla()) { - if (dh.currentPass != RenderPass.VANILLA) { + if (dh.currentPass != null) { pipeline = vivecraft$vrPipelinesCurrentDimension.get(dh.currentPass); } else { pipeline = vivecraft$vrPipelinesCurrentDimension.get(RenderPass.LEFT); diff --git a/common/src/main/resources/assets/vivecraft/lang/en_us.json b/common/src/main/resources/assets/vivecraft/lang/en_us.json index 14812fd01..5e0592288 100644 --- a/common/src/main/resources/assets/vivecraft/lang/en_us.json +++ b/common/src/main/resources/assets/vivecraft/lang/en_us.json @@ -54,6 +54,7 @@ "vivecraft.key.category.gui": "GUI", "vivecraft.key.category.climbey": "Climbey Motion", "vivecraft.key.category.keyboard": "Keyboard", + "vivecraft.key.category.skeletal_input": "Skeletal Input", "_comment2": "Action set names", "vivecraft.actionset.ingame": "In-Game", "vivecraft.actionset.gui": "GUI", From 279d3cbf75b32b3d2961b9c9af9587aa9859be5d Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:19:37 -0700 Subject: [PATCH 06/12] fix guilistscreen render --- .../org/vivecraft/client/gui/settings/GuiListScreen.java | 2 +- .../org/vivecraft/client/gui/widgets/SettingsList.java | 2 +- common/src/main/java/org/vivecraft/client_vr/VRData.java | 2 +- .../client_vr/gameplay/trackers/HorseTracker.java | 2 +- .../client_vr/provider/openvr_lwjgl/MCOpenVR.java | 8 ++++---- .../java/org/vivecraft/client_vr/render/ShaderHelper.java | 2 +- .../client_vr/settings/profile/ProfileManager.java | 4 ++-- .../client_vr/settings/profile/ProfileReader.java | 2 +- .../java/org/vivecraft/client_vr/utils/LoaderUtils.java | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java index 42cfc88cb..b65b8b86a 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java @@ -52,7 +52,7 @@ public void render(GuiGraphics guiGraphics, int i, int j, float f) { init(); reinit = false; } - this.render(guiGraphics, i, j, f); + super.render(guiGraphics, i, j, f); list.render(guiGraphics, i, j, f); guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, 8, 0xFFFFFF); } diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java index 44b6f4c95..6a6e13e28 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java @@ -15,10 +15,10 @@ import net.minecraft.client.gui.navigation.FocusNavigationEvent; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import org.jetbrains.annotations.Nullable; import org.vivecraft.client.gui.widgets.SettingsList.BaseEntry; import org.vivecraft.server.config.ConfigBuilder.ConfigValue; +import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.function.BooleanSupplier; diff --git a/common/src/main/java/org/vivecraft/client_vr/VRData.java b/common/src/main/java/org/vivecraft/client_vr/VRData.java index 7a731a465..94eeeb562 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRData.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRData.java @@ -182,7 +182,7 @@ public String toString() { } @ParametersAreNonnullByDefault - public class VRDevicePose { + public static class VRDevicePose { final VRData data; final Vec3 pos; final Vec3 dir; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java index d377f5f8b..017fd8b44 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java @@ -122,7 +122,7 @@ public ModelInfo getModelInfo() { return this.info; } - public class ModelInfo { + public static class ModelInfo { public Vec3 leftReinPos = Vec3.ZERO; public Vec3 rightReinPos = Vec3.ZERO; } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index bd2360945..8180863c2 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -826,21 +826,21 @@ private void installApplicationManifest(boolean force) throws RenderConfigExcept if (i != EVRApplicationError_VRApplicationError_None) { // application needs to be installed, so abort - String pathFormatted = ""; + StringBuilder pathFormatted = new StringBuilder(); boolean hasInvalidChars = false; for (char c : file1.getAbsolutePath().toCharArray()) { if (c > 127) { hasInvalidChars = true; - pathFormatted += "§c" + c + "§r"; + pathFormatted.append("§c").append(c).append("§r"); } else { - pathFormatted += c; + pathFormatted.append(c); } } String error = VRApplications_GetApplicationsErrorNameFromEnum(i) + (hasInvalidChars ? "\nInvalid characters in path: \n" : "\n"); logger.error("Failed to install application manifest: {}{}", error, file1.getAbsolutePath()); - throw new RenderConfigException("Failed to install application manifest", Component.empty().append(error).append(pathFormatted)); + throw new RenderConfigException("Failed to install application manifest", Component.empty().append(error).append(pathFormatted.toString())); } logger.info("Application manifest installed successfully"); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java index 3b8a412d8..aa7688ca5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/ShaderHelper.java @@ -9,7 +9,7 @@ import static org.vivecraft.common.utils.Utils.logger; public class ShaderHelper { - private static int createShader(String shaderGLSL, int shaderType) throws Exception { + private static int createShader(String shaderGLSL, int shaderType) { int i = 0; try { diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java index 1127b9d84..8d601d3bc 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java @@ -72,7 +72,7 @@ public static synchronized void load() { } } - private static void validateProfiles() throws Exception { + private static void validateProfiles() { for (String s : profiles.keySet()) { if (profiles.get(s) instanceof JsonObject JsonObject) { JsonObject JsonObject1 = null; @@ -153,7 +153,7 @@ private static synchronized boolean loadLegacySettings(String settingStr, JsonOb return i != 0; } - private static synchronized boolean loadLegacySettings(String[] settingStr, JsonObject theProfile, String set) throws Exception { + private static synchronized boolean loadLegacySettings(String[] settingStr, JsonObject theProfile, String set) { Map map = new HashMap<>(); int i = 0; diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java index 9aeb04ece..c1de6430e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java @@ -25,7 +25,7 @@ public ProfileReader(String set, JsonObject theProfiles) { this.theProfiles = theProfiles; } - public String readLine() throws IOException { + public String readLine() { String s = null; if (this.currentProfile == null) { diff --git a/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java b/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java index 229ff8c05..4d041e292 100644 --- a/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java +++ b/common/src/main/java/org/vivecraft/client_vr/utils/LoaderUtils.java @@ -41,7 +41,7 @@ public static URI getVivecraftZipLocation() throws URISyntaxException { } } - public static ZipFile getVivecraftZip() throws URISyntaxException, IOException { + public static ZipFile getVivecraftZip() throws IOException { if (vivecraftFile == null) { init(); } From b6dd5b4a4648baaa0991a11643e2ef24fbba9ca7 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Tue, 3 Oct 2023 11:28:23 -0700 Subject: [PATCH 07/12] merge fix for mixed reality mirror --- .../gui/settings/GuiRenderOpticsSettings.java | 4 + .../client_vr/provider/VRRenderer.java | 3 +- .../vivecraft/client_vr/render/VRShaders.java | 9 +- .../render/helpers/VRPassHelper.java | 27 +++- .../client_vr/settings/VRSettings.java | 24 +--- .../mixin/client_vr/MinecraftVRMixin.java | 127 ++++++------------ .../optifine/OptifineHelper.java | 23 ++++ .../minecraft/shaders/core/mixedreality.fsh | 89 ++++++++---- .../minecraft/shaders/core/mixedreality.json | 21 +-- .../minecraft/shaders/core/passthrough.vsh | 2 +- 10 files changed, 175 insertions(+), 154 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java index 8660aee76..30b345537 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java @@ -113,11 +113,15 @@ protected void actionPerformed(AbstractWidget widget) { } else { dh.vrRenderer.reinitFrameBuffers("Render Setting Changed"); } + this.reinit = true; } } case RELOAD_EXTERNAL_CAMERA -> { VRHotkeys.loadExternalCameraConfig(); } + case MIXED_REALITY_ALPHA_MASK, MIXED_REALITY_UNITY_LIKE, MIXED_REALITY_UNDISTORTED -> { + this.reinit = true; + } } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java index 32537f256..fe153325c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlUtil; +import com.mojang.blaze3d.shaders.ProgramManager; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import com.mojang.blaze3d.vertex.VertexFormat.Mode; @@ -184,7 +185,7 @@ public void doStencil(boolean inverse) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.enableCull(); - GlStateManager._glUseProgram(s); + ProgramManager.glUseProgram(s); RenderSystem.stencilFunc(GL11C.GL_NOTEQUAL, 255, 1); RenderSystem.stencilOp(GL11C.GL_KEEP, GL11C.GL_KEEP, GL11C.GL_KEEP); RenderSystem.stencilMask(0); // Dont Write to stencil buffer diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java b/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java index b6cfcd532..e642519d5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VRShaders.java @@ -15,14 +15,11 @@ public class VRShaders { public static AbstractUniform _Lanczos_projectionUniform; public static AbstractUniform _Lanczos_modelViewUniform; public static ShaderInstance depthMaskShader; - public static AbstractUniform _DepthMask_resolutionUniform; - public static AbstractUniform _DepthMask_positionUniform; - public static AbstractUniform _DepthMask_scaleUniform; public static AbstractUniform _DepthMask_hmdViewPosition; public static AbstractUniform _DepthMask_hmdPlaneNormal; public static AbstractUniform _DepthMask_projectionMatrix; public static AbstractUniform _DepthMask_viewMatrix; - public static AbstractUniform _DepthMask_passUniform; + public static AbstractUniform _DepthMask_firstPersonPassUniform; public static AbstractUniform _DepthMask_keyColorUniform; public static AbstractUniform _DepthMask_alphaModeUniform; public static int _FOVReduction_Enabled; @@ -54,13 +51,11 @@ public static void setupDepthMask() throws Exception { depthMaskShader = new ShaderInstance(mc.getResourceManager(), "mixedreality", DefaultVertexFormat.POSITION_TEX); - _DepthMask_resolutionUniform = depthMaskShader.safeGetUniform("resolution"); - _DepthMask_positionUniform = depthMaskShader.safeGetUniform("position"); _DepthMask_hmdViewPosition = depthMaskShader.safeGetUniform("hmdViewPosition"); _DepthMask_hmdPlaneNormal = depthMaskShader.safeGetUniform("hmdPlaneNormal"); _DepthMask_projectionMatrix = depthMaskShader.safeGetUniform("projectionMatrix"); _DepthMask_viewMatrix = depthMaskShader.safeGetUniform("viewMatrix"); - _DepthMask_passUniform = depthMaskShader.safeGetUniform("pass"); + _DepthMask_firstPersonPassUniform = depthMaskShader.safeGetUniform("firstPersonPass"); _DepthMask_keyColorUniform = depthMaskShader.safeGetUniform("keyColor"); _DepthMask_alphaModeUniform = depthMaskShader.safeGetUniform("alphaMode"); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java index 0b0552f20..4cfe54e6e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java @@ -2,17 +2,22 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.shaders.ProgramManager; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.Util; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import org.lwjgl.opengl.GL11C; +import org.lwjgl.opengl.GL13C; import org.vivecraft.client.Xplat; import org.vivecraft.client.extensions.RenderTargetExtension; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.render.VRShaders; +import org.vivecraft.client_vr.settings.VRSettings; +import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; import org.vivecraft.mod_compat_vr.iris.IrisHelper; +import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; import static java.lang.Math.pow; import static net.minecraft.client.Minecraft.ON_OSX; @@ -185,7 +190,7 @@ public static void renderSingleView(RenderPass eye, float partialTicks, long nan dh.vrRenderer.framebufferEye0.viewWidth, dh.vrRenderer.framebufferEye0.viewHeight ); - GlStateManager._glUseProgram(0); + ProgramManager.glUseProgram(0); checkGLError("post overlay" + eye); mc.getProfiler().pop(); } @@ -206,12 +211,28 @@ public static void renderSingleView(RenderPass eye, float partialTicks, long nan ); mc.getProfiler().pop(); } + case THIRD -> { + if (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY && OptifineHelper.isOptifineLoaded() && + renderWorld && mc.level != null && OptifineHelper.isShaderActive() && + OptifineHelper.bindShaderFramebuffer() + ) { + // copy optifine depth buffer, since we need it for the mixed reality split + RenderSystem.activeTexture(GL13C.GL_TEXTURE0); + RenderSystem.bindTexture(dh.vrRenderer.framebufferMR.getDepthTextureId()); + checkGLError("pre copy depth"); + GlStateManager._glCopyTexSubImage2D(GL13C.GL_TEXTURE_2D, 0, 0, 0, 0, 0, dh.vrRenderer.framebufferMR.width, dh.vrRenderer.framebufferMR.height); + checkGLError("post copy depth"); + // rebind the original buffer + dh.vrRenderer.framebufferMR.bindWrite(false); + } + } } } public static void checkGLError(String string) { - if (GlStateManager._getError() != 0) { - logger.error(string); + int i = GlStateManager._getError(); + if (i != 0) { + logger.error("{}: {}", string, i); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java index bcb47f2d2..cf51b225f 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java @@ -1231,16 +1231,6 @@ void onOptionChange() { dh.vrRenderer.reinitFrameBuffers("Mirror Setting Changed"); } } - - @Override - Object setOptionValue(Object value) { - // TODO: remove this method after fixing mixed reality... again - MirrorMode mode = ((MirrorMode) value).getNext(); - if (mode == MirrorMode.MIXED_REALITY) { - mode = mode.getNext(); - } - return mode; - } }, MIRROR_EYE(false, true, "vivecraft.options.left", "vivecraft.options.right"), // Mirror Eye MIXED_REALITY_KEY_COLOR(false, false) { // Key Color @@ -1286,23 +1276,19 @@ Object setOptionValue(Object value) { @Override void onOptionChange() { - dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); + // reinit, because of maybe new first person pass + dh.vrRenderer.reinitFrameBuffers("MR Setting Changed"); } }, MIXED_REALITY_UNDISTORTED(false, true) { // Undistorted Pass @Override void onOptionChange() { - dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); - } - }, - MIXED_REALITY_ALPHA_MASK(false, true) { // Alpha Mask - - @Override - void onOptionChange() { - dh.vrRenderer.resizeFrameBuffers("MR Setting Changed"); + // reinit, because of maybe new first person pass + dh.vrRenderer.reinitFrameBuffers("MR Setting Changed"); } }, + MIXED_REALITY_ALPHA_MASK(false, true), // Alpha Mask MIXED_REALITY_FOV(true, false, 0, 179, 1, 0) { // Third Person FOV @Override diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index e55f71a60..96f9b6bbf 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -4,12 +4,12 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.pipeline.MainTarget; import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.Window; +import com.mojang.blaze3d.shaders.ProgramManager; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexSorting; +import com.mojang.blaze3d.vertex.*; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; import net.minecraft.ChatFormatting; import net.minecraft.client.*; import net.minecraft.client.gui.Gui; @@ -42,7 +42,6 @@ import org.joml.Matrix4f; import org.joml.Vector3f; import org.lwjgl.opengl.GL11C; -import org.lwjgl.opengl.GL13C; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.At.Shift; @@ -977,100 +976,62 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Unique private void vivecraft$doMixedRealityMirror() { -// boolean flag = Config.isShaders(); -// boolean flag = false; - boolean alphaMask = dh.vrSettings.mixedRealityUnityLike && dh.vrSettings.mixedRealityAlphaMask; + // set viewport to fullscreen, since it would be still on the one from the last pass + RenderSystem.viewport(0, 0, this.window.getScreenWidth(), this.window.getScreenHeight()); + + Vec3 camPlayer = dh.vrPlayer.vrdata_room_pre.getHeadPivot() + .subtract(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); + Matrix4f viewMatrix = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix(); + Vector3f cameraLook = viewMatrix.transformProject(forward, new Vector3f()); + + // set uniforms + VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) mc.gameRenderer).vivecraft$getThirdPassProjectionMatrix()); + VRShaders._DepthMask_viewMatrix.set(viewMatrix); + VRShaders._DepthMask_hmdViewPosition.set((float) camPlayer.x, (float) camPlayer.y, (float) camPlayer.z); + VRShaders._DepthMask_hmdPlaneNormal.set(-cameraLook.x(), 0.0F, -cameraLook.z()); + boolean alphaMask = dh.vrSettings.mixedRealityUnityLike && dh.vrSettings.mixedRealityAlphaMask; if (!alphaMask) { - RenderSystem.clearColor( + VRShaders._DepthMask_keyColorUniform.set( dh.vrSettings.mixedRealityKeyColor.getR(), dh.vrSettings.mixedRealityKeyColor.getG(), - dh.vrSettings.mixedRealityKeyColor.getB(), - 1.0F + dh.vrSettings.mixedRealityKeyColor.getB() ); } else { - RenderSystem.clearColor(0.0F, 0.0F, 0.0F, 1.0F); + VRShaders._DepthMask_keyColorUniform.set(0.0F, 0.0F, 0.0F); } - - RenderSystem.clear(GL11C.GL_COLOR_BUFFER_BIT | GL11C.GL_DEPTH_BUFFER_BIT, ON_OSX); - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot() - .subtract(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); - Vector3f vector3 = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix().transformProject(forward, new Vector3f()); - VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) mc.gameRenderer).vivecraft$getThirdPassProjectionMatrix()); - VRShaders._DepthMask_viewMatrix.set(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix()); - VRShaders._DepthMask_hmdViewPosition.set((float) vec3.x, (float) vec3.y, (float) vec3.z); - VRShaders._DepthMask_hmdPlaneNormal.set(-vector3.x, 0.0F, -vector3.z); - VRShaders._DepthMask_keyColorUniform.set( - dh.vrSettings.mixedRealityKeyColor.getR(), - dh.vrSettings.mixedRealityKeyColor.getG(), - dh.vrSettings.mixedRealityKeyColor.getB() - ); VRShaders._DepthMask_alphaModeUniform.set(alphaMask ? 1 : 0); - RenderSystem.activeTexture(GL13C.GL_TEXTURE1); - RenderSystem.setShaderTexture(0, dh.vrRenderer.framebufferMR.getColorTextureId()); - RenderSystem.activeTexture(GL13C.GL_TEXTURE2); - -// if (flag && Shaders.dfb != null) { TODO -// GlStateManager._bindTexture(Shaders.dfb.depthTextures.get(0)); -// } else { - RenderSystem.setShaderTexture(1, dh.vrRenderer.framebufferMR.getDepthTextureId()); -// } + VRShaders._DepthMask_firstPersonPassUniform.set(dh.vrSettings.mixedRealityUnityLike ? 1 : 0); - RenderSystem.activeTexture(GL13C.GL_TEXTURE0); - - for (int i = 0; i < (alphaMask ? 3 : 2); ++i) { - int j = this.window.getScreenWidth() / 2; - int k = this.window.getScreenHeight(); - int l = this.window.getScreenWidth() / 2 * i; - int i1 = 0; + // bind textures + RenderSystem.setShaderTexture(0, dh.vrRenderer.framebufferMR.getColorTextureId()); + RenderSystem.setShaderTexture(1, dh.vrRenderer.framebufferMR.getDepthTextureId()); - if (dh.vrSettings.mixedRealityUnityLike) { - j = this.window.getScreenWidth() / 2; - k = this.window.getScreenHeight() / 2; + VRShaders.depthMaskShader.setSampler("thirdPersonColor", RenderSystem.getShaderTexture(0)); + VRShaders.depthMaskShader.setSampler("thirdPersonDepth", RenderSystem.getShaderTexture(1)); - if (dh.vrSettings.mixedRealityAlphaMask && i == 2) { - l = this.window.getScreenWidth() / 2; - i1 = this.window.getScreenHeight() / 2; - } else { - l = 0; - i1 = this.window.getScreenHeight() / 2 * (1 - i); - } + if (dh.vrSettings.mixedRealityUnityLike) { + if (dh.vrSettings.mixedRealityUndistorted){ + RenderSystem.setShaderTexture(2, dh.vrRenderer.framebufferUndistorted.getColorTextureId()); + } else { + RenderSystem.setShaderTexture(2, dh.vrRenderer.framebufferEye0.getColorTextureId()); } - - VRShaders._DepthMask_resolutionUniform.set((float) j, k); - VRShaders._DepthMask_positionUniform.set((float) l, i1); - VRShaders._DepthMask_passUniform.set(i); - ((RenderTargetExtension) dh.vrRenderer.framebufferMR).vivecraft$blitToScreen( - VRShaders.depthMaskShader, - l, - j, - k, - i1, - true, - 0.0F, - 0.0F, - false - ); + VRShaders.depthMaskShader.setSampler("firstPersonColor", RenderSystem.getShaderTexture(2)); } - GlStateManager._glUseProgram(0); + VRShaders.depthMaskShader.apply(); - if (dh.vrSettings.mixedRealityUnityLike) { - ((RenderTargetExtension) ( - dh.vrSettings.mixedRealityUndistorted ? - dh.vrRenderer.framebufferUndistorted : - dh.vrRenderer.framebufferEye0 - )).vivecraft$blitToScreen( - this.window.getScreenWidth() / 2, - this.window.getScreenWidth() / 2, - this.window.getScreenHeight() / 2, - 0, - true, - 0.0F, - 0.0F, - false - ); - } + Tesselator tesselator = RenderSystem.renderThreadTesselator(); + BufferBuilder bufferbuilder = tesselator.getBuilder(); + bufferbuilder.begin(Mode.QUADS, VRShaders.depthMaskShader.getVertexFormat()); + bufferbuilder.vertex(-1, -1, 0.0).uv(0, 0).endVertex(); + bufferbuilder.vertex(1, -1, 0.0).uv(2, 0).endVertex(); + bufferbuilder.vertex(1, 1, 0.0).uv(2, 2).endVertex(); + bufferbuilder.vertex(-1, 1, 0.0).uv(0, 2).endVertex(); + BufferUploader.draw(bufferbuilder.end()); + VRShaders.depthMaskShader.clear(); + + ProgramManager.glUseProgram(0); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java index 9d0118835..c4793ce9a 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java @@ -47,6 +47,9 @@ public class OptifineHelper { private static Class shaders; private static Method shadersBeginEntitiesMethod; private static Method shadersEndEntitiesMethod; + private static Field shadersDFB; + + private static Method shadersFramebufferBindFramebuffer; private static Field optionsOfRenderRegions; private static Field optionsOfCloudHeight; @@ -80,6 +83,19 @@ public static boolean isShaderActive() { } } + public static boolean bindShaderFramebuffer(){ + try { + Object dfb = shadersDFB.get(shaders); + if (dfb != null) { + shadersFramebufferBindFramebuffer.invoke(dfb); + return true; + } + } catch (InvocationTargetException | IllegalAccessException e) { + e.printStackTrace(); + } + return false; + } + public static void beginOutlineShader() { try { shadersRenderBeginOutlineMethod.invoke(shadersRender); @@ -294,6 +310,9 @@ private static void init() { shadersRenderBeginOutlineMethod = shadersRender.getMethod("beginOutline"); shadersRenderEndOutlineMethod = shadersRender.getMethod("endOutline"); + Class shadersFramebuffer = Class.forName("net.optifine.shaders.ShadersFrameBuffer"); + shadersFramebufferBindFramebuffer = shadersFramebuffer.getMethod("bindFramebuffer"); + shaders = Class.forName("net.optifine.shaders.Shaders"); shadersBeginEntitiesMethod = shaders.getMethod("beginEntities"); shadersEndEntitiesMethod = shaders.getMethod("endEntities"); @@ -308,6 +327,10 @@ private static void init() { customColorsGetFogColorNetherMethod = customColors.getDeclaredMethod("getFogColorNether", Vec3.class); customColorsGetFogColorNetherMethod.setAccessible(true); + // private fields + shadersDFB = shaders.getDeclaredField("dfb"); + shadersDFB.setAccessible(true); + try { vertexRenderPositions = Vertex.class.getField("renderPositions"); } catch (NoSuchFieldException e) { diff --git a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.fsh b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.fsh index d7eaa9526..1e7975cc2 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.fsh +++ b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.fsh @@ -1,43 +1,82 @@ #version 330 core -uniform vec2 resolution; -uniform vec2 position; -uniform sampler2D Sampler0; -uniform sampler2D Sampler1; +uniform sampler2D thirdPersonColor; +uniform sampler2D thirdPersonDepth; +uniform sampler2D firstPersonColor; + uniform vec3 hmdViewPosition; uniform vec3 hmdPlaneNormal; uniform mat4 projectionMatrix; uniform mat4 viewMatrix; -uniform int pass; +uniform int firstPersonPass; uniform vec3 keyColor; uniform int alphaMode; + +in vec2 texCoordinates; + out vec4 out_Color; -vec3 getFragmentPosition(vec2 coord) { - vec4 posScreen = vec4(coord * 2.0 - 1.0, texture(Sampler1, coord).x * 2.0 - 1.0, 1); + +vec3 getFragmentPosition(in vec2 coord) { + vec4 posScreen = vec4(coord * 2.0 - 1.0, texture(thirdPersonDepth, coord).x * 2.0 - 1.0, 1); vec4 posView = inverse(projectionMatrix * viewMatrix) * posScreen; return posView.xyz / posView.w; } + +vec3 avoidKeyColor(in vec3 color) { + // make sure colors don't match keyColor + if (all(lessThan(color - keyColor, vec3(0.004)))) { + if (all(lessThan(keyColor, vec3(0.004)))) { + // if key is black add + return color + 0.004; + } else { + return color - 0.004; + } + } else { + return color; + } +} + void main(void) { - vec2 pos = (gl_FragCoord.xy - position) / resolution; - vec3 fragPos = getFragmentPosition(pos); - float fragHmdDot = dot(fragPos - hmdViewPosition, hmdPlaneNormal); - if (((pass == 0 || pass == 2) && fragHmdDot >= 0) || pass == 1) { - vec4 color = texture(Sampler0, pos); - if (pass == 2) { - color = vec4(1, 1, 1, 1); - } else if (alphaMode == 0) { - vec3 diff = color.rgb - keyColor;// The following code prevents actual colors from matching the key color and looking weird - if (keyColor.r < 0.004 && keyColor.g < 0.004 && keyColor.b < 0.004 && color.r < 0.004 && color.g < 0.004 && color.b < 0.004) { - color = vec4(0.004, 0.004, 0.004, 1); - } else if (diff.r < 0.004 && diff.g < 0.004 && diff.b < 0.004) { - color = vec4(color.r - 0.004, color.g - 0.004, color.b - 0.004, color.a); + + out_Color = vec4(keyColor, 1.0); + if (firstPersonPass == 1) { + // unity like + vec2 sampleTexcCoord = fract(texCoordinates); + if (texCoordinates.x < 1.0 && texCoordinates.y < 1.0) { + // third person all + out_Color.rgb = texture(thirdPersonColor, sampleTexcCoord).rgb; + } else if (texCoordinates.y >= 1.0){ + // third person front + vec3 fragPos = getFragmentPosition(sampleTexcCoord); + if (dot(fragPos - hmdViewPosition, hmdPlaneNormal) >= 0.0) { + if (texCoordinates.x < 1.0) { + // color + out_Color.rgb = texture(thirdPersonColor, sampleTexcCoord).rgb; + if (alphaMode == 0) { + out_Color.rgb = avoidKeyColor(out_Color.rgb); + } + } else if (alphaMode == 1){ + // white mask + out_Color.rgb = vec3(1.0); + } } + } else if (texCoordinates.x >= 1.0 && texCoordinates.y < 1.0){ + // first person + out_Color.rgb = texture(firstPersonColor, sampleTexcCoord).rgb; } - out_Color = color; - // out_Color = vec4(vec3((distance(fragPos.xz,hmdViewPosition.xz)) / 3), 1); // Draw distance to hmd - // out_Color = texture(depthTex, pos); // Draw depth buffer } else { - discard;// Throw out the fragment to save some GPU processing - //out_Color = vec4(1, 0, 1, 1); + // side by side + vec2 sampleTexcCoord = fract(texCoordinates * vec2(1.0, 0.5)); + if (texCoordinates.x >= 1.0) { + // third person all + out_Color.rgb = texture(thirdPersonColor, sampleTexcCoord).rgb; + } else { + // third person front + vec3 fragPos = getFragmentPosition(sampleTexcCoord); + if (dot(fragPos - hmdViewPosition, hmdPlaneNormal) >= 0.0) { + // color + out_Color.rgb = avoidKeyColor(texture(thirdPersonColor, sampleTexcCoord).rgb); + } + } } } diff --git a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json index a4ad6369e..b167a1dba 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json +++ b/common/src/main/resources/assets/minecraft/shaders/core/mixedreality.json @@ -9,10 +9,13 @@ "attributes": ["Position", "UV0"], "samplers": [ { - "name": "Sampler0" + "name": "thirdPersonColor" }, { - "name": "Sampler1" + "name": "thirdPersonDepth" + }, + { + "name": "firstPersonColor" } ], "uniforms": [ @@ -28,18 +31,6 @@ "count": 16, "values": [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] }, - { - "name": "resolution", - "type": "float", - "count": 2, - "values": [1.0, 1.0] - }, - { - "name": "position", - "type": "float", - "count": 2, - "values": [1.0, 1.0] - }, { "name": "hmdViewPosition", "type": "float", @@ -59,7 +50,7 @@ "values": [1.0, 1.0, 1.0] }, { - "name": "pass", + "name": "firstPersonPass", "type": "int", "count": 1, "values": [1] diff --git a/common/src/main/resources/assets/minecraft/shaders/core/passthrough.vsh b/common/src/main/resources/assets/minecraft/shaders/core/passthrough.vsh index 6fcd47fa7..aa5d758b8 100644 --- a/common/src/main/resources/assets/minecraft/shaders/core/passthrough.vsh +++ b/common/src/main/resources/assets/minecraft/shaders/core/passthrough.vsh @@ -7,6 +7,6 @@ in vec2 UV0; out vec2 texCoordinates; void main() { - gl_Position = projection * modelView * vec4(Position, 1.0); + gl_Position = vec4(Position, 1.0); texCoordinates = UV0; } From 2f4e628dac97e9a6395029d3bc73926e23e55cd9 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:18:55 -0700 Subject: [PATCH 08/12] fix copyToMirror OFF --- .../mixin/client_vr/MinecraftVRMixin.java | 96 +++++++++---------- 1 file changed, 44 insertions(+), 52 deletions(-) diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 96f9b6bbf..5bfdbfcbb 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -894,84 +894,76 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { @Unique private void vivecraft$copyToMirror() { - // TODO: fix mixed reality... again - int left = 0; - int width = this.window.getScreenWidth(); - int height = this.window.getScreenHeight(); - int top = 0; - boolean disableBlend = true; - float xCropFactor = 0.0F; - float yCropFactor = 0.0F; - boolean keepAspect = false; - RenderTarget source = switch (dh.vrSettings.displayMirrorMode) { + switch (dh.vrSettings.displayMirrorMode) { case MIXED_REALITY -> { if (VRShaders.depthMaskShader != null) { this.vivecraft$doMixedRealityMirror(); } else { this.vivecraft$notifyMirror("Shader compile failed, see log", true, 10000); } - yield null; } case DUAL -> { + int height = this.window.getScreenHeight(); + int width = this.window.getScreenWidth() / 2; // run eye0 - width /= 2; - if (dh.vrRenderer.framebufferEye0 != null) { - ((RenderTargetExtension) dh.vrRenderer.framebufferEye0).vivecraft$blitToScreen( - left, - width, - height, - top, - disableBlend, - xCropFactor, - yCropFactor, - keepAspect - ); - } - left = width; // setup for eye1 - yield dh.vrRenderer.framebufferEye1; + ((RenderTargetExtension) dh.vrRenderer.framebufferEye0).vivecraft$blitToScreen( + 0, width, height, 0, true, 0.0F, 0.0F, false + ); + // run eye1 + ((RenderTargetExtension) dh.vrRenderer.framebufferEye1).vivecraft$blitToScreen( + width, width, height, 0, true, 0.0F, 0.0F, false + ); } case FIRST_PERSON -> { - yield dh.vrRenderer.framebufferUndistorted; + ((RenderTargetExtension) dh.vrRenderer.framebufferUndistorted).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false + ); } case THIRD_PERSON -> { - yield dh.vrRenderer.framebufferMR; + ((RenderTargetExtension) dh.vrRenderer.framebufferMR).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false + ); } case GUI -> { - yield GuiHandler.guiFramebuffer; + ((RenderTargetExtension) GuiHandler.guiFramebuffer).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false + ); } case OFF -> { if (dh.vr.isHMDTracking()) { this.vivecraft$notifyMirror("Mirror is OFF", true, 1000); + } else { + ((RenderTargetExtension) ( + !dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + )).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false + ); } - yield (!dh.vrSettings.displayMirrorLeftEye ? - dh.vrRenderer.framebufferEye1 : - dh.vrRenderer.framebufferEye0 - ); } case SINGLE -> { - yield !dh.vrSettings.displayMirrorLeftEye ? - dh.vrRenderer.framebufferEye1 : - dh.vrRenderer.framebufferEye0; + ((RenderTargetExtension) ( + !dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + )).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.0F, 0.0F, false + ); } case CROPPED -> { - xCropFactor = 0.15F; - yCropFactor = 0.15F; - keepAspect = true; - yield (!dh.vrSettings.displayMirrorLeftEye ? - dh.vrRenderer.framebufferEye1 : - dh.vrRenderer.framebufferEye0 + ((RenderTargetExtension) ( + !dh.vrSettings.displayMirrorLeftEye ? + dh.vrRenderer.framebufferEye1 : + dh.vrRenderer.framebufferEye0 + )).vivecraft$blitToScreen( + 0, this.window.getScreenWidth(), this.window.getScreenHeight(), 0, true, 0.15F, 0.15F, true ); } - }; - // Debug - // source = GuiHandler.guiFramebuffer; - // source = dh.vrRenderer.telescopeFramebufferR; - // - if (source != null) { - ((RenderTargetExtension) source).vivecraft$blitToScreen( - left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect - ); } + // TODO Debug + // GuiHandler.guiFramebuffer; + // dh.vrRenderer.telescopeFramebufferR; } @Unique @@ -1012,7 +1004,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { VRShaders.depthMaskShader.setSampler("thirdPersonDepth", RenderSystem.getShaderTexture(1)); if (dh.vrSettings.mixedRealityUnityLike) { - if (dh.vrSettings.mixedRealityUndistorted){ + if (dh.vrSettings.mixedRealityUndistorted) { RenderSystem.setShaderTexture(2, dh.vrRenderer.framebufferUndistorted.getColorTextureId()); } else { RenderSystem.setShaderTexture(2, dh.vrRenderer.framebufferEye0.getColorTextureId()); From 620a28b5d17b974cfa1ccd50521515bc500120fa Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:28:45 -0700 Subject: [PATCH 09/12] the same but better Accept more changes from IDE analysis. Consolidate conditional logic in MCVR updateAim. Bump mixinextras to rc5. fix missing key binding category `skeletal_input` hide `skeletal_input` keys --- .../VivecraftMod_Default.xml | 2 +- common/build.gradle | 2 +- .../org/vivecraft/client/VRPlayersClient.java | 9 +- .../org/vivecraft/client/VivecraftVRMod.java | 46 ++--- .../gui/framework/GuiVROptionsBase.java | 4 +- .../gui/settings/GuiListValueEditScreen.java | 2 +- .../gui/settings/GuiRadialConfiguration.java | 4 +- .../org/vivecraft/client/utils/Utils.java | 4 +- .../org/vivecraft/client_vr/Vec3History.java | 7 +- .../client_vr/gameplay/VRPlayer.java | 4 +- .../gameplay/screenhandlers/GuiHandler.java | 22 +-- .../gameplay/trackers/ClimbTracker.java | 6 +- .../gameplay/trackers/EatingTracker.java | 4 +- .../gameplay/trackers/InteractTracker.java | 7 +- .../gameplay/trackers/RunTracker.java | 2 +- .../gameplay/trackers/TeleportTracker.java | 4 +- .../gameplay/trackers/TelescopeTracker.java | 2 +- .../gameplay/trackers/VehicleTracker.java | 8 +- .../client_vr/menuworlds/FakeBlockAccess.java | 2 +- .../menuworlds/MenuWorldRenderer.java | 5 +- .../vivecraft/client_vr/provider/MCVR.java | 159 +++++++----------- .../client_vr/provider/VRRenderer.java | 2 +- .../provider/openvr_lwjgl/MCOpenVR.java | 5 +- .../render/helpers/VREffectsHelper.java | 2 +- .../render/helpers/VRPassHelper.java | 1 - .../render/helpers/VRWidgetHelper.java | 5 +- .../client_vr/settings/VRSettings.java | 6 +- .../settings/profile/ProfileManager.java | 2 +- .../settings/profile/ProfileReader.java | 1 - .../settings/profile/ProfileWriter.java | 6 +- .../vivecraft/common/utils/color/Color.java | 2 +- .../client/blaze3d/RenderTargetMixin.java | 4 +- .../client/gui/screens/TitleScreenMixin.java | 2 +- .../mixin/client_vr/KeyMappingVRMixin.java | 8 +- .../mixin/client_vr/MinecraftVRMixin.java | 2 +- .../client_vr/player/LocalPlayerVRMixin.java | 6 +- .../renderer/GameRendererVRMixin.java | 6 +- .../world/entity/monster/EndermanMixin.java | 2 +- .../projectile/ThrowableProjectileMixin.java | 2 +- .../mixin/IrisPipelineManagerVRMixin.java | 31 ++-- .../vivecraft/server/ServerNetworking.java | 22 ++- .../java/org/vivecraft/server/ServerUtil.java | 2 +- fabric/build.gradle | 2 +- forge/build.gradle | 2 +- 44 files changed, 197 insertions(+), 231 deletions(-) diff --git a/.idea/inspectionProfiles/VivecraftMod_Default.xml b/.idea/inspectionProfiles/VivecraftMod_Default.xml index 97e77ca9a..0d82cb7cd 100644 --- a/.idea/inspectionProfiles/VivecraftMod_Default.xml +++ b/.idea/inspectionProfiles/VivecraftMod_Default.xml @@ -35,7 +35,7 @@ - + diff --git a/common/build.gradle b/common/build.gradle index edf9c586c..ea18086f0 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -52,7 +52,7 @@ dependencies { implementation 'com.github.fayer3:LaunchPopup:master-SNAPSHOT' // MixinExtras - implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0-rc.4")) + implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0-rc.5")) } // extract the LaunchPopup classes diff --git a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java index 72857ec87..cc5f5f25e 100644 --- a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java +++ b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java @@ -213,12 +213,9 @@ public RotInfo getRotationsForPlayer(UUID uuid) { public static RotInfo getMainPlayerRotInfo(VRData data) { RotInfo playermodelcontroller$rotinfo = new RotInfo(); - Quaternionf quaternion = new Quaternionf().setFromNormalized(data.getController(1).getMatrix()); - Quaternionf quaternion1 = new Quaternionf().setFromNormalized(data.getController(0).getMatrix()); - Quaternionf quaternion2 = new Quaternionf().setFromNormalized(data.hmd.getMatrix()); - playermodelcontroller$rotinfo.headQuat = quaternion2; - playermodelcontroller$rotinfo.leftArmQuat = quaternion; - playermodelcontroller$rotinfo.rightArmQuat = quaternion1; + playermodelcontroller$rotinfo.headQuat.setFromNormalized(data.hmd.getMatrix()); + playermodelcontroller$rotinfo.leftArmQuat.setFromNormalized(data.getController(1).getMatrix()); + playermodelcontroller$rotinfo.rightArmQuat.setFromNormalized(data.getController(0).getMatrix()); playermodelcontroller$rotinfo.seated = dh.vrSettings.seated; convertToVector3f(data.getController(1).getPosition(), playermodelcontroller$rotinfo.leftArmPos); convertToVector3f(data.getController(0).getPosition(), playermodelcontroller$rotinfo.rightArmPos); diff --git a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java index b4878b310..300483da0 100644 --- a/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java +++ b/common/src/main/java/org/vivecraft/client/VivecraftVRMod.java @@ -78,27 +78,7 @@ public class VivecraftVRMod { keyMoveThirdPersonCam, keyTogglePlayerList, keyToggleHandheldCam, - keyQuickHandheldCam, - keyCurlMainThumb, - keyCurlMainIndex, - keyCurlMainMiddle, - keyCurlMainRing, - keyCurlMainLittle, - keyCurlOffThumb, - keyCurlOffIndex, - keyCurlOffMiddle, - keyCurlOffRing, - keyCurlOffLittle, - keyExtensionMainThumb, - keyExtensionMainIndex, - keyExtensionMainMiddle, - keyExtensionMainRing, - keyExtensionMainLittle, - keyExtensionOffThumb, - keyExtensionOffIndex, - keyExtensionOffMiddle, - keyExtensionOffRing, - keyExtensionOffLittle + keyQuickHandheldCam )); /** Key binds internal to vivecraft, which the player may not bind. */ @@ -130,7 +110,27 @@ public class VivecraftVRMod { keyHotbarPrev, keyHotbarScroll, keyVRInteract, - keyWalkabout + keyWalkabout, + keyCurlMainThumb, + keyCurlMainIndex, + keyCurlMainMiddle, + keyCurlMainRing, + keyCurlMainLittle, + keyCurlOffThumb, + keyCurlOffIndex, + keyCurlOffMiddle, + keyCurlOffRing, + keyCurlOffLittle, + keyExtensionMainThumb, + keyExtensionMainIndex, + keyExtensionMainMiddle, + keyExtensionMainRing, + keyExtensionMainLittle, + keyExtensionOffThumb, + keyExtensionOffIndex, + keyExtensionOffMiddle, + keyExtensionOffRing, + keyExtensionOffLittle )); /** Key binds provided by vanilla. */ @@ -146,7 +146,7 @@ public static boolean isSafeBinding(KeyMapping kb) { return allKeyBindingSet.contains(kb) || kb == mc.options.keyChat || kb == mc.options.keyInventory; } - /** checks if a key bind is provided by vanilla or internal to vivecraft */ + /** checks if a key bind is NOT provided by vanilla NOR internal to vivecraft */ public static boolean isModBinding(final KeyMapping kb) { return !hiddenKeyBindingSet.contains(kb) && !vanillaBindingSet.contains(kb); } diff --git a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java index e05cea5d4..7c631250b 100644 --- a/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java +++ b/common/src/main/java/org/vivecraft/client/gui/framework/GuiVROptionsBase.java @@ -137,9 +137,7 @@ public void onClick(double mouseX, double mouseY) { })); } else if (customHandler != null) { this.addRenderableWidget(new GuiVROptionButton(x, y, buttonText, (p) -> - { - customHandler.apply((GuiVROptionButton) p, new Vec2(0.0F, 0.0F)); - })); + customHandler.apply((GuiVROptionButton) p, new Vec2(0.0F, 0.0F)))); } else { this.addRenderableWidget(new GuiVROptionButton(x, y, buttonText, (p) -> { })); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java index 948aee5b1..3be5c7142 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java @@ -103,7 +103,7 @@ public ListValueEntry(Component name, EditBox valueWidget, OnPress deleteAction) @Override public void render(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, int n, int o, boolean bl, float f) { - this.valueWidget.setX(k + -50); + this.valueWidget.setX(k - 50); this.valueWidget.setY(j); this.valueWidget.render(guiGraphics, n, o, f); this.deleteButton.setX(k + 230); diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java index 0ce6daa69..025863278 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRadialConfiguration.java @@ -65,9 +65,7 @@ public void init() { .build() ); this.addRenderableWidget(new Builder(Component.translatable("vivecraft.gui.clear"), (p) -> - { - this.setKey(null); - }) + this.setKey(null)) .size(150, 20) .pos(this.width / 2 - 155, 25) .build() diff --git a/common/src/main/java/org/vivecraft/client/utils/Utils.java b/common/src/main/java/org/vivecraft/client/utils/Utils.java index afcb39c1e..e673fa16c 100644 --- a/common/src/main/java/org/vivecraft/client/utils/Utils.java +++ b/common/src/main/java/org/vivecraft/client/utils/Utils.java @@ -473,9 +473,7 @@ public static List wrapText(FormattedText text, int width, Font f }, Style.EMPTY); List list = Lists.newArrayList(); fontRenderer.getSplitter().splitLines(componentcollector.getResultOrEmpty(), width, Style.EMPTY, (lineText, sameLine) -> - { - list.add(sameLine && linePrefix != null ? FormattedText.composite(linePrefix, lineText) : lineText); - }); + list.add(sameLine && linePrefix != null ? FormattedText.composite(linePrefix, lineText) : lineText)); return list.isEmpty() ? Lists.newArrayList(FormattedText.EMPTY) : list; } diff --git a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java index 2aefc2cd2..8ae34013a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java +++ b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java @@ -22,12 +22,13 @@ public class Vec3History { _data.addAll(generate(entry::new).limit(_capacity).toList()); } - public void add(double x, double y, double z) { + public Vector3dc add(double x, double y, double z) { this._data.addFirst(this._data.removeLast().set(x, y, z)); + return this._data.getFirst().data; } - public void add(Vec3 in) { - this.add(in.x(), in.y(), in.z()); + public Vector3dc add(Vec3 in) { + return this.add(in.x(), in.y(), in.z()); } public Vector3dc add(Vector3dc in) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java index 0a8f81c01..e545b021a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java @@ -352,7 +352,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { } float f3 = player.getDimensions(player.getPose()).width * 0.45F; - double d3 = (double) (f - f3); + double d3 = f - f3; AABB aabb1 = new AABB( vec31.x - d3, aabb.minY, @@ -390,7 +390,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { aabb.maxY, aabb.maxZ )); - Vec3 vec32 = this.roomOrigin.add(d4, (double) (0.1F * (float) j), d5); + Vec3 vec32 = this.roomOrigin.add(d4, 0.1F * (float) j, d5); this.setRoomOrigin(vec32.x, vec32.y, vec32.z, false); Vec3 vec33 = player.getLookAngle(); Vec3 vec34 = (new Vec3(vec33.x, 0.0D, vec33.z)).normalize(); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java index 11ea2d520..eff6df3ba 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java @@ -50,16 +50,16 @@ public class GuiHandler { public static float guiScaleApplied = 1.0F; public static Vec3 guiPos_room; public static Matrix4f guiRotation_room; - public static final KeyMapping keyLeftClick = new KeyMapping("vivecraft.key.guiLeftClick", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyRightClick = new KeyMapping("vivecraft.key.guiRightClick", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyMiddleClick = new KeyMapping("vivecraft.key.guiMiddleClick", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyShift = new KeyMapping("vivecraft.key.guiShift", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyCtrl = new KeyMapping("vivecraft.key.guiCtrl", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyAlt = new KeyMapping("vivecraft.key.guiAlt", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyScrollUp = new KeyMapping("vivecraft.key.guiScrollUp", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyScrollDown = new KeyMapping("vivecraft.key.guiScrollDown", -1, "vivecraft.key.category.gui"); - public static final KeyMapping keyScrollAxis = new KeyMapping("vivecraft.key.guiScrollAxis", -1, "vivecraft.key.category.gui"); - public static final HandedKeyBinding keyKeyboardClick = new HandedKeyBinding("vivecraft.key.keyboardClick", -1, "vivecraft.key.category.keyboard") { + public static final KeyMapping keyLeftClick = new KeyMapping("vivecraft.key.guiLeftClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyRightClick = new KeyMapping("vivecraft.key.guiRightClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyMiddleClick = new KeyMapping("vivecraft.key.guiMiddleClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyShift = new KeyMapping("vivecraft.key.guiShift", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyCtrl = new KeyMapping("vivecraft.key.guiCtrl", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyAlt = new KeyMapping("vivecraft.key.guiAlt", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyScrollUp = new KeyMapping("vivecraft.key.guiScrollUp", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyScrollDown = new KeyMapping("vivecraft.key.guiScrollDown", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final KeyMapping keyScrollAxis = new KeyMapping("vivecraft.key.guiScrollAxis", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); + public static final HandedKeyBinding keyKeyboardClick = new HandedKeyBinding("vivecraft.key.keyboardClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.keyboard") { @Override public boolean isPriorityOnController(ControllerType type) { if (KeyboardHandler.isShowing() && !dh.vrSettings.physicalKeyboard) { @@ -69,7 +69,7 @@ public boolean isPriorityOnController(ControllerType type) { } } }; - public static final HandedKeyBinding keyKeyboardShift = new HandedKeyBinding("vivecraft.key.keyboardShift", -1, "vivecraft.key.category.keyboard") { + public static final HandedKeyBinding keyKeyboardShift = new HandedKeyBinding("vivecraft.key.keyboardShift", GLFW_KEY_UNKNOWN, "vivecraft.key.category.keyboard") { @Override public boolean isPriorityOnController(ControllerType type) { if (KeyboardHandler.isShowing()) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java index bdcc3a8d7..191b462c3 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java @@ -464,12 +464,12 @@ public void doProcess() { if (j != 2 && j != 3) { if (j == 4 || j == 5) { d0 = d8 - vec36.z; - d10 = (double) ((float) blockpos2.getX() + 0.5F); + d10 = (float) blockpos2.getX() + 0.5F; d10 += (1.0 - min(dh.vrPlayer.worldScale, 1.0)) * (j == 4 ? 0.5 : -0.5); } } else { d10 = d4 - vec36.x; - d0 = (double) ((float) blockpos2.getZ() + 0.5F); + d0 = (float) blockpos2.getZ() + 0.5F; d0 += (1.0 - min(dh.vrPlayer.worldScale, 1.0)) * (j == 2 ? 0.5 : -0.5); } } @@ -478,7 +478,7 @@ public void doProcess() { double d1 = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition().y; if (!this.wantjump && this.latchbox[this.latchStartController] != null && d1 <= d12 / 2.0D && this.latchStart[this.latchStartController].y > this.latchbox[this.latchStartController].maxY * 0.8D + (double) blockpos2.getY()) { - Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.hmd.getDirection().scale((double) 0.1F); + Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.hmd.getDirection().scale(0.1F); Vec3 vec33 = (new Vec3(vec32.x, 0.0D, vec32.z)).normalize().scale(0.1D); boolean flag5 = mc.level.noCollision(mc.player, mc.player.getBoundingBox().move(vec33.x, this.latchbox[this.latchStartController].maxY + (double) blockpos2.getY() - mc.player.getY(), vec33.z)); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java index 7203ea450..b3051a4d6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java @@ -65,7 +65,7 @@ public void reset() { @Override public void doProcess() { Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vec3 mouthPos = dh.vrPlayer.vrdata_room_pre.getController(0).getCustomVector(new Vec3(0.0D, (double) (-this.mouthtoEyeDistance), 0.0D)).add(hmdPos); + Vec3 mouthPos = dh.vrPlayer.vrdata_room_pre.getController(0).getCustomVector(new Vec3(0.0D, -this.mouthtoEyeDistance, 0.0D)).add(hmdPos); for (int c = 0; c < 2; ++c) { @@ -103,7 +103,7 @@ public void doProcess() { } if (this.eating[c]) { - long k = (long) mc.player.getUseItemRemainingTicks(); + long k = mc.player.getUseItemRemainingTicks(); if (k > 0L && k % 5L <= (long) crunchiness) { dh.vr.triggerHapticPulse(c, 700); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java index c51369cca..8af66220c 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java @@ -186,9 +186,7 @@ public void doProcess() { Vec3 vec33 = new Vec3(vec3.x + vec31.x * -0.1D, vec3.y + vec31.y * -0.1D, vec3.z + vec31.z * -0.1D); AABB aabb = new AABB(vec3, vec33); this.inEntityHit[j] = ProjectileUtil.getEntityHitResult(mc.getCameraEntity(), vec35, vec3, aabb, (e) -> - { - return !e.isSpectator() && e.isPickable() && e != mc.getCameraEntity().getVehicle(); - }, 0.0D); + !e.isSpectator() && e.isPickable() && e != mc.getCameraEntity().getVehicle(), 0.0D); if (this.inEntityHit[j] != null) { Entity entity = this.inEntityHit[j].getEntity(); @@ -198,8 +196,7 @@ public void doProcess() { } if (!this.active[j]) { - BlockPos blockpos = null; - blockpos = BlockPos.containing(vec3); + BlockPos blockpos = BlockPos.containing(vec3); BlockState blockstate = mc.level.getBlockState(blockpos); BlockHitResult blockhitresult = blockstate.getShape(mc.level, blockpos).clip(vec35, vec3, blockpos); this.inBlockPos[j] = blockpos; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java index 8b1778572..eeaac805e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java @@ -81,7 +81,7 @@ public void doProcess() { } if (this.speed > 1.0D) { - this.speed = (double) 1.3F; + this.speed = 1.3F; } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java index c3ac89511..e2053b902 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java @@ -100,7 +100,7 @@ public void doProcess() { ((PlayerExtension) mc.player).vivecraft$setMovementTeleportTimer(((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() + 1); if (((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() > 0) { - this.movementTeleportProgress = (double) ((float) ((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer()); + this.movementTeleportProgress = (float) ((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer(); if (this.movementTeleportProgress >= 1.0D) { this.movementTeleportProgress = 1.0D; @@ -308,7 +308,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, BlockState blockstate = player.level().getBlockState(blockpos); if (!mc.level.getFluidState(blockpos).isEmpty()) { - Vec3 vec3 = new Vec3(collision.getLocation().x, (double) blockpos.getY(), collision.getLocation().z); + Vec3 vec3 = new Vec3(collision.getLocation().x, blockpos.getY(), collision.getLocation().z); Vec3 vec31 = vec3.subtract(player.getX(), player.getBoundingBox().minY, player.getZ()); AABB aabb = player.getBoundingBox().move(vec31.x, vec31.y, vec31.z); boolean flag = mc.level.noCollision(player, aabb); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java index 2ca6ae293..4e926ba62 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java @@ -43,7 +43,7 @@ public static boolean isLegacyTelescope(ItemStack i) { private static Vec3 getLensOrigin(int controller) { VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(controller); - return vrdata$vrdevicepose.getPosition().add(getViewVector(controller).scale(-0.2D).add(vrdata$vrdevicepose.getDirection().scale((double) 0.05F))); + return vrdata$vrdevicepose.getPosition().add(getViewVector(controller).scale(-0.2D).add(vrdata$vrdevicepose.getDirection().scale(0.05F))); } private static Vec3 getViewVector(int controller) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java index 8b64d820c..9a207bd08 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java @@ -83,7 +83,7 @@ public void doProcess() { if (dh.vrSettings.vehicleRotation && mc.player.isPassenger() && this.rotationCooldown == 0) { Entity entity = mc.player.getVehicle(); - this.rotationTarget = (double) entity.getYRot(); + this.rotationTarget = entity.getYRot(); if (entity instanceof AbstractHorse abstracthorse && !dh.horseTracker.isActive()) { @@ -91,14 +91,14 @@ public void doProcess() { return; } - this.rotationTarget = (double) abstracthorse.yBodyRot; + this.rotationTarget = abstracthorse.yBodyRot; } else if (entity instanceof Mob mob) { if (mob.isControlledByLocalInstance()) { return; } - this.rotationTarget = (double) mob.yBodyRot; + this.rotationTarget = mob.yBodyRot; } boolean flag = true; @@ -113,7 +113,7 @@ public void doProcess() { this.minecartStupidityCounter = 3; } - this.rotationTarget = (double) this.getMinecartRenderYaw((Minecart) entity); + this.rotationTarget = this.getMinecartRenderYaw((Minecart) entity); if (this.minecartStupidityCounter > 0) { this.vehicleInitialRotation = (float) this.rotationTarget; diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java index c05227a18..9abf39357 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/FakeBlockAccess.java @@ -195,7 +195,7 @@ public int getBlockTint(BlockPos blockPosIn, ColorResolver colorResolverIn) { for (MutableBlockPos blockpos$mutable = new MutableBlockPos(); cursor3D.advance(); i1 += j1 & 255) { blockpos$mutable.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ()); - j1 = colorResolverIn.getColor(this.getBiome(blockpos$mutable).value(), (double) blockpos$mutable.getX(), (double) blockpos$mutable.getZ()); + j1 = colorResolverIn.getColor(this.getBiome(blockpos$mutable).value(), blockpos$mutable.getX(), blockpos$mutable.getZ()); k += (j1 & 16711680) >> 16; l += (j1 & 65280) >> 8; } diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java index 171963a92..47ae6f955 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java @@ -942,8 +942,8 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub double localZ = rainZ + 0.5; float distance = (float) sqrt(localX * localX + localZ * localZ) / (float) rainDistance; float blend; - float xOffset = 0; - float yOffset = 0; + float xOffset; + float yOffset; int skyLight = blockAccess.getBrightness(LightLayer.SKY, mutableBlockPos) << 4; int blockLight = blockAccess.getBrightness(LightLayer.BLOCK, mutableBlockPos) << 4; @@ -959,6 +959,7 @@ private void renderSnowAndRain(PoseStack poseStack, double inX, double inY, doub } blend = ((1.0F - distance * distance) * 0.5F + 0.5F); + xOffset = 0; int x = this.ticks + rainX * rainX * 3121 + rainX * 45238971 + rainZ * rainZ * 418711 + rainZ * 13761 & 0x1F; yOffset = -((float) x + mc.getFrameTime()) / 32.0f * (3.0f + randomSource.nextFloat()); } else if (precipitation == Precipitation.SNOW) { diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index 39a5c6ad8..59b165a01 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -380,9 +380,8 @@ protected void processHotbar() { protected KeyMapping findKeyBinding(String name) { return Stream.concat(Arrays.stream(mc.options.keyMappings), VivecraftVRMod.hiddenKeyBindingSet.stream()).filter((kb) -> - { - return name.equals(kb.getName()); - }).findFirst().orElse(null); + name.equals(kb.getName()) + ).findFirst().orElse(null); } protected void hmdSampling() { @@ -445,7 +444,6 @@ protected void hmdSampling() { protected void updateAim() { RenderPassManager.setGUIRenderPass(); - this.hmdRotation.identity(); this.hmdRotation.set3x3(this.hmdPose); this.hmdPivotHistory.add( @@ -453,109 +451,80 @@ protected void updateAim() { .add(this.hmdHistory.add(this.getCenterEyePosition())) ); - if (dh.vrSettings.seated) { - this.controllerPose[0] = this.hmdPose.invert(new Matrix4f()).invert(new Matrix4f()); - this.controllerPose[1] = this.hmdPose.invert(new Matrix4f()).invert(new Matrix4f()); - } - - Matrix4f[] amatrix4f = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; - Matrix4f[] amatrix4f1 = new Matrix4f[]{new Matrix4f(), new Matrix4f()}; + // should be Matrix4fc, don't edit these! + final Matrix4f controller1tip; + final Matrix4f controller1hand; if (dh.vrSettings.seated) { - amatrix4f1[0].set(this.controllerPose[0]); - } else { - this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "handgrip"), amatrix4f1[0]); - } - - this.handRotation[0].identity(); - this.handRotation[0].set3x3(amatrix4f1[0]); - - if (dh.vrSettings.seated) { - amatrix4f[0].set(this.controllerPose[0]); - } else { - this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "tip"), amatrix4f[0]); - } - - amatrix4f[0].getTranslation(this.aimSource[0]); - this.controllerHistory[0].add(this.getAimSource(0)); - this.controllerRotation[0].identity(); - this.controllerRotation[0].set3x3(amatrix4f[0]); - - if (dh.vrSettings.seated && mc.screen == null) { - Matrix4f matrix4f = new Matrix4f(); - if (mc.isWindowActive()) { - float f = 110.0F; - float f1 = 180.0F; - int i = mc.getWindow().getScreenHeight(); - - if (i % 2 != 0) { - --i; - } - double d0 = mc.mouseHandler.xpos() / (double) mc.getWindow().getScreenWidth() * f - (f / 2.0F); - double d3; - Vector3f vec31 = this.getHmdVector(); - - if (d0 < (double) (-dh.vrSettings.keyholeX)) { - this.seatedRot += 20.0F * dh.vrSettings.xSensitivity * (((float) abs(d0) - dh.vrSettings.keyholeX) / (f / 2.0F - dh.vrSettings.keyholeX)); - this.seatedRot %= 360.0F; + this.hmdPose.invert(this.controllerPose[0]).invert(); + this.hmdPose.invert(this.controllerPose[1]).invert(); + controller1tip = controller1hand = this.controllerPose[1]; + this.aimSource[0].set(this.getCenterEyePosition()); + this.aimSource[1].set(this.getCenterEyePosition()); + if (mc.screen == null && mc.isWindowActive()) { + final int i = mc.getWindow().getScreenHeight(); + final float width = mc.getWindow().getScreenWidth(); + final float height = i % 2 != 0 ? i - 1 : i; + final float xpos = (float) mc.mouseHandler.xpos(); + + final float f1 = xpos / width * 110.0F - (110.0F / 2.0F); + final float f2 = abs(f1); + final float f3; + final float f4; + + if (f2 > dh.vrSettings.keyholeX) { + Vector3f vec31 = this.getHmdVector(); this.hmdForwardYaw = (float) toDegrees(atan2(vec31.x, vec31.z)); - d3 = ((int) ((double) (-dh.vrSettings.keyholeX + f / 2.0F) * (double) mc.getWindow().getScreenWidth() / (double) f) + 1); - d0 = -dh.vrSettings.keyholeX; - } else if (d0 > (double) dh.vrSettings.keyholeX) { - this.seatedRot -= 20.0F * dh.vrSettings.xSensitivity * (((float) abs(d0) - dh.vrSettings.keyholeX) / (f / 2.0F - dh.vrSettings.keyholeX)); + float f5 = 20.0F * dh.vrSettings.xSensitivity * ((f2 - dh.vrSettings.keyholeX) / (110.0F / 2.0F - dh.vrSettings.keyholeX)); + if (f1 < -dh.vrSettings.keyholeX) { + this.seatedRot += f5; + f3 = (int) ((-dh.vrSettings.keyholeX + 110.0F / 2.0F) * width / 110.0F) + 1; + f4 = -dh.vrSettings.keyholeX; + } else { + this.seatedRot -= f5; + f3 = (int) ((dh.vrSettings.keyholeX + 110.0F / 2.0F) * width / 110.0F) - 1; + f4 = dh.vrSettings.keyholeX; + } this.seatedRot %= 360.0F; - this.hmdForwardYaw = (float) toDegrees(atan2(vec31.x, vec31.z)); - d3 = ((int) ((double) (dh.vrSettings.keyholeX + f / 2.0F) * (double) mc.getWindow().getScreenWidth() / (double) f) - 1); - d0 = dh.vrSettings.keyholeX; } else { - d3 = mc.mouseHandler.xpos(); + f3 = xpos; + f4 = f1; } - InputSimulator.setMousePos(d3, i / 2.0D); - glfwSetCursorPos(mc.getWindow().getWindow(), d3, i / 2.0D); - matrix4f.rotateX((float) toRadians(-clamp( - -89.9D, 89.9D, this.aimPitch + (-mc.mouseHandler.ypos() / i * f1 + (f1 / 2.0F)) * 0.5F * dh.vrSettings.ySensitivity - ))); - matrix4f.rotateY((float) toRadians(-180.0D + d0 - (double) this.hmdForwardYaw)); + InputSimulator.setMousePos(f3, height / 2.0F); + glfwSetCursorPos(mc.getWindow().getWindow(), f3, height / 2.0F); + final float xRot = toRadians(-clamp( + -89.9F, 89.9F, this.aimPitch + (-((float) mc.mouseHandler.ypos()) / height * 180.0F + (180.0F / 2.0F)) * 0.5F * dh.vrSettings.ySensitivity + )); + final float yRot = toRadians(-180.0F + f4 - this.hmdForwardYaw); + this.handRotation[0].rotationXYZ(xRot, yRot, 0); + this.controllerRotation[0].rotationXYZ(xRot, yRot, 0); + } else { + this.handRotation[0].identity().set3x3(this.controllerPose[0]); + this.controllerRotation[0].identity().set3x3(this.controllerPose[0]); } - - this.controllerRotation[0].set3x3(matrix4f); - - this.handRotation[0].set3x3(matrix4f); - } - - Vec3 vec32 = this.getAimVector(0); - this.aimPitch = (float) toDegrees(asin(vec32.y / vec32.length())); - this.controllerForwardHistory[0].add(vec32); - this.controllerUpHistory[0].add(this.controllerRotation[0].transformProject(up, new Vector3f())); - - if (dh.vrSettings.seated) { - amatrix4f1[1].set(this.controllerPose[1]); } else { - this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "handgrip"), amatrix4f1[1]); + controller1hand = this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "handgrip"), new Matrix4f()); + final Matrix4f controller0tip = this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "tip"), new Matrix4f()); + controller1tip = this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "tip"), new Matrix4f()); + controller0tip.getTranslation(this.aimSource[0]); + controller1tip.getTranslation(this.aimSource[1]); + this.handRotation[0].identity().set3x3(this.controllerPose[0].mul0(this.getControllerComponentTransform(0, "handgrip"), new Matrix4f())); + this.controllerRotation[0].identity().set3x3(controller0tip); } - this.handRotation[1].identity(); - this.handRotation[1].set3x3(amatrix4f1[1]); - - if (dh.vrSettings.seated) { - amatrix4f[1].set(this.controllerPose[1]); - } else { - this.controllerPose[1].mul0(this.getControllerComponentTransform(1, "tip"), amatrix4f[1]); - } + this.handRotation[1].identity().set3x3(controller1hand); + this.controllerRotation[1].identity().set3x3(controller1tip); - amatrix4f[1].getTranslation(this.aimSource[1]); + this.controllerHistory[0].add(this.getAimSource(0)); this.controllerHistory[1].add(this.getAimSource(1)); - this.controllerRotation[1].identity(); - this.controllerRotation[1].set3x3(amatrix4f[1]); + + Vector3dc vec32 = this.controllerForwardHistory[0].add(this.getAimVector(0)); + this.aimPitch = (float) toDegrees(asin(vec32.y() / vec32.length())); + this.controllerUpHistory[0].add(this.controllerRotation[0].transformProject(up, new Vector3f())); this.controllerForwardHistory[1].add(this.getAimVector(1)); this.controllerUpHistory[1].add(this.controllerRotation[1].transformProject(up, new Vector3f())); - if (dh.vrSettings.seated) { - this.aimSource[1].set(this.getCenterEyePosition()); - this.aimSource[0].set(this.getCenterEyePosition()); - } - // boolean flag = false; // // if (flag) @@ -613,7 +582,7 @@ public void processBindings() { float f2 = f; ControllerType controllertype = this.findActiveBindingControllerType(VivecraftVRMod.keyWalkabout); - if (controllertype != null && controllertype == ControllerType.LEFT) { + if (controllertype == ControllerType.LEFT) { f2 = f1; } @@ -799,7 +768,7 @@ public void processBindings() { } if (RadialHandler.isShowing() && VivecraftVRMod.keyMenuButton.consumeClick()) { - RadialHandler.setOverlayShowing(false, (ControllerType) null); + RadialHandler.setOverlayShowing(false, null); } if (VivecraftVRMod.keyMenuButton.consumeClick()) { @@ -987,9 +956,9 @@ public Map getSpecialActionParams() { protected void changeHotbar(int dir) { if (mc.player != null && (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getMainHandItem()))) { if (mc.screen == null) { - InputSimulator.scrollMouse(0.0D, (double) (dir * 4)); + InputSimulator.scrollMouse(0.0D, dir * 4); } else { - mc.player.getInventory().swapPaint((double) dir); + mc.player.getInventory().swapPaint(dir); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java index fe153325c..b559a44fc 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/VRRenderer.java @@ -554,7 +554,7 @@ public void setupRenderConfiguration() throws Exception { float resolutionScale = ResolutionControlHelper.isLoaded() ? ResolutionControlHelper.getCurrentScaleFactor() : 1.0F; - this.renderScale = (float) sqrt(dh.vrSettings.renderScaleFactor) * resolutionScale; + this.renderScale = sqrt(dh.vrSettings.renderScaleFactor) * resolutionScale; int eyeFBWidth = roundUsing(eyew * this.renderScale, RoundingMode.CEILING); int eyeFBHeight = roundUsing(eyeh * this.renderScale, RoundingMode.CEILING); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index 8180863c2..1bc6a1947 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -454,10 +454,7 @@ private void generateActionManifest() { map.put("action_sets", list); List list1 = new ArrayList<>(this.inputActions.values()); - list1.sort(Comparator.comparing((action) -> - { - return action.keyBinding; - })); + list1.sort(Comparator.comparing((action) -> action.keyBinding)); List> list2 = new ArrayList<>(); for (VRInputAction vrinputaction : list1) { diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java index dbfb7acb9..99323f5d6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java @@ -685,7 +685,7 @@ public static void renderGuiLayer(float partialTicks, boolean depthAlways, PoseS .rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); poseStack.last().normal().rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); - if (dh.menuWorldRenderer.isReady()) { + if (dh.menuWorldRenderer != null && dh.menuWorldRenderer.isReady()) { try { renderTechjarsAwesomeMainMenuRoom(poseStack); } catch (Exception exception) { diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java index 4cfe54e6e..176451f4a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRPassHelper.java @@ -14,7 +14,6 @@ import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.render.VRShaders; -import org.vivecraft.client_vr.settings.VRSettings; import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; import org.vivecraft.mod_compat_vr.iris.IrisHelper; import org.vivecraft.mod_compat_vr.optifine.OptifineHelper; diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java index bce574bc7..ada5b11ae 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java @@ -77,9 +77,8 @@ public static void renderVRHandheldCameraWidget() { RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/black.png")); } }, (face) -> - { - return face == Direction.SOUTH ? DisplayFace.NORMAL : DisplayFace.NONE; - }); + face == Direction.SOUTH ? DisplayFace.NORMAL : DisplayFace.NONE + ); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java index cf51b225f..0ed90489a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/VRSettings.java @@ -807,7 +807,7 @@ public void loadOptions(JsonObject theProfiles) { try { ProfileReader optionsVRReader = new ProfileReader(ProfileManager.PROFILE_SET_VR, theProfiles); - String var2 = ""; + String var2; while ((var2 = optionsVRReader.readLine()) != null) { try { @@ -918,9 +918,7 @@ public String getButtonDisplayString(VrOptions par1EnumOptions) { String var2 = par1EnumOptions.getLangKey(); var2 = var2 != null ? I18n.get(var2) : I18n.get("vivecraft.options." + par1EnumOptions.name()); - String var3 = var2 + ": "; - String var4 = var3; - String var5; + String var4 = var2 + ": "; try { var mapping = fieldEnumMap.get(par1EnumOptions); diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java index 8d601d3bc..a81423e20 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileManager.java @@ -211,7 +211,7 @@ public static synchronized Map getProfileSet(JsonObject theProfi } public static synchronized void setProfileSet(String profile, String set, Map settings) { - JsonObject JsonObject = null; + JsonObject JsonObject; JsonObject JsonObject1 = new JsonObject(); if (profiles.has(profile)) { diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java index c1de6430e..896452b62 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileReader.java @@ -2,7 +2,6 @@ import com.google.gson.JsonObject; -import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java index df9560e08..9392891ad 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/profile/ProfileWriter.java @@ -6,22 +6,20 @@ import java.util.Map; public class ProfileWriter { - private String activeProfileName; - private String set; + private final String activeProfileName; + private final String set; private Map data = new HashMap<>(); private JsonObject theProfile; public ProfileWriter(String set) { this.activeProfileName = ProfileManager.currentProfileName; this.set = set; - this.data = new HashMap<>(); } public ProfileWriter(String set, JsonObject theProfile) { this.activeProfileName = ProfileManager.currentProfileName; this.set = set; this.theProfile = theProfile; - this.data = new HashMap<>(); } public void println(String s) { diff --git a/common/src/main/java/org/vivecraft/common/utils/color/Color.java b/common/src/main/java/org/vivecraft/common/utils/color/Color.java index 81cf7f757..2401c89b7 100644 --- a/common/src/main/java/org/vivecraft/common/utils/color/Color.java +++ b/common/src/main/java/org/vivecraft/common/utils/color/Color.java @@ -112,7 +112,7 @@ * * @apiNote This class intentionally shadows {@link java.awt.Color} to prevent it from being used. *
- * Using {@link java.awt.Color} or any of {@link java.awt}, may crash {@link org.lwjgl} on MacOS. + * Using {@link java.awt.Color} or any of {@link java.awt}, may crash {@link org.lwjgl} on macOS. */ @ParametersAreNonnullByDefault public class Color { diff --git a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java index 6bbee2ad9..8043b5ded 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/blaze3d/RenderTargetMixin.java @@ -109,9 +109,7 @@ public String toString() { public void vivecraft$blitToScreen(ShaderInstance instance, int left, int width, int height, int top, boolean disableBlend, float xCropFactor, float yCropFactor, boolean keepAspect) { RenderSystem.assertOnGameThreadOrInit(); if (!RenderSystem.isInInitPhase()) { - RenderSystem.recordRenderCall(() -> { - this.vivecraft$_blitToScreen(instance, left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect); - }); + RenderSystem.recordRenderCall(() -> this.vivecraft$_blitToScreen(instance, left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect)); } else { this.vivecraft$_blitToScreen(instance, left, width, height, top, disableBlend, xCropFactor, yCropFactor, keepAspect); } diff --git a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java index fc6cd70d6..2f8df5591 100644 --- a/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client/gui/screens/TitleScreenMixin.java @@ -83,7 +83,7 @@ protected TitleScreenMixin(Component component) { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/PanoramaRenderer;render(FF)V"), method = "render") public void vivecraft$maybeNoPanorama(PanoramaRenderer instance, float f, float g) { - if (vrRunning && dh.menuWorldRenderer.isReady()) { + if (vrRunning && dh.menuWorldRenderer != null && dh.menuWorldRenderer.isReady()) { return; } instance.render(f, g); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java index 0e361522e..e4c617b90 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/KeyMappingVRMixin.java @@ -16,9 +16,9 @@ public abstract class KeyMappingVRMixin { // inject custom controls categories static { - CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", 8); - CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", 9); - CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", 10); - //CATEGORY_SORT_ORDER.put("vivecraft.key.category.skeletal_input", 11); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.gui", CATEGORY_SORT_ORDER.values().stream().max(Integer::compareTo).orElse(0) + 1); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.climbey", CATEGORY_SORT_ORDER.values().stream().max(Integer::compareTo).orElse(0) + 1); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.keyboard", CATEGORY_SORT_ORDER.values().stream().max(Integer::compareTo).orElse(0) + 1); + CATEGORY_SORT_ORDER.put("vivecraft.key.category.skeletal_input", CATEGORY_SORT_ORDER.values().stream().max(Integer::compareTo).orElse(0) + 1); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 5bfdbfcbb..03bf43982 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -620,7 +620,7 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { if (vrRunning) { - if (dh.menuWorldRenderer.isReady()) { + if (dh.menuWorldRenderer != null && dh.menuWorldRenderer.isReady()) { // update textures in the menu if (mc.level == null) { this.textureManager.tick(); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java index 967c1583b..795144ce6 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java @@ -345,7 +345,7 @@ public void moveRelative(float pAmount, Vec3 pRelative) { double d7 = 1.0D; if (d3 >= (double) 1.0E-4F || dh.katvr) { - d3 = (double) sqrt((float) d3); + d3 = sqrt((float) d3); if (d3 < 1.0D && !dh.katvr) { d3 = 1.0D; @@ -359,7 +359,7 @@ public void moveRelative(float pAmount, Vec3 pRelative) { if (dh.katvr) { jkatvr.query(); - d3 = (double) (jkatvr.getSpeed() * jkatvr.walkDirection() * dh.vrSettings.movementSpeedMultiplier); + d3 = jkatvr.getSpeed() * jkatvr.walkDirection() * dh.vrSettings.movementSpeedMultiplier; vec3 = new Vec3(0.0D, 0.0D, d3); if (isFlyingOrSwimming) { @@ -369,7 +369,7 @@ public void moveRelative(float pAmount, Vec3 pRelative) { vec3 = vec3.yRot(toRadians(-jkatvr.getYaw()) + dh.vrPlayer.vrdata_world_pre.rotation_radians); } else if (dh.infinadeck) { jinfinadeck.query(); - d3 = (double) (jinfinadeck.getSpeed() * jinfinadeck.walkDirection() * dh.vrSettings.movementSpeedMultiplier); + d3 = jinfinadeck.getSpeed() * jinfinadeck.walkDirection() * dh.vrSettings.movementSpeedMultiplier; vec3 = new Vec3(0.0D, 0.0D, d3); if (isFlyingOrSwimming) { diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java index b00ac0986..e4d04387a 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java @@ -298,7 +298,7 @@ public abstract class GameRendererVRMixin } } - @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;viewport(IIII)V", shift = Shift.AFTER), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V") + @Inject(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;viewport(IIII)V", shift = Shift.AFTER), method = "render(FJZ)V") public void vivecraft$matrix(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) { this.resetProjectionMatrix(this.getProjectionMatrix(mc.options.fov().get())); RenderSystem.getModelViewStack().setIdentity(); @@ -311,7 +311,7 @@ public abstract class GameRendererVRMixin return poseStack; } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V", shift = Shift.AFTER), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;renderLevel(FJLcom/mojang/blaze3d/vertex/PoseStack;)V", shift = Shift.AFTER), method = "render(FJZ)V") public void vivecraft$renderoverlay(float f, long l, boolean bl, CallbackInfo ci) { if (vrRunning && dh.currentPass != RenderPass.THIRD && dh.currentPass != RenderPass.CAMERA) { VREffectsHelper.renderFaceOverlay(f, this.vivecraft$stack); @@ -347,7 +347,7 @@ public abstract class GameRendererVRMixin this.vivecraft$shouldDrawGui = shouldDrawGui; } - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", shift = Shift.BEFORE, ordinal = 6), method = "Lnet/minecraft/client/renderer/GameRenderer;render(FJZ)V", cancellable = true) + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", shift = Shift.BEFORE, ordinal = 6), method = "render(FJZ)V", cancellable = true) public void vivecraft$mainMenu(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo info) { if (RenderPassType.isVanilla()) { return; diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java index 8c7d8b511..3764f87ba 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/monster/EndermanMixin.java @@ -29,7 +29,7 @@ protected EndermanMixin(EntityType entityType, Level level) { super(entityType, level); } - @Inject(at = @At("HEAD"), method = "Lnet/minecraft/world/entity/monster/EnderMan;isLookingAtMe(Lnet/minecraft/world/entity/player/Player;)Z", cancellable = true) + @Inject(at = @At("HEAD"), method = "isLookingAtMe(Lnet/minecraft/world/entity/player/Player;)Z", cancellable = true) public void vivecraft$lookAtVR(Player player, CallbackInfoReturnable cir) { if (ServerVRPlayers.isVRPlayer((ServerPlayer) player)) { cir.setReturnValue(vivecraft$shouldEndermanAttackVRPlayer((EnderMan) (Object) this, (ServerPlayer) player)); diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java index 6305a90a8..08c71d3d4 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ThrowableProjectileMixin.java @@ -30,7 +30,7 @@ protected ThrowableProjectileMixin(EntityType p_37248_, Le ServerVivePlayer serverviveplayer = ServerVRPlayers.getVivePlayer(player); if (serverviveplayer != null && serverviveplayer.isVR()) { Vec3 vec3 = serverviveplayer.getControllerPos(serverviveplayer.activeHand, (Player) p_37463_); - Vec3 vec31 = serverviveplayer.getControllerDir(serverviveplayer.activeHand).scale((double) 0.6F); + Vec3 vec31 = serverviveplayer.getControllerDir(serverviveplayer.activeHand).scale(0.6F); this.setPos(vec3.x + vec31.x, vec3.y + vec31.y, vec3.z + vec31.z); } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java index c0ee1bdf7..f1dab2a9c 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisPipelineManagerVRMixin.java @@ -100,19 +100,30 @@ private void resetTextureState() { for (RenderPass renderPass : RenderPass.values()) { Iris.logger.info("Creating VR pipeline for dimension {}, RenderPass {}", newDimension, renderPass); - WorldRenderPass worldRenderPass = null; - switch (renderPass) { - case LEFT, RIGHT -> worldRenderPass = WorldRenderPass.stereoXR; - case CENTER -> worldRenderPass = WorldRenderPass.center; - case THIRD -> worldRenderPass = WorldRenderPass.mixedReality; - case SCOPEL -> worldRenderPass = WorldRenderPass.leftTelescope; - case SCOPER -> worldRenderPass = WorldRenderPass.rightTelescope; - case CAMERA -> worldRenderPass = WorldRenderPass.camera; + WorldRenderPass worldRenderPass = switch (renderPass) { + case LEFT, RIGHT -> { + yield WorldRenderPass.stereoXR; + } + case CENTER -> { + yield WorldRenderPass.center; + } + case THIRD -> { + yield WorldRenderPass.mixedReality; + } + case SCOPEL -> { + yield WorldRenderPass.leftTelescope; + } + case SCOPER -> { + yield WorldRenderPass.rightTelescope; + } + case CAMERA -> { + yield WorldRenderPass.camera; + } default -> { Iris.logger.info("skipped VR pipeline for dimension {}, RenderPass {}, not used", newDimension, renderPass); - continue; + yield null; } - } + }; if (worldRenderPass != null) { RenderPassManager.setWorldRenderPass(worldRenderPass); diff --git a/common/src/main/java/org/vivecraft/server/ServerNetworking.java b/common/src/main/java/org/vivecraft/server/ServerNetworking.java index f7ca7daeb..e4c2ee562 100644 --- a/common/src/main/java/org/vivecraft/server/ServerNetworking.java +++ b/common/src/main/java/org/vivecraft/server/ServerNetworking.java @@ -136,8 +136,6 @@ public static void handlePacket(PacketDiscriminators packetID, FriendlyByteBuf b listener.send(getVivecraftServerPacket(PacketDiscriminators.VR_SWITCHING, new byte[]{(byte) (ServerConfig.vrSwitchingEnabled.get() && !ServerConfig.vr_only.get() ? 1 : 0)})); listener.send(getVivecraftServerPacket(PacketDiscriminators.NETWORK_VERSION, new byte[]{(byte) vivePlayer.networkVersion})); - - break; } case IS_VR_ACTIVE -> { if (vivePlayer.isVR() != buffer.readBoolean()) { @@ -153,19 +151,29 @@ public static void handlePacket(PacketDiscriminators packetID, FriendlyByteBuf b } } - case DRAW -> vivePlayer.draw = buffer.readFloat(); + case DRAW -> { + vivePlayer.draw = buffer.readFloat(); + } - case VR_PLAYER_STATE -> vivePlayer.vrPlayerState = VRPlayerState.deserialize(buffer); + case VR_PLAYER_STATE -> { + vivePlayer.vrPlayerState = VRPlayerState.deserialize(buffer); + } - case WORLDSCALE -> vivePlayer.worldScale = buffer.readFloat(); - case HEIGHT -> vivePlayer.heightScale = buffer.readFloat(); + case WORLDSCALE -> { + vivePlayer.worldScale = buffer.readFloat(); + } + case HEIGHT -> { + vivePlayer.heightScale = buffer.readFloat(); + } case TELEPORT -> { float f = buffer.readFloat(); float f1 = buffer.readFloat(); float f2 = buffer.readFloat(); playerEntity.absMoveTo(f, f1, f2, playerEntity.getYRot(), playerEntity.getXRot()); } - case CLIMBING -> playerEntity.fallDistance = 0.0F; + case CLIMBING -> { + playerEntity.fallDistance = 0.0F; + } case ACTIVEHAND -> { vivePlayer.activeHand = buffer.readByte(); diff --git a/common/src/main/java/org/vivecraft/server/ServerUtil.java b/common/src/main/java/org/vivecraft/server/ServerUtil.java index b69e441a4..23e3fe5e3 100644 --- a/common/src/main/java/org/vivecraft/server/ServerUtil.java +++ b/common/src/main/java/org/vivecraft/server/ServerUtil.java @@ -30,7 +30,7 @@ public static void scheduleWelcomeMessageOrKick(ServerPlayer serverPlayer) { // only do stuff, if the player is still on the server if (!serverPlayer.hasDisconnected()) { ServerVivePlayer vivePlayer = ServerVRPlayers.getVivePlayer(serverPlayer); - String message = ""; + String message; boolean isOpAndAllowed = ServerConfig.allow_op.get() && serverPlayer.server.getPlayerList().isOp(serverPlayer.getGameProfile()); diff --git a/fabric/build.gradle b/fabric/build.gradle index 00480662d..877631fb8 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -80,7 +80,7 @@ dependencies { include(implementation("org.lwjgl:lwjgl-openvr:3.3.1:natives-windows")) // MixinExtras - include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.2.0-rc.4"))) + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.2.0-rc.5"))) } diff --git a/forge/build.gradle b/forge/build.gradle index a65f6cf6b..63bad8148 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -62,7 +62,7 @@ dependencies { bundle("org.lwjgl:lwjgl-openvr:3.3.1:natives-windows") { transitive = false } // MixinExtras - implementation(include("io.github.llamalad7:mixinextras-forge:0.2.0-rc.4")) + implementation(include("io.github.llamalad7:mixinextras-forge:0.2.0-rc.5")) } processResources { From 43602ef786f134c0b95768e20e8a8092a63f5c08 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:02:46 -0700 Subject: [PATCH 10/12] no need to self-reference ever again --- common/src/main/java/org/vivecraft/client_vr/VRState.java | 8 ++++++-- .../main/java/org/vivecraft/client_vr/provider/MCVR.java | 1 - .../org/vivecraft/client_vr/provider/nullvr/NullVR.java | 7 ------- .../client_vr/provider/openvr_lwjgl/MCOpenVR.java | 6 ------ .../provider/openvr_lwjgl/OpenVRHapticScheduler.java | 5 +++-- .../provider/openvr_lwjgl/control/HapticMusicPlayer.java | 8 +++++--- .../openvr_lwjgl/control/TrackpadSwipeSampler.java | 6 ++++-- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client_vr/VRState.java b/common/src/main/java/org/vivecraft/client_vr/VRState.java index 544cf73de..125d276c4 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRState.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRState.java @@ -51,8 +51,12 @@ public static void initializeVR() { vrInitialized = true; dh.vr = switch (dh.vrSettings.stereoProviderPluginID) { - case OPENVR -> new MCOpenVR(); - default -> new NullVR(); + case OPENVR -> { + yield new MCOpenVR(); + } + default -> { + yield new NullVR(); + } }; if (dh.vr.init()) { dh.vrRenderer = dh.vr.createVRRenderer(); diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index 59b165a01..d00301a36 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -49,7 +49,6 @@ @ParametersAreNonnullByDefault public abstract class MCVR { - protected static MCVR me; protected Matrix4f hmdPose = new Matrix4f(); public Matrix4f hmdRotation = new Matrix4f(); public HardwareType detectedHardware = HardwareType.VIVE; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java index fbd54686e..da0d2b352 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/nullvr/NullVR.java @@ -19,21 +19,14 @@ import static org.vivecraft.common.utils.Utils.logger; public class NullVR extends MCVR { - protected static NullVR ome; - private boolean vrActive = true; private boolean vrActiveChangedLastFrame = false; public NullVR() { super(); - ome = this; this.hapticScheduler = new NullVRHapticScheduler(); } - public static NullVR get() { - return ome; - } - @Override public void destroy() { diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index 1bc6a1947..cdc7693cf 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -56,7 +56,6 @@ import static org.vivecraft.common.utils.Utils.*; public class MCOpenVR extends MCVR { - protected static MCOpenVR ome; private final String ACTION_EXTERNAL_CAMERA = "/actions/mixedreality/in/externalcamera"; private final String ACTION_LEFT_HAND = "/actions/global/in/lefthand"; private final String ACTION_LEFT_HAND_GESTURE = "/actions/global/in/lefthandbones"; @@ -100,7 +99,6 @@ public class MCOpenVR extends MCVR { public MCOpenVR() { super(); - ome = this; this.hapticScheduler = new OpenVRHapticScheduler(); for (int i = 0; i < controllerDeviceIndex.length; ++i) { @@ -119,10 +117,6 @@ public MCOpenVR() { this.originInfo = InputOriginInfo.calloc(); } - public static MCOpenVR get() { - return ome; - } - static String getInputErrorName(int code) { return switch (code) { case EVRInputError_VRInputError_None -> { diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java index 4a5a23cfc..cf16ef9b6 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/OpenVRHapticScheduler.java @@ -6,14 +6,15 @@ import java.util.concurrent.TimeUnit; import static org.lwjgl.openvr.VRInput.VRInput_TriggerHapticVibrationAction; +import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.common.utils.Utils.logger; public class OpenVRHapticScheduler extends HapticScheduler { private void triggerHapticPulse(ControllerType controller, float durationSeconds, float frequency, float amplitude) { - int i = VRInput_TriggerHapticVibrationAction(MCOpenVR.get().getHapticHandle(controller), 0.0F, durationSeconds, frequency, amplitude, 0L); + int i = VRInput_TriggerHapticVibrationAction(((MCOpenVR) dh.vr).getHapticHandle(controller), 0.0F, durationSeconds, frequency, amplitude, 0L); if (i != 0) { - logger.error("Error triggering haptic: {}", MCOpenVR.getInputErrorName(i)); + logger.error("Error triggering haptic: {}", ((MCOpenVR) dh.vr).getInputErrorName(i)); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java index 1c7491490..b81e3a248 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/HapticMusicPlayer.java @@ -9,6 +9,8 @@ import java.util.List; import java.util.Map; +import static org.vivecraft.client_vr.VRState.dh; + public class HapticMusicPlayer { private static final Map map = new HashMap<>(); @@ -59,10 +61,10 @@ public void play() { if (object instanceof Note hapticmusicplayer$music$note) { if (hapticmusicplayer$music$note.controller != null) { - MCOpenVR.get().triggerHapticPulse(hapticmusicplayer$music$note.controller, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); + dh.vr.triggerHapticPulse(hapticmusicplayer$music$note.controller, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); } else { - MCOpenVR.get().triggerHapticPulse(ControllerType.RIGHT, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); - MCOpenVR.get().triggerHapticPulse(ControllerType.LEFT, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); + dh.vr.triggerHapticPulse(ControllerType.RIGHT, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); + dh.vr.triggerHapticPulse(ControllerType.LEFT, hapticmusicplayer$music$note.durationSeconds, hapticmusicplayer$music$note.frequency, hapticmusicplayer$music$note.amplitude, f); } } else if (object instanceof Delay hapticmusicplayer$music$delay) { f += hapticmusicplayer$music$delay.durationSeconds; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java index b774f5678..e228fdd36 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/control/TrackpadSwipeSampler.java @@ -5,6 +5,8 @@ import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.client_vr.provider.openvr_lwjgl.MCOpenVR; +import static org.vivecraft.client_vr.VRState.dh; + public class TrackpadSwipeSampler { private static final int UP = 0; private static final int RIGHT = 1; @@ -24,9 +26,9 @@ public TrackpadSwipeSampler() { } public void update(ControllerType hand, Vector2f position) { - MCOpenVR.get().getInputAction(VivecraftVRMod.keyTrackpadTouch).setCurrentHand(hand); + ((MCOpenVR) dh.vr).getInputAction(VivecraftVRMod.keyTrackpadTouch).setCurrentHand(hand); - if (MCOpenVR.get().getInputAction(VivecraftVRMod.keyTrackpadTouch).isButtonPressed()) { + if (((MCOpenVR) dh.vr).getInputAction(VivecraftVRMod.keyTrackpadTouch).isButtonPressed()) { this.buffer[this.index].set(position.x(), position.y()); if (++this.index >= this.buffer.length) { From aa959978e41ce893668c882c28c1fc53fe86f222 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Sun, 8 Oct 2023 13:49:40 -0700 Subject: [PATCH 11/12] hunting Vec3 among the fixes clever girl --- .../org/vivecraft/client/VRPlayersClient.java | 6 +- .../client/gui/settings/GuiListScreen.java | 8 +- .../gui/settings/GuiListValueEditScreen.java | 11 +- .../client/gui/widgets/SettingsList.java | 15 +- .../client/network/ClientNetworking.java | 7 +- .../client/render/VRPlayerModel_WithArms.java | 4 +- .../java/org/vivecraft/client_vr/VRData.java | 117 +++++----- .../org/vivecraft/client_vr/Vec3History.java | 52 ++++- .../extensions/GameRendererExtension.java | 7 +- .../client_vr/gameplay/VRPlayer.java | 141 +++++++------ .../gameplay/screenhandlers/GuiHandler.java | 170 +++++++-------- .../screenhandlers/KeyboardHandler.java | 199 ++++++++---------- .../screenhandlers/RadialHandler.java | 116 +++++----- .../gameplay/trackers/BackpackTracker.java | 53 +++-- .../gameplay/trackers/BowTracker.java | 141 ++++++------- .../gameplay/trackers/CameraTracker.java | 24 +-- .../gameplay/trackers/ClimbTracker.java | 144 ++++++++----- .../gameplay/trackers/EatingTracker.java | 17 +- .../gameplay/trackers/HorseTracker.java | 18 +- .../gameplay/trackers/InteractTracker.java | 33 +-- .../gameplay/trackers/JumpTracker.java | 78 +++---- .../gameplay/trackers/RowTracker.java | 40 ++-- .../gameplay/trackers/RunTracker.java | 7 +- .../gameplay/trackers/SwimTracker.java | 40 ++-- .../gameplay/trackers/SwingTracker.java | 76 ++++--- .../gameplay/trackers/TeleportTracker.java | 69 +++--- .../gameplay/trackers/TelescopeTracker.java | 38 ++-- .../gameplay/trackers/VehicleTracker.java | 19 +- .../client_vr/gui/PhysicalKeyboard.java | 4 +- .../menuworlds/MenuWorldRenderer.java | 127 ++++++----- .../vivecraft/client_vr/provider/MCVR.java | 86 ++++---- .../provider/openvr_lwjgl/MCOpenVR.java | 2 +- .../render/VivecraftItemRendering.java | 94 ++++----- .../vivecraft/client_vr/render/XRCamera.java | 16 +- .../render/helpers/RenderHelper.java | 86 ++++---- .../client_vr/render/helpers/VRArmHelper.java | 75 ++++--- .../render/helpers/VREffectsHelper.java | 78 +++---- .../render/helpers/VRWidgetHelper.java | 16 +- .../client_vr/settings/VRHotkeys.java | 20 +- .../common/network/VRPlayerState.java | 6 +- .../org/vivecraft/common/utils/Utils.java | 27 ++- .../mixin/client_vr/MinecraftVRMixin.java | 6 +- .../ClientPacketListenerVRMixin.java | 3 +- .../MultiPlayerGameModeVRMixin.java | 4 +- .../particle/ItemPickupParticleVRMixin.java | 7 +- .../client_vr/player/LocalPlayerVRMixin.java | 27 +-- .../renderer/GameRendererVRMixin.java | 34 +-- .../renderer/ItemInHandRendererVRMixin.java | 24 +-- .../renderer/LevelRendererVRMixin.java | 10 +- .../entity/EntityRenderDispatcherVRMixin.java | 33 ++- .../entity/FishingHookRendererVRMixin.java | 21 +- .../entity/GuardianRendererVRMixin.java | 4 +- .../renderer/entity/MobRendererVRMixin.java | 4 +- .../FireworkRocketEntityVRMixin.java | 19 +- .../entity/projectile/ProjectileMixin.java | 27 ++- .../iris/mixin/IrisShadowMatricesMixin.java | 17 +- .../optifine/OptifineHelper.java | 23 +- .../optifine/mixin/ShadersVRMixin.java | 12 +- .../server/config/ConfigBuilder.java | 13 +- 59 files changed, 1348 insertions(+), 1227 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java index cc5f5f25e..3fa8600c2 100644 --- a/common/src/main/java/org/vivecraft/client/VRPlayersClient.java +++ b/common/src/main/java/org/vivecraft/client/VRPlayersClient.java @@ -217,9 +217,9 @@ public static RotInfo getMainPlayerRotInfo(VRData data) { playermodelcontroller$rotinfo.leftArmQuat.setFromNormalized(data.getController(1).getMatrix()); playermodelcontroller$rotinfo.rightArmQuat.setFromNormalized(data.getController(0).getMatrix()); playermodelcontroller$rotinfo.seated = dh.vrSettings.seated; - convertToVector3f(data.getController(1).getPosition(), playermodelcontroller$rotinfo.leftArmPos); - convertToVector3f(data.getController(0).getPosition(), playermodelcontroller$rotinfo.rightArmPos); - convertToVector3f(data.hmd.getPosition(), playermodelcontroller$rotinfo.Headpos); + data.getController(1).getPosition(playermodelcontroller$rotinfo.leftArmPos); + data.getController(0).getPosition(playermodelcontroller$rotinfo.rightArmPos); + data.hmd.getPosition(playermodelcontroller$rotinfo.Headpos); return playermodelcontroller$rotinfo; } diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java index b65b8b86a..98c4aa4bf 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java @@ -10,6 +10,8 @@ import java.util.List; +import static org.vivecraft.client_vr.VRState.mc; + public abstract class GuiListScreen extends Screen { protected final Screen lastScreen; @@ -28,17 +30,17 @@ protected void init() { clearWidgets(); double scrollAmount = list != null ? list.getScrollAmount() : 0.0D; - this.list = new SettingsList(this, minecraft, getEntries()); + this.list = new SettingsList(this, getEntries()); list.setScrollAmount(scrollAmount); this.addWidget(this.list); - this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> this.minecraft.setScreen(this.lastScreen)).bounds(this.width / 2 - 100, this.height - 27, 200, 20).build()); + this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> mc.setScreen(this.lastScreen)).bounds(this.width / 2 - 100, this.height - 27, 200, 20).build()); } protected abstract List getEntries(); @Override public void onClose() { - this.minecraft.setScreen(lastScreen); + mc.setScreen(lastScreen); } @Override diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java index 3be5c7142..16ec0415b 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListValueEditScreen.java @@ -1,7 +1,6 @@ package org.vivecraft.client.gui.settings; import com.google.common.collect.ImmutableList; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.Button.OnPress; @@ -22,6 +21,8 @@ import java.util.List; import java.util.stream.Collectors; +import static org.vivecraft.client_vr.VRState.mc; + public class GuiListValueEditScreen extends GuiListScreen { protected final ListValue listValue; @@ -37,17 +38,17 @@ protected void init() { clearWidgets(); double scrollAmount = list != null ? list.getScrollAmount() : 0.0D; - this.list = new SettingsList(this, minecraft, getEntries()); + this.list = new SettingsList(this, getEntries()); list.setScrollAmount(scrollAmount); this.addWidget(this.list); this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, button -> { listValue.set(getCurrentValues()); - this.minecraft.setScreen(this.lastScreen); + mc.setScreen(this.lastScreen); }).bounds(this.width / 2 - 155, this.height - 27, 150, 20).build()); this.addRenderableWidget(Button - .builder(CommonComponents.GUI_CANCEL, button -> this.minecraft.setScreen(this.lastScreen)) + .builder(CommonComponents.GUI_CANCEL, button -> mc.setScreen(this.lastScreen)) .bounds(this.width / 2 + 5, this.height - 27, 150, 20) .build()); } @@ -70,7 +71,7 @@ protected List getEntries() { } int i = 0; for (String item : elements) { - EditBox box = new EditBox(Minecraft.getInstance().font, 0, 0, ListValueEntry.valueButtonWidth - 1, 20, Component.literal(item)); + EditBox box = new EditBox(mc.font, 0, 0, ListValueEntry.valueButtonWidth - 1, 20, Component.literal(item)); box.setMaxLength(1000); box.setValue(item); int index = i++; diff --git a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java index 6a6e13e28..44a9caddc 100644 --- a/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java +++ b/common/src/main/java/org/vivecraft/client/gui/widgets/SettingsList.java @@ -1,7 +1,6 @@ package org.vivecraft.client.gui.widgets; import com.google.common.collect.ImmutableList; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ComponentPath; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; @@ -23,16 +22,18 @@ import java.util.List; import java.util.function.BooleanSupplier; +import static org.vivecraft.client_vr.VRState.mc; + public class SettingsList extends ContainerObjectSelectionList { final Screen parent; int maxNameWidth; - public SettingsList(Screen parent, Minecraft minecraft, List entries) { - super(minecraft, parent.width + 45, parent.height, 20, parent.height - 32, 20); + public SettingsList(Screen parent, List entries) { + super(mc, parent.width + 45, parent.height, 20, parent.height - 32, 20); this.parent = parent; for (BaseEntry entry : entries) { int i; - if ((i = minecraft.font.width(entry.name)) > this.maxNameWidth) { + if ((i = mc.font.width(entry.name)) > this.maxNameWidth) { this.maxNameWidth = i; } this.addEntry(entry); @@ -59,12 +60,12 @@ public static class CategoryEntry extends BaseEntry { public CategoryEntry(Component name) { super(name); - this.width = Minecraft.getInstance().font.width(this.name); + this.width = mc.font.width(this.name); } @Override public void render(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, int n, int o, boolean bl, float f) { - guiGraphics.drawString(Minecraft.getInstance().font, this.name, Minecraft.getInstance().screen.width / 2 - this.width / 2, j + m - Minecraft.getInstance().font.lineHeight - 1, 0xFFFFFF); + guiGraphics.drawString(mc.font, this.name, mc.screen.width / 2 - this.width / 2, j + m - mc.font.lineHeight - 1, 0xFFFFFF); } @Override @@ -144,7 +145,7 @@ public WidgetEntry(Component name, AbstractWidget valueWidget) { @Override public void render(GuiGraphics guiGraphics, int i, int j, int k, int l, int m, int n, int o, boolean bl, float f) { - guiGraphics.drawString(Minecraft.getInstance().font, this.name, k + 90 - 140, j + m / 2 - Minecraft.getInstance().font.lineHeight / 2, 0xFFFFFF); + guiGraphics.drawString(mc.font, this.name, k + 90 - 140, j + m / 2 - mc.font.lineHeight / 2, 0xFFFFFF); this.valueWidget.setX(k + 105); this.valueWidget.setY(j); this.valueWidget.render(guiGraphics, n, o, f); diff --git a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java index a59d11570..9b8412e4c 100644 --- a/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java +++ b/common/src/main/java/org/vivecraft/client/network/ClientNetworking.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3fc; import org.vivecraft.client.VRPlayersClient; import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.gameplay.VRPlayer; @@ -195,12 +196,12 @@ public static void overridePose(LocalPlayer player) { } } - public static void overrideLook(Player player, Vec3 view) { + public static void overrideLook(Player player, Vector3fc view) { if (!serverWantsData) { capturedPitch = player.getXRot(); capturedYaw = player.getYRot(); - float f = (float) toDegrees(asin(-view.y / view.length())); - float f1 = (float) toDegrees(atan2(-view.x, view.z)); + float f = (float) toDegrees(asin(-view.y() / view.length())); + float f1 = (float) toDegrees(atan2(-view.x(), view.z())); ((LocalPlayer) player).connection.send(new Rot(f1, f, player.onGround())); overrideActive = true; } diff --git a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java index aeb11cc68..4b5e01e8d 100644 --- a/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java +++ b/common/src/main/java/org/vivecraft/client/render/VRPlayerModel_WithArms.java @@ -225,7 +225,7 @@ public void translateToHand(HumanoidArm pSide, PoseStack pMatrixStack) { ModelPart modelpart = this.getArm(pSide); if (this.laying) { - float ang = toRadians(-90.0F); + float ang = (float) PI / -2.0F; pMatrixStack.last().pose().rotateX(ang); pMatrixStack.last().normal().rotateX(ang); } @@ -261,7 +261,7 @@ public void translateToHand(HumanoidArm pSide, PoseStack pMatrixStack) { // // if (this.laying) // { -// float ang = toRadians(-90.0F); +// float ang = (float) PI / -2.0F; // pMatrixStack.last().pose().rotateX(ang); // pMatrixStack.last().normal().rotateX(ang); // } diff --git a/common/src/main/java/org/vivecraft/client_vr/VRData.java b/common/src/main/java/org/vivecraft/client_vr/VRData.java index 94eeeb562..b511b5e38 100644 --- a/common/src/main/java/org/vivecraft/client_vr/VRData.java +++ b/common/src/main/java/org/vivecraft/client_vr/VRData.java @@ -4,6 +4,7 @@ import org.joml.Matrix3f; import org.joml.Matrix4f; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client_vr.render.RenderPass; import javax.annotation.Nonnull; @@ -42,60 +43,60 @@ public class VRData { @Nonnull public VRDevicePose cam; @Nonnull - public Vec3 origin; + public Vector3f origin; public float rotation_radians; public float worldScale; public VRData() { - this(new Vec3(0.0D, 0.0D, 0.0D), 1.0F, 0.0F); + this(new Vector3f(), 1.0F, 0.0F); } - public VRData(Vec3 origin, float worldScale, float rotation_radians) { - this.origin = origin; + public VRData(Vector3fc origin, float worldScale, float rotation_radians) { + this.origin = new Vector3f(origin); this.worldScale = worldScale; this.rotation_radians = rotation_radians; - Vec3 vec3 = convertToVec3(dh.vr.getCenterEyePosition()); - Vec3 vec31 = new Vec3(vec3.x * (double) dh.vrSettings.walkMultiplier, vec3.y, vec3.z * (double) dh.vrSettings.walkMultiplier); - this.hmd = new VRDevicePose(this, dh.vr.hmdRotation, vec31, convertToVec3(dh.vr.getHmdVector())); - this.eye0 = new VRDevicePose(this, dh.vr.getEyeRotation(RenderPass.LEFT), dh.vr.getEyePosition(RenderPass.LEFT).subtract(vec3).add(vec31), convertToVec3(dh.vr.getHmdVector())); - this.eye1 = new VRDevicePose(this, dh.vr.getEyeRotation(RenderPass.RIGHT), dh.vr.getEyePosition(RenderPass.RIGHT).subtract(vec3).add(vec31), convertToVec3(dh.vr.getHmdVector())); - this.c0 = new VRDevicePose(this, dh.vr.getAimRotation(0), dh.vr.getAimSource(0).subtract(vec3).add(vec31), dh.vr.getAimVector(0)); - this.c1 = new VRDevicePose(this, dh.vr.getAimRotation(1), dh.vr.getAimSource(1).subtract(vec3).add(vec31), dh.vr.getAimVector(1)); + Vector3fc hmd_raw = dh.vr.getCenterEyePosition(); + Vector3f scaledPos = new Vector3f(hmd_raw.x() * dh.vrSettings.walkMultiplier, hmd_raw.y(), hmd_raw.z() * dh.vrSettings.walkMultiplier); + this.hmd = new VRDevicePose(this, dh.vr.hmdRotation, scaledPos, dh.vr.getHmdVector()); + this.eye0 = new VRDevicePose(this, dh.vr.getEyeRotation(RenderPass.LEFT), dh.vr.getEyePosition(RenderPass.LEFT).sub(hmd_raw).add(scaledPos), dh.vr.getHmdVector()); + this.eye1 = new VRDevicePose(this, dh.vr.getEyeRotation(RenderPass.RIGHT), dh.vr.getEyePosition(RenderPass.RIGHT).sub(hmd_raw).add(scaledPos), dh.vr.getHmdVector()); + this.c0 = new VRDevicePose(this, dh.vr.getAimRotation(0), dh.vr.getAimSource(0, new Vector3f()).sub(hmd_raw).add(scaledPos), dh.vr.getAimVector(0, new Vector3f())); + this.c1 = new VRDevicePose(this, dh.vr.getAimRotation(1), dh.vr.getAimSource(1, new Vector3f()).sub(hmd_raw).add(scaledPos), dh.vr.getAimVector(1, new Vector3f())); // this.g0 = new VRDevicePose(this, new Matrix4d(), dh.vr.getGesturePosition(0), dh.vr.getGestureVector(0)); // this.g1 = new VRDevicePose(this, new Matrix4d(), dh.vr.getGesturePosition(1), dh.vr.getGestureVector(1)); - this.h0 = new VRDevicePose(this, dh.vr.getHandRotation(0), dh.vr.getAimSource(0).subtract(vec3).add(vec31), dh.vr.getHandVector(0)); - this.h1 = new VRDevicePose(this, dh.vr.getHandRotation(1), dh.vr.getAimSource(1).subtract(vec3).add(vec31), dh.vr.getHandVector(1)); + this.h0 = new VRDevicePose(this, dh.vr.getHandRotation(0), dh.vr.getAimSource(0, new Vector3f()).sub(hmd_raw).add(scaledPos), dh.vr.getHandVector(0, new Vector3f())); + this.h1 = new VRDevicePose(this, dh.vr.getHandRotation(1), dh.vr.getAimSource(1, new Vector3f()).sub(hmd_raw).add(scaledPos), dh.vr.getHandVector(1, new Vector3f())); if (dh.vrSettings.seated) { this.t0 = eye0; this.t1 = eye1; } else { - Matrix4f matrix4f = this.getSmoothedRotation(0, 0.2F); - Matrix4f matrix4f1 = this.getSmoothedRotation(1, 0.2F); - this.t0 = new VRDevicePose(this, matrix4f, dh.vr.getAimSource(0).subtract(vec3).add(vec31), convertToVec3(matrix4f.transformProject(forward, new Vector3f()))); - this.t1 = new VRDevicePose(this, matrix4f1, dh.vr.getAimSource(1).subtract(vec3).add(vec31), convertToVec3(matrix4f1.transformProject(forward, new Vector3f()))); + Matrix4f s0 = this.getSmoothedRotation(0, 0.2F); + Matrix4f s1 = this.getSmoothedRotation(1, 0.2F); + this.t0 = new VRDevicePose(this, s0, dh.vr.getAimSource(0, new Vector3f()).sub(hmd_raw).add(scaledPos), s0.transformProject(forward, new Vector3f())); + this.t1 = new VRDevicePose(this, s1, dh.vr.getAimSource(1, new Vector3f()).sub(hmd_raw).add(scaledPos), s1.transformProject(forward, new Vector3f())); } - Matrix4f matrix4f2 = new Matrix4f().rotationY(-rotation_radians).rotate(dh.cameraTracker.getRotation()); + Matrix4f camRot = new Matrix4f().rotationY(-rotation_radians).rotate(dh.cameraTracker.getRotation()); float inverseWorldScale = 1.0F / worldScale; - this.cam = new VRDevicePose(this, matrix4f2, dh.cameraTracker.getPosition().subtract(origin).yRot(-rotation_radians).multiply(inverseWorldScale, inverseWorldScale, inverseWorldScale).subtract(vec3).add(vec31), convertToVec3(new Vector3f(forward).mulProject(matrix4f2))); + this.cam = new VRDevicePose(this, camRot, dh.cameraTracker.getPosition().sub(origin, new Vector3f()).rotateY(-rotation_radians).mul(inverseWorldScale).sub(hmd_raw).add(scaledPos), new Vector3f(forward).mulProject(camRot)); if (dh.vr.mrMovingCamActive) { - this.c2 = new VRDevicePose(this, dh.vr.getAimRotation(2), dh.vr.getAimSource(2).subtract(vec3).add(vec31), dh.vr.getAimVector(2)); + this.c2 = new VRDevicePose(this, dh.vr.getAimRotation(2), dh.vr.getAimSource(2, new Vector3f()).sub(hmd_raw).add(scaledPos), dh.vr.getAimVector(2, new Vector3f())); } else { - Matrix4f matrix4f3 = new Matrix4f().set(dh.vrSettings.vrFixedCamrotQuat); - Vec3 vec32 = new Vec3(dh.vrSettings.vrFixedCamposX, dh.vrSettings.vrFixedCamposY, dh.vrSettings.vrFixedCamposZ); - Vec3 vec33 = convertToVec3(matrix4f3.transformProject(forward, new Vector3f())); - this.c2 = new VRDevicePose(this, matrix4f3, vec32.subtract(vec3).add(vec31), vec33); + Matrix4f rot = new Matrix4f().set(dh.vrSettings.vrFixedCamrotQuat); + Vector3f pos = new Vector3f(dh.vrSettings.vrFixedCamposX, dh.vrSettings.vrFixedCamposY, dh.vrSettings.vrFixedCamposZ); + Vector3f dir = rot.transformProject(forward, new Vector3f()); + this.c2 = new VRDevicePose(this, rot, pos.sub(hmd_raw).add(scaledPos), dir); } } private Matrix4f getSmoothedRotation(int c, float lenSec) { - // Vector3f vec3 = dh.vr.controllerHistory[c].averagePosition(lenSec, new Vector3f()); - Vector3f vec31 = dh.vr.controllerForwardHistory[c].averagePosition(lenSec, new Vector3f()); - Vector3f vec32 = dh.vr.controllerUpHistory[c].averagePosition(lenSec, new Vector3f()); - Vector3f vec33 = vec31.cross(vec32, new Vector3f()); - return new Matrix4f(new Matrix3f().set(vec31, vec32, vec33).transpose()); + // Vector3f pos = dh.vr.controllerHistory[c].averagePosition(lenSec, new Vector3f()); + Vector3f u = dh.vr.controllerForwardHistory[c].averagePosition(lenSec, new Vector3f()); + Vector3f f = dh.vr.controllerUpHistory[c].averagePosition(lenSec, new Vector3f()); + Vector3f r = u.cross(f, new Vector3f()); + return new Matrix4f(new Matrix3f().set(u, f, r).transpose()); } public VRDevicePose getController(int c) { @@ -115,15 +116,15 @@ public float getBodyYaw() { if (dh.vrSettings.seated) { return this.hmd.getYaw(); } else { - Vector3f vec3 = convertToVector3f(this.c1.getPosition().subtract(this.c0.getPosition()).normalize().yRot((-(float) PI / 2F)), new Vector3f()); - Vector3f vec31 = convertToVector3f(this.hmd.getDirection(), new Vector3f()); + Vector3f v = this.c1.getPosition(new Vector3f()).sub(this.c0.getPosition(new Vector3f())).normalize().rotateY((-(float) PI / 2F)); + Vector3f h = this.hmd.getDirection(new Vector3f()); - if (vec3.dot(vec31) < 0.0D) { - vec3.negate(); + if (v.dot(h) < 0.0D) { + v.negate(); } - vec31.lerp(vec3, 0.7F, vec3); - return (float) toDegrees(atan2(-vec3.x, vec3.z)); + h.lerp(v, 0.7F, v); + return (float) toDegrees(atan2(-v.x, v.z)); } } @@ -131,23 +132,23 @@ public float getFacingYaw() { if (dh.vrSettings.seated) { return this.hmd.getYaw(); } else { - Vec3 vec3 = this.c1.getPosition().subtract(this.c0.getPosition()).normalize().yRot((-(float) PI / 2F)); - return (float) toDegrees(dh.vrSettings.reverseHands ? atan2(vec3.x, -vec3.z) : atan2(-vec3.x, vec3.z)); + Vector3f v = this.c1.getPosition(new Vector3f()).sub(this.c0.getPosition(new Vector3f())).normalize().rotateY((-(float) PI / 2F)); + return (float) toDegrees(dh.vrSettings.reverseHands ? atan2(v.x, -v.z) : atan2(-v.x, v.z)); } } - public Vec3 getHeadPivot() { + public Vector3f getHeadPivot(Vector3f dest) { // scale pivot point with world scale, to prevent unwanted player movement - return convertToVec3(this.hmd.getMatrix() + return dest.set(this.hmd.getMatrix() .transformProject(0.0F, -0.1F * worldScale, 0.1F * worldScale, new Vector3f()) - .add(this.hmd.getPosition().toVector3f()) + .add(this.hmd.getPosition(new Vector3f())) ); } public Vec3 getHeadRear() { return convertToVec3(this.hmd.getMatrix() .transformProject(0.0F, -0.2F, 0.2F, new Vector3f()) - .add(this.hmd.getPosition().toVector3f()) + .add(this.hmd.getPosition(new Vector3f())) ); } @@ -184,39 +185,37 @@ public String toString() { @ParametersAreNonnullByDefault public static class VRDevicePose { final VRData data; - final Vec3 pos; - final Vec3 dir; + final Vector3fc pos; + final Vector3fc dir; final Matrix4f matrix; - public VRDevicePose(VRData data, Matrix4f matrix, Vec3 pos, Vec3 dir) { + public VRDevicePose(VRData data, Matrix4f matrix, Vector3fc pos, Vector3fc dir) { this.data = data; this.matrix = new Matrix4f(matrix); - this.pos = new Vec3(pos.x, pos.y, pos.z); - this.dir = new Vec3(dir.x, dir.y, dir.z); + this.pos = new Vector3f(pos); + this.dir = new Vector3f(dir); } - public Vec3 getPosition() { - return this.pos.scale(this.data.worldScale).yRot(this.data.rotation_radians).add(this.data.origin); + public Vector3f getPosition(@Nonnull Vector3f dest) { + return this.pos.mul(this.data.worldScale, dest).rotateY(this.data.rotation_radians).add(this.data.origin); } - public Vec3 getDirection() { - return this.dir.yRot(this.data.rotation_radians); + public Vector3f getDirection(@Nonnull Vector3f dest) { + return this.dir.rotateY(this.data.rotation_radians, dest); } - public Vec3 getCustomVector(Vec3 axis) { - return convertToVec3( - this.matrix.transformProject(axis.toVector3f()).rotateY(this.data.rotation_radians) - ); + public Vector3f getCustomVector(Vector3f axis) { + return this.matrix.transformProject(axis).rotateY(this.data.rotation_radians); } public float getYaw() { - Vec3 vec3 = this.getDirection(); - return (float) toDegrees(atan2(-vec3.x, vec3.z)); + Vector3f dir = this.getDirection(new Vector3f()); + return (float) toDegrees(atan2(-dir.x, dir.z)); } public float getPitch() { - Vec3 vec3 = this.getDirection(); - return (float) toDegrees(asin(vec3.y / vec3.length())); + Vector3f dir = this.getDirection(new Vector3f()); + return (float) toDegrees(asin(dir.y / dir.length())); } public float getRoll() { @@ -228,7 +227,7 @@ public Matrix4f getMatrix() { } public String toString() { - return "Device: pos:" + this.getPosition() + " dir: " + this.getDirection(); + return "Device: pos:" + this.getPosition(new Vector3f()) + " dir: " + this.getDirection(new Vector3f()); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java index 8ae34013a..00522b4a3 100644 --- a/common/src/main/java/org/vivecraft/client_vr/Vec3History.java +++ b/common/src/main/java/org/vivecraft/client_vr/Vec3History.java @@ -22,29 +22,65 @@ public class Vec3History { _data.addAll(generate(entry::new).limit(_capacity).toList()); } + /** + * update the queue with newer data + * @param x newer x + * @param y newer y + * @param z newer z + * @return reference to the internal {@link Vector3d} (be careful with it) + */ public Vector3dc add(double x, double y, double z) { this._data.addFirst(this._data.removeLast().set(x, y, z)); - return this._data.getFirst().data; + return this._data.getFirst().data; // allow chaining on the queue structs } + /** + * update the queue with newer data + * @param in newer vector + * @return reference to the internal {@link Vector3d} (be careful with it) + */ public Vector3dc add(Vec3 in) { - return this.add(in.x(), in.y(), in.z()); + return this.add(in.x(), in.y(), in.z()); // allow chaining on the queue structs } + /** + * update the queue with newer data + * @param in newer vector + * @return {@code in} + * @apiNote {@code in} is not to be confused with the internal {@link Vector3d}. + */ public Vector3dc add(Vector3dc in) { + // the result of this.add is intentionally ignored this.add(in.x(), in.y(), in.z()); - return in; + return in; // allow chaining on `in` rather than the queue structs } + /** + * update the queue with newer data + * @param in newer vector + * @return {@code in} + * @apiNote {@code in} is not to be confused with the internal {@link Vector3d}. + */ public Vector3fc add(Vector3fc in) { + // the result of this.add is intentionally ignored this.add(in.x(), in.y(), in.z()); - return in; + return in; // allow chaining on `in` rather than the queue structs } + /** + * copy the newest data in the queue + * @param dest location to put the newest data in + * @return {@code dest} + */ public Vector3d latest(Vector3d dest) { return dest.set((this._data.getFirst()).data); } + /** + * copy the newest data in the queue + * @param dest location to put the newest data in + * @return {@code dest} + */ public Vector3f latest(Vector3f dest) { return dest.set((this._data.getFirst()).data); } @@ -69,6 +105,10 @@ public double totalMovement(double seconds) { return d0; } + public float totalMovement(float seconds){ + return (float) totalMovement((double) seconds); + } + public Vector3d netMovement(double seconds, Vector3d dest) { long i = Util.getMillis(); entry vec3history$entry = null; @@ -133,6 +173,10 @@ public double averageSpeed(double seconds) { return j == 0 ? d0 : d0 / j; } + public float averageSpeed(float seconds){ + return (float) averageSpeed((double) seconds); + } + public Vector3d averagePosition(double seconds, Vector3d dest) { long i = Util.getMillis(); int j = 0; diff --git a/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java b/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java index df149854f..660fc67af 100644 --- a/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java +++ b/common/src/main/java/org/vivecraft/client_vr/extensions/GameRendererExtension.java @@ -2,8 +2,9 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.joml.Vector3fc; public interface GameRendererExtension { @@ -27,13 +28,13 @@ public interface GameRendererExtension { double vivecraft$getRveY(); - Vec3 vivecraft$getRvePos(float partialTicks); + Vector3f vivecraft$getRvePos(float partialTicks, Vector3f dest); boolean vivecraft$isInMenuRoom(); boolean vivecraft$willBeInMenuRoom(Screen newScreen); - Vec3 vivecraft$getCrossVec(); + Vector3f vivecraft$getCrossVec(Vector3f dest); void vivecraft$resetProjectionMatrix(float partialTicks); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java index e545b021a..da8c6cec7 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/VRPlayer.java @@ -1,10 +1,8 @@ package org.vivecraft.client_vr.gameplay; -import net.minecraft.client.Minecraft; import net.minecraft.client.particle.TerrainParticle; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; -import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -18,6 +16,8 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.Xplat; import org.vivecraft.client.network.ClientNetworking; @@ -41,17 +41,16 @@ import java.util.ArrayList; import java.util.Random; -import static java.lang.Math.pow; import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.logger; +import static org.vivecraft.common.utils.Utils.*; public class VRPlayer { - public VRData vrdata_room_pre; - public VRData vrdata_world_pre; - public VRData vrdata_room_post; - public VRData vrdata_world_post; + public VRData vrdata_room_pre = new VRData(); + public VRData vrdata_world_pre = new VRData(); + public VRData vrdata_room_post = new VRData(); + public VRData vrdata_world_post = new VRData(); @Nullable public VRData vrdata_world_render; ArrayList trackers = new ArrayList<>(); @@ -61,7 +60,7 @@ public class VRPlayer { public boolean teleportWarning = false; public boolean vrSwitchWarning = false; public int chatWarningTimer = -1; - public Vec3 roomOrigin = new Vec3(0.0D, 0.0D, 0.0D); + public Vector3f roomOrigin = new Vector3f(); private boolean isFreeMoveCurrent = true; public double wfMode = 0.0D; public int wfCount = 0; @@ -73,24 +72,17 @@ public void registerTracker(Tracker tracker) { this.trackers.add(tracker); } - public VRPlayer() { - this.vrdata_room_pre = new VRData(); - this.vrdata_room_post = new VRData(); - this.vrdata_world_post = new VRData(); - this.vrdata_world_pre = new VRData(); - } - @Nonnull public VRData getVRDataWorld() { return this.vrdata_world_render != null ? this.vrdata_world_render : this.vrdata_world_pre; } - public static Vec3 room_to_world_pos(Vec3 pos, VRData data) { - return pos.scale(data.worldScale).yRot(data.rotation_radians).add(data.origin); + public static Vector3f room_to_world_pos(Vector3fc pos, VRData data, Vector3f dest) { + return pos.mul(data.worldScale, dest).rotateY(data.rotation_radians).add(data.origin); } - public static Vec3 world_to_room_pos(Vec3 pos, VRData data) { - return pos.subtract(data.origin).scale(pow(data.worldScale, -1)).yRot(-data.rotation_radians); + public static Vector3f world_to_room_pos(Vector3fc pos, VRData data, Vector3f dest) { + return pos.sub(data.origin, dest).div(data.worldScale).rotateY(-data.rotation_radians); } public void postPoll() { @@ -142,8 +134,8 @@ public void preTick() { // scale world with player size this.worldScale *= PehkuiHelper.getPlayerScale(mc.player, mc.getFrameTime()); // limit scale - if (this.worldScale > 100F) { - this.worldScale = 100F; + if (this.worldScale > 100.0F) { + this.worldScale = 100.0F; } else if (this.worldScale < 0.025F) //minClip + player position indicator offset { this.worldScale = 0.025F; @@ -159,13 +151,17 @@ public void preTick() { public void postTick() { VRData vrdata = new VRData(this.vrdata_world_pre.origin, this.vrdata_world_pre.worldScale, this.vrdata_world_pre.rotation_radians); VRData vrdata1 = new VRData(this.vrdata_world_pre.origin, this.worldScale, this.vrdata_world_pre.rotation_radians); - Vec3 vec3 = vrdata1.hmd.getPosition().subtract(vrdata.hmd.getPosition()); - this.roomOrigin = this.roomOrigin.subtract(vec3); + this.roomOrigin.sub(vrdata1.hmd.getPosition(new Vector3f()).sub(vrdata.hmd.getPosition(new Vector3f()))); VRData vrdata2 = new VRData(this.roomOrigin, this.worldScale, this.vrdata_world_pre.rotation_radians); float rad = this.vrdata_world_pre.rotation_radians - toRadians(dh.vrSettings.worldRotation); - Vec3 o = vrdata2.getHeadPivot(); if (rad != 0.0F) { - this.setRoomOrigin(cos(rad) * (this.roomOrigin.x - o.x) - sin(rad) * (this.roomOrigin.z - o.z) + o.x, this.roomOrigin.y, sin(rad) * (this.roomOrigin.x - o.x) + cos(rad) * (this.roomOrigin.z - o.z) + o.z, false); + Vector3f o = vrdata2.getHeadPivot(new Vector3f()); + this.setRoomOrigin( + cos(rad) * (this.roomOrigin.x - o.x) - sin(rad) * (this.roomOrigin.z - o.z) + o.x, + this.roomOrigin.y, + sin(rad) * (this.roomOrigin.x - o.x) + cos(rad) * (this.roomOrigin.z - o.z) + o.z, + false + ); } this.vrdata_room_post = new VRData(); this.vrdata_world_post = new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)); @@ -189,8 +185,12 @@ public void preRender(float par1) { } float f4 = f1 * par1 + f2 * (1.0F - par1); - Vec3 vec3 = new Vec3(this.vrdata_world_pre.origin.x + (this.vrdata_world_post.origin.x - this.vrdata_world_pre.origin.x) * (double) par1, this.vrdata_world_pre.origin.y + (this.vrdata_world_post.origin.y - this.vrdata_world_pre.origin.y) * (double) par1, this.vrdata_world_pre.origin.z + (this.vrdata_world_post.origin.z - this.vrdata_world_pre.origin.z) * (double) par1); - this.vrdata_world_render = new VRData(vec3, f, f4); + this.vrdata_world_render = new VRData( + this.vrdata_world_post.origin.sub(this.vrdata_world_pre.origin, new Vector3f()) + .mulAdd(par1, this.vrdata_world_pre.origin), + f, + f4 + ); for (Tracker tracker : this.trackers) { if (tracker.getEntryPoint() == EntryPoint.SPECIAL_ITEMS) { @@ -210,34 +210,34 @@ public void postRender(float par1) { public void setRoomOrigin(double x, double y, double z, boolean reset) { if (reset && this.vrdata_world_pre != null) { - this.vrdata_world_pre.origin = new Vec3(x, y, z); + this.vrdata_world_pre.origin.set(x, y, z); } - this.roomOrigin = new Vec3(x, y, z); + this.roomOrigin.set(x, y, z); } public void snapRoomOriginToPlayerEntity(boolean reset, boolean instant) { if (!"Server thread".equals(Thread.currentThread().getName())) { if (mc.player != null && mc.player.position() != Vec3.ZERO) { - if (dh.sneakTracker.sneakCounter <= 0) { - VRData vrdata = this.vrdata_world_pre; - - if (instant) { - vrdata = new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)); - } - - Vec3 vec3 = vrdata.getHeadPivot().subtract(vrdata.origin); - double d0 = mc.player.getX() - vec3.x; - double d2 = mc.player.getZ() - vec3.z; - double d1 = mc.player.getY() + ((PlayerExtension) mc.player).vivecraft$getRoomYOffsetFromPose(); - this.setRoomOrigin(d0, d1, d2, reset); + VRData vrdata = ( + instant ? + new VRData(this.roomOrigin, this.worldScale, toRadians(dh.vrSettings.worldRotation)) : + this.vrdata_world_pre + ); + Vector3f vec3 = vrdata.getHeadPivot(new Vector3f()).sub(vrdata.origin.x(), vrdata.origin.y(), vrdata.origin.z()); + this.setRoomOrigin( + mc.player.getX() - vec3.x, + mc.player.getY() + ((PlayerExtension) mc.player).vivecraft$getRoomYOffsetFromPose(), + mc.player.getZ() - vec3.z, + reset + ); } } } } - public void tick(LocalPlayer player, Minecraft mc, RandomSource rand) { + public void tick(LocalPlayer player) { if (((PlayerExtension) player).vivecraft$getInitFromServer()) { if (!this.initdone) { logger.info( @@ -305,7 +305,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { if (dh.vehicleTracker.canRoomscaleDismount()) { Vec3 vec35 = mc.player.getVehicle().position(); - Vec3 vec36 = vrdata.getHeadPivot(); + Vector3f vec36 = vrdata.getHeadPivot(new Vector3f()); double d6 = sqrt( (vec36.x - vec35.x) * (vec36.x - vec35.x) + (vec36.z - vec35.z) * (vec36.z - vec35.z)); @@ -315,7 +315,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { } else { float f = player.getBbWidth() / 2.0F; float f1 = player.getBbHeight(); - Vec3 vec3 = vrdata.getHeadPivot(); + Vector3f vec3 = vrdata.getHeadPivot(new Vector3f()); double d0 = vec3.x; double d1 = player.getY(); double d2 = vec3.z; @@ -380,7 +380,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { if (flag) { d0 = d0 + d4; d2 = d2 + d5; - d1 = d1 + (double) (0.1F * (float) j); + d1 = d1 + (double) (0.1F * j); player.setPosRaw(d0, d1, d2); player.setBoundingBox(new AABB( aabb.minX, @@ -390,7 +390,7 @@ public void doPlayerMoveInRoom(LocalPlayer player) { aabb.maxY, aabb.maxZ )); - Vec3 vec32 = this.roomOrigin.add(d4, 0.1F * (float) j, d5); + Vec3 vec32 = new Vec3(this.roomOrigin.x + d4, this.roomOrigin.y + 0.1F * j, this.roomOrigin.z + d5); this.setRoomOrigin(vec32.x, vec32.y, vec32.z, false); Vec3 vec33 = player.getLookAngle(); Vec3 vec34 = (new Vec3(vec33.x, 0.0D, vec33.z)).normalize(); @@ -456,11 +456,13 @@ public String toString() { return "VRPlayer: \r\n \t origin: " + this.roomOrigin + "\r\n \t rotation: " + String.format("%.3f", dh.vrSettings.worldRotation) + "\r\n \t scale: " + String.format("%.3f", this.worldScale) + "\r\n \t room_pre " + this.vrdata_room_pre + "\r\n \t world_pre " + this.vrdata_world_pre + "\r\n \t world_post " + this.vrdata_world_post + "\r\n \t world_render " + this.vrdata_world_render; } - public Vec3 getRightClickLookOverride(Player entity, int c) { - Vec3 vec3 = entity.getLookAngle(); + public Vector3f getRightClickLookOverride(Player entity, int c) { + Vector3f vec3 = new Vector3f(); - if (((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec() != null) { - vec3 = entity.getEyePosition(1.0F).subtract(((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec()).normalize().reverse(); + if (((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec(vec3) != null) { + convertToVector3f(entity.getEyePosition(1.0F).subtract(vec3.x(), vec3.y(), vec3.z()).normalize().reverse(), vec3); + } else { + convertToVector3f(entity.getLookAngle(), vec3); } ItemStack itemstack; @@ -479,18 +481,18 @@ public Vec3 getRightClickLookOverride(Player entity, int c) { } VRData vrdata = dh.vrPlayer.vrdata_world_pre; - vec3 = vrdata.getController(c).getDirection(); - Vec3 vec31 = dh.bowTracker.getAimVector(); + vrdata.getController(c).getDirection(vec3); + Vector3fc vec31 = dh.bowTracker.getAimVector(); - if (dh.bowTracker.isNotched() && vec31 != null && vec31.lengthSqr() > 0.0D) { - vec3 = vec31.reverse(); + if (dh.bowTracker.isNotched() && vec31 != null && vec31.lengthSquared() > 0.0F) { + vec31.negate(vec3); } return vec3; } if (itemstack.getItem() == Items.BUCKET && dh.interactTracker.bukkit[c]) { - vec3 = entity.getEyePosition(1.0F).subtract(dh.vrPlayer.vrdata_world_pre.getController(c).getPosition()).normalize().reverse(); + vec3 = convertToVector3f(entity.getEyePosition(1.0F), new Vector3f()).sub(dh.vrPlayer.vrdata_world_pre.getController(c).getPosition(new Vector3f())).normalize().negate(); } return vec3; @@ -500,11 +502,11 @@ public void doPermanentLookOverride(LocalPlayer entity, VRData data) { if (entity == null) { return; } - + Vector3f vector3f = new Vector3f(); // TODO: 😈 if (entity.isPassenger()) { //Server-side movement - Vec3 vec3 = VehicleTracker.getSteeringDirection(entity); + Vector3f vec3 = VehicleTracker.getSteeringDirection(entity, new Vector3f()); if (vec3 != null) { entity.setXRot((float) toDegrees(asin(-vec3.y / vec3.length()))); @@ -535,9 +537,9 @@ public void doPermanentLookOverride(LocalPlayer entity, VRData data) { entity.setYHeadRot(entity.getYRot()); entity.setXRot(-data.hmd.getPitch()); } - } else if (((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec() != null) { + } else if (((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec(vector3f) != null) { //Look AT the crosshair by default, most compatible with mods. - Vec3 playerToCrosshair = entity.getEyePosition(1).subtract(((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec()); //backwards + Vector3f playerToCrosshair = convertToVector3f(entity.getEyePosition(1), new Vector3f()).sub(vector3f); //backwards double what = playerToCrosshair.y / playerToCrosshair.length(); if (what > 1) { what = 1; @@ -558,16 +560,19 @@ public void doPermanentLookOverride(LocalPlayer entity, VRData data) { } } - public Vec3 AimedPointAtDistance(VRData source, int controller, double distance) { - Vec3 vec3 = source.getController(controller).getPosition(); - Vec3 vec31 = source.getController(controller).getDirection(); - return vec3.add(vec31.x * distance, vec31.y * distance, vec31.z * distance); + public Vector3f AimedPointAtDistance(VRData source, int controller, float distance, Vector3f dest) { + return source.getController(controller).getPosition(dest) + .add(source.getController(controller).getDirection(new Vector3f()).mul(distance)); } - public HitResult rayTraceBlocksVR(VRData source, int controller, double blockReachDistance, boolean fluid) { - Vec3 vec3 = source.getController(controller).getPosition(); - Vec3 vec31 = this.AimedPointAtDistance(source, controller, blockReachDistance); - return mc.level.clip(new ClipContext(vec3, vec31, Block.OUTLINE, fluid ? Fluid.ANY : Fluid.NONE, mc.player)); + public HitResult rayTraceBlocksVR(VRData source, int controller, float blockReachDistance, boolean fluid) { + return mc.level.clip(new ClipContext( + convertToVec3(source.getController(controller).getPosition(new Vector3f())), + convertToVec3(this.AimedPointAtDistance(source, controller, blockReachDistance, new Vector3f())), + Block.OUTLINE, + fluid ? Fluid.ANY : Fluid.NONE, + mc.player + )); } public boolean isTeleportSupported() { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java index eff6df3ba..533b9a76a 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/GuiHandler.java @@ -17,8 +17,8 @@ import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; import org.joml.Vector2f; -import org.joml.Vector3d; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.gameplay.VRPlayer; @@ -32,6 +32,7 @@ import static org.joml.Math.*; import static org.lwjgl.glfw.GLFW.*; import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.client_vr.gameplay.VRPlayer.world_to_room_pos; import static org.vivecraft.common.utils.Utils.*; public class GuiHandler { @@ -48,7 +49,7 @@ public class GuiHandler { public static boolean guiAppearOverBlockActive = false; public static float guiScale = 1.0F; public static float guiScaleApplied = 1.0F; - public static Vec3 guiPos_room; + public static Vector3f guiPos_room; public static Matrix4f guiRotation_room; public static final KeyMapping keyLeftClick = new KeyMapping("vivecraft.key.guiLeftClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); public static final KeyMapping keyRightClick = new KeyMapping("vivecraft.key.guiRightClick", GLFW_KEY_UNKNOWN, "vivecraft.key.category.gui"); @@ -159,35 +160,33 @@ public static void processGui() { } } - public static Vec2 getTexCoordsForCursor(Vec3 guiPos_room, Matrix4f guiRotation_room, float guiScale, VRDevicePose controller) { - Vec3 vec3 = controller.getPosition(); - Vector3f vector3 = convertToVector3f(vec3, new Vector3f()); - Vec3 vec31 = controller.getDirection(); - Vector3f vector31 = convertToVector3f(vec31, new Vector3f()); - Vector3f vector33 = guiRotation_room.transformProject(backward, new Vector3f()); - Vector3f vector34 = guiRotation_room.transformProject(right, new Vector3f()); - Vector3f vector35 = guiRotation_room.transformProject(up, new Vector3f()); - float f = vector33.dot(vector31); + public static Vec2 getTexCoordsForCursor(Vector3fc guiPos_room, Matrix4f guiRotation_room, float guiScale, VRDevicePose controller) { + Vector3f cPos = controller.getPosition(new Vector3f()); + Vector3f cDir = controller.getDirection(new Vector3f()); + Vector3f guiNormal = guiRotation_room.transformProject(backward, new Vector3f()); + Vector3f guiRight = guiRotation_room.transformProject(right, new Vector3f()); + Vector3f guiUp = guiRotation_room.transformProject(up, new Vector3f()); + float f = guiNormal.dot(cDir); if (abs(f) > 1.0E-5F) { - float f1 = 1.0F; - float f2 = f1 * 0.5F; - float f3 = 1.0F; - float f4 = f3 * 0.5F; - Vector3f vector36 = convertToVector3f(guiPos_room, new Vector3f()); - Vector3f vector37 = vector36.sub(vector35.div(1.0F / f4, new Vector3f()), new Vector3f()).sub(vector34.div(1.0F / f2, new Vector3f()), new Vector3f()); - float f5 = -vector33.dot(vector3.sub(vector37, new Vector3f())) / f; - - if (f5 > 0.0F) { - Vector3f vector38 = vector3.add(vector31.div(1.0F / f5, new Vector3f()), new Vector3f()); - Vector3f vector39 = vector38.sub(vector37, new Vector3f()); - float f6 = vector39.dot(vector34.div(1.0F / f1, new Vector3f())); - float f7 = vector39.dot(vector35.div(1.0F / f1, new Vector3f())); - float f8 = (float) mc.getWindow().getGuiScaledHeight() / (float) mc.getWindow().getGuiScaledWidth(); - f6 = (f6 - 0.5F) / 1.5F / guiScale + 0.5F; - f7 = (f7 - 0.5F) / f8 / 1.5F / guiScale + 0.5F; - f7 = 1.0F - f7; - return new Vec2(f6, f7); + float guiWidth = 1.0F; + float guiHalfWidth = guiWidth * 0.5F; + float guiHeight = 1.0F; + float guiHalfHeight = guiHeight * 0.5F; + Vector3f gp = new Vector3f(guiPos_room); + Vector3f guiTopLeft = gp.sub(guiUp.div(1.0F / guiHalfHeight, new Vector3f()), new Vector3f()).sub(guiRight.div(1.0F / guiHalfWidth, new Vector3f()), new Vector3f()); + float intersectDist = -guiNormal.dot(cPos.sub(guiTopLeft, new Vector3f())) / f; + + if (intersectDist > 0.0F) { + Vector3f pointOnPlane = cPos.add(cDir.div(1.0F / intersectDist, new Vector3f()), new Vector3f()); + Vector3f relativePoint = pointOnPlane.sub(guiTopLeft, new Vector3f()); + float u = relativePoint.dot(guiRight.div(1.0F / guiWidth, new Vector3f())); + float v = relativePoint.dot(guiUp.div(1.0F / guiWidth, new Vector3f())); + float ar = (float) mc.getWindow().getGuiScaledHeight() / (float) mc.getWindow().getGuiScaledWidth(); + u = (u - 0.5F) / 1.5F / guiScale + 0.5F; + v = (v - 0.5F) / ar / 1.5F / guiScale + 0.5F; + v = 1.0F - v; + return new Vec2(u, v); } } @@ -195,9 +194,9 @@ public static Vec2 getTexCoordsForCursor(Vec3 guiPos_room, Matrix4f guiRotation_ } public static void processBindingsGui() { - boolean flag = controllerMouseX >= 0.0D && controllerMouseX < (double) mc.getWindow().getScreenWidth() && controllerMouseY >= 0.0D && controllerMouseY < (double) mc.getWindow().getScreenWidth(); + boolean mouseValid = controllerMouseX >= 0.0D && controllerMouseX < (double) mc.getWindow().getScreenWidth() && controllerMouseY >= 0.0D && controllerMouseY < (double) mc.getWindow().getScreenWidth(); - if (keyLeftClick.consumeClick() && mc.screen != null && flag) { + if (keyLeftClick.consumeClick() && mc.screen != null && mouseValid) { InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_LEFT); lastPressedLeftClick = true; } @@ -207,7 +206,7 @@ public static void processBindingsGui() { lastPressedLeftClick = false; } - if (keyRightClick.consumeClick() && mc.screen != null && flag) { + if (keyRightClick.consumeClick() && mc.screen != null && mouseValid) { InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_RIGHT); lastPressedRightClick = true; } @@ -217,7 +216,7 @@ public static void processBindingsGui() { lastPressedRightClick = false; } - if (keyMiddleClick.consumeClick() && mc.screen != null && flag) { + if (keyMiddleClick.consumeClick() && mc.screen != null && mouseValid) { InputSimulator.pressMouse(GLFW_MOUSE_BUTTON_MIDDLE); lastPressedMiddleClick = true; } @@ -303,9 +302,9 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b if (staticScreen) { guiScale = 2.0F; - Vector2f afloat = dh.vr.getPlayAreaSize(); + Vector2f playArea = dh.vr.getPlayAreaSize(); // slight offset to center of the room, to prevent z fighting - guiPos_room = new Vec3(0.02D, 1.3F, -max(afloat != null ? afloat.y / 2.0F : 0.0F, 1.5F)); + guiPos_room = new Vector3f(0.02F, 1.3F, -max(playArea != null ? playArea.y / 2.0F : 0.0F, 1.5F)); guiRotation_room = new Matrix4f(); } else { if (previousGuiScreen == null && newScreen != null || newScreen instanceof ChatScreen || newScreen instanceof BookEditScreen || newScreen instanceof AbstractSignEditScreen) { @@ -321,42 +320,38 @@ public static void onScreenChanged(Screen previousGuiScreen, Screen newScreen, b && mc.hitResult instanceof EntityHitResult && ((EntityHitResult) mc.hitResult).getEntity() instanceof ContainerEntity; - Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); + Vector3f hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(new Vector3f()); if (guiAppearOverBlockActive && (isBlockScreen || isEntityScreen) && dh.vrSettings.guiAppearOverBlock) { - Vec3 sourcePos; + Vector3f sourcePos; if (isEntityScreen) { EntityHitResult entityHitResult = (EntityHitResult) mc.hitResult; - sourcePos = new Vec3(entityHitResult.getEntity().getX(), entityHitResult.getEntity().getY(), entityHitResult.getEntity().getZ()); + sourcePos = convertToVector3f(entityHitResult.getEntity().position(), new Vector3f()); } else { BlockHitResult blockHitResult = (BlockHitResult) mc.hitResult; - sourcePos = new Vec3(((float) blockHitResult.getBlockPos().getX() + 0.5F), blockHitResult.getBlockPos().getY(), ((float) blockHitResult.getBlockPos().getZ() + 0.5F)); + sourcePos = convertToVector3f(blockHitResult.getBlockPos(), new Vector3f()); + sourcePos.x += 0.5F; + sourcePos.z += 0.5F; } - Vec3 roomPos = VRPlayer.world_to_room_pos(sourcePos, dh.vrPlayer.vrdata_world_pre); - double distance = roomPos.subtract(hmdPos).length(); + double distance = world_to_room_pos(sourcePos, dh.vrPlayer.vrdata_world_pre, new Vector3f()).sub(hmdPos).length(); guiScale = (float) sqrt(distance); - Vec3 sourcePosWorld = new Vec3(sourcePos.x, sourcePos.y + 1.1D + (double) (0.5F * guiScale / 2.0F), sourcePos.z); - guiPos_room = VRPlayer.world_to_room_pos(sourcePosWorld, dh.vrPlayer.vrdata_world_pre); + Vector3f sourcePosWorld = new Vector3f(sourcePos.x, sourcePos.y + 1.1F + (0.5F * guiScale / 2.0F), sourcePos.z); + guiPos_room = world_to_room_pos(sourcePosWorld, dh.vrPlayer.vrdata_world_pre, new Vector3f()); } else { - Vec3 vec3 = new Vec3(0.0D, 0.0D, -2.0D); - - if (newScreen instanceof ChatScreen) { - vec3 = new Vec3(0.0D, 0.5D, -2.0D); - } else if (newScreen instanceof BookEditScreen || newScreen instanceof AbstractSignEditScreen) { - vec3 = new Vec3(0.0D, 0.25D, -2.0D); - } - - Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector(vec3); - guiPos_room = new Vec3(vec32.x / 2.0D + hmdPos.x, vec32.y / 2.0D + hmdPos.y, vec32.z / 2.0D + hmdPos.z); - - if (dh.vrSettings.physicalKeyboard && KeyboardHandler.isShowing() && guiPos_room.y < hmdPos.y + 0.2D) { - guiPos_room = new Vec3(guiPos_room.x, hmdPos.y + 0.2D, guiPos_room.z); + guiPos_room = dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector( + newScreen instanceof ChatScreen ? new Vector3f(0.0F, 0.5F, -2.0F) : + (newScreen instanceof BookEditScreen || newScreen instanceof AbstractSignEditScreen) ? + new Vector3f(0.0F, 0.25F, -2.0F) : + new Vector3f(0.0F, 0.0F, -2.0F) + ).mul(0.5F).add(hmdPos); + if (dh.vrSettings.physicalKeyboard && KeyboardHandler.isShowing() && guiPos_room.y < hmdPos.y + 0.2F) { + guiPos_room.y = hmdPos.y + 0.2F; } } // orient screen - Vector3f look = new Vector3f((float) (guiPos_room.x - hmdPos.x), (float) (guiPos_room.y - hmdPos.y), (float) (guiPos_room.z - hmdPos.z)); + Vector3f look = new Vector3f(guiPos_room.x - hmdPos.x, guiPos_room.y - hmdPos.y, guiPos_room.z - hmdPos.z); float pitch = asin((look.y / look.length())); float yaw = (float) (PI + atan2(look.x, look.z)); guiRotation_room = new Matrix4f().rotationY(yaw).rotateX(pitch); @@ -399,14 +394,14 @@ public static Vector3f applyGUIModelView(RenderPass currentPass, PoseStack pMatr .rotateY(((float) PI * 0.1F) * hand); scale = 0.58823526F; guilocal.y = 0.32F * dh.vrPlayer.vrdata_world_render.worldScale; - convertToVector3f(RenderHelper.getControllerRenderPos(1), guipos); + RenderHelper.getControllerRenderPos(1, guipos); dh.vr.hudPopup = true; } case WRIST -> { guirot.mul0(dh.vr.getAimRotation(1)) .rotateZ(((float) PI / 2F) * hand) .rotateY(((float) PI * 0.3F) * hand); - convertToVector3f(RenderHelper.getControllerRenderPos(1), guipos); + RenderHelper.getControllerRenderPos(1, guipos); dh.vr.hudPopup = true; scale = 0.4F; guilocal.set( @@ -418,57 +413,52 @@ public static Vector3f applyGUIModelView(RenderPass currentPass, PoseStack pMatr } default -> { guirot.mul0(dh.vr.hmdRotation); - convertToVector3f(dh.vrPlayer.vrdata_world_render.hmd.getPosition(), guipos); - Vector3f vec34 = new Vector3f(); + dh.vrPlayer.vrdata_world_render.hmd.getPosition(guipos); + Vector3f d; if (dh.vrSettings.seated && dh.vrSettings.seatedHudAltMode) { - convertToVector3f(dh.vrPlayer.vrdata_world_render.getController(0).getDirection(), vec34); + d = dh.vrPlayer.vrdata_world_render.getController(0).getDirection(new Vector3f()); guirot.mul0(dh.vr.getAimRotation(0)); } else { - convertToVector3f(dh.vrPlayer.vrdata_world_render.hmd.getDirection(), vec34); + d = dh.vrPlayer.vrdata_world_render.hmd.getDirection(new Vector3f()); } - guipos.add(vec34.mul(dh.vrPlayer.vrdata_world_render.worldScale * dh.vrSettings.hudDistance)); + guipos.add(d.mul(dh.vrPlayer.vrdata_world_render.worldScale * dh.vrSettings.hudDistance)); scale = dh.vrSettings.hudScale; } } } } else { - convertToVector3f(VRPlayer.room_to_world_pos(guiPos_room, dh.vrPlayer.vrdata_world_render), guipos); + VRPlayer.room_to_world_pos(guiPos_room, dh.vrPlayer.vrdata_world_render, guipos); guirot.set(guiRotation_room).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); } if ((dh.vrSettings.seated || dh.vrSettings.menuAlwaysFollowFace) && ((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom()) { scale = 2.0F; - Vector3d vec35 = new Vector3d(); - - for (Vec3 vec37 : dh.vr.hmdPosSamples) { - vec35.add(vec37.x, vec37.y, vec37.z); - } - - vec35.div(dh.vr.hmdPosSamples.size()); - float f1 = 0.0F; - - for (float f3 : dh.vr.hmdYawSamples) { - f1 += f3; - } - - f1 /= dh.vr.hmdYawSamples.size(); - f1 = toRadians(f1); - float f4 = ((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom() ? 2.5F * dh.vrPlayer.vrdata_world_render.worldScale : dh.vrSettings.hudDistance; - vec35.add(-sin(f1) * f4, 0, cos(f1) * f4); - guiPos_room = convertToVec3(vec35); - convertToVector3f(VRPlayer.room_to_world_pos(guiPos_room, dh.vrPlayer.vrdata_world_render), guipos); - guiRotation_room = guirot.rotationY((float) PI - f1).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); + Vector3f posAvg = dh.vr.hmdPosSamples.parallelStream().reduce(new Vector3f(), Vector3f::add) + .div(dh.vr.hmdPosSamples.size()); + float yawAvg = toRadians( + dh.vr.hmdYawSamples.parallelStream().reduce(0.0F, Float::sum) / dh.vr.hmdYawSamples.size() + ); + float roomScale = ( + ((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom() ? + 2.5F * dh.vrPlayer.vrdata_world_render.worldScale : + dh.vrSettings.hudDistance + ); + posAvg.x -= sin(yawAvg) * roomScale; + posAvg.z += cos(yawAvg) * roomScale; + guiPos_room = posAvg; + VRPlayer.room_to_world_pos(guiPos_room, dh.vrPlayer.vrdata_world_render, guipos); + guiRotation_room = guirot.rotationY((float) PI - yawAvg).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); guiScale = 2.0F; } - Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition().toVector3f(); - pMatrixStack.last().pose().translate(guipos.sub(eye)).mul(guirot).translate(guilocal); - float f2 = scale * dh.vrPlayer.vrdata_world_render.worldScale; - pMatrixStack.scale(f2, f2, f2); - guiScaleApplied = f2; + Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition(new Vector3f()); + pMatrixStack.last().pose().translate(guipos.sub(eye, eye)).mul(guirot).translate(guilocal); + float guiScaleApplied = scale * dh.vrPlayer.vrdata_world_render.worldScale; + pMatrixStack.scale(guiScaleApplied, guiScaleApplied, guiScaleApplied); + GuiHandler.guiScaleApplied = guiScaleApplied; mc.getProfiler().pop(); return guipos; } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java index 9f29b73e9..655fff733 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/KeyboardHandler.java @@ -13,12 +13,13 @@ import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class KeyboardHandler { private static boolean Showing = false; public static GuiKeyboard UI = new GuiKeyboard(); public static PhysicalKeyboard physicalKeyboard = new PhysicalKeyboard(); - public static Vec3 Pos_room = new Vec3(0.0D, 0.0D, 0.0D); + public static Vector3f Pos_room = new Vector3f(); public static Matrix4f Rotation_room = new Matrix4f(); private static boolean PointedL; private static boolean PointedR; @@ -32,11 +33,7 @@ public static boolean setOverlayShowing(boolean showingState) { if (dh.kiosk) { return false; } else { - if (dh.vrSettings.seated) { - showingState = false; - } - - if (showingState) { + if (showingState && !dh.vrSettings.seated) { if (dh.vrSettings.physicalKeyboard) { physicalKeyboard.show(); @@ -63,94 +60,76 @@ public static void processGui() { PointedL = false; PointedR = false; - if (Showing) { - if (!dh.vrSettings.seated) { - if (Rotation_room != null) { - if (dh.vrSettings.physicalKeyboard) { - physicalKeyboard.process(); + if (isShowing() && !dh.vrSettings.seated && Rotation_room != null) { + if (dh.vrSettings.physicalKeyboard) { + physicalKeyboard.process(); + } else { + Vec2 conOne = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); + Vec2 conZero = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); + float u = conZero.x; + float v = conZero.y; + + if (!(u < 0.0F) && !(v < 0.0F) && !(u > 1.0F) && !(v > 1.0F)) { + if (UI.cursorX2 == -1.0F) { + UI.cursorX2 = (int) (u * GuiHandler.guiWidth); + UI.cursorY2 = (int) (v * GuiHandler.guiHeight); + } else { + UI.cursorX2 = UI.cursorX2 * 0.7F + (float) ((int) (u * GuiHandler.guiWidth)) * 0.3F; + UI.cursorY2 = UI.cursorY2 * 0.7F + (float) ((int) (v * GuiHandler.guiHeight)) * 0.3F; + } + PointedR = true; + } else { + UI.cursorX2 = -1.0F; + UI.cursorY2 = -1.0F; + PointedR = false; + } + + u = conOne.x; + v = conOne.y; + + if (!(u < 0.0F) && !(v < 0.0F) && !(u > 1.0F) && !(v > 1.0F)) { + if (UI.cursorX1 == -1.0F) { + UI.cursorX1 = (int) (u * GuiHandler.guiWidth); + UI.cursorY1 = (int) (v * GuiHandler.guiHeight); } else { - Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); - Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); - float f = vec21.x; - float f1 = vec21.y; - - if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) { - if (UI.cursorX2 == -1.0F) { - UI.cursorX2 = (float) ((int) (f * (float) GuiHandler.guiWidth)); - UI.cursorY2 = (float) ((int) (f1 * (float) GuiHandler.guiHeight)); - } else { - float f2 = (float) ((int) (f * (float) GuiHandler.guiWidth)); - float f3 = (float) ((int) (f1 * (float) GuiHandler.guiHeight)); - UI.cursorX2 = UI.cursorX2 * 0.7F + f2 * 0.3F; - UI.cursorY2 = UI.cursorY2 * 0.7F + f3 * 0.3F; - } - PointedR = true; - } else { - UI.cursorX2 = -1.0F; - UI.cursorY2 = -1.0F; - PointedR = false; - } - - f = vec2.x; - f1 = vec2.y; - - if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) { - if (UI.cursorX1 == -1.0F) { - UI.cursorX1 = (float) ((int) (f * (float) GuiHandler.guiWidth)); - UI.cursorY1 = (float) ((int) (f1 * (float) GuiHandler.guiHeight)); - } else { - float f4 = (float) ((int) (f * (float) GuiHandler.guiWidth)); - float f5 = (float) ((int) (f1 * (float) GuiHandler.guiHeight)); - UI.cursorX1 = UI.cursorX1 * 0.7F + f4 * 0.3F; - UI.cursorY1 = UI.cursorY1 * 0.7F + f5 * 0.3F; - } - PointedL = true; - } else { - UI.cursorX1 = -1.0F; - UI.cursorY1 = -1.0F; - PointedL = false; - } + UI.cursorX1 = UI.cursorX1 * 0.7F + (float) ((int) (u * GuiHandler.guiWidth)) * 0.3F; + UI.cursorY1 = UI.cursorY1 * 0.7F + (float) ((int) (v * GuiHandler.guiHeight)) * 0.3F; } + PointedL = true; + } else { + UI.cursorX1 = -1.0F; + UI.cursorY1 = -1.0F; + PointedL = false; } } } } public static void orientOverlay(boolean guiRelative) { - if (Showing) { + if (isShowing()) { keyboardForGui = guiRelative; if (dh.vrSettings.physicalKeyboard) { - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vec3 vec31 = new Vec3(0.0D, -0.5D, 0.3D); - vec31 = vec31.yRot(toRadians(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw())); - Pos_room = new Vec3(vec3.x + vec31.x, vec3.y + vec31.y, vec3.z + vec31.z); - float f = (float) PI + toRadians(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw()); - Rotation_room.rotationY(f).rotateX((float) PI * 0.8F); + Vector3f hmdDir = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(new Vector3f()); + float hmdYawRad = toRadians(-dh.vrPlayer.vrdata_room_pre.hmd.getYaw()); + Pos_room.set(0.0F, -0.5F, 0.3F).rotateY(hmdYawRad).add(hmdDir.x(), hmdDir.y(), hmdDir.z()); + Rotation_room.rotationY((float) PI + hmdYawRad).rotateX((float) PI * 0.8F); } else if (guiRelative && GuiHandler.guiRotation_room != null) { - Vector3f vec35 = GuiHandler.guiRotation_room.getColumn(1, new Vector3f()).mul(0.8F); - Vector3f vec37 = GuiHandler.guiRotation_room.getColumn(2, new Vector3f()).mul(0.25F * GuiHandler.guiScale); - Matrix4f matrix4f = new Matrix4f() - .translate((float) (GuiHandler.guiPos_room.x - vec35.x), (float) (GuiHandler.guiPos_room.y - vec35.y), (float) (GuiHandler.guiPos_room.z - vec35.z)) - .translate(vec37) + Vector3f guiUp = GuiHandler.guiRotation_room.getColumn(1, new Vector3f()).mul(-0.8F).add(GuiHandler.guiPos_room); + Vector3f guiFwd = GuiHandler.guiRotation_room.getColumn(2, new Vector3f()).mul(0.25F * GuiHandler.guiScale); + Matrix4f guiRot = new Matrix4f() + .translate(guiUp) + .translate(guiFwd) .mul(GuiHandler.guiRotation_room) - .rotateX(toRadians(-30.0F)); - Pos_room = convertToVec3(matrix4f.getTranslation(new Vector3f())); - Rotation_room.set(matrix4f.setTranslation(new Vector3f(0.0F, 0.0F, 0.0F))); + .rotateX((float) PI / -6.0F); + Pos_room.set(guiRot.getTranslation(new Vector3f())); + Rotation_room.set(guiRot.setTranslation(new Vector3f())); } else { - Vec3 vec33 = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vec3 vec34 = new Vec3(0.0D, -0.5D, -2.0D); - Vec3 vec36 = dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector(vec34); - Pos_room = new Vec3(vec36.x / 2.0D + vec33.x, vec36.y / 2.0D + vec33.y, vec36.z / 2.0D + vec33.z); - Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vector3f vector3 = new Vector3f( - (float) (Pos_room.x - vec32.x), - (float) (Pos_room.y - vec32.y), - (float) (Pos_room.z - vec32.z) - ); - float f1 = asin(vector3.y / vector3.length()); - float f2 = (float) PI + atan2(vector3.x, vector3.z); - Rotation_room.rotationY(f2); + Vector3f hmdDir = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(new Vector3f()); + Pos_room.set(dh.vrPlayer.vrdata_room_pre.hmd.getCustomVector(new Vector3f(0.0F, -0.5F, -2.0F)).mul(0.5F)); + // float pitch = asin(Pos_room.y() / Pos_room.length()); + Rotation_room.rotationY((float) PI + atan2(Pos_room.x(), Pos_room.z())); + Pos_room.sub(hmdDir); } } else { keyboardForGui = false; @@ -158,46 +137,46 @@ public static void orientOverlay(boolean guiRelative) { } public static void processBindings() { - if (Showing) { + if (isShowing()) { if (dh.vrSettings.physicalKeyboard) { physicalKeyboard.processBindings(); - return; - } + } else { - int i0 = (int) (clamp(0, GuiHandler.guiWidth, (int) UI.cursorX1) * (double) UI.width / (double) GuiHandler.guiWidth); - int i1 = (int) (clamp(0, GuiHandler.guiHeight, (int) UI.cursorY1) * (double) UI.height / (double) GuiHandler.guiHeight); + final int i0 = clamp(0, GuiHandler.guiWidth, (int) UI.cursorX1) * UI.width / GuiHandler.guiWidth; + final int i1 = clamp(0, GuiHandler.guiHeight, (int) UI.cursorY1) * UI.height / GuiHandler.guiHeight; - if (PointedL && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.LEFT)) { - UI.mouseClicked(i0, i1, 0); - lastPressedClickL = true; - } + if (PointedL && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.LEFT)) { + UI.mouseClicked(i0, i1, 0); + lastPressedClickL = true; + } - if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.LEFT) && lastPressedClickL) { - UI.mouseReleased(i0, i1, 0); - lastPressedClickL = false; - } + if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.LEFT) && lastPressedClickL) { + UI.mouseReleased(i0, i1, 0); + lastPressedClickL = false; + } - i0 = (int) (clamp(0, GuiHandler.guiWidth, (int) UI.cursorX2) * (double) UI.width / (double) GuiHandler.guiWidth); - i1 = (int) (clamp(0, GuiHandler.guiHeight, (int) UI.cursorY2) * (double) UI.height / (double) GuiHandler.guiHeight); + final int i2 = clamp(0, GuiHandler.guiWidth, (int) UI.cursorX2) * UI.width / GuiHandler.guiWidth; + final int i3 = clamp(0, GuiHandler.guiHeight, (int) UI.cursorY2) * UI.height / GuiHandler.guiHeight; - if (PointedR && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.RIGHT)) { - UI.mouseClicked(i0, i1, 0); - lastPressedClickR = true; - } + if (PointedR && GuiHandler.keyKeyboardClick.consumeClick(ControllerType.RIGHT)) { + UI.mouseClicked(i2, i3, 0); + lastPressedClickR = true; + } - if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.RIGHT) && lastPressedClickR) { - UI.mouseReleased(i0, i1, 0); - lastPressedClickR = false; - } + if (!GuiHandler.keyKeyboardClick.isDown(ControllerType.RIGHT) && lastPressedClickR) { + UI.mouseReleased(i2, i3, 0); + lastPressedClickR = false; + } - if (GuiHandler.keyKeyboardShift.consumeClick()) { - UI.setShift(true); - lastPressedShift = true; - } + if (GuiHandler.keyKeyboardShift.consumeClick()) { + UI.setShift(true); + lastPressedShift = true; + } - if (!GuiHandler.keyKeyboardShift.isDown() && lastPressedShift) { - UI.setShift(false); - lastPressedShift = false; + if (!GuiHandler.keyKeyboardShift.isDown() && lastPressedShift) { + UI.setShift(false); + lastPressedShift = false; + } } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java index 864545891..d69d4be30 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/screenhandlers/RadialHandler.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.pipeline.RenderTarget; import net.minecraft.world.phys.Vec2; -import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; import org.joml.Vector3f; import org.vivecraft.client.VivecraftVRMod; @@ -17,8 +16,8 @@ public class RadialHandler { private static boolean Showing = false; public static GuiRadial UI = new GuiRadial(); - public static Vec3 Pos_room = new Vec3(0.0D, 0.0D, 0.0D); - public static Matrix4f Rotation_room = new Matrix4f(); + public static final Vector3f Pos_room = new Vector3f(); + public static final Matrix4f Rotation_room = new Matrix4f(); private static boolean PointedL; private static boolean PointedR; public static RenderTarget Framebuffer; @@ -32,11 +31,7 @@ public static boolean setOverlayShowing(boolean showingState, ControllerType con if (dh.kiosk) { return false; } else { - if (dh.vrSettings.seated) { - showingState = false; - } - - if (showingState) { + if (showingState && !dh.vrSettings.seated) { UI.init(mc, GuiHandler.scaledWidth, GuiHandler.scaledHeight); Showing = true; activecontroller = controller; @@ -54,78 +49,67 @@ public static void processGui() { PointedL = false; PointedR = false; - if (isShowing()) { - if (!dh.vrSettings.seated) { - if (Rotation_room != null) { - Vec2 vec2 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); - Vec2 vec21 = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); - float f = vec21.x; - float f1 = vec21.y; - - if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) { - if (UI.cursorX2 == -1.0F) { - UI.cursorX2 = (float) ((int) (f * GuiHandler.guiWidth)); - UI.cursorY2 = (float) ((int) (f1 * GuiHandler.guiHeight)); - } else { - float f2 = (float) ((int) (f * GuiHandler.guiWidth)); - float f3 = (float) ((int) (f1 * GuiHandler.guiHeight)); - UI.cursorX2 = UI.cursorX2 * 0.7F + f2 * 0.3F; - UI.cursorY2 = UI.cursorY2 * 0.7F + f3 * 0.3F; - } - PointedR = true; - } else { - UI.cursorX2 = -1.0F; - UI.cursorY2 = -1.0F; - PointedR = false; - } + if (isShowing() && !dh.vrSettings.seated) { + Vec2 conOne = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(1)); + Vec2 conZero = GuiHandler.getTexCoordsForCursor(Pos_room, Rotation_room, GuiHandler.guiScale, dh.vrPlayer.vrdata_room_pre.getController(0)); + float u = conZero.x; + float v = conZero.y; + + if (!(u < 0.0F) && !(v < 0.0F) && !(u > 1.0F) && !(v > 1.0F)) { + if (UI.cursorX2 == -1.0F) { + UI.cursorX2 = (float) ((int) (u * GuiHandler.guiWidth)); + UI.cursorY2 = (float) ((int) (v * GuiHandler.guiHeight)); + } else { + UI.cursorX2 = UI.cursorX2 * 0.7F + (float) ((int) (u * GuiHandler.guiWidth)) * 0.3F; + UI.cursorY2 = UI.cursorY2 * 0.7F + (float) ((int) (v * GuiHandler.guiHeight)) * 0.3F; + } + PointedR = true; + } else { + UI.cursorX2 = -1.0F; + UI.cursorY2 = -1.0F; + PointedR = false; + } - f = vec2.x; - f1 = vec2.y; - - if (!(f < 0.0F) && !(f1 < 0.0F) && !(f > 1.0F) && !(f1 > 1.0F)) { - if (UI.cursorX1 == -1.0F) { - UI.cursorX1 = (float) ((int) (f * GuiHandler.guiWidth)); - UI.cursorY1 = (float) ((int) (f1 * GuiHandler.guiHeight)); - } else { - float f4 = (float) ((int) (f * GuiHandler.guiWidth)); - float f5 = (float) ((int) (f1 * GuiHandler.guiHeight)); - UI.cursorX1 = UI.cursorX1 * 0.7F + f4 * 0.3F; - UI.cursorY1 = UI.cursorY1 * 0.7F + f5 * 0.3F; - } - PointedL = true; - } else { - UI.cursorX1 = -1.0F; - UI.cursorY1 = -1.0F; - PointedL = false; - } + u = conOne.x; + v = conOne.y; + + if (!(u < 0.0F) && !(v < 0.0F) && !(u > 1.0F) && !(v > 1.0F)) { + if (UI.cursorX1 == -1.0F) { + UI.cursorX1 = (float) ((int) (u * GuiHandler.guiWidth)); + UI.cursorY1 = (float) ((int) (v * GuiHandler.guiHeight)); + } else { + UI.cursorX1 = UI.cursorX1 * 0.7F + (float) ((int) (u * GuiHandler.guiWidth)) * 0.3F; + UI.cursorY1 = UI.cursorY1 * 0.7F + (float) ((int) (v * GuiHandler.guiHeight)) * 0.3F; } + PointedL = true; + } else { + UI.cursorX1 = -1.0F; + UI.cursorY1 = -1.0F; + PointedL = false; } } } public static void orientOverlay(ControllerType controller) { if (isShowing()) { - VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.hmd; - float f = 2.0F; int con = (controller == ControllerType.LEFT) ? 1 : 0; + VRDevicePose pose; + float f; if (dh.vrSettings.radialModeHold) { - vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(con); + pose = dh.vrPlayer.vrdata_room_pre.getController(con); f = 1.2F; + } else { + pose = dh.vrPlayer.vrdata_room_pre.hmd; + f = 2.0F; } - Vec3 vec3 = vrdata$vrdevicepose.getPosition(); - Vec3 vec31 = new Vec3(0.0D, 0.0D, -f); - Vec3 vec32 = vrdata$vrdevicepose.getCustomVector(vec31); - Pos_room = new Vec3(vec32.x / 2.0D + vec3.x, vec32.y / 2.0D + vec3.y, vec32.z / 2.0D + vec3.z); - Vector3f vector3 = new Vector3f( - (float) (Pos_room.x - vec3.x), - (float) (Pos_room.y - vec3.y), - (float) (Pos_room.z - vec3.z) - ); - float f1 = asin(vector3.y / vector3.length()); - float f2 = (float) PI + atan2(vector3.x, vector3.z); - Rotation_room.rotationY(f2).rotateX(f1); + pose.getPosition(Pos_room); + Vector3f look = pose.getCustomVector(new Vector3f(0.0F, 0.0F, -f)).mul(0.5F); + Pos_room.add(look); + float pitch = asin(look.y / look.length()); + float yaw = (float) PI + atan2(look.x, look.z); + Rotation_room.rotationY(yaw).rotateX(pitch); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java index 0debfdd19..672ad088e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BackpackTracker.java @@ -4,16 +4,17 @@ import net.minecraft.core.Direction; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket; import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.Action; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import static org.joml.Math.abs; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; public class BackpackTracker extends Tracker { public boolean[] wasIn = new boolean[2]; public int previousSlot = 0; - private final Vec3 down = new Vec3(0.0D, -1.0D, 0.0D); @Override public boolean isActive() { @@ -37,25 +38,23 @@ public boolean isActive() { @Override public void doProcess() { - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadRear(); + Vector3fc hmdPos = convertToVector3f(dh.vrPlayer.vrdata_room_pre.getHeadRear(), new Vector3f()); - for (int i = 0; i < 2; ++i) { - Vec3 vec31 = dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(); - Vec3 vec32 = dh.vrPlayer.vrdata_room_pre.getHand(i).getDirection(); - Vec3 vec33 = dh.vrPlayer.vrdata_room_pre.hmd.getDirection(); - Vec3 vec34 = vec3.subtract(vec31); - double d0 = vec32.dot(this.down); - double d1 = vec34.dot(vec33); - boolean flag = abs(vec3.y - vec31.y) < 0.25D; - boolean flag1 = d1 > 0.0D && vec34.length() > 0.05D; - boolean flag2 = d0 > 0.6D; - boolean flag3 = d1 < 0.0D && vec34.length() > 0.25D; - boolean flag4 = d0 < 0.0D; - boolean flag5 = flag && flag1 && flag2; + for (int hand = 0; hand < 2; ++hand) { + Vector3f controllerPos = dh.vrPlayer.vrdata_room_pre.getController(hand).getPosition(new Vector3f()); + boolean below = abs(hmdPos.y() - controllerPos.y()) < 0.25D; + hmdPos.sub(controllerPos, controllerPos); // controllerPos -> delta + double dot = dh.vrPlayer.vrdata_room_pre.getHand(hand).getDirection(new Vector3f()).dot(0.0F, -1.0F, 0.0F); + double dotDelta = controllerPos.dot(dh.vrPlayer.vrdata_room_pre.hmd.getDirection(new Vector3f())); + boolean behind = dotDelta > 0.0D && controllerPos.length() > 0.05D; + boolean aimdown = dot > 0.6D; + boolean infront = dotDelta < 0.0D && controllerPos.length() > 0.25D; + boolean aimup = dot < 0.0D; + boolean zone = below && behind && aimdown; - if (flag5) { - if (!this.wasIn[i]) { - if (i == 0) { + if (zone) { + if (!this.wasIn[hand]) { + if (hand == 0) { if (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getMainHandItem())) { if (mc.player.getInventory().selected != 0) { this.previousSlot = mc.player.getInventory().selected; @@ -66,18 +65,18 @@ public void doProcess() { } } } else if (!dh.climbTracker.isGrabbingLadder() || !dh.climbTracker.isClaws(mc.player.getOffhandItem())) { - if (dh.vrSettings.physicalGuiEnabled) { - //minecraft.physicalGuiManager.toggleInventoryBag(); - } else { +// if (dh.vrSettings.physicalGuiEnabled) { +// minecraft.physicalGuiManager.toggleInventoryBag(); +// } else { mc.player.connection.send(new ServerboundPlayerActionPacket(Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ZERO, Direction.DOWN)); - } +// } } - dh.vr.triggerHapticPulse(i, 1500); - this.wasIn[i] = true; + dh.vr.triggerHapticPulse(hand, 1500); + this.wasIn[hand] = true; } - } else if (flag3 || flag4) { - this.wasIn[i] = false; + } else if (infront || aimup) { + this.wasIn[hand] = false; } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java index 9fc84e622..f9a3340c0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/BowTracker.java @@ -1,14 +1,13 @@ package org.vivecraft.client_vr.gameplay.trackers; import net.minecraft.Util; -import net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket; import net.minecraft.tags.ItemTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.UseAnim; -import net.minecraft.world.phys.Vec3; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.Xplat; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.VRData; @@ -24,30 +23,21 @@ import static org.joml.Math.toDegrees; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.convertToVector3f; public class BowTracker extends Tracker { - private double lastcontrollersDist; - private double lastcontrollersDot; - private double controllersDist; - private double controllersDot; - private double currentDraw; - private double lastDraw; + private float currentDraw; public boolean isDrawing; private boolean pressed; - private boolean lastpressed; private boolean canDraw; - private boolean lastcanDraw; public long startDrawTime; - private final double notchDotThreshold = 20.0D; - private double maxDraw; + private float maxDraw; private long maxDrawMillis = 1100L; - private Vec3 aim; + private final Vector3f aim = new Vector3f(); float tsNotch = 0.0F; int hapcounter = 0; int lasthapStep = 0; - public Vec3 getAimVector() { + public Vector3fc getAimVector() { return this.aim; } @@ -125,53 +115,49 @@ public void doProcess() { VRData vrdata = dh.vrPlayer.getVRDataWorld(); if (dh.vrSettings.seated) { - this.aim = vrdata.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, 1.0D)); + vrdata.getController(0).getCustomVector(this.aim.set(0.0F, 0.0F, 1.0F)); } else { - this.lastcontrollersDist = this.controllersDist; - this.lastcontrollersDot = this.controllersDot; - this.lastpressed = this.pressed; - this.lastDraw = this.currentDraw; - this.lastcanDraw = this.canDraw; - this.maxDraw = (double) mc.player.getBbHeight() * 0.22D; + boolean lastpressed = this.pressed; + boolean lastcanDraw = this.canDraw; + this.maxDraw = mc.player.getBbHeight() * 0.22F; + PlayerExtension playerExt = (PlayerExtension) mc.player; if (Xplat.isModLoaded("pehkui")) { // this is meant to be relative to the base Bb height, not the scaled one this.maxDraw /= PehkuiHelper.getPlayerBbScale(mc.player, mc.getFrameTime()); } - Vec3 vec3 = vrdata.getController(0).getPosition(); - Vec3 vec31 = vrdata.getController(1).getPosition(); - this.controllersDist = vec31.distanceTo(vec3); - Vec3 vec32 = new Vec3(0.0D, 1.0D * vrdata.worldScale, 0.0D); - Vec3 vec33 = vrdata.getHand(1).getCustomVector(vec32).scale(this.maxDraw * 0.5D).add(vec31); - double d0 = vec3.distanceTo(vec33); - this.aim = vec3.subtract(vec31).normalize(); - Vec3 vec34 = vrdata.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)); - Vec3 vec35 = vrdata.getHand(1).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); - this.controllersDot = toDegrees(acos((double) convertToVector3f(vec35, new Vector3f()).dot(convertToVector3f(vec34, new Vector3f())))); + Vector3fc rightPos = vrdata.getController(0).getPosition(new Vector3f()); + Vector3fc leftPos = vrdata.getController(1).getPosition(new Vector3f()); + float controllersDist = leftPos.distance(rightPos); + Vector3fc stringPos = vrdata.getHand(1).getCustomVector(new Vector3f(0.0F, vrdata.worldScale, 0.0F)).mul(this.maxDraw * 0.5F).add(leftPos); + float notchDist = rightPos.distance(stringPos); + rightPos.sub(leftPos, this.aim).normalize(); + Vector3fc rightAim = vrdata.getController(0).getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F)); + Vector3fc leftAim = vrdata.getHand(1).getCustomVector(new Vector3f(0.0F, -1.0F, 0.0F)); + float controllersDot = (float) toDegrees(acos(leftAim.dot(rightAim))); this.pressed = mc.options.keyAttack.isDown(); - float f = 0.15F * vrdata.worldScale; - boolean flag = isHoldingBow(InteractionHand.MAIN_HAND); - InteractionHand interactionhand = flag ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; - ItemStack itemstack = ItemStack.EMPTY; - ItemStack itemstack1 = ItemStack.EMPTY; - - if (flag) { - itemstack1 = mc.player.getMainHandItem(); - itemstack = mc.player.getProjectile(itemstack1); + float notchDistThreshold = 0.15F * vrdata.worldScale; + boolean main = isHoldingBow(InteractionHand.MAIN_HAND); + InteractionHand interactionhand = main ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; + final ItemStack bow; + final ItemStack ammo; + if (main) { + ammo = mc.player.getProjectile(bow = mc.player.getMainHandItem()); } else { - if (mc.player.getMainHandItem().is(ItemTags.ARROWS)) { - itemstack = mc.player.getMainHandItem(); + bow = mc.player.getOffhandItem(); + if (mc.player.getMainHandItem().is(ItemTags.ARROWS)){ + ammo = mc.player.getMainHandItem(); + } else { + ammo = ItemStack.EMPTY; } + }; - itemstack1 = mc.player.getOffhandItem(); - } - - int i = itemstack1.getUseDuration(); - int j = itemstack1.getUseDuration() - 15; - int k = 0; + int stage0 = bow.getUseDuration(); + int stage1 = bow.getUseDuration() - 15; + int stage2 = 0; - if (itemstack != ItemStack.EMPTY && d0 <= (double) f && this.controllersDot <= 20.0D) { + if (ammo != ItemStack.EMPTY && notchDist <= notchDistThreshold && controllersDot <= 20.0F) { if (!this.canDraw) { this.startDrawTime = Util.getMillis(); } @@ -180,29 +166,27 @@ public void doProcess() { this.tsNotch = (float) Util.getMillis(); if (!this.isDrawing) { - ((PlayerExtension) mc.player).vivecraft$setItemInUseClient(itemstack1, interactionhand); - ((PlayerExtension) mc.player).vivecraft$setItemInUseCountClient(i); + playerExt.vivecraft$setItemInUseClient(bow, interactionhand); + playerExt.vivecraft$setItemInUseCountClient(stage0); //Minecraft.getInstance().physicalGuiManager.preClickAction(); } } else if ((float) Util.getMillis() - this.tsNotch > 500.0F) { this.canDraw = false; - ((PlayerExtension) mc.player).vivecraft$setItemInUseClient(ItemStack.EMPTY, interactionhand); + playerExt.vivecraft$setItemInUseClient(ItemStack.EMPTY, interactionhand); } - if (!this.isDrawing && this.canDraw && this.pressed && !this.lastpressed) { + if (!this.isDrawing && this.canDraw && this.pressed && !lastpressed) { this.isDrawing = true; //Minecraft.getInstance().physicalGuiManager.preClickAction(); mc.gameMode.useItem(mc.player, interactionhand); } - if (this.isDrawing && !this.pressed && this.lastpressed && (double) this.getDrawPercent() > 0.0D) { + if (this.isDrawing && !this.pressed && lastpressed && this.getDrawPercent() > 0.0F) { dh.vr.triggerHapticPulse(0, 500); dh.vr.triggerHapticPulse(1, 3000); - ServerboundCustomPayloadPacket serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(this.getDrawPercent()).array()); - mc.getConnection().send(serverboundcustompayloadpacket); + mc.getConnection().send(ClientNetworking.getVivecraftClientPacket(PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(this.getDrawPercent()).array())); mc.gameMode.releaseUsingItem(mc.player); - serverboundcustompayloadpacket = ClientNetworking.getVivecraftClientPacket(PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(0.0F).array()); - mc.getConnection().send(serverboundcustompayloadpacket); + mc.getConnection().send(ClientNetworking.getVivecraftClientPacket(PacketDiscriminators.DRAW, ByteBuffer.allocate(4).putFloat(0.0F).array())); this.isDrawing = false; } @@ -210,43 +194,44 @@ public void doProcess() { this.isDrawing = false; } - if (!this.isDrawing && this.canDraw && !this.lastcanDraw) { + if (!this.isDrawing && this.canDraw && !lastcanDraw) { dh.vr.triggerHapticPulse(1, 800); dh.vr.triggerHapticPulse(0, 800); } if (this.isDrawing) { - this.currentDraw = (this.controllersDist - (double) f) / vrdata.worldScale; + this.currentDraw = (controllersDist - notchDistThreshold) / vrdata.worldScale; if (this.currentDraw > this.maxDraw) { this.currentDraw = this.maxDraw; } - int j1 = 0; + float drawPerc = this.getDrawPercent(); + int hap; - if (this.getDrawPercent() > 0.0F) { - j1 = (int) (this.getDrawPercent() * 500.0F) + 700; + if (drawPerc > 0.0F) { + hap = (int) (drawPerc * 500.0F) + 700; + } else { + hap = 0; } - int l = (int) ((float) itemstack1.getUseDuration() - this.getDrawPercent() * (float) this.maxDrawMillis); - ((PlayerExtension) mc.player).vivecraft$setItemInUseClient(itemstack1, interactionhand); - double d1 = this.getDrawPercent(); + playerExt.vivecraft$setItemInUseClient(bow, interactionhand); - if (d1 >= 1.0D) { - ((PlayerExtension) mc.player).vivecraft$setItemInUseCountClient(k); - } else if (d1 > 0.4D) { - ((PlayerExtension) mc.player).vivecraft$setItemInUseCountClient(j); + if (drawPerc >= 1.0F) { + playerExt.vivecraft$setItemInUseCountClient(stage2); + } else if (drawPerc > 0.4F) { + playerExt.vivecraft$setItemInUseCountClient(stage1); } else { - ((PlayerExtension) mc.player).vivecraft$setItemInUseCountClient(i); + playerExt.vivecraft$setItemInUseCountClient(stage0); } - int i1 = (int) (d1 * 4.0D * 4.0D * 3.0D); + int hapStep = (int) (drawPerc * 4.0F * 4.0F * 3.0F); - if (i1 % 2 == 0 && this.lasthapStep != i1) { - dh.vr.triggerHapticPulse(0, j1); + if ((hapStep % 2) == 0 && this.lasthapStep != hapStep) { + dh.vr.triggerHapticPulse(0, hap); - if (d1 == 1.0D) { - dh.vr.triggerHapticPulse(1, j1); + if (drawPerc == 1.0F) { + dh.vr.triggerHapticPulse(1, hap); } } @@ -254,7 +239,7 @@ public void doProcess() { dh.vr.triggerHapticPulse(1, 200); } - this.lasthapStep = i1; + this.lasthapStep = hapStep; ++this.hapcounter; } else { this.hapcounter = 0; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java index fd4368380..b46470415 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/CameraTracker.java @@ -1,10 +1,10 @@ package org.vivecraft.client_vr.gameplay.trackers; import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; import org.joml.Quaternionf; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.render.RenderPass; @@ -15,11 +15,11 @@ public class CameraTracker extends Tracker { public static final ModelResourceLocation cameraModel = new ModelResourceLocation("vivecraft", "camera", ""); public static final ModelResourceLocation cameraDisplayModel = new ModelResourceLocation("vivecraft", "camera_display", ""); private boolean visible = false; - private Vec3 position = new Vec3(0.0D, 0.0D, 0.0D); + private final Vector3f position = new Vector3f(); private Quaternionf rotation = new Quaternionf(); private int startController; private VRDevicePose startControllerPose; - private Vec3 startPosition; + private final Vector3f startPosition = new Vector3f(); private Quaternionf startRotation; private boolean quickMode; @@ -38,12 +38,12 @@ public boolean isActive() { public void doProcess() { if (this.startControllerPose != null) { VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_render.getController(this.startController); - Vec3 vec3 = this.startControllerPose.getPosition(); - Vec3 vec31 = vrdata$vrdevicepose.getPosition().subtract(vec3); + Vector3f vec3 = this.startControllerPose.getPosition(new Vector3f()); + Vector3f vec31 = vrdata$vrdevicepose.getPosition(new Vector3f()).sub(vec3); Matrix4f matrix4f = vrdata$vrdevicepose.getMatrix().mul0(this.startControllerPose.getMatrix().invertAffine(), new Matrix4f()); - Vector3f vector3 = new Vector3f((float) this.startPosition.x - (float) vec3.x, (float) this.startPosition.y - (float) vec3.y, (float) this.startPosition.z - (float) vec3.z); + Vector3f vector3 = new Vector3f(this.startPosition.x - vec3.x, this.startPosition.y - vec3.y, this.startPosition.z - vec3.z); Vector3f vector31 = matrix4f.transformProject(vector3, new Vector3f()); - this.position = new Vec3(this.startPosition.x + (double) ((float) vec31.x) + (double) (vector31.x - vector3.x), this.startPosition.y + (double) ((float) vec31.y) + (double) (vector31.y - vector3.y), this.startPosition.z + (double) ((float) vec31.z) + (double) (vector31.z - vector3.z)); + this.position.set(this.startPosition.x + vec31.x + vector31.x - vector3.x, this.startPosition.y + vec31.y + vector31.y - vector3.y, this.startPosition.z + vec31.z + vector31.z - vector3.z); this.rotation.setFromNormalized(matrix4f); this.startRotation.mul(this.rotation, this.rotation); } @@ -52,7 +52,7 @@ public void doProcess() { this.visible = false; } - if (dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().distanceTo(this.position) > (double) (mc.options.getEffectiveRenderDistance() * 12)) { + if (dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition(new Vector3f()).distance(this.position) > (double) (mc.options.getEffectiveRenderDistance() * 12)) { this.visible = false; } } @@ -77,12 +77,12 @@ public void toggleVisibility() { this.visible = !this.visible; } - public Vec3 getPosition() { + public Vector3fc getPosition() { return this.position; } - public void setPosition(Vec3 position) { - this.position = position; + public void setPosition(Vector3fc position) { + this.position.set(position); } public Quaternionf getRotation() { @@ -108,7 +108,7 @@ public boolean isQuickMode() { public void startMoving(int controller, boolean quickMode) { this.startController = controller; this.startControllerPose = dh.vrPlayer.vrdata_world_pre.getController(controller); - this.startPosition = this.position; + this.startPosition.set(this.position); this.startRotation = new Quaternionf(this.rotation); this.quickMode = quickMode; } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java index 191b462c3..f51c6768e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/ClimbTracker.java @@ -12,9 +12,8 @@ import net.minecraft.world.level.block.VineBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.VoxelShape; -import org.joml.Vector3d; +import org.joml.Vector3f; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.BlockTags; @@ -28,7 +27,7 @@ import static org.joml.Math.min; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class ClimbTracker extends Tracker { private boolean[] latched = new boolean[2]; @@ -39,9 +38,12 @@ public class ClimbTracker extends Tracker { public byte serverblockmode = 0; private boolean gravityOverride = false; public boolean forceActivate = false; - public Vec3[] latchStart = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; - public Vec3[] latchStart_room = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; - public Vec3[] latchStartBody = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; + public final Vector3f latchStartc0 = new Vector3f(); + public final Vector3f latchStartc1 = new Vector3f(); + public final Vector3f latchStart_roomc0 = new Vector3f(); + public final Vector3f latchStart_roomc1 = new Vector3f(); + public final Vector3f latchStartBodyc0 = new Vector3f(); + public final Vector3f latchStartBodyc1 = new Vector3f(); public int latchStartController = -1; boolean wantjump = false; AABB[] box = new AABB[2]; @@ -164,17 +166,29 @@ public void reset() { public void doProcess() { boolean[] aboolean = new boolean[2]; boolean[] aboolean1 = new boolean[2]; - Vec3[] avec3 = new Vec3[2]; + Vector3f[] avec3 = new Vector3f[2]; boolean flag = false; boolean flag1 = false; boolean flag2 = false; boolean flag3 = false; for (int i = 0; i < 2; ++i) { - avec3[i] = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getDirection(); + final Vector3f latchStart; + final Vector3f latchStartRoom; + final Vector3f latchStartBody; + if (i == 0) { + latchStart = latchStartc0; + latchStartRoom = latchStart_roomc0; + latchStartBody = latchStartBodyc0; + } else { + latchStart = latchStartc1; + latchStartRoom = latchStart_roomc1; + latchStartBody = latchStartBodyc1; + } + avec3[i] = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(new Vector3f()); + Vector3f vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getDirection(new Vector3f()); this.inblock[i] = false; - BlockPos blockpos = BlockPos.containing(avec3[i]); + BlockPos blockpos = BlockPos.containing(avec3[i].x(), avec3[i].y(), avec3[i].z()); BlockState blockstate = mc.level.getBlockState(blockpos); Block block = blockstate.getBlock(); VoxelShape voxelshape = blockstate.getCollisionShape(mc.level, blockpos); @@ -186,13 +200,13 @@ public void doProcess() { } if (!dh.climbTracker.isClimbeyClimb()) { - Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition().subtract(vec3.scale(0.2D)); - AABB aabb = new AABB(avec3[i], vec31); + Vector3f vec31 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(new Vector3f()).sub(vec3.mul(0.2F, new Vector3f())); + AABB aabb = new AABB(avec3[i].x(), avec3[i].y(), avec3[i].z(), vec31.x(), vec31.y(), vec31.z()); flag3 = true; boolean flag4 = block instanceof LadderBlock || block instanceof VineBlock || blockstate.is(BlockTags.VIVECRAFT_CLIMBABLE); if (!flag4) { - BlockPos blockpos1 = BlockPos.containing(vec31); + BlockPos blockpos1 = BlockPos.containing(vec31.x(), vec31.y(), vec31.z()); BlockState blockstate1 = mc.level.getBlockState(blockpos1); Block block1 = blockstate1.getBlock(); @@ -282,13 +296,12 @@ public void doProcess() { } } } else { - Vec3 vec311 = this.latchStart[i].subtract(avec3[i]); - double d9 = vec311.length(); + double d9 = latchStart.sub(avec3[i], new Vector3f()).length(); if (d9 > 0.5D) { this.inblock[i] = false; } else { - BlockPos blockpos5 = BlockPos.containing(this.latchStart[i]); + BlockPos blockpos5 = BlockPos.containing(latchStart.x, latchStart.y, latchStart.z); BlockState blockstate2 = mc.level.getBlockState(blockpos5); this.inblock[i] = this.wasinblock[i] && blockstate2.getBlock() instanceof LadderBlock || blockstate2.getBlock() instanceof VineBlock || blockstate2.is(BlockTags.VIVECRAFT_CLIMBABLE); } @@ -307,13 +320,12 @@ public void doProcess() { aboolean[i] = VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT); } - this.inblock[i] = this.box[i] != null && this.box[i].move(blockpos).contains(avec3[i]); + this.inblock[i] = this.box[i] != null && this.box[i].move(blockpos).contains(avec3[i].x, avec3[i].y, avec3[i].z); if (!this.inblock[i]) { - Vec3 vec310 = this.latchStart[i].subtract(avec3[i]); - double d7 = vec310.length(); + Vector3f vec310 = latchStart.sub(avec3[i], new Vector3f()); - if (d7 > 0.5D) { + if (vec310.length() > 0.5F) { aboolean[i] = false; } } @@ -343,9 +355,9 @@ public void doProcess() { if (!this.wasinblock[i] && this.inblock[i] && aboolean[i] || !this.wasbutton[i] && aboolean[i] && this.inblock[i]) { flag1 = true; this.wantjump = false; - this.latchStart[i] = avec3[i]; - this.latchStart_room[i] = dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(); - this.latchStartBody[i] = mc.player.position(); + latchStart.set(avec3[i]); + dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(latchStartRoom); + convertToVector3f(mc.player.position(), latchStartBody); this.latchStartController = i; this.latchbox[i] = this.box[i]; this.latched[i] = true; @@ -358,10 +370,10 @@ public void doProcess() { } dh.vr.triggerHapticPulse(i, 2000); - ((PlayerExtension) mc.player).vivecraft$stepSound(blockpos, this.latchStart[i].x(), this.latchStart[i].y(), this.latchStart[i].z()); + ((PlayerExtension) mc.player).vivecraft$stepSound(blockpos, latchStart.x(), latchStart.y(), latchStart.z()); if (!flag3) { - dh.vrPlayer.blockDust(this.latchStart[i].x(), this.latchStart[i].y(), this.latchStart[i].z(), 5, blockpos, blockstate, 0.1F, 0.2F); + dh.vrPlayer.blockDust(latchStart.x(), latchStart.y(), latchStart.z(), 5, blockpos, blockstate, 0.1F, 0.2F); } } } @@ -374,19 +386,26 @@ public void doProcess() { for (int k = 0; k < 2; ++k) { if (this.inblock[k] && aboolean[k] && aboolean1[k]) { flag1 = true; - this.latchStart[k] = avec3[k]; - this.latchStart_room[k] = dh.vrPlayer.vrdata_room_pre.getController(k).getPosition(); - this.latchStartBody[k] = mc.player.position(); + final Vector3f latchStart; + if (k == 0) { + latchStart = latchStartc0.set(avec3[k]); + dh.vrPlayer.vrdata_room_pre.getController(k).getPosition(latchStart_roomc0); + convertToVector3f(mc.player.position(), latchStartBodyc0); + } else { + latchStart = latchStartc1.set(avec3[k]); + dh.vrPlayer.vrdata_room_pre.getController(k).getPosition(latchStart_roomc1); + convertToVector3f(mc.player.position(), latchStartBodyc1); + } this.latchStartController = k; this.latched[k] = true; this.latchbox[k] = this.box[k]; this.wantjump = false; dh.vr.triggerHapticPulse(k, 2000); - BlockPos blockpos4 = BlockPos.containing(this.latchStart[k]); + BlockPos blockpos4 = BlockPos.containing(latchStart.x, latchStart.y, latchStart.z); BlockState blockstate4 = mc.level.getBlockState(blockpos4); if (!flag3) { - dh.vrPlayer.blockDust(this.latchStart[k].x, this.latchStart[k].y, this.latchStart[k].z, 5, blockpos4, blockstate4, 0.1F, 0.2F); + dh.vrPlayer.blockDust(latchStart.x, latchStart.y, latchStart.z, 5, blockpos4, blockstate4, 0.1F, 0.2F); } } } @@ -418,27 +437,34 @@ public void doProcess() { this.latchStartController = -1; } else { + final Vector3f latchStart; + final Vector3f latchStartRoom; + final Vector3f latchStartBody; + if (latchStartController == 0) { + latchStart = latchStartc0; + latchStartRoom = latchStart_roomc0; + } else { + latchStart = latchStartc1; + latchStartRoom = latchStart_roomc1; + } if ((this.latched[0] || this.latched[1]) && this.rand.nextInt(20) == 10) { mc.player.causeFoodExhaustion(0.1F); - BlockPos blockpos3 = BlockPos.containing(this.latchStart[this.latchStartController]); + BlockPos blockpos3 = BlockPos.containing(latchStart.x, latchStart.y, latchStart.z); BlockState blockstate3 = mc.level.getBlockState(blockpos3); if (!flag3) { - dh.vrPlayer.blockDust(this.latchStart[this.latchStartController].x, this.latchStart[this.latchStartController].y, this.latchStart[this.latchStartController].z, 1, blockpos3, blockstate3, 0.1F, 0.2F); + dh.vrPlayer.blockDust(latchStart.x, latchStart.y, latchStart.z, 1, blockpos3, blockstate3, 0.1F, 0.2F); } } - Vec3 vec34 = dh.vrPlayer.vrdata_world_pre.getController(this.latchStartController).getPosition(); - Vec3 vec35 = VRPlayer.room_to_world_pos(this.latchStart_room[this.latchStartController], dh.vrPlayer.vrdata_world_pre); - Vec3 vec36 = vec34.subtract(vec35); - this.latchStart_room[this.latchStartController] = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition(); + Vector3f vec36 = dh.vrPlayer.vrdata_world_pre.getController(this.latchStartController).getPosition(new Vector3f()).sub(VRPlayer.room_to_world_pos(latchStartRoom, dh.vrPlayer.vrdata_world_pre, new Vector3f())); + dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition(latchStartRoom); if (this.wantjump) { dh.vr.triggerHapticPulse(this.latchStartController, 200); } if (!flag2) { - Vec3 vec37 = this.latchStart[this.latchStartController]; if (flag1) { mc.player.setDeltaMovement(0.0D, 0.0D, 0.0D); @@ -453,7 +479,7 @@ public void doProcess() { double d10 = d4; double d0 = d8; double d11 = d6 - vec36.y; - BlockPos blockpos2 = BlockPos.containing(vec37); + BlockPos blockpos2 = BlockPos.containing(latchStart.x, latchStart.y, latchStart.z); if (!flag3) { d10 = d4 - vec36.x; @@ -474,18 +500,19 @@ public void doProcess() { } } - double d12 = dh.vrPlayer.vrdata_room_pre.getHeadPivot().y; - double d1 = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition().y; + double d12 = dh.vrPlayer.vrdata_room_pre.getHeadPivot(new Vector3f()).y; + double d1 = dh.vrPlayer.vrdata_room_pre.getController(this.latchStartController).getPosition(new Vector3f()).y; - if (!this.wantjump && this.latchbox[this.latchStartController] != null && d1 <= d12 / 2.0D && this.latchStart[this.latchStartController].y > this.latchbox[this.latchStartController].maxY * 0.8D + (double) blockpos2.getY()) { - Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.hmd.getDirection().scale(0.1F); - Vec3 vec33 = (new Vec3(vec32.x, 0.0D, vec32.z)).normalize().scale(0.1D); - boolean flag5 = mc.level.noCollision(mc.player, mc.player.getBoundingBox().move(vec33.x, this.latchbox[this.latchStartController].maxY + (double) blockpos2.getY() - mc.player.getY(), vec33.z)); + if (!this.wantjump && this.latchbox[this.latchStartController] != null && d1 <= d12 / 2.0D && latchStart.y > this.latchbox[this.latchStartController].maxY * 0.8D + (double) blockpos2.getY()) { + Vector3f vec32 = dh.vrPlayer.vrdata_world_pre.hmd.getDirection(new Vector3f()).mul(0.1F); + vec32.y = 0; + vec32.normalize().mul(0.1F); + boolean flag5 = mc.level.noCollision(mc.player, mc.player.getBoundingBox().move(vec32.x, this.latchbox[this.latchStartController].maxY + (double) blockpos2.getY() - mc.player.getY(), vec32.z)); if (flag5) { - d10 = mc.player.getX() + vec33.x; + d10 = mc.player.getX() + vec32.x; d11 = this.latchbox[this.latchStartController].maxY + (double) blockpos2.getY(); - d0 = mc.player.getZ() + vec33.z; + d0 = mc.player.getZ() + vec32.z; this.latchStartController = -1; this.latched[0] = false; this.latched[1] = false; @@ -569,27 +596,30 @@ public void doProcess() { } } else { this.wantjump = false; - Vec3 vec38 = mc.player.position().subtract(vec36); - Vec3 vec39 = convertToVec3(dh.vr.controllerHistory[this.latchStartController].netMovement(0.3D, new Vector3d())); - double d5 = dh.vr.controllerHistory[this.latchStartController].averageSpeed(0.3D); - vec39 = vec39.scale(0.66D * d5); + Vector3f vec38 = convertToVector3f(mc.player.position(), new Vector3f()).sub(vec36); + Vector3f vec39 = dh.vr.controllerHistory[this.latchStartController].netMovement(0.3F, new Vector3f()); + float d5 = dh.vr.controllerHistory[this.latchStartController].averageSpeed(0.3F); + vec39.mul(0.66F * d5); float f = 0.66F; - if (vec39.length() > (double) f) { - vec39 = vec39.scale((double) f / vec39.length()); + if (vec39.length() > f) { + vec39.mul(f / vec39.length()); } if (mc.player.hasEffect(MobEffects.JUMP)) { - vec39 = vec39.scale((double) mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); + vec39.mul(mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5F); } - vec39 = vec39.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); - mc.player.setDeltaMovement(vec39.multiply(-1.0D, -1.0D, -1.0D)); + vec39.rotateY(dh.vrPlayer.vrdata_world_pre.rotation_radians); + mc.player.setDeltaMovement(-vec39.x, -vec39.y, -vec39.z); mc.player.xOld = vec38.x; mc.player.yOld = vec38.y; mc.player.zOld = vec38.z; - vec38 = vec38.add(mc.player.getDeltaMovement().x, mc.player.getDeltaMovement().y, mc.player.getDeltaMovement().z); - mc.player.setPos(vec38.x, vec38.y, vec38.z); + mc.player.setPos( + vec38.x + mc.player.getDeltaMovement().x, + vec38.y + mc.player.getDeltaMovement().y, + vec38.z + mc.player.getDeltaMovement().z + ); dh.vrPlayer.snapRoomOriginToPlayerEntity(false, false); mc.player.causeFoodExhaustion(0.3F); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java index b3051a4d6..7ac374db0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/EatingTracker.java @@ -4,14 +4,14 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.UseAnim; -import net.minecraft.world.phys.Vec3; -import org.joml.Vector3d; +import org.joml.Vector3f; import java.util.Random; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class EatingTracker extends Tracker { float mouthtoEyeDistance = 0.0F; @@ -64,15 +64,16 @@ public void reset() { @Override public void doProcess() { - Vec3 hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(); - Vec3 mouthPos = dh.vrPlayer.vrdata_room_pre.getController(0).getCustomVector(new Vec3(0.0D, -this.mouthtoEyeDistance, 0.0D)).add(hmdPos); + Vector3f hmdPos = dh.vrPlayer.vrdata_room_pre.hmd.getPosition(new Vector3f()); + Vector3f mouthPos = dh.vrPlayer.vrdata_room_pre.getController(0).getCustomVector(new Vector3f(0.0F, -this.mouthtoEyeDistance, 0.0F)).add(hmdPos); for (int c = 0; c < 2; ++c) { - Vec3 controllerPos = convertToVec3(dh.vr.controllerHistory[c].averagePosition(0.333D, new Vector3d())).add(dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0.0D, 0.0D, -0.1D))); - controllerPos = controllerPos.add(dh.vrPlayer.vrdata_room_pre.getController(c).getDirection().scale(0.1D)); + Vector3f controllerPos = dh.vr.controllerHistory[c].averagePosition(0.333F, new Vector3f()) + .add(dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vector3f(0.0F, 0.0F, -0.1F))) + .add(dh.vrPlayer.vrdata_room_pre.getController(c).getDirection(new Vector3f()).mul(0.1F)); - if (mouthPos.distanceTo(controllerPos) < (double) this.threshold) { + if (mouthPos.distance(controllerPos) < (double) this.threshold) { ItemStack itemstack = c == 0 ? mc.player.getMainHandItem() : mc.player.getOffhandItem(); if (itemstack == ItemStack.EMPTY) { continue; @@ -81,7 +82,7 @@ public void doProcess() { int crunchiness = 0; if (itemstack.getUseAnimation() == UseAnim.DRINK) {//thats how liquid works. - if (dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vec3(0, 1, 0)).y > 0) { + if (dh.vrPlayer.vrdata_room_pre.getController(c).getCustomVector(new Vector3f(0, 1, 0)).y > 0) { continue; } } else if (itemstack.getUseAnimation() == UseAnim.EAT) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java index 017fd8b44..c9cd317de 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/HorseTracker.java @@ -48,16 +48,16 @@ public void doProcess() { Quaternionf quaternion = new Quaternionf().setAngleAxis(-this.horse.yBodyRot, 0.0F, 1.0F, 0.0F) .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F), new Quaternionf()) .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F), new Quaternionf()); - Vec3 vec32 = convertToVec3(quaternion.transformUnit(forward, new Vector3f())); - Vec3 vec33 = convertToVec3(quaternion.transformUnit(right, new Vector3f())); - Vec3 vec34 = convertToVec3(quaternion.transformUnit(left, new Vector3f())); + Vector3f vec32 = quaternion.transformUnit(forward, new Vector3f()); + Vector3f vec33 = quaternion.transformUnit(right, new Vector3f()); + Vector3f vec34 = quaternion.transformUnit(left, new Vector3f()); Quaternionf quaternion1 = new Quaternionf().setAngleAxis(toRadians(dh.vrSettings.worldRotation), 0.0F, 1.0F, 0.0F) .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F), new Quaternionf()) .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F), new Quaternionf()); - Vec3 vec35 = dh.vrPlayer.roomOrigin.add(convertToVec3(quaternion1.transformUnit(dh.vr.controllerHistory[1].latest(new Vector3f()), new Vector3f()))); - Vec3 vec36 = dh.vrPlayer.roomOrigin.add(convertToVec3(quaternion1.transformUnit(dh.vr.controllerHistory[0].latest(new Vector3f()), new Vector3f()))); - double d1 = vec35.subtract(this.info.leftReinPos).dot(vec32) + vec35.subtract(this.info.leftReinPos).dot(vec33); - double d2 = vec36.subtract(this.info.rightReinPos).dot(vec32) + vec36.subtract(this.info.rightReinPos).dot(vec34); + Vector3f vec35 = dh.vrPlayer.roomOrigin.add(quaternion1.transformUnit(dh.vr.controllerHistory[1].latest(new Vector3f()))).sub(this.info.leftReinPos); + Vector3f vec36 = dh.vrPlayer.roomOrigin.add(quaternion1.transformUnit(dh.vr.controllerHistory[0].latest(new Vector3f()))).sub(this.info.rightReinPos); + double d1 = vec35.dot(vec32) + vec35.dot(vec33); + double d2 = vec36.dot(vec32) + vec36.dot(vec34); if (this.speedLevel < 0) { this.speedLevel = 0; @@ -123,7 +123,7 @@ public ModelInfo getModelInfo() { } public static class ModelInfo { - public Vec3 leftReinPos = Vec3.ZERO; - public Vec3 rightReinPos = Vec3.ZERO; + public Vector3f leftReinPos = new Vector3f(); + public Vector3f rightReinPos = new Vector3f(); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java index 8af66220c..44744ba5e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/InteractTracker.java @@ -19,6 +19,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.VRData.VRDevicePose; @@ -36,6 +38,8 @@ import static org.joml.RoundingMode.FLOOR; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class InteractTracker extends Tracker { public boolean[] bukkit = new boolean[2]; @@ -150,19 +154,19 @@ public void doProcess() { this.active[j] = true; } - Vec3 vec35 = dh.vrPlayer.vrdata_world_pre.getHeadPivot(); - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(j).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getHand(j).getCustomVector(vec34); + Vector3f vec35 = dh.vrPlayer.vrdata_world_pre.getHeadPivot(new Vector3f()); + Vector3f vec3 = dh.vrPlayer.vrdata_world_pre.getController(j).getPosition(new Vector3f()); + Vector3fc vec31 = dh.vrPlayer.vrdata_world_pre.getHand(j).getCustomVector(convertToVector3f(vec34, new Vector3f())); ItemStack itemstack = mc.player.getItemInHand(j == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); Item item = null; if (!this.active[j] && (dh.vrSettings.displayMirrorMode == MirrorMode.MIXED_REALITY || dh.vrSettings.displayMirrorMode == MirrorMode.THIRD_PERSON) && dh.vrSettings.mixedRealityRenderCameraModel) { VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.THIRD); - Vec3 vec32 = vrdata$vrdevicepose.getPosition(); - vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double) 0.15F * dh.vrPlayer.vrdata_world_pre.worldScale)); - vec32 = vec32.subtract(vrdata$vrdevicepose.getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)).scale((double) 0.05F * dh.vrPlayer.vrdata_world_pre.worldScale)); + Vector3f vec32 = vrdata$vrdevicepose.getPosition(new Vector3f()) + .sub(vrdata$vrdevicepose.getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F)).mul(0.15F * dh.vrPlayer.vrdata_world_pre.worldScale)) + .sub(vrdata$vrdevicepose.getCustomVector(new Vector3f(0.0F, -1.0F, 0.0F)).mul(0.05F * dh.vrPlayer.vrdata_world_pre.worldScale)); - if (vec3.distanceTo(vec32) < (double) 0.15F * dh.vrPlayer.vrdata_world_pre.worldScale) { + if (vec3.distance(vec32) < (double) 0.15F * dh.vrPlayer.vrdata_world_pre.worldScale) { this.inCamera[j] = true; this.active[j] = true; } @@ -170,10 +174,9 @@ public void doProcess() { if (!this.active[j] && dh.cameraTracker.isVisible() && !dh.cameraTracker.isQuickMode()) { VRDevicePose vrdata$vrdevicepose1 = dh.vrPlayer.vrdata_world_pre.getEye(RenderPass.CAMERA); - Vec3 vec36 = vrdata$vrdevicepose1.getPosition(); - vec36 = vec36.subtract(vrdata$vrdevicepose1.getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).scale((double) 0.08F * dh.vrPlayer.vrdata_world_pre.worldScale)); + Vector3f vec36 = vrdata$vrdevicepose1.getPosition(new Vector3f()).sub(vrdata$vrdevicepose1.getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F)).mul(0.08F * dh.vrPlayer.vrdata_world_pre.worldScale)); - if (vec3.distanceTo(vec36) < (double) 0.11F * dh.vrPlayer.vrdata_world_pre.worldScale) { + if (vec3.distance(vec36) < (double) 0.11F * dh.vrPlayer.vrdata_world_pre.worldScale) { this.inHandheldCamera[j] = true; this.active[j] = true; } @@ -183,9 +186,9 @@ public void doProcess() { int k = roundUsing(vec3.x, FLOOR); int l = roundUsing(vec3.y, FLOOR); int i = roundUsing(vec3.z, FLOOR); - Vec3 vec33 = new Vec3(vec3.x + vec31.x * -0.1D, vec3.y + vec31.y * -0.1D, vec3.z + vec31.z * -0.1D); - AABB aabb = new AABB(vec3, vec33); - this.inEntityHit[j] = ProjectileUtil.getEntityHitResult(mc.getCameraEntity(), vec35, vec3, aabb, (e) -> + Vec3 vec33 = new Vec3(vec3.x + vec31.x() * -0.1D, vec3.y + vec31.y() * -0.1D, vec3.z + vec31.z() * -0.1D); + AABB aabb = new AABB(vec3.x, vec3.y, vec3.z, vec33.x, vec33.y, vec33.z); + this.inEntityHit[j] = ProjectileUtil.getEntityHitResult(mc.getCameraEntity(), convertToVec3(vec35), convertToVec3(vec3), aabb, (e) -> !e.isSpectator() && e.isPickable() && e != mc.getCameraEntity().getVehicle(), 0.0D); if (this.inEntityHit[j] != null) { @@ -196,9 +199,9 @@ public void doProcess() { } if (!this.active[j]) { - BlockPos blockpos = BlockPos.containing(vec3); + BlockPos blockpos = BlockPos.containing(vec3.x, vec3.y, vec3.z); BlockState blockstate = mc.level.getBlockState(blockpos); - BlockHitResult blockhitresult = blockstate.getShape(mc.level, blockpos).clip(vec35, vec3, blockpos); + BlockHitResult blockhitresult = blockstate.getShape(mc.level, blockpos).clip(convertToVec3(vec35), convertToVec3(vec3), blockpos); this.inBlockPos[j] = blockpos; this.inBlockHit[j] = blockhitresult; this.active[j] = blockhitresult != null && (this.rightClickable.contains(blockstate.getBlock().getClass()) || this.rightClickable.contains(blockstate.getBlock().getClass().getSuperclass())); diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java index a66458959..c62ba0afd 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/JumpTracker.java @@ -4,8 +4,9 @@ import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.phys.Vec3; import org.joml.Vector3d; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.extensions.PlayerExtension; @@ -14,11 +15,15 @@ import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class JumpTracker extends Tracker { - public Vec3[] latchStart = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; - public Vec3[] latchStartOrigin = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; - public Vec3[] latchStartPlayer = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; + public final Vector3f latchStartc0 = new Vector3f(); + public final Vector3f latchStartc1 = new Vector3f(); + public final Vector3f latchStartOriginc0 = new Vector3f(); + public final Vector3f latchStartOriginc1 = new Vector3f(); + public final Vector3f latchStartPlayerc0 = new Vector3f(); + public final Vector3f latchStartPlayerc1 = new Vector3f(); private boolean c0Latched = false; private boolean c1Latched = false; @@ -69,6 +74,7 @@ public void reset() { @Override public void doProcess() { if (this.isClimbeyJumpEquipped()) { + Vector3fc playerPos = convertToVector3f(mc.player.position(), new Vector3f()); boolean[] aboolean = new boolean[2]; for (int i = 0; i < 2; ++i) { @@ -82,14 +88,14 @@ public void doProcess() { flag = true; } - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getController(0).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_room_pre.getController(1).getPosition(); - Vec3 vec32 = vec3.add(vec31).scale(0.5D); + Vector3f vec32 = dh.vrPlayer.vrdata_room_pre.getController(0).getPosition(new Vector3f()) + .add(dh.vrPlayer.vrdata_room_pre.getController(1).getPosition(new Vector3f())) + .mul(0.5F); if (aboolean[0] && !this.c0Latched) { - this.latchStart[0] = vec32; - this.latchStartOrigin[0] = dh.vrPlayer.vrdata_world_pre.origin; - this.latchStartPlayer[0] = mc.player.position(); + this.latchStartc0.set(vec32); + this.latchStartOriginc0.set(dh.vrPlayer.vrdata_world_pre.origin); + this.latchStartPlayerc0.set(playerPos); dh.vr.triggerHapticPulse(0, 1000); } @@ -99,17 +105,15 @@ public void doProcess() { } if (aboolean[1] && !this.c1Latched) { - this.latchStart[1] = vec32; - this.latchStartOrigin[1] = dh.vrPlayer.vrdata_world_pre.origin; - this.latchStartPlayer[1] = mc.player.position(); + this.latchStartc1.set(vec32); + this.latchStartOriginc1.set(dh.vrPlayer.vrdata_world_pre.origin); + this.latchStartPlayerc1.set(playerPos); dh.vr.triggerHapticPulse(1, 1000); } this.c0Latched = aboolean[0]; this.c1Latched = aboolean[1]; - int j = 0; - Vec3 vec33 = vec32.subtract(this.latchStart[j]); - vec33 = vec33.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); + vec32.sub(this.latchStartc0).rotateY(dh.vrPlayer.vrdata_world_pre.rotation_radians); if (!flag && this.isjumping()) { dh.vr.triggerHapticPulse(0, 200); @@ -118,33 +122,33 @@ public void doProcess() { if (flag) { dh.climbTracker.forceActivate = true; - Vec3 vec34 = convertToVec3(dh.vr.controllerHistory[0].netMovement(0.3D, new Vector3d()).add(dh.vr.controllerHistory[1].netMovement(0.3D, new Vector3d()))); - double d0 = (dh.vr.controllerHistory[0].averageSpeed(0.3D) + dh.vr.controllerHistory[1].averageSpeed(0.3D)) / 2.0D; - vec34 = vec34.scale((double) 0.33F * d0); + Vector3f vec34 = dh.vr.controllerHistory[0].netMovement(0.3F, new Vector3f()).add(dh.vr.controllerHistory[1].netMovement(0.3F, new Vector3f())); + float d0 = (dh.vr.controllerHistory[0].averageSpeed(0.3F) + dh.vr.controllerHistory[1].averageSpeed(0.3F)) / 2.0F; + vec34.mul(0.33F * d0); float f = 0.66F; - if (vec34.length() > (double) f) { - vec34 = vec34.scale((double) f / vec34.length()); + if (vec34.length() > f) { + vec34.mul(f / vec34.length()); } if (mc.player.hasEffect(MobEffects.JUMP)) { - vec34 = vec34.scale((double) mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5D); + vec34.mul(mc.player.getEffect(MobEffects.JUMP).getAmplifier() + 1.5F); } - vec34 = vec34.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); - Vec3 vec35 = mc.player.position().subtract(vec33); - - if (vec33.y < 0.0D && vec34.y < 0.0D) { - double d2 = -vec34.x; - double d1 = mc.player.getDeltaMovement().x + d2 * 1.25D; - d2 = -vec34.y; - double d3 = -vec34.z; - mc.player.setDeltaMovement(d1, d2, mc.player.getDeltaMovement().z + d3 * 1.25D); - mc.player.xOld = vec35.x; - mc.player.yOld = vec35.y; - mc.player.zOld = vec35.z; - vec35 = vec35.add(mc.player.getDeltaMovement()); - mc.player.setPos(vec35.x, vec35.y, vec35.z); + vec34.rotateY(dh.vrPlayer.vrdata_world_pre.rotation_radians); + + if (vec32.y < 0.0F && vec34.y < 0.0F) { + playerPos.sub(vec32, vec32); + mc.player.setDeltaMovement( + mc.player.getDeltaMovement().x - vec34.x * 1.25F, + -vec34.y, + mc.player.getDeltaMovement().z - vec34.z * 1.25F + ); + mc.player.xOld = vec32.x; + mc.player.yOld = vec32.y; + mc.player.zOld = vec32.z; + vec32.add(convertToVector3f(mc.player.getDeltaMovement(), new Vector3f())); + mc.player.setPos(vec32.x, vec32.y, vec32.z); dh.vrPlayer.snapRoomOriginToPlayerEntity(false, true); mc.player.causeFoodExhaustion(0.3F); mc.player.setOnGround(false); @@ -152,7 +156,7 @@ public void doProcess() { dh.vrPlayer.snapRoomOriginToPlayerEntity(false, true); } } else if (this.isjumping()) { - Vec3 vec36 = this.latchStartOrigin[0].subtract(this.latchStartPlayer[0]).add(mc.player.position()).subtract(vec33); + Vector3f vec36 = this.latchStartOriginc0.sub(this.latchStartPlayerc0, new Vector3f()).add(playerPos).sub(vec32); dh.vrPlayer.setRoomOrigin(vec36.x, vec36.y, vec36.z, false); } } else if (dh.vr.hmdPivotHistory.netMovement(0.25D, new Vector3d()).y > 0.1D && dh.vr.hmdPivotHistory.latest(new Vector3d()).y - (double) AutoCalibration.getPlayerHeight() > (double) dh.vrSettings.jumpThreshold) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java index 8c92d6332..15461e378 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java @@ -9,8 +9,7 @@ import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.backward; -import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.*; public class RowTracker extends Tracker { Vec3[] lastUWPs = new Vec3[2]; @@ -91,12 +90,12 @@ public void doProcessFinaltransmithastofixthis() { this.forces[i] = 0.0D; this.lastUWPs[i] = null; } else { - Vec3 vec3 = this.getArmToPaddleVector(i, boat); - Vec3 vec31 = this.getAttachmentPoint(i, boat); - Vec3 vec32 = vec31.add(vec3.normalize()).subtract(boat.position()); + Vector3f vec32 = this.getAttachmentPoint(i, boat, new Vector3f()) + .add(this.getArmToPaddleVector(i, boat, new Vector3f()).normalize()) + .sub(convertToVector3f(boat.position(), new Vector3f())); if (this.lastUWPs[i] != null) { - Vec3 vec33 = this.lastUWPs[i].subtract(vec32); + Vec3 vec33 = this.lastUWPs[i].subtract(vec32.x, vec32.y, vec32.z); vec33 = vec33.subtract(boat.getDeltaMovement()); Vec3 vec34 = convertToVec3(quaternion.transformUnit(new Vector3f(backward))); double d0 = vec33.dot(vec34) * this.transmissionEfficiency / 5.0D; @@ -108,18 +107,16 @@ public void doProcessFinaltransmithastofixthis() { } } - this.lastUWPs[i] = vec32; + this.lastUWPs[i] = convertToVec3(vec32); } } } - Vec3 getArmToPaddleVector(int paddle, Boat boat) { - Vec3 vec3 = this.getAttachmentPoint(paddle, boat); - Vec3 vec31 = this.getAbsArmPos(paddle == 0 ? 1 : 0); - return vec3.subtract(vec31); + Vector3f getArmToPaddleVector(int paddle, Boat boat, Vector3f dest) { + return this.getAttachmentPoint(paddle, boat, dest).sub(this.getAbsArmPos(paddle == 0 ? 1 : 0, new Vector3f())); } - Vec3 getAttachmentPoint(int paddle, Boat boat) { + Vector3f getAttachmentPoint(int paddle, Boat boat, Vector3f dest) { Quaternionf quaternion = new Quaternionf().setAngleAxis(-(boat.getYRot() % 360.0F), 0.0F, 1.0F, 0.0F) .mul(new Quaternionf().setAngleAxis(boat.getXRot(), 1.0F, 0.0F, 0.0F)) .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F)); @@ -128,24 +125,25 @@ Vec3 getAttachmentPoint(int paddle, Boat boat) { } else { quaternion.identity(); } - return boat.position().add(convertToVec3(quaternion.transformUnit(new Vector3f( + return convertToVector3f(boat.position(), dest).add(quaternion.transformUnit(new Vector3f( (paddle == 0 ? 9.0F : -9.0F) / 16.0F, 0.625F, 0.1875F) - ))); + )); } - Vec3 getAbsArmPos(int side) { - return dh.vrPlayer.roomOrigin.add(convertToVec3( + Vector3f getAbsArmPos(int side, Vector3f dest) { + return dh.vrPlayer.roomOrigin.add( new Quaternionf().setAngleAxis(toRadians(dh.vrSettings.worldRotation), 0.0F, 1.0F, 0.0F) .mul(new Quaternionf().setAngleAxis(0.0F, 1.0F, 0.0F, 0.0F)) .mul(new Quaternionf().setAngleAxis(0.0F, 0.0F, 0.0F, 1.0F)) - .transformUnit(dh.vr.controllerHistory[side].averagePosition(0.1D, new Vector3f())) - )); + .transformUnit(dh.vr.controllerHistory[side].averagePosition(0.1D, dest)) + ); } boolean isPaddleUnderWater(int paddle, Boat boat) { - Vec3 vec3 = this.getAttachmentPoint(paddle, boat); - Vec3 vec31 = this.getArmToPaddleVector(paddle, boat).normalize(); - BlockPos blockpos = BlockPos.containing(vec3.add(vec31)); + Vector3f vec3 = this.getAttachmentPoint(paddle, boat, new Vector3f()); + Vector3f vec31 = this.getArmToPaddleVector(paddle, boat, new Vector3f()).normalize(); + vec3.add(vec31); + BlockPos blockpos = BlockPos.containing(vec3.x, vec3.y, vec3.z); // TODO: liquid is deprecated return boat.level().getBlockState(blockpos).liquid(); } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java index eeaac805e..627799e26 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RunTracker.java @@ -1,6 +1,6 @@ package org.vivecraft.client_vr.gameplay.trackers; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.vivecraft.client_vr.settings.VRSettings.FreeMove; import static org.joml.Math.abs; @@ -11,7 +11,6 @@ public class RunTracker extends Tracker { private double direction = 0.0D; private double speed = 0.0D; - private Vec3 movedir; @Override public boolean isActive() { @@ -53,8 +52,6 @@ public void reset() { @Override public void doProcess() { - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); double d0 = dh.vr.controllerHistory[0].averageSpeed(0.33D); double d1 = dh.vr.controllerHistory[1].averageSpeed(0.33D); @@ -71,7 +68,7 @@ public void doProcess() { if (abs(d0 - d1) > 0.5D) { this.speed = 0.0D; } else { - Vec3 vec32 = dh.vrPlayer.vrdata_world_pre.getController(0).getDirection().add(dh.vrPlayer.vrdata_world_pre.getController(1).getDirection()).scale(0.5D); + Vector3f vec32 = dh.vrPlayer.vrdata_world_pre.getController(0).getDirection(new Vector3f()).add(dh.vrPlayer.vrdata_world_pre.getController(1).getDirection(new Vector3f())).mul(0.5F); this.direction = atan2(-vec32.x, vec32.z); double d2 = (d0 + d1) / 2.0D; this.speed = d2 * 1.0D * 1.3D; diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java index 740e77b24..9d08826da 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwimTracker.java @@ -1,16 +1,16 @@ package org.vivecraft.client_vr.gameplay.trackers; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; public class SwimTracker extends Tracker { - Vec3 motion = Vec3.ZERO; - double friction = 0.9F; - double lastDist; - final double riseSpeed = 0.005F; - double swimspeed = 1.3F; + final Vector3f motion = new Vector3f(); + final float friction = 0.9F; + float lastDist; + final float riseSpeed = 0.005F; + final float swimspeed = 1.3F; @Override public boolean isActive() { @@ -37,25 +37,23 @@ public boolean isActive() { @Override public void doProcess() { - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); - Vec3 vec32 = vec31.subtract(vec3).scale(0.5D).add(vec3); - Vec3 vec33 = dh.vrPlayer.vrdata_world_pre.getHeadPivot().subtract(0.0D, 0.3D, 0.0D); - Vec3 vec34 = vec32.subtract(vec33).normalize().add(dh.vrPlayer.vrdata_world_pre.hmd.getDirection()).scale(0.5D); - Vec3 vec35 = dh.vrPlayer.vrdata_world_pre.getController(0).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)).add(dh.vrPlayer.vrdata_world_pre.getController(1).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D))).scale(0.5D); - double d0 = vec35.add(vec34).length() / 2.0D; - double d1 = vec33.distanceTo(vec32); - double d2 = this.lastDist - d1; + Vector3f vec3 = dh.vrPlayer.vrdata_world_pre.getController(0).getPosition(new Vector3f()); + Vector3f vec32 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(new Vector3f()).sub(vec3).mul(0.5F).add(vec3); + Vector3f vec33 = dh.vrPlayer.vrdata_world_pre.getHeadPivot(new Vector3f()).sub(0.0F, 0.3F, 0.0F); + Vector3f vec34 = vec32.sub(vec33, new Vector3f()).normalize().add(dh.vrPlayer.vrdata_world_pre.hmd.getDirection(new Vector3f())).mul(0.5F); + Vector3f vec35 = dh.vrPlayer.vrdata_world_pre.getController(0).getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F)).add(dh.vrPlayer.vrdata_world_pre.getController(1).getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F))).mul(0.5F); + float d0 = vec34.add(vec35.x, vec35.y, vec35.z).length() / 2.0F; + float d1 = vec33.distance(vec32); + float d2 = this.lastDist - d1; - if (d2 > 0.0D) { - Vec3 vec36 = vec34.scale(d2 * this.swimspeed * d0); - this.motion = this.motion.add(vec36.scale(0.15D)); + if (d2 > 0.0F) { + this.motion.add(vec34.mul(d2 * this.swimspeed * d0).mul(0.15F)); } this.lastDist = d1; - mc.player.setSwimming(this.motion.length() > (double) 0.3F); - mc.player.setSprinting(this.motion.length() > 1.0D); + mc.player.setSwimming(this.motion.length() > 0.3F); + mc.player.setSprinting(this.motion.length() > 1.0F); mc.player.push(this.motion.x, this.motion.y, this.motion.z); - this.motion = this.motion.scale(this.friction); + this.motion.mul(this.friction); } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java index 06456b53e..da2002a32 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/SwingTracker.java @@ -17,6 +17,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult.Type; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client_vr.BlockTags; import org.vivecraft.client_vr.ItemTags; @@ -30,16 +32,21 @@ import static org.joml.Math.min; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.*; public class SwingTracker extends Tracker { - private Vec3[] lastWeaponEndAir = new Vec3[]{new Vec3(0.0D, 0.0D, 0.0D), new Vec3(0.0D, 0.0D, 0.0D)}; - private boolean[] lastWeaponSolid = new boolean[2]; - public Vec3[] miningPoint = new Vec3[2]; - public Vec3[] attackingPoint = new Vec3[2]; - public Vec3History[] tipHistory = new Vec3History[]{new Vec3History(), new Vec3History()}; - public boolean[] canact = new boolean[2]; + private final Vector3f lastWeaponEndAirc0 = new Vector3f(); + private final Vector3f lastWeaponEndAirc1 = new Vector3f(); + private final boolean[] lastWeaponSolid = new boolean[2]; + public final Vector3f miningPointc0 = new Vector3f(); + public final Vector3f miningPointc1 = new Vector3f(); + public final Vector3f attackingPointc0 = new Vector3f(); + public final Vector3f attackingPointc1 = new Vector3f(); + + public final Vec3History tipHistoryc0 = new Vec3History(); + public final Vec3History tipHistoryc1 = new Vec3History(); + public final boolean[] canact = new boolean[2]; public int disableSwing = 3; - Vec3 forward = new Vec3(0.0D, 0.0D, -1.0D); double speedthresh = 3.0D; @Override @@ -91,9 +98,24 @@ public void doProcess() { mc.getProfiler().push("updateSwingAttack"); for (int i = 0; i < 2; ++i) { + final Vector3f miningPoint; + final Vector3f lastWeaponEndAir; + final Vector3f attackingPoint; + final Vec3History tipHistory; + if (i == 0){ + miningPoint = miningPointc0; + lastWeaponEndAir = lastWeaponEndAirc0; + attackingPoint = attackingPointc0; + tipHistory = tipHistoryc0; + } else { + miningPoint = miningPointc1; + lastWeaponEndAir = lastWeaponEndAirc1; + attackingPoint = attackingPointc1; + tipHistory = tipHistoryc1; + } if (!dh.climbTracker.isGrabbingLadder(i)) { - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_world_pre.getHand(i).getCustomVector(this.forward); + Vector3fc vec3 = dh.vrPlayer.vrdata_world_pre.getController(i).getPosition(new Vector3f()); + Vector3fc vec31 = dh.vrPlayer.vrdata_world_pre.getHand(i).getCustomVector(new Vector3f(forward)); ItemStack itemstack = mc.player.getItemInHand(i == 0 ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); Item item = itemstack.getItem(); boolean flag = false; @@ -128,30 +150,30 @@ public void doProcess() { } f *= dh.vrPlayer.vrdata_world_pre.worldScale; - this.miningPoint[i] = vec3.add(vec31.scale(f)); - this.tipHistory[i].add( - dh.vrPlayer.vrdata_room_pre.getController(i).getPosition().add( - dh.vrPlayer.vrdata_room_pre.getHand(i).getCustomVector(this.forward).scale(0.3D) + vec3.add(vec31.mul(f, new Vector3f()), miningPoint); + tipHistory.add( + dh.vrPlayer.vrdata_room_pre.getController(i).getPosition(new Vector3f()).add( + dh.vrPlayer.vrdata_room_pre.getHand(i).getCustomVector(new Vector3f(forward)).mul(0.3F) ) ); - float f2 = (float) this.tipHistory[i].averageSpeed(0.33D); + float f2 = tipHistory.averageSpeed(0.33F); boolean flag2 = false; this.canact[i] = (double) f2 > this.speedthresh && !this.lastWeaponSolid[i]; boolean flag3 = this.canact[i]; if (flag3) { - BlockHitResult blockhitresult = mc.level.clip(new ClipContext(dh.vrPlayer.vrdata_world_pre.hmd.getPosition(), vec3, Block.OUTLINE, Fluid.NONE, mc.player)); + BlockHitResult blockhitresult = mc.level.clip(new ClipContext(convertToVec3(dh.vrPlayer.vrdata_world_pre.hmd.getPosition(new Vector3f())), convertToVec3(vec3), Block.OUTLINE, Fluid.NONE, mc.player)); if (blockhitresult.getType() != Type.MISS) { flag3 = false; } } - this.attackingPoint[i] = this.constrain(vec3, this.miningPoint[i]); - Vec3 vec33 = vec3.add(vec31.scale(f + f1)); - vec33 = this.constrain(vec3, vec33); - AABB aabb = new AABB(vec3, this.attackingPoint[i]); - AABB aabb1 = new AABB(vec3, vec33); + this.constrain(vec3, miningPoint, attackingPoint); + Vector3f vec33 = vec31.mul(f + f1, new Vector3f()).add(vec3); + this.constrain(vec3, vec33, vec33); + AABB aabb = new AABB(convertToVec3(vec3), convertToVec3(attackingPoint)); + AABB aabb1 = new AABB(convertToVec3(vec3), convertToVec3(vec33)); List list = mc.level.getEntities(mc.player, aabb1); list.removeIf((e) -> e instanceof Player); List list1 = mc.level.getEntities(mc.player, aabb); @@ -174,11 +196,11 @@ public void doProcess() { this.canact[i] = this.canact[i] && !flag1 && !flag2; if (!dh.climbTracker.isClimbeyClimb() || (i != 0 || !VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT)) && flag && (i != 1 || !VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT)) && flag) { - BlockPos blockpos = BlockPos.containing(this.miningPoint[i]); + BlockPos blockpos = BlockPos.containing(miningPoint.x, miningPoint.y, miningPoint.z); BlockState blockstate = mc.level.getBlockState(blockpos); - BlockHitResult blockhitresult1 = mc.level.clip(new ClipContext(this.lastWeaponEndAir[i], this.miningPoint[i], Block.OUTLINE, Fluid.NONE, mc.player)); + BlockHitResult blockhitresult1 = mc.level.clip(new ClipContext(convertToVec3(lastWeaponEndAir), convertToVec3(miningPoint), Block.OUTLINE, Fluid.NONE, mc.player)); - if (!blockstate.isAir() && blockhitresult1.getType() == Type.BLOCK && this.lastWeaponEndAir[i].length() != 0.0D) { + if (!blockstate.isAir() && blockhitresult1.getType() == Type.BLOCK && lastWeaponEndAir.length() != 0.0F) { this.lastWeaponSolid[i] = true; boolean flag4 = blockhitresult1.getBlockPos().equals(blockpos); boolean flag5 = dh.vrSettings.realisticClimbEnabled && (blockstate.getBlock() instanceof LadderBlock || blockstate.getBlock() instanceof VineBlock || blockstate.is(BlockTags.VIVECRAFT_CLIMBABLE)); @@ -233,7 +255,7 @@ public void doProcess() { dh.vr.triggerHapticPulse(i, 250 * j); } } else { - this.lastWeaponEndAir[i] = this.miningPoint[i]; + lastWeaponEndAir.set(miningPoint); this.lastWeaponSolid[i] = false; } } @@ -252,9 +274,9 @@ private void clearBlockHitDelay() { // Minecraft.getInstance().gameMode.blockBreakingCooldown = 1; } - public Vec3 constrain(Vec3 start, Vec3 end) { - BlockHitResult blockhitresult = mc.level.clip(new ClipContext(start, end, Block.OUTLINE, Fluid.NONE, mc.player)); - return blockhitresult.getType() == Type.BLOCK ? blockhitresult.getLocation() : end; + public Vector3f constrain(Vector3fc start, Vector3fc end, Vector3f dest) { + BlockHitResult blockhitresult = mc.level.clip(new ClipContext(convertToVec3(start), convertToVec3(end), Block.OUTLINE, Fluid.NONE, mc.player)); + return blockhitresult.getType() == Type.BLOCK ? convertToVector3f(blockhitresult.getLocation(), dest) : dest.set(end); } public static float getItemFade(ItemStack is) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java index e2053b902..282d0cdb0 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TeleportTracker.java @@ -19,6 +19,7 @@ import org.joml.Matrix4f; import org.joml.Quaternionf; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.BlockTags; @@ -31,17 +32,17 @@ import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.up; +import static org.vivecraft.common.utils.Utils.*; public class TeleportTracker extends Tracker { private float teleportEnergy; - private Vec3 movementTeleportDestination = new Vec3(0.0D, 0.0D, 0.0D); + private final Vector3f movementTeleportDestination = new Vector3f(); private Direction movementTeleportDestinationSideHit; public double movementTeleportProgress; public double movementTeleportDistance; private Vec3[] movementTeleportArc = new Vec3[50]; public int movementTeleportArcSteps = 0; - public double lastTeleportArcDisplayOffset = 0.0D; + public float lastTeleportArcDisplayOffset = 0.0F; public final VRMovementStyle vrMovementStyle = new VRMovementStyle(); public float getTeleportEnergy() { @@ -52,7 +53,7 @@ public boolean isAiming() { return this.movementTeleportProgress > 0.0D; } - public Vec3 getDestination() { + public Vector3fc getDestination() { return this.movementTeleportDestination; } @@ -71,7 +72,7 @@ public boolean isActive() { @Override public void reset() { - this.movementTeleportDestination = new Vec3(0.0D, 0.0D, 0.0D); + this.movementTeleportDestination.zero(); this.movementTeleportArcSteps = 0; this.movementTeleportProgress = 0.0D; } @@ -85,7 +86,7 @@ public void doProcess() { } boolean flag = false; - Vec3 vec3 = null; + Vector3f vec3 = null; boolean flag1 = VivecraftVRMod.keyTeleport.isDown() && dh.vrPlayer.isTeleportEnabled(); boolean flag2 = dh.vrSettings.seated && !dh.vrPlayer.getFreeMove() && (mc.player.input.forwardImpulse != 0.0F || mc.player.input.leftImpulse != 0.0F); @@ -106,9 +107,9 @@ public void doProcess() { this.movementTeleportProgress = 1.0D; } - if (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D) { - Vec3 vec38 = dh.vrPlayer.vrdata_world_pre.hmd.getPosition(); - Vec3 vec31 = vec3.add(-vec38.x, -vec38.y, -vec38.z).normalize(); + if (vec3.x != 0.0F || vec3.y != 0.0F || vec3.z != 0.0F) { + Vector3f vec38 = dh.vrPlayer.vrdata_world_pre.hmd.getPosition(new Vector3f()); + Vector3f vec31 = vec3.add(-vec38.x, -vec38.y, -vec38.z, new Vector3f()).normalize(); Vec3 vec32 = mc.player.getLookAngle(); Vec3 vec33 = vec32.cross(new Vec3(0.0D, 1.0D, 0.0D)); Vec3 vec34 = vec33.cross(vec32); @@ -126,13 +127,13 @@ public void doProcess() { } } } - } else if (((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() >= 0 && (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D)) { + } else if (((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() >= 0 && (vec3.x != 0.0F || vec3.y != 0.0F || vec3.z != 0.0F)) { if (((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() == 0) { } ((PlayerExtension) mc.player).vivecraft$setMovementTeleportTimer(((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() + 1); Vec3 vec39 = mc.player.position(); - double d6 = vec3.distanceTo(vec39); + float d6 = vec3.distance((float) vec39.x, (float) vec39.y, (float) vec39.z); double d7 = (double) ((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() / (d6 + 3.0D); if (((PlayerExtension) mc.player).vivecraft$getMovementTeleportTimer() > 0) { @@ -141,7 +142,7 @@ public void doProcess() { if (this.vrMovementStyle.destinationSparkles) { } - Vec3 vec310 = vec3.add(-mc.player.getX(), -mc.player.getY(), -mc.player.getZ()).normalize(); + Vector3f vec310 = vec3.add((float) -mc.player.getX(), (float) -mc.player.getY(), (float) -mc.player.getZ(), new Vector3f()).normalize(); Vec3 vec311 = mc.player.getLookAngle(); Vec3 vec35 = vec311.cross(new Vec3(0.0D, 1.0D, 0.0D)); Vec3 vec312 = vec35.cross(vec311); @@ -176,7 +177,7 @@ public void doProcess() { } if (flag && vec3 != null && (vec3.x != 0.0D || vec3.y != 0.0D || vec3.z != 0.0D)) { - this.movementTeleportDistance = vec3.distanceTo(mc.player.position()); + this.movementTeleportDistance = vec3.distance((float) mc.player.position().x, (float) mc.player.position().y, (float) mc.player.position().z); if (this.movementTeleportDistance > 0.0D && this.vrMovementStyle.endTeleportingSound != null) { boolean flag3 = true; @@ -198,7 +199,7 @@ public void doProcess() { } this.doTeleportCallback(); - ((PlayerExtension) mc.player).vivecraft$stepSound(BlockPos.containing(vec3), vec3.x(), vec3.y(), vec3.z()); + ((PlayerExtension) mc.player).vivecraft$stepSound(BlockPos.containing(convertToVec3(vec3)), vec3.x(), vec3.y(), vec3.z()); } } @@ -206,7 +207,7 @@ public void updateTeleportDestinations() { mc.getProfiler().push("updateTeleportDestinations"); if (this.vrMovementStyle.arcAiming) { - this.movementTeleportDestination = new Vec3(0.0D, 0.0D, 0.0D); + this.movementTeleportDestination.zero(); if (this.movementTeleportProgress > 0.0D) { this.updateTeleportArc(); @@ -217,23 +218,23 @@ public void updateTeleportDestinations() { } private void updateTeleportArc() { - Vec3 vec3; - Vec3 vec31; + final Vector3fc vec3; + final Vector3fc vec31; Matrix4f matrix4f; if (dh.vrSettings.seated) { - vec3 = RenderHelper.getControllerRenderPos(0); - vec31 = dh.vrPlayer.vrdata_world_render.getController(0).getDirection(); + vec3 = RenderHelper.getControllerRenderPos(0, new Vector3f()); + vec31 = dh.vrPlayer.vrdata_world_render.getController(0).getDirection(new Vector3f()); matrix4f = new Matrix4f(dh.vr.getAimRotation(0)).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); } else { - vec3 = dh.vrPlayer.vrdata_world_render.getController(1).getPosition(); - vec31 = dh.vrPlayer.vrdata_world_render.getController(1).getDirection(); + vec3 = dh.vrPlayer.vrdata_world_render.getController(1).getPosition(new Vector3f()); + vec31 = dh.vrPlayer.vrdata_world_render.getController(1).getDirection(new Vector3f()); matrix4f = new Matrix4f(dh.vr.getAimRotation(1)).rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); } Quaternionf quaternion = new Quaternionf().setFromUnnormalized(matrix4f); int i = 50; - this.movementTeleportArc[0] = new Vec3(vec3.x, vec3.y, vec3.z); + this.movementTeleportArc[0] = new Vec3(vec3.x(), vec3.y(), vec3.z()); this.movementTeleportArcSteps = 1; float f = 0.098F; Matrix4f matrix4f4 = matrix4f.rotateZ(-atan2((2.0F * (quaternion.x * quaternion.y + quaternion.w * quaternion.z)), (quaternion.w * quaternion.w - quaternion.x * quaternion.x + quaternion.y * quaternion.y - quaternion.z * quaternion.z))); @@ -241,8 +242,8 @@ private void updateTeleportArc() { Vec3 vec32 = new Vec3(-vector31.x, -vector31.y, -vector31.z); vec32 = vec32.scale(f); float f1 = 0.5F; - Vec3 vec33 = new Vec3(vec31.x * (double) f1, vec31.y * (double) f1, vec31.z * (double) f1); - Vec3 vec34 = new Vec3(vec3.x, vec3.y, vec3.z); + Vec3 vec33 = new Vec3(vec31.x() * (double) f1, vec31.y() * (double) f1, vec31.z() * (double) f1); + Vec3 vec34 = new Vec3(vec3.x(), vec3.y(), vec3.z()); for (int j = this.movementTeleportArcSteps; j < i && !((float) (j * 4) > this.teleportEnergy); ++j) { Vec3 vec35 = new Vec3(vec34.x + vec33.x, vec34.y + vec33.y, vec34.z + vec33.z); @@ -256,8 +257,8 @@ private void updateTeleportArc() { this.movementTeleportArcSteps = j + 1; Vec3 vec36 = vec34.subtract(vec35).normalize(); Vec3 vec37 = new Vec3(-vec36.x * 0.02D, -vec36.y * 0.02D, -vec36.z * 0.02D); - this.checkAndSetTeleportDestination(mc, mc.player, vec3, blockhitresult, vec37); - Vec3 vec38 = mc.player.position().subtract(this.movementTeleportDestination); + this.checkAndSetTeleportDestination(mc, mc.player, convertToVec3(vec3), blockhitresult, vec37); + Vec3 vec38 = mc.player.position().subtract(this.movementTeleportDestination.x, this.movementTeleportDestination.y, this.movementTeleportDestination.z); double d0 = vec38.y; this.movementTeleportDistance = vec38.length(); double d1 = sqrt(vec38.x * vec38.x + vec38.z * vec38.z); @@ -274,7 +275,7 @@ private void updateTeleportArc() { } if (!flag1) { - this.movementTeleportDestination = new Vec3(0.0D, 0.0D, 0.0D); + this.movementTeleportDestination.zero(); this.movementTeleportDistance = 0.0D; } @@ -327,7 +328,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, } if (flag) { - this.movementTeleportDestination = new Vec3(aabb.getCenter().x, aabb.minY + (double) f, aabb.getCenter().z); + this.movementTeleportDestination.set(aabb.getCenter().x, aabb.minY + f, aabb.getCenter().z); this.movementTeleportDestinationSideHit = collision.getDirection(); return true; } @@ -340,7 +341,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, vec36 = vec36.add(0.0D, -1.0D, 0.0D); } - this.movementTeleportDestination = vec36.scale(1.0D); + convertToVector3f(vec36.scale(1.0D), this.movementTeleportDestination); this.movementTeleportDestinationSideHit = collision.getDirection(); return true; } @@ -380,7 +381,7 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, if (flag1) { Vec3 vec37 = new Vec3(aabb1.getCenter().x, (double) blockpos1.getY() + d2, aabb1.getCenter().z); - this.movementTeleportDestination = vec37.scale(1.0D); + convertToVector3f(vec37.scale(1.0D), this.movementTeleportDestination); return true; } @@ -391,10 +392,10 @@ private boolean checkAndSetTeleportDestination(Minecraft mc, LocalPlayer player, return false; } - public Vec3 getInterpolatedArcPosition(float progress) { + public Vector3f getInterpolatedArcPosition(float progress, Vector3f dest) { if (this.movementTeleportArcSteps != 1 && !(progress <= 0.0F)) { if (progress >= 1.0F) { - return new Vec3(this.movementTeleportArc[this.movementTeleportArcSteps - 1].x, this.movementTeleportArc[this.movementTeleportArcSteps - 1].y, this.movementTeleportArc[this.movementTeleportArcSteps - 1].z); + return convertToVector3f(this.movementTeleportArc[this.movementTeleportArcSteps - 1], dest); } else { float f = progress * (float) (this.movementTeleportArcSteps - 1); int i = (int) floor(f); @@ -402,10 +403,10 @@ public Vec3 getInterpolatedArcPosition(float progress) { double d1 = this.movementTeleportArc[i + 1].y - this.movementTeleportArc[i].y; double d2 = this.movementTeleportArc[i + 1].z - this.movementTeleportArc[i].z; float f1 = f - (float) i; - return new Vec3(this.movementTeleportArc[i].x + d0 * (double) f1, this.movementTeleportArc[i].y + d1 * (double) f1, this.movementTeleportArc[i].z + d2 * (double) f1); + return dest.set(this.movementTeleportArc[i].x + d0 * (double) f1, this.movementTeleportArc[i].y + d1 * (double) f1, this.movementTeleportArc[i].z + d2 * (double) f1); } } else { - return new Vec3(this.movementTeleportArc[0].x, this.movementTeleportArc[0].y, this.movementTeleportArc[0].z); + return convertToVector3f(this.movementTeleportArc[0], dest); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java index 4e926ba62..cd0e8a846 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/TelescopeTracker.java @@ -4,7 +4,7 @@ import net.minecraft.network.chat.contents.TranslatableContents; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.render.RenderPass; @@ -17,10 +17,10 @@ public class TelescopeTracker extends Tracker { //public static final ResourceLocation scopeResource = new ResourceLocation("vivecraft:trashbin"); public static final ModelResourceLocation scopeModel = new ModelResourceLocation("vivecraft", "spyglass_in_hand", "inventory"); - private static final double lensDistMax = 0.05D; - private static final double lensDistMin = 0.185D; - private static final double lensDotMax = 0.9D; - private static final double lensDotMin = 0.75D; + private static final float lensDistMax = 0.05F; + private static final float lensDistMin = 0.185F; + private static final float lensDotMax = 0.9F; + private static final float lensDotMin = 0.75F; public static boolean isTelescope(ItemStack i) { return i != null && (i.getItem() == Items.SPYGLASS || isLegacyTelescope(i) || i.is(ItemTags.VIVECRAFT_TELESCOPE)); @@ -41,13 +41,13 @@ public static boolean isLegacyTelescope(ItemStack i) { } } - private static Vec3 getLensOrigin(int controller) { - VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(controller); - return vrdata$vrdevicepose.getPosition().add(getViewVector(controller).scale(-0.2D).add(vrdata$vrdevicepose.getDirection().scale(0.05F))); + private static Vector3f getLensOrigin(int controller, Vector3f dest) { + VRDevicePose con = dh.vrPlayer.vrdata_room_pre.getController(controller); + return con.getPosition(dest).add(getViewVector(controller, new Vector3f()).mul(-0.2F).add(con.getDirection(new Vector3f()).mul(0.05F))); } - private static Vec3 getViewVector(int controller) { - return dh.vrPlayer.vrdata_room_pre.getController(controller).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); + private static Vector3f getViewVector(int controller, Vector3f dest) { + return dh.vrPlayer.vrdata_room_pre.getController(controller).getCustomVector(dest.set(0.0F, -1.0F, 0.0F)); } public static boolean isViewing(int controller) { @@ -81,16 +81,16 @@ private static float viewPercent(int controller, int e) { return 0.0F; } else { VRDevicePose eye = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.values()[e]); - double dist = eye.getPosition().subtract(getLensOrigin(controller)).length(); - Vec3 look = eye.getDirection(); - double dot = abs(look.dot(getViewVector(controller))); + float dist = eye.getPosition(new Vector3f()).sub(getLensOrigin(controller, new Vector3f())).length(); + Vector3f look = eye.getDirection(new Vector3f()); + float dot = abs(look.dot(getViewVector(controller, new Vector3f()))); - double dfact = 0.0D; - double distfact = 0.0D; + float dfact = 0.0F; + float distfact = 0.0F; if (dot > lensDotMin) { if (dot > lensDotMax) { - dfact = 1.0D; + dfact = 1.0F; } else { dfact = (dot - lensDotMin) / (lensDotMax - lensDotMin); } @@ -98,13 +98,13 @@ private static float viewPercent(int controller, int e) { if (dist < lensDistMin) { if (dist < lensDistMax) { - distfact = 1.0D; + distfact = 1.0F; } else { - distfact = 1.0D - (dist - lensDistMax) / (lensDistMin - lensDistMax); + distfact = 1.0F - (dist - lensDistMax) / (lensDistMin - lensDistMax); } } - return (float) min(dfact, distfact); + return min(dfact, distfact); } } } diff --git a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java index 9a207bd08..d28559bd5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java +++ b/common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/VehicleTracker.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.vehicle.Minecart; import net.minecraft.world.item.FoodOnAStickItem; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.settings.VRSettings.FreeMove; @@ -15,9 +16,10 @@ import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class VehicleTracker extends Tracker { - public Vec3 Premount_Pos_Room = new Vec3(0.0D, 0.0D, 0.0D); + public final Vector3f Premount_Pos_Room = new Vector3f(); public float vehicleInitialRotation = 0.0F; public int rotationCooldown = 0; private double rotationTarget = 0.0D; @@ -46,8 +48,7 @@ public double getVehicleFloor(Entity vehicle, double original) { return original; } - public static Vec3 getSteeringDirection(LocalPlayer player) { - Vec3 vec3 = null; + public static Vector3f getSteeringDirection(LocalPlayer player, Vector3f dest) { Entity entity = player.getVehicle(); if (!(entity instanceof AbstractHorse) && !(entity instanceof Boat)) { @@ -56,18 +57,18 @@ public static Vec3 getSteeringDirection(LocalPlayer player) { if (mob.isControlledByLocalInstance()) { int i = (player.getMainHandItem().getItem() instanceof FoodOnAStickItem || player.getMainHandItem().is(ItemTags.VIVECRAFT_FOOD_STICKS)) ? 0 : 1; VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getController(i); - return vrdata$vrdevicepose.getPosition().add(vrdata$vrdevicepose.getDirection().scale(0.3D)).subtract(entity.position()).normalize(); + return vrdata$vrdevicepose.getPosition(new Vector3f()).add(vrdata$vrdevicepose.getDirection(new Vector3f()).mul(0.3F)).sub(convertToVector3f(entity.position(), dest)).normalize(); } } } else if (player.zza > 0.0F) { if (dh.vrSettings.vrFreeMoveMode == FreeMove.HMD) { - return dh.vrPlayer.vrdata_world_pre.hmd.getDirection(); + return dh.vrPlayer.vrdata_world_pre.hmd.getDirection(dest); } - return dh.vrPlayer.vrdata_world_pre.getController(0).getDirection(); + return dh.vrPlayer.vrdata_world_pre.getController(0).getDirection(dest); } - return vec3; + return null; } @Override @@ -157,8 +158,8 @@ public void doProcess() { } public void onStartRiding(Entity vehicle, LocalPlayer player) { - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot(); - this.Premount_Pos_Room = new Vec3(vec3.x, 0.0D, vec3.z); + Vector3f vec3 = dh.vrPlayer.vrdata_room_pre.getHeadPivot(new Vector3f()); + this.Premount_Pos_Room.set(vec3.x, 0.0F, vec3.z); this.dismountCooldown = 5; if (dh.vrSettings.vehicleRotation) { diff --git a/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java b/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java index 830fa3350..4d4505e86 100644 --- a/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java +++ b/common/src/main/java/org/vivecraft/client_vr/gui/PhysicalKeyboard.java @@ -361,8 +361,8 @@ private Vector3f getCenterPos() { private KeyButton findTouchedKey(ControllerType controller) { Matrix4f matrix4f = new Matrix4f().translate(this.getCenterPos()) .mul(KeyboardHandler.Rotation_room.invertAffine(new Matrix4f())) - .translate(convertToVector3f(KeyboardHandler.Pos_room, new Vector3f()).negate()); - Vector3f vector = convertToVector3f(dh.vrPlayer.vrdata_room_pre.getController(controller.ordinal()).getPosition(), new Vector3f()); + .translate(-KeyboardHandler.Pos_room.x(), -KeyboardHandler.Pos_room.y(), -KeyboardHandler.Pos_room.z()); + Vector3f vector = dh.vrPlayer.vrdata_room_pre.getController(controller.ordinal()).getPosition(new Vector3f()); matrix4f.transformPosition(vector, vector); for (KeyButton physicalkeyboard$keybutton : this.keys) { diff --git a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java index 47ae6f955..d644a74c9 100644 --- a/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java +++ b/common/src/main/java/org/vivecraft/client_vr/menuworlds/MenuWorldRenderer.java @@ -45,6 +45,7 @@ import org.joml.Matrix4f; import org.joml.Vector2f; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.lwjgl.opengl.GL11C; import org.vivecraft.client.Xplat; import org.vivecraft.client_vr.settings.VRSettings.MenuWorld; @@ -59,12 +60,14 @@ import static java.lang.Math.pow; import static net.minecraft.client.Minecraft.useFancyGraphics; +import static net.minecraft.util.CubicSampler.gaussianSampleVec3; +import static net.minecraft.world.phys.Vec3.fromRGB24; import static org.joml.Math.*; import static org.joml.RoundingMode.FLOOR; import static org.joml.Vector2i.lengthSquared; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.logger; +import static org.vivecraft.common.utils.Utils.*; public class MenuWorldRenderer { private static final ResourceLocation MOON_LOCATION = new ResourceLocation("textures/environment/moon_phases.png"); @@ -177,8 +180,10 @@ public void render(PoseStack poseStack) { .translate(-0.5F, -blockAccess.getGround() + (int) blockAccess.getGround(), -0.5F); // not sure why this needs to be rotated twice, but it works - Vec3 offset = new Vec3(0.5, -blockAccess.getGround() + (int) blockAccess.getGround(), 0.5).yRot(worldRotRads); - Vec3 eyePosition = getEyePos().add(offset).yRot(-worldRotRads); + // TODO: because it's not rotated twice + Vector3f eyePosition = getEyePos(new Vector3f()) + .add(new Vector3f(0.5F, -blockAccess.getGround() + (int) blockAccess.getGround(), 0.5F).rotateY(worldRotRads)) + .rotateY(-worldRotRads); fogRenderer.levelFogColor(); @@ -486,7 +491,7 @@ public void pushVisibleTextures() { } // End VanillaFix support - public void renderSky(PoseStack poseStack, Vec3 position) { + public void renderSky(PoseStack poseStack, Vector3fc position) { if (this.dimensionInfo.skyType() == SkyType.END) { this.renderEndSky(poseStack); } else if (this.dimensionInfo.skyType() == SkyType.NORMAL) { @@ -495,17 +500,19 @@ public void renderSky(PoseStack poseStack, Vec3 position) { ShaderInstance skyShader = RenderSystem.getShader(); //RenderSystem.disableTexture(); - Vec3 skyColor = this.getSkyColor(position); + Vector3f skyColor; if (OptifineHelper.isOptifineLoaded()) { - skyColor = OptifineHelper.getCustomSkyColor(skyColor, blockAccess, position.x, position.y, position.z); + skyColor = OptifineHelper.getCustomSkyColor(new Vector3f(), blockAccess, position.x(), position.y(), position.z()); + } else { + skyColor = this.getSkyColor(position); } fogRenderer.levelFogColor(); BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder(); RenderSystem.depthMask(false); - RenderSystem.setShaderColor((float) skyColor.x, (float) skyColor.y, (float) skyColor.z, 1.0F); + RenderSystem.setShaderColor(skyColor.x, skyColor.y, skyColor.z, 1.0F); if (!OptifineHelper.isOptifineLoaded() || OptifineHelper.isSkyEnabled()) { @@ -525,8 +532,8 @@ public void renderSky(PoseStack poseStack, Vec3 position) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); poseStack.pushPose(); - float ang0 = toRadians(90.0F); - float ang1 = sin(this.getSunAngle()) < 0.0F ? toRadians(180.0F) : 0.0F; + float ang0 = (float) PI / 2.0F; + float ang1 = sin(this.getSunAngle()) < 0.0F ? (float) PI : 0.0F; poseStack.last().pose() .rotateX(ang0) @@ -565,7 +572,7 @@ public void renderSky(PoseStack poseStack, Vec3 position) { float f10 = 1.0F - getRainLevel(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f10); - float ang1 = toRadians(-90.0F); + float ang1 = (float) PI / -2.0F; poseStack.last().normal().rotateY(ang1); Matrix4f modelView = poseStack.last().pose().rotateY(ang1); @@ -628,7 +635,7 @@ public void renderSky(PoseStack poseStack, Vec3 position) { poseStack.popPose(); //RenderSystem.disableTexture(); - double horizonDistance = position.y - this.blockAccess.getHorizon(); + double horizonDistance = position.y() - this.blockAccess.getHorizon(); if (horizonDistance < 0.0D) { RenderSystem.setShaderColor(0.0F, 0.0F, 0.0F, 1.0F); @@ -659,27 +666,27 @@ private void renderEndSky(PoseStack poseStack) { poseStack.pushPose(); Matrix4f modelView = switch (i) { case 1 -> { - float ang1 = toRadians(90.0F); + float ang1 = (float) PI / 2.0F; poseStack.last().normal().rotateX(ang1); yield poseStack.last().pose().rotateX(ang1); } case 2 -> { - float ang2 = toRadians(-90.0F); + float ang2 = (float) PI / -2.0F; poseStack.last().normal().rotateX(ang2); yield poseStack.last().pose().rotateX(ang2); } case 3 -> { - float ang3 = toRadians(180.0F); + float ang3 = (float) PI; poseStack.last().normal().rotateX(ang3); yield poseStack.last().pose().rotateX(ang3); } case 4 -> { - float ang4 = toRadians(90.0F); + float ang4 = (float) PI / 2.0F; poseStack.last().normal().rotateZ(ang4); yield poseStack.last().pose().rotateZ(ang4); } case 5 -> { - float ang5 = toRadians(-90.0F); + float ang5 = (float) PI / -2.0F; poseStack.last().normal().rotateZ(ang5); yield poseStack.last().pose().rotateZ(ang5); } @@ -690,16 +697,20 @@ private void renderEndSky(PoseStack poseStack) { bufferBuilder.begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); - int r = 40; - int g = 40; - int b = 40; + int r; + int g; + int b; if (OptifineHelper.isOptifineLoaded() && OptifineHelper.isCustomColors()) { - Vec3 newSkyColor = new Vec3((double) r / 255.0D, (double) g / 255.0D, (double) b / 255.0D); - newSkyColor = OptifineHelper.getCustomSkyColorEnd(newSkyColor); - r = (int) (newSkyColor.x * 255.0D); - g = (int) (newSkyColor.y * 255.0D); - b = (int) (newSkyColor.z * 255.0D); + Vector3f newSkyColor = new Vector3f(40 / 255.0F, 40 / 255.0F, 40 / 255.0F); + OptifineHelper.getCustomSkyColorEnd(newSkyColor); + r = (int) (newSkyColor.x * 255.0F); + g = (int) (newSkyColor.y * 255.0F); + b = (int) (newSkyColor.z * 255.0F); + } else { + r = 40; + g = 40; + b = 40; } bufferBuilder.vertex(modelView, -100.0F, -100.0F, -100.0F).uv(0.0F, 0.0F).color(r, g, b, 255).endVertex(); bufferBuilder.vertex(modelView, -100.0F, -100.0F, 100.0F).uv(0.0F, 16.0F).color(r, g, b, 255).endVertex(); @@ -1055,12 +1066,12 @@ public float getStarBrightness() { return f1 * f1 * 0.5F; } - public Vec3 getSkyColor(Vec3 position) { + public Vector3f getSkyColor(Vector3fc position) { float dayTime = this.getTimeOfDay(); - Vec3 samplePosition = position.subtract(2.0, 2.0, 2.0).scale(0.25); + Vector3f samplePosition = position.sub(2.0F, 2.0F, 2.0F, new Vector3f()).mul(0.25F); - Vec3 skyColor = CubicSampler.gaussianSampleVec3(samplePosition, (i, j, k) -> Vec3.fromRGB24(blockAccess.getBiomeManager().getNoiseBiomeAtQuart(i, j, k).value().getSkyColor())); + Vec3 skyColor = gaussianSampleVec3(convertToVec3(samplePosition), (i, j, k) -> fromRGB24(blockAccess.getBiomeManager().getNoiseBiomeAtQuart(i, j, k).value().getSkyColor())); float h = cos(dayTime * ((float) PI * 2)) * 2.0F + 0.5F; h = clamp(0.0F, 1.0F, h); @@ -1093,13 +1104,13 @@ public Vec3 getSkyColor(Vec3 position) { skyColorG = skyColorG * (1.0F - flash) + 0.8F * flash; skyColorB = skyColorB * (1.0F - flash) + flash; } - return new Vec3(skyColorR, skyColorG, skyColorB); + return samplePosition.set(skyColorR, skyColorG, skyColorB); } - public Vec3 getFogColor(Vec3 pos) { + public Vector3f getFogColor(Vector3f pos) { float f = clamp(0.0F, 1.0F, cos(this.getTimeOfDay() * ((float) PI * 2F)) * 2.0F + 0.5F); - Vec3 scaledPos = pos.subtract(2.0D, 2.0D, 2.0D).scale(0.25D); - return CubicSampler.gaussianSampleVec3(scaledPos, (x, y, z) -> this.dimensionInfo.getBrightnessDependentFogColor(Vec3.fromRGB24(this.blockAccess.getBiomeManager().getNoiseBiomeAtQuart(x, y, z).value().getFogColor()), f)); + pos.sub(2.0F, 2.0F, 2.0F).mul(0.25F); + return convertToVector3f(gaussianSampleVec3(convertToVec3(pos), (x, y, z) -> this.dimensionInfo.getBrightnessDependentFogColor(fromRGB24(this.blockAccess.getBiomeManager().getNoiseBiomeAtQuart(x, y, z).value().getFogColor()), f)), pos); } public Vec3 getCloudColour() { @@ -1368,14 +1379,14 @@ public boolean areEyesInFluid(TagKey tagIn) { return false; } - Vec3 pos = getEyePos(); - BlockPos blockpos = BlockPos.containing(pos); + Vector3f pos = getEyePos(new Vector3f()); + BlockPos blockpos = BlockPos.containing(pos.x(), pos.y(), pos.z()); FluidState fluidstate = this.blockAccess.getFluidState(blockpos); return isFluidTagged(fluidstate, tagIn) && pos.y < (double) ((float) blockpos.getY() + fluidstate.getAmount() + 0.11111111F); } - public Vec3 getEyePos() { - return dh.vrPlayer.vrdata_room_post.hmd.getPosition(); + public Vector3f getEyePos(Vector3f dest) { + return dh.vrPlayer.vrdata_room_post.hmd.getPosition(dest); } private boolean isFluidTagged(Fluid fluid, TagKey tag) { @@ -1407,7 +1418,7 @@ public MenuFogRenderer(MenuWorldRenderer menuWorldRenderer) { } public void setupFogColor() { - Vec3 eyePos = this.menuWorldRenderer.getEyePos(); + Vector3f eyePos = this.menuWorldRenderer.getEyePos(new Vector3f()); FogType fogType = getEyeFogType(); @@ -1493,36 +1504,40 @@ public void setupFogColor() { private void updateSurfaceFog() { float f = 0.25F + 0.75F * (float) this.menuWorldRenderer.renderDistanceChunks / 32.0F; f = 1.0F - (float) pow(f, 0.25); - Vec3 eyePos = this.menuWorldRenderer.getEyePos(); - Vec3 skyColor = this.menuWorldRenderer.getSkyColor(eyePos); + Vector3f eyePos = this.menuWorldRenderer.getEyePos(new Vector3f()); + Vector3f skyColor = this.menuWorldRenderer.getSkyColor(eyePos); if (OptifineHelper.isOptifineLoaded()) { if (menuWorldRenderer.blockAccess.dimensionType().effectsLocation().equals(BuiltinDimensionTypes.OVERWORLD_EFFECTS)) { - skyColor = OptifineHelper.getCustomSkyColor(skyColor, menuWorldRenderer.blockAccess, eyePos.x, eyePos.y, eyePos.z); + OptifineHelper.getCustomSkyColor(skyColor, menuWorldRenderer.blockAccess, eyePos.x, eyePos.y, eyePos.z); } else if (menuWorldRenderer.blockAccess.dimensionType().effectsLocation().equals(BuiltinDimensionTypes.END_EFFECTS)) { - skyColor = OptifineHelper.getCustomSkyColorEnd(skyColor); + OptifineHelper.getCustomSkyColorEnd(skyColor); } } - float f1 = (float) skyColor.x; - float f2 = (float) skyColor.y; - float f3 = (float) skyColor.z; - Vec3 fogColor = this.menuWorldRenderer.getFogColor(eyePos); + float f1 = skyColor.x; + float f2 = skyColor.y; + float f3 = skyColor.z; + Vector3f fogColor = this.menuWorldRenderer.getFogColor(eyePos); if (OptifineHelper.isOptifineLoaded()) { if (menuWorldRenderer.blockAccess.dimensionType().effectsLocation().equals(BuiltinDimensionTypes.OVERWORLD_EFFECTS)) { - fogColor = OptifineHelper.getCustomFogColor(fogColor, menuWorldRenderer.blockAccess, eyePos.x, eyePos.y, eyePos.z); + OptifineHelper.getCustomFogColor(fogColor, menuWorldRenderer.blockAccess, eyePos.x, eyePos.y, eyePos.z); } else if (menuWorldRenderer.blockAccess.dimensionType().effectsLocation().equals(BuiltinDimensionTypes.END_EFFECTS)) { - fogColor = OptifineHelper.getCustomFogColorEnd(fogColor); + OptifineHelper.getCustomFogColorEnd(fogColor); } else if (menuWorldRenderer.blockAccess.dimensionType().effectsLocation().equals(BuiltinDimensionTypes.NETHER_EFFECTS)) { - fogColor = OptifineHelper.getCustomFogColorNether(fogColor); + OptifineHelper.getCustomFogColorNether(fogColor); } } - fogRed = (float) fogColor.x; - fogGreen = (float) fogColor.y; - fogBlue = (float) fogColor.z; + fogRed = fogColor.x; + fogGreen = fogColor.y; + fogBlue = fogColor.z; if (this.menuWorldRenderer.renderDistanceChunks >= 4) { - float d0 = sin(this.menuWorldRenderer.getSunAngle()) > 0.0F ? -1.0F : 1.0F; - Vec3 vec3d2 = new Vec3(d0, 0.0F, 0.0F).yRot(0); - float f5 = (float) dh.vrPlayer.vrdata_room_post.hmd.getDirection().yRot(menuWorldRenderer.worldRotation).dot(vec3d2); + float f5 = dh.vrPlayer.vrdata_room_post.hmd.getDirection(new Vector3f()) + .rotateY(menuWorldRenderer.worldRotation) + .dot(new Vector3f( + sin(this.menuWorldRenderer.getSunAngle()) > 0.0F ? -1.0F : 1.0F, + 0.0F, + 0.0F + ).rotateY(0)); if (f5 < 0.0F) { f5 = 0.0F; @@ -1565,7 +1580,7 @@ private void updateSurfaceFog() { private void updateWaterFog(LevelReader levelIn) { long currentTime = Util.getMillis(); - int waterFogColor = levelIn.getBiome(BlockPos.containing(this.menuWorldRenderer.getEyePos())).value().getWaterFogColor(); + int waterFogColor = levelIn.getBiome(BlockPos.containing(convertToVec3(this.menuWorldRenderer.getEyePos(new Vector3f())))).value().getWaterFogColor(); if (this.biomeChangedTime < 0L) { targetBiomeFog = waterFogColor; @@ -1611,7 +1626,7 @@ public void setupFog(FogMode fogMode) { fogStart = -8.0F; fogEnd = 96.0F; - Holder holder = menuWorldRenderer.blockAccess.getBiome(BlockPos.containing(menuWorldRenderer.getEyePos())); + Holder holder = menuWorldRenderer.blockAccess.getBiome(BlockPos.containing(convertToVec3(menuWorldRenderer.getEyePos(new Vector3f())))); if (holder.is(BiomeTags.HAS_CLOSER_WATER_FOG)) { fogEnd *= 0.85F; } @@ -1643,7 +1658,7 @@ private FogType getEyeFogType() { fogType = FogType.WATER; } else if (menuWorldRenderer.areEyesInFluid(FluidTags.LAVA)) { fogType = FogType.LAVA; - } else if (menuWorldRenderer.blockAccess.getBlockState(BlockPos.containing(menuWorldRenderer.getEyePos())).is(Blocks.POWDER_SNOW)) { + } else if (menuWorldRenderer.blockAccess.getBlockState(BlockPos.containing(convertToVec3(menuWorldRenderer.getEyePos(new Vector3f())))).is(Blocks.POWDER_SNOW)) { fogType = FogType.POWDER_SNOW; } return fogType; diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java index d00301a36..a90c00c9e 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/MCVR.java @@ -9,7 +9,6 @@ import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.TorchBlock; -import net.minecraft.world.phys.Vec3; import org.joml.*; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client_vr.VRData.VRDevicePose; @@ -40,6 +39,7 @@ import java.util.stream.Stream; import static org.joml.Math.*; +import static org.joml.RoundingMode.FLOOR; import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; import static org.lwjgl.glfw.GLFW.glfwSetCursorPos; import static org.vivecraft.client.utils.Utils.message; @@ -80,16 +80,12 @@ public abstract class MCVR { protected Matrix4f[] poseMatrices; protected Vector3f[] aimSource = new Vector3f[]{new Vector3f(), new Vector3f()}; public int hmdAvgLength = 90; - public LinkedList hmdPosSamples = new LinkedList<>(); + public LinkedList hmdPosSamples = new LinkedList<>(); public LinkedList hmdYawSamples = new LinkedList<>(); protected float hmdYawTotal; protected float hmdYawLast; protected boolean trigger; public boolean mrMovingCamActive; - public Vec3 mrControllerPos = Vec3.ZERO; - public float mrControllerPitch; - public float mrControllerYaw; - public float mrControllerRoll; protected HapticScheduler hapticScheduler; public float seatedRot; public float aimPitch = 0.0F; @@ -121,16 +117,16 @@ public Matrix4f getAimRotation(int controller) { return this.controllerRotation[controller]; } - public Vec3 getAimSource(int controller) { - return convertToVec3( + public Vector3f getAimSource(int controller, Vector3f dest) { + return ( !dh.vrSettings.seated && dh.vrSettings.allowStandingOriginOffset && dh.vr.isHMDTracking() ? - this.aimSource[controller].add(dh.vrSettings.originOffset, new Vector3f()) : - this.aimSource[controller] + this.aimSource[controller].add(dh.vrSettings.originOffset, dest) : + dest.set(this.aimSource[controller]) ); } - public Vec3 getAimVector(int controller) { - return convertToVec3(this.controllerRotation[controller].transformProject(forward, new Vector3f())); + public Vector3f getAimVector(int controller, Vector3f dest) { + return this.controllerRotation[controller].transformProject(forward, dest); } public Vector3f getGesturePosition(int controller) { @@ -186,8 +182,8 @@ public Matrix4f getHandRotation(int controller) { return this.handRotation[controller]; } - public Vec3 getHandVector(int controller) { - return convertToVec3(this.handRotation[controller].transformProject(forward, new Vector3f())); + public Vector3f getHandVector(int controller, Vector3f dest) { + return this.handRotation[controller].transformProject(forward, dest); } public Vector3f getCenterEyePosition() { @@ -198,7 +194,7 @@ public Vector3f getCenterEyePosition() { ); } - public Vec3 getEyePosition(RenderPass eye) { + public Vector3f getEyePosition(RenderPass eye) { Vector3f vector3 = switch (eye) { case LEFT -> { yield this.hmdPose.mul0(this.hmdPoseLeftEye, new Matrix4f()).getTranslation(new Vector3f()); @@ -217,7 +213,7 @@ public Vec3 getEyePosition(RenderPass eye) { } } - return convertToVec3(vector3); + return vector3; } public HardwareType getHardwareType() { @@ -309,55 +305,53 @@ protected void processHotbar() { return; } - Vec3 main = this.getAimSource(0); - Vec3 off = this.getAimSource(1); - Vec3 barStartos, barEndos; + Vector3f main = this.getAimSource(0, new Vector3f()); + Vector3f off = this.getAimSource(1, new Vector3f()); + Vector3f barStartos, barEndos; int i = dh.vrSettings.reverseHands ? 0 : 1; if (dh.vrSettings.vrHudLockMode == HUDLock.WRIST) { - barStartos = convertToVec3(this.getAimRotation(1).transformProject((float) i * 0.02F, 0.05F, 0.26F, new Vector3f())); - barEndos = convertToVec3(this.getAimRotation(1).transformProject((float) i * 0.02F, 0.05F, 0.01F, new Vector3f())); + barStartos = this.getAimRotation(1).transformProject((float) i * 0.02F, 0.05F, 0.26F, new Vector3f()); + barEndos = this.getAimRotation(1).transformProject((float) i * 0.02F, 0.05F, 0.01F, new Vector3f()); } else if (dh.vrSettings.vrHudLockMode == HUDLock.HAND) { - barStartos = convertToVec3(this.getAimRotation(1).transformProject((float) i * -0.18F, 0.08F, -0.01F, new Vector3f())); - barEndos = convertToVec3(this.getAimRotation(1).transformProject((float) i * 0.19F, 0.04F, -0.08F, new Vector3f())); + barStartos = this.getAimRotation(1).transformProject((float) i * -0.18F, 0.08F, -0.01F, new Vector3f()); + barEndos = this.getAimRotation(1).transformProject((float) i * 0.19F, 0.04F, -0.08F, new Vector3f()); } else { return; //how did u get here } - Vec3 barStart = off.add(barStartos.x, barStartos.y, barStartos.z); - Vec3 barEnd = off.add(barEndos.x, barEndos.y, barEndos.z); + Vector3f barStart = off.add(barStartos, new Vector3f()); + Vector3f barEnd = off.add(barEndos, new Vector3f()); - Vec3 u = barStart.subtract(barEnd); - Vec3 pq = barStart.subtract(main); - float dist = (float) (pq.cross(u).length() / u.length()); + Vector3f u = barStart.sub(barEnd, new Vector3f()); + Vector3f pq = barStart.sub(main, new Vector3f()); + float dist = pq.cross(u).length() / u.length(); if (dist > 0.06) { return; } - float fact = (float) (pq.dot(u) / (u.x * u.x + u.y * u.y + u.z * u.z)); + float fact = pq.dot(u) / (u.x * u.x + u.y * u.y + u.z * u.z); if (fact < -1) { return; } - Vec3 w2 = u.scale(fact).subtract(pq); + Vector3f w2 = u.mul(fact, new Vector3f()).sub(pq); - Vec3 point = main.subtract(w2); - float linelen = (float) u.length(); - float ilen = (float) barStart.subtract(point).length(); + float ilen = barStart.sub(main.sub(w2)).length(); if (fact < 0) { ilen *= -1; } - float pos = ilen / linelen * 9; + float pos = ilen / u.length() * 9.0F; if (dh.vrSettings.reverseHands) { pos = 9 - pos; } - int box = (int) floor(pos); + int box = roundUsing(pos, FLOOR); if (box > 8) { return; @@ -416,7 +410,7 @@ protected void hmdSampling() { logger.warn("HMD yaw desync/overflow corrected"); } - this.hmdPosSamples.add(dh.vrPlayer.vrdata_room_pre.hmd.getPosition()); + this.hmdPosSamples.add(dh.vrPlayer.vrdata_room_pre.hmd.getPosition(new Vector3f())); float f2 = 0.0F; if (this.hmdYawSamples.size() > 0) { @@ -493,9 +487,9 @@ protected void updateAim() { InputSimulator.setMousePos(f3, height / 2.0F); glfwSetCursorPos(mc.getWindow().getWindow(), f3, height / 2.0F); final float xRot = toRadians(-clamp( - -89.9F, 89.9F, this.aimPitch + (-((float) mc.mouseHandler.ypos()) / height * 180.0F + (180.0F / 2.0F)) * 0.5F * dh.vrSettings.ySensitivity + -89.9F, 89.9F, this.aimPitch + (-((float) mc.mouseHandler.ypos()) / height * 180.0F + 90.0F) * 0.5F * dh.vrSettings.ySensitivity )); - final float yRot = toRadians(-180.0F + f4 - this.hmdForwardYaw); + final float yRot = toRadians(f4 - this.hmdForwardYaw) - (float) PI; this.handRotation[0].rotationXYZ(xRot, yRot, 0); this.controllerRotation[0].rotationXYZ(xRot, yRot, 0); } else { @@ -515,13 +509,13 @@ protected void updateAim() { this.handRotation[1].identity().set3x3(controller1hand); this.controllerRotation[1].identity().set3x3(controller1tip); - this.controllerHistory[0].add(this.getAimSource(0)); - this.controllerHistory[1].add(this.getAimSource(1)); + this.controllerHistory[0].add(this.getAimSource(0, new Vector3f())); + this.controllerHistory[1].add(this.getAimSource(1, new Vector3f())); - Vector3dc vec32 = this.controllerForwardHistory[0].add(this.getAimVector(0)); + Vector3fc vec32 = this.controllerForwardHistory[0].add(this.getAimVector(0, new Vector3f())); this.aimPitch = (float) toDegrees(asin(vec32.y() / vec32.length())); this.controllerUpHistory[0].add(this.controllerRotation[0].transformProject(up, new Vector3f())); - this.controllerForwardHistory[1].add(this.getAimVector(1)); + this.controllerForwardHistory[1].add(this.getAimVector(1, new Vector3f())); this.controllerUpHistory[1].add(this.controllerRotation[1].transformProject(up, new Vector3f())); // boolean flag = false; @@ -571,8 +565,8 @@ public void processBindings() { } } - Vec3 vec3 = this.getAimVector(0); - Vec3 vec31 = this.getAimVector(1); + Vector3f vec3 = this.getAimVector(0, new Vector3f()); + Vector3f vec31 = this.getAimVector(1, new Vector3f()); float f = (float) toDegrees(atan2(-vec3.x, vec3.z)); float f1 = (float) toDegrees(atan2(-vec31.x, vec31.z)); @@ -798,7 +792,7 @@ public void processBindings() { } VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_pre.getController(hand.ordinal()); - dh.cameraTracker.setPosition(vrdata$vrdevicepose.getPosition()); + dh.cameraTracker.setPosition(vrdata$vrdevicepose.getPosition(new Vector3f())); dh.cameraTracker.setRotation(new Quaternionf().setFromNormalized(vrdata$vrdevicepose.getMatrix())); } } @@ -815,7 +809,7 @@ public void processBindings() { } VRDevicePose vrdata$vrdevicepose1 = dh.vrPlayer.vrdata_world_pre.getController(hand.ordinal()); - dh.cameraTracker.setPosition(vrdata$vrdevicepose1.getPosition()); + dh.cameraTracker.setPosition(vrdata$vrdevicepose1.getPosition(new Vector3f())); dh.cameraTracker.setRotation(new Quaternionf().setFromNormalized(vrdata$vrdevicepose1.getMatrix())); dh.cameraTracker.startMoving(hand.ordinal(), true); } diff --git a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java index cdc7693cf..8df58b220 100644 --- a/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java +++ b/common/src/main/java/org/vivecraft/client_vr/provider/openvr_lwjgl/MCOpenVR.java @@ -1071,7 +1071,7 @@ private void updateControllerGesture(int controller, long gestureHandle) { for (VRBoneTransform BoneTrans : BoneTransDat) { HmdVector4 pos = BoneTrans.position$(); // print("Skeletal Bone Position: " + pos); - this.gestureFingerTransforms[controller].add(new Vector4f(pos.v(0), pos.v(1), pos.v(2), pos.v(3))); + this.gestureFingerTransforms[controller].add(new Vector4f(pos.v())); HmdQuaternionf dir = BoneTrans.orientation(); // print("Skeletal Bone Orientation: " + BoneTrans.orientation()); this.gestureFingerOrientations[controller].add(new Quaternionf(dir.w(), dir.x(), dir.y(), dir.z())); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java index 3a32c74a7..e9880a303 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/VivecraftItemRendering.java @@ -12,6 +12,8 @@ import net.minecraft.world.level.block.TorchBlock; import net.minecraft.world.phys.Vec3; import org.joml.Quaternionf; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client_vr.ItemTags; import org.vivecraft.client_vr.gameplay.trackers.SwingTracker; @@ -23,6 +25,7 @@ import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; public class VivecraftItemRendering { public static VivecraftItemTransformType getTransformType(ItemStack pStack, AbstractClientPlayer pPlayer, ItemRenderer itemRenderer) { @@ -103,8 +106,7 @@ public static void applyThirdPersonItemTransforms(@Nonnull PoseStack pMatrixStac public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStack, VivecraftItemTransformType rendertype, boolean mainHand, AbstractClientPlayer pPlayer, float pEquippedProgress, float pPartialTicks, ItemStack pStack, InteractionHand pHand) { - int k = mainHand ? 1 : -1; - float scale = 0.7F; + final float scale; float translateX = -0.05F; float translateY = 0.005F; float translateZ = 0.0F; @@ -116,9 +118,10 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac switch (rendertype) { case Bow_Seated -> { + scale = 0.7F; translateY -= 0.1F; translateZ += 0.1F; - rotation.rotateX(toRadians(90.0F - gunAngle)); + rotation.rotateX((float) PI / 2.0F - toRadians(gunAngle)); } case Bow_Roomscale -> { rotation.rotationX(0.0F); @@ -135,34 +138,21 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac scale = 1.0F; int i = dh.vrSettings.reverseShootingEye ? 1 : 0; - Vec3 vec3 = dh.bowTracker.getAimVector(); - Vec3 vec31 = new Vec3(vec3.x, vec3.y, vec3.z); - Vec3 vec32 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vec3(0.0D, -1.0D, 0.0D)); - Vec3 vec33 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vec3(0.0D, 0.0D, -1.0D)); - vec31.cross(vec32); - float f = (float) toDegrees(asin(vec31.y / vec31.length())); - float f1 = (float) toDegrees(atan2(vec31.x, vec31.z)); - Vec3 vec34 = new Vec3(0.0D, 1.0D, 0.0D); - Vec3 vec35 = new Vec3(vec31.x, 0.0D, vec31.z); - Vec3 vec36 = Vec3.ZERO; - double d5 = vec33.dot(vec35); - - if (d5 != 0.0D) { - vec36 = vec35.scale(d5); - } - - Vec3 vec37 = vec33.subtract(vec36).normalize(); - double d6 = vec37.dot(vec34); - double d7 = vec35.dot(vec37.cross(vec34)); - float f2; + Vector3fc vec31 = dh.bowTracker.getAimVector(); + // Vector3f vec32 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vector3f(0.0F, -1.0F, 0.0F)); + Vector3f vec33 = dh.vrPlayer.vrdata_world_render.getHand(1).getCustomVector(new Vector3f(0.0F, 0.0F, -1.0F)); + // vec31.cross(vec32); // TODO: wtf + Vector3fc vec35 = new Vector3f(vec31.x(), 0.0F, vec31.z()); + Vector3f vec36 = new Vector3f(); + float f2 = vec33.dot(vec31.x(), 0.0F, vec31.z()); - if (d7 < 0.0D) { - f2 = -((float) acos(d6)); - } else { - f2 = (float) acos(d6); + if (f2 != 0.0F) { + vec35.mul(f2, vec36); } - float f3 = (180F / (float) PI) * f2; + vec33.sub(vec36, vec36).normalize(); + float f3 = vec36.dot(0.0F, 1.0F, 0.0F); + float f5 = acos(f3); if (dh.bowTracker.isCharged()) { long j = Util.getMillis() - dh.bowTracker.startDrawTime; @@ -172,13 +162,13 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac pMatrixStack.last().pose() .translate(0.0F, 0.0F, 0.1F) .mul(dh.vrPlayer.vrdata_world_render.getController(1).getMatrix()); - rotation.rotateY(toRadians(f1)); - rotation.rotateX(toRadians(-f)); - rotation.rotateZ(toRadians(-f3)); - rotation.rotateZ(toRadians(180.0F)); + rotation.rotateY(atan2(vec31.x(), vec31.z())); + rotation.rotateX(-asin(vec31.y() / vec31.length())); + rotation.rotateZ(-f5 * ((vec35.dot(vec36.cross(0.0F, 1.0F, 0.0F)) < 0.0F) ? -1 : 1)); + rotation.rotateZ((float) PI); pMatrixStack.last().pose().rotate(rotation); rotation.rotationY(0.0F); - rotation.rotateY(toRadians(180.0F)); + rotation.rotateY((float) PI); rotation.rotateX(toRadians(160.0F)); translateY += 0.1225F; translateX += 0.125F; @@ -190,10 +180,10 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac translateY -= 0.02F; scale = 0.5F; rotation.rotationX(0.0F); - rotation.rotateY(toRadians(10.0F)); + rotation.rotateY((float) PI / 18.0F); } case Map -> { - rotation.rotationX(toRadians(-45.0F)); + rotation.rotationX((float) PI / -4.0F); translateX = 0.0F; translateY = 0.16F; translateZ = -0.075F; @@ -201,7 +191,7 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac } case Noms -> { long l = mc.player.getUseItemRemainingTicks(); - rotation.rotationZ(toRadians(180.0F)); + rotation.rotationZ((float) PI); rotation.rotateX(toRadians(-135.0F)); translateZ += 0.006F * sin(l); translateZ += 0.02F; @@ -209,7 +199,7 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac scale = 0.4F; } case Compass -> { - rotation.rotationY(toRadians(90.0F)); + rotation.rotationY((float) PI / 2.0F); rotation.rotateX(toRadians(25.0F)); scale = 0.4F; } @@ -219,10 +209,11 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac translateX += 0.05F; } case Block_Stick -> { + scale = 0.7F; rotation.rotationX(0.0F); translateY += -0.105F + 0.06F * gunAngle / 40.0F; translateZ -= 0.1F; - rotation.rotateX(toRadians(-45.0F)); + rotation.rotateX((float) PI / -4.0F); rotation.rotateX(toRadians(gunAngle)); } case Horn -> { @@ -230,18 +221,15 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac rotation = new Quaternionf().rotationX(0.0F); translateY += -0.105F + 0.06F * gunAngle / 40.0F; translateZ -= 0.1F; - rotation.rotateX(toRadians(-45.0F)); + rotation.rotateX((float) PI / -4.0F); rotation.rotateX(toRadians(gunAngle)); } case Shield -> { - boolean reverse = dh.vrSettings.reverseHands && !dh.vrSettings.seated; - if (reverse) { - k *= -1; - } + int hand = (mainHand || dh.vrSettings.seated) && !dh.vrSettings.reverseHands ? 1 : -1; scale = 0.4F; translateY += 0.18F; - if (k == 1) { + if (hand == 1) { rotation.rotateX(toRadians(105.0F - gunAngle)); translateX += 0.11F; } else { @@ -251,11 +239,11 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac translateZ += 0.1F; if (pPlayer.isUsingItem() && pPlayer.getUseItemRemainingTicks() > 0 && pPlayer.getUsedItemHand() == pHand) { - rotation.rotateX(toRadians(k * 5F)); + rotation.rotateX(toRadians(hand * 5F)); rotation.rotateZ(toRadians(-5F)); translateY -= 0.12F; - if (k == 1) { + if (hand == 1) { translateZ -= .1F; translateX += .04F; } else { @@ -265,12 +253,12 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac if (pPlayer.isBlocking()) { - rotation.rotateY(toRadians((float) k * 90.0F)); + rotation.rotateY(hand * (float) PI / 2.0F); } else { - rotation.rotateY(toRadians((1.0F - pEquippedProgress)) * (float) k * 90.0F); + rotation.rotateY(hand * toRadians(1.0F - pEquippedProgress) * ((float) PI / 2.0F)); } } - rotation.rotateY(toRadians((float) k * -90.0F)); + rotation.rotateY(hand * (float) PI / -2.0F); } case Spear -> { rotation.rotationX(0.0F); @@ -344,14 +332,17 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac if (VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.RIGHT) && mainHand || VivecraftVRMod.keyClimbeyGrab.isDown(ControllerType.LEFT) && !mainHand) { translateZ -= 0.2F; } + } else { + scale = 0.7F; } if (pStack.getItem() instanceof ArrowItem || pStack.is(ItemTags.VIVECRAFT_ARROWS)) { - preRotation.rotationZ(toRadians(-180.0F)); + preRotation.rotationZ(-(float) PI); rotation.rotateX(toRadians(-gunAngle)); } } case Telescope -> { + scale = 0.7F; preRotation.rotationX(0.0F); rotation.rotationX(0.0F); translateZ = 0.0F; @@ -359,9 +350,10 @@ public static void applyFirstPersonItemTransforms(@Nonnull PoseStack pMatrixStac translateX = 0.0F; } case Item, Block_Item, Sword -> { + scale = 0.7F; } default -> { - rotation.rotationZ(toRadians(180.0F)); + rotation.rotationZ((float) PI); rotation.rotateX(toRadians(-135.0F)); scale = 0.4F; translateX += 0.08F; diff --git a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java index d87549fe8..369a29707 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/XRCamera.java @@ -3,7 +3,8 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.material.FogType; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.vivecraft.client_vr.VRData.VRDevicePose; import org.vivecraft.client_vr.settings.VRSettings.MirrorMode; import org.vivecraft.client_xr.render_pass.RenderPassType; @@ -23,14 +24,15 @@ public void setup(BlockGetter pLevel, Entity pRenderViewEntity, boolean pThirdPe this.level = pLevel; this.entity = pRenderViewEntity; VRDevicePose eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass); - this.setPosition(eye.getPosition()); + Vector3fc eyePos = eye.getPosition(new Vector3f()); + this.setPosition(eyePos.x(), eyePos.y(), eyePos.z()); this.xRot = -eye.getPitch(); this.yRot = eye.getYaw(); - this.getLookVector().set((float) eye.getDirection().x, (float) eye.getDirection().y, (float) eye.getDirection().z); - Vec3 vec3 = eye.getCustomVector(new Vec3(0.0D, 1.0D, 0.0D)); - this.getUpVector().set((float) vec3.x, (float) vec3.y, (float) vec3.z); - eye.getCustomVector(new Vec3(1.0D, 0.0D, 0.0D)); - this.getLeftVector().set((float) vec3.x, (float) vec3.y, (float) vec3.z); + this.getLookVector().set(eye.getDirection(new Vector3f())); + Vector3f vec3 = eye.getCustomVector(new Vector3f(0.0F, 1.0F, 0.0F)); + this.getUpVector().set(vec3); + eye.getCustomVector(vec3.set(1.0F, 0.0F, 0.0F)); + this.getLeftVector().set(vec3); this.rotation().set(0.0F, 0.0F, 0.0F, 1.0F).rotateY(toRadians(-this.yRot)).rotateX(toRadians(this.xRot)); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java index 96599f7a7..2838e8a8d 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/RenderHelper.java @@ -20,6 +20,7 @@ import org.joml.Matrix3f; import org.joml.Matrix4f; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.lwjgl.opengl.GL11C; import org.vivecraft.client.extensions.RenderTargetExtension; import org.vivecraft.client_vr.gameplay.trackers.TelescopeTracker; @@ -53,68 +54,61 @@ public static void applyVRModelView(RenderPass currentPass, PoseStack poseStack) public static void applyStereo(RenderPass currentPass, PoseStack matrix) { if (currentPass == RenderPass.LEFT || currentPass == RenderPass.RIGHT) { - matrix.last().pose().translate(convertToVector3f( - dh.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition() - .subtract(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition()), - new Vector3f() - )); + matrix.last().pose().translate( + dh.vrPlayer.vrdata_world_render.getEye(currentPass).getPosition(new Vector3f()) + .sub(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition(new Vector3f())) + ); // TODO .negate()? } } - public static Vec3 getControllerRenderPos(int c) { + public static Vector3f getControllerRenderPos(int c, Vector3f dest) { if (!dh.vrSettings.seated) { - return dh.vrPlayer.vrdata_world_render.getController(c).getPosition(); + return dh.vrPlayer.vrdata_world_render.getController(c).getPosition(dest); } else { - Vec3 out = null; + Vector3f dir = dh.vrPlayer.vrdata_world_render.hmd.getDirection(new Vector3f()); + dir.rotateY(c == 0 ? -(float) PI * 7.0F / 36.0F : (float) PI * 7.0F / 36.0F).y = 0.0F; + dir.normalize(); if (mc.getCameraEntity() != null && mc.level != null) { - Vec3 dir = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); - dir = dir.yRot((float) toRadians(c == 0 ? -35.0D : 35.0D)); - dir = new Vec3(dir.x, 0.0D, dir.z); - dir = dir.normalize(); RenderPass renderpass = RenderPass.CENTER; - if (TelescopeTracker.isTelescope(mc.player.getUseItem())) { - if (c == 0 && mc.player.getUsedItemHand() == InteractionHand.MAIN_HAND) { - out = dh.vrPlayer.vrdata_world_render.eye0.getPosition() - .add(dh.vrPlayer.vrdata_world_render.hmd.getDirection() - .scale(0.2 * dh.vrPlayer.vrdata_world_render.worldScale)); - } - if (c == 1 && mc.player.getUsedItemHand() == InteractionHand.OFF_HAND) { - out = dh.vrPlayer.vrdata_world_render.eye1.getPosition() - .add(dh.vrPlayer.vrdata_world_render.hmd.getDirection() - .scale(0.2 * dh.vrPlayer.vrdata_world_render.worldScale)); - } - } - if (out == null) { - out = dh.vrPlayer.vrdata_world_render.getEye(renderpass).getPosition().add( - dir.x * 0.3D * dh.vrPlayer.vrdata_world_render.worldScale, - -0.4D * dh.vrPlayer.vrdata_world_render.worldScale, - dir.z * 0.3D * dh.vrPlayer.vrdata_world_render.worldScale); + if (c == 0 && mc.player.getUsedItemHand() == InteractionHand.MAIN_HAND && TelescopeTracker.isTelescope(mc.player.getUseItem())) { + dh.vrPlayer.vrdata_world_render.eye0.getPosition(dest) + .add( + dh.vrPlayer.vrdata_world_render.hmd.getDirection(new Vector3f()) + .mul(0.2F * dh.vrPlayer.vrdata_world_render.worldScale) + ); + } else if (c == 1 && mc.player.getUsedItemHand() == InteractionHand.OFF_HAND && TelescopeTracker.isTelescope(mc.player.getUseItem())) { + dh.vrPlayer.vrdata_world_render.eye1.getPosition(dest) + .add( + dh.vrPlayer.vrdata_world_render.hmd.getDirection(new Vector3f()) + .mul(0.2F * dh.vrPlayer.vrdata_world_render.worldScale) + ); + } else { + dh.vrPlayer.vrdata_world_render.getEye(renderpass).getPosition(dest).add( + dir.x * 0.3F * dh.vrPlayer.vrdata_world_render.worldScale, + -0.4F * dh.vrPlayer.vrdata_world_render.worldScale, + dir.z * 0.3F * dh.vrPlayer.vrdata_world_render.worldScale + ); } } else { //main menu - Vec3 dir = dh.vrPlayer.vrdata_world_render.hmd.getDirection(); - dir = dir.yRot((float) toRadians(c == 0 ? -35.0D : 35.0D)); - dir = new Vec3(dir.x, 0.0D, dir.z); - dir = dir.normalize(); - out = dh.vrPlayer.vrdata_world_render.hmd.getPosition().add(dir.x * 0.3D, -0.4D, - dir.z * 0.3D); + dh.vrPlayer.vrdata_world_render.hmd.getPosition(dest).add(dir.x * 0.3F, -0.4F, dir.z * 0.3F); } - return out; + return dest; } } public static void setupRenderingAtController(int controller, PoseStack matrix) { - Vec3 aimSource = getControllerRenderPos(controller); - aimSource = aimSource.subtract(dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition()); + Vector3f aimSource = getControllerRenderPos(controller, new Vector3f()); + aimSource.sub(dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(new Vector3f())); matrix.last().pose().translate((float) aimSource.x, (float) aimSource.y, (float) aimSource.z); float sc = dh.vrPlayer.vrdata_world_render.worldScale; if (mc.level != null && TelescopeTracker.isTelescope(mc.player.getUseItem())) { matrix.last().pose() .mul(dh.vrPlayer.vrdata_world_render.hmd.getMatrix()) - .rotateX(toRadians(90.0F)) + .rotateX((float) PI / 2.0F) .translate(controller == 0 ? 0.075F * sc : -0.075F * sc, -0.025F * sc, 0.0325F * sc); - matrix.last().normal().rotateX(toRadians(90.0F)); + matrix.last().normal().rotateX((float) PI / 2.0F); } else { matrix.last().pose().mul(dh.vrPlayer.vrdata_world_render.getController(controller).getMatrix()); } @@ -345,20 +339,20 @@ public static void drawSizedQuadWithLightmap(float displayWidth, float displayHe } } - public static void renderFlatQuad(Vec3 pos, float width, float height, float yaw, int r, int g, int b, int a, PoseStack poseStack) { + public static void renderFlatQuad(Vector3fc pos, float width, float height, float yaw, int r, int g, int b, int a, PoseStack poseStack) { Tesselator tesselator = Tesselator.getInstance(); tesselator.getBuilder().begin(Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_NORMAL); - Vec3 offset = (new Vec3((width / 2.0F), 0.0, height / 2.0F)).yRot(toRadians(-yaw)); + Vector3fc offset = new Vector3f(width / 2.0F, 0.0F, height / 2.0F).rotateY(toRadians(-yaw)); Matrix4f mat = poseStack.last().pose(); - tesselator.getBuilder().vertex(mat, (float) (pos.x + offset.x), (float) pos.y, (float) (pos.z + offset.z)) + tesselator.getBuilder().vertex(mat, pos.x() + offset.x(), pos.y(), pos.z() + offset.z()) .color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); - tesselator.getBuilder().vertex(mat, (float) (pos.x + offset.x), (float) pos.y, (float) (pos.z - offset.z)) + tesselator.getBuilder().vertex(mat, pos.x() + offset.x(), pos.y(), pos.z() - offset.z()) .color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); - tesselator.getBuilder().vertex(mat, (float) (pos.x - offset.x), (float) pos.y, (float) (pos.z - offset.z)) + tesselator.getBuilder().vertex(mat, pos.x() - offset.x(), pos.y(), pos.z() - offset.z()) .color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); - tesselator.getBuilder().vertex(mat, (float) (pos.x - offset.x), (float) pos.y, (float) (pos.z + offset.z)) + tesselator.getBuilder().vertex(mat, pos.x() - offset.x(), pos.y(), pos.z() + offset.z()) .color(r, g, b, a).normal(0.0F, 1.0F, 0.0F).endVertex(); tesselator.end(); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java index e6070ec79..145c80929 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRArmHelper.java @@ -17,6 +17,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; +import org.joml.Vector3fc; import org.lwjgl.opengl.GL11C; import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.extensions.GameRendererExtension; @@ -30,6 +32,8 @@ import static org.joml.RoundingMode.FLOOR; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; public class VRArmHelper { @@ -118,7 +122,7 @@ public static void renderMainMenuHand(int c, float partialTicks, boolean depthAl if (mc.level != null) { float light = mc.level.getMaxLocalRawBrightness( - BlockPos.containing(dh.vrPlayer.vrdata_world_render.hmd.getPosition()) + BlockPos.containing(convertToVec3(dh.vrPlayer.vrdata_world_render.hmd.getPosition(new Vector3f()))) ); int minLight = ShadersHelper.ShaderLight(); @@ -273,7 +277,6 @@ public static void renderVRHand_Offhand(float partialTicks, boolean renderTelepo ) { poseStack.pushPose(); RenderHelper.setupRenderingAtController(1, poseStack); - Vec3 start = new Vec3(0.0D, 0.005D, 0.03D); float max = 0.03F; float r; @@ -290,9 +293,9 @@ public static void renderVRHand_Offhand(float partialTicks, boolean renderTelepo RenderSystem.setShader(GameRenderer::getPositionColorShader); mc.getTextureManager().bindForSetup(new ResourceLocation("vivecraft:textures/white.png")); RenderSystem.setShaderTexture(0, new ResourceLocation("vivecraft:textures/white.png")); - RenderHelper.renderFlatQuad(start.add(0.0D, 0.05001D, 0.0D), r, r, 0.0F, tpLimitedColor.getX(), + RenderHelper.renderFlatQuad(new Vector3f(0.0F, 0.05501F, 0.03F), r, r, 0.0F, tpLimitedColor.getX(), tpLimitedColor.getY(), tpLimitedColor.getZ(), 128, poseStack); - RenderHelper.renderFlatQuad(start.add(0.0D, 0.05D, 0.0D), max, max, 0.0F, tpLimitedColor.getX(), + RenderHelper.renderFlatQuad(new Vector3f(0.0F, 0.055F, 0.03F), max, max, 0.0F, tpLimitedColor.getX(), tpLimitedColor.getY(), tpLimitedColor.getZ(), 50, poseStack); poseStack.popPose(); } @@ -331,12 +334,12 @@ public static void renderTeleportArc(PoseStack poseStack) { Tesselator tesselator = Tesselator.getInstance(); tesselator.getBuilder().begin(Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_NORMAL); - double VOffset = dh.teleportTracker.lastTeleportArcDisplayOffset; - Vec3 dest = dh.teleportTracker.getDestination(); - boolean validLocation = dest.x != 0.0D || dest.y != 0.0D || dest.z != 0.0D; + float VOffset = dh.teleportTracker.lastTeleportArcDisplayOffset; + Vector3fc dest = dh.teleportTracker.getDestination(); + boolean validLocation = dest.x() != 0.0F || dest.y() != 0.0F || dest.z() != 0.0F; - byte alpha = -1; - Vec3i color; + final byte alpha; + final Vec3i color; if (!validLocation) { color = tpInvalidColor; @@ -348,9 +351,9 @@ public static void renderTeleportArc(PoseStack poseStack) { color = tpUnlimitedColor; } - VOffset = dh.vrRenderer.getCurrentTimeSecs() - * (double) dh.teleportTracker.vrMovementStyle.textureScrollSpeed * 0.6D; - dh.teleportTracker.lastTeleportArcDisplayOffset = VOffset; + VOffset = dh.teleportTracker.lastTeleportArcDisplayOffset = (float) dh.vrRenderer.getCurrentTimeSecs() + * dh.teleportTracker.vrMovementStyle.textureScrollSpeed * 0.6F; + alpha = -1; } float segmentHalfWidth = dh.teleportTracker.vrMovementStyle.beamHalfWidth * 0.15F; @@ -360,22 +363,27 @@ public static void renderTeleportArc(PoseStack poseStack) { segments = (int) (segments * dh.teleportTracker.movementTeleportProgress); } - double segmentProgress = 1.0D / (double) segments; + float segmentProgress = 1.0F / (float) segments; + Vector3fc camPos = convertToVector3f(mc.getCameraEntity().position(), new Vector3f()); // arc for (int i = 0; i < segments; ++i) { - double progress = (double) i / (double) segments + VOffset * segmentProgress; - int progressBase = roundUsing(progress, FLOOR); - progress -= progressBase; - - Vec3 start = dh.teleportTracker - .getInterpolatedArcPosition((float) (progress - segmentProgress * (double) 0.4F)) - .subtract(mc.getCameraEntity().position()); - - Vec3 end = dh.teleportTracker.getInterpolatedArcPosition((float) progress) - .subtract(mc.getCameraEntity().position()); - float shift = (float) progress * 2.0F; - RenderHelper.renderBox(tesselator, start, end, -segmentHalfWidth, segmentHalfWidth, (-1.0F + shift) * segmentHalfWidth, (1.0F + shift) * segmentHalfWidth, color, alpha, poseStack); + float progress = (float) i / segments + VOffset * segmentProgress; + progress -= roundUsing(progress, FLOOR); + float shift = progress * 2.0F; + + RenderHelper.renderBox( + tesselator, + convertToVec3(dh.teleportTracker.getInterpolatedArcPosition(progress - segmentProgress * 0.4F, new Vector3f()).sub(camPos)), + convertToVec3(dh.teleportTracker.getInterpolatedArcPosition(progress, new Vector3f()).sub(camPos)), + -segmentHalfWidth, + segmentHalfWidth, + (-1.0F + shift) * segmentHalfWidth, + (1.0F + shift) * segmentHalfWidth, + color, + alpha, + poseStack + ); } tesselator.end(); @@ -383,25 +391,22 @@ public static void renderTeleportArc(PoseStack poseStack) { // hit indicator if (validLocation && dh.teleportTracker.movementTeleportProgress >= 1.0D) { RenderSystem.disableCull(); - Vec3 vec34 = (new Vec3(dest.x, dest.y, dest.z)).subtract(mc.getCameraEntity().position()); + Vector3f vec34 = dest.sub(camPos, new Vector3f()); float offset = 0.01F; - double x = 0.0D; - double y = 0.0D; - double z = 0.0D; - y += offset; + vec34.y += offset; - RenderHelper.renderFlatQuad(vec34.add(x, y, z), 0.6F, 0.6F, 0.0F, (int) (color.getX() * 1.03D), + RenderHelper.renderFlatQuad(vec34, 0.6F, 0.6F, 0.0F, (int) (color.getX() * 1.03D), (int) (color.getY() * 1.03D), (int) (color.getZ() * 1.03D), 64, poseStack); - y += offset; + vec34.y += offset; - RenderHelper.renderFlatQuad(vec34.add(x, y, z), 0.4F, 0.4F, 0.0F, (int) (color.getX() * 1.04D), + RenderHelper.renderFlatQuad(vec34, 0.4F, 0.4F, 0.0F, (int) (color.getX() * 1.04D), (int) (color.getY() * 1.04D), (int) (color.getZ() * 1.04D), 64, poseStack); - y += offset; + vec34.y += offset; - RenderHelper.renderFlatQuad(vec34.add(x, y, z), 0.2F, 0.2F, 0.0F, (int) (color.getX() * 1.05D), + RenderHelper.renderFlatQuad(vec34, 0.2F, 0.2F, 0.0F, (int) (color.getX() * 1.05D), (int) (color.getY() * 1.05D), (int) (color.getZ() * 1.05D), 64, poseStack); RenderSystem.enableCull(); } diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java index 99323f5d6..64cef7112 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VREffectsHelper.java @@ -7,7 +7,6 @@ import com.mojang.blaze3d.vertex.*; import com.mojang.blaze3d.vertex.VertexFormat.Mode; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; @@ -24,11 +23,11 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult.Type; -import net.minecraft.world.phys.Vec3; import org.apache.commons.lang3.tuple.Triple; import org.joml.Matrix4f; import org.joml.Vector2f; import org.joml.Vector3f; +import org.joml.Vector3fc; import org.lwjgl.opengl.GL11C; import org.vivecraft.client.VivecraftVRMod; import org.vivecraft.client.Xplat; @@ -76,11 +75,11 @@ public static boolean isInsideOpaqueBlock(Vector3f in) { } } - public static Triple getNearOpaqueBlock(Vec3 in, double dist) { + public static Triple getNearOpaqueBlock(Vector3fc in, double dist) { if (mc.level == null) { return null; } else { - AABB aabb = new AABB(in.subtract(dist, dist, dist), in.add(dist, dist, dist)); + AABB aabb = new AABB(in.x() - dist, in.y() - dist, in.z() - dist, in.x() + dist, in.y() + dist, in.z() + dist); Stream stream = BlockPos.betweenClosedStream(aabb).filter((bp) -> mc.level.getBlockState(bp).isSolidRender(mc.level, bp)); Optional optional = stream.findFirst(); @@ -114,7 +113,8 @@ public static void drawScopeFB(PoseStack matrixStackIn, int i) { RenderSystem.setShaderTexture(0, new ResourceLocation("textures/misc/spyglass_scope.png")); RenderSystem.enableBlend(); matrixStackIn.last().pose().translate(0.0F, 0.0F, 0.00001F); - int light = LevelRenderer.getLightColor(mc.level, BlockPos.containing(dh.vrPlayer.vrdata_world_render.getController(i).getPosition())); + Vector3fc vector3f = dh.vrPlayer.vrdata_world_render.getController(i).getPosition(new Vector3f()); + int light = LevelRenderer.getLightColor(mc.level, BlockPos.containing(vector3f.x(), vector3f.y(), vector3f.z())); RenderHelper.drawSizedQuadWithLightmapCutout(720.0F, 720.0F, scale, light, matrixStackIn.last().pose()); matrixStackIn.popPose(); @@ -396,7 +396,7 @@ public static void renderVrFast(float partialTicks, boolean secondPass, boolean } // render hands in second pass when gui is open - boolean renderHandsSecond = RadialHandler.isShowing() || KeyboardHandler.isShowing() || Minecraft.getInstance().screen != null; + boolean renderHandsSecond = RadialHandler.isShowing() || KeyboardHandler.isShowing() || mc.screen != null; if (secondPass == renderHandsSecond) { // should render hands in second pass if menus are open, else in the first pass // only render the hands only once @@ -409,7 +409,7 @@ private static boolean shouldOccludeGui() { if (dh.currentPass != RenderPass.THIRD && dh.currentPass != RenderPass.CAMERA) { return !((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom() && mc.screen == null && !KeyboardHandler.isShowing() && !RadialHandler.isShowing() && dh.vrSettings.hudOcclusion - && !isInsideOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition().toVector3f()); + && !isInsideOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f())); } else { return true; } @@ -419,7 +419,7 @@ private static void renderGuiAndShadow(PoseStack poseStack, float partialTicks, if (shadowFirst) { VREffectsHelper.renderVrShadow(partialTicks, depthAlways, poseStack); } - if (Minecraft.getInstance().screen != null || !KeyboardHandler.isShowing()) { + if (mc.screen != null || !KeyboardHandler.isShowing()) { renderGuiLayer(partialTicks, depthAlways, poseStack); } if (!shadowFirst) { @@ -455,10 +455,9 @@ public static void renderVrShadow(float partialTicks, boolean depthAlways, PoseS poseStack.setIdentity(); RenderSystem.disableCull(); RenderHelper.applyVRModelView(dh.currentPass, poseStack); - Vec3 vec3 = dh.vrPlayer.vrdata_world_render - .getEye(dh.currentPass).getPosition(); - Vec3 interpolatedPlayerPos = ((GameRendererExtension) mc.gameRenderer).vivecraft$getRvePos(partialTicks); - Vec3 pos = interpolatedPlayerPos.subtract(vec3).add(0.0D, 0.005D, 0.0D); + Vector3f vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f()); + Vector3f interpolatedPlayerPos = ((GameRendererExtension) mc.gameRenderer).vivecraft$getRvePos(partialTicks, new Vector3f()); + Vector3f pos = interpolatedPlayerPos.sub(vec3.x(), vec3.y() - 0.005F, vec3.z()); RenderHelper.setupPolyRendering(true); RenderSystem.enableDepthTest(); @@ -528,7 +527,7 @@ public static void renderFireInFirstPerson() { float v0 = lerp(vMin, vMid, ShrinkRatio); float v1 = lerp(vMax, vMid, ShrinkRatio); float a = 0.3F; - float b = (float) (dh.vrPlayer.vrdata_world_render.getHeadPivot().y - ((GameRendererExtension) mc.gameRenderer).vivecraft$getRveY()); + float b = (float) (dh.vrPlayer.vrdata_world_render.getHeadPivot(new Vector3f()).y - ((GameRendererExtension) mc.gameRenderer).vivecraft$getRveY()); for (int i = 0; i < 4; ++i) { posestack.pushPose(); @@ -556,10 +555,10 @@ public static void renderPhysicalKeyboard(float partialTicks, PoseStack poseStac poseStack.setIdentity(); mc.getProfiler().push("applyPhysicalKeyboardModelView"); - Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition().toVector3f(); + Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f()); //convert previously calculated coords to world coords - Vector3f guiPos = VRPlayer.room_to_world_pos(KeyboardHandler.Pos_room, dh.vrPlayer.vrdata_world_render).toVector3f(); + Vector3f guiPos = VRPlayer.room_to_world_pos(KeyboardHandler.Pos_room, dh.vrPlayer.vrdata_world_render, new Vector3f()); poseStack.last().pose() .mul(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getMatrix()) @@ -604,7 +603,8 @@ private static void renderScreen(PoseStack poseStack, RenderTarget screenFramebu // cache fog distance float fogStart = RenderSystem.getShaderFogStart(); float[] color = new float[]{1.0F, 1.0F, 1.0F, 1.0F}; - if (!((GameRendererExtension) mc.gameRenderer).vivecraft$isInMenuRoom()) { + GameRendererExtension GRE = ((GameRendererExtension) mc.gameRenderer); + if (!GRE.vivecraft$isInMenuRoom()) { if (mc.screen == null) { color[3] = dh.vrSettings.hudOpacity; } @@ -639,8 +639,8 @@ private static void renderScreen(PoseStack poseStack, RenderTarget screenFramebu RenderSystem.enableDepthTest(); if (mc.level != null) { - if (isInsideOpaqueBlock(screenPos) || ((GameRendererExtension) mc.gameRenderer).vivecraft$isInBlock() > 0.0F) { - convertToVector3f(dh.vrPlayer.vrdata_world_render.hmd.getPosition(), screenPos); + if (isInsideOpaqueBlock(screenPos) || GRE.vivecraft$isInBlock() > 0.0F) { + dh.vrPlayer.vrdata_world_render.hmd.getPosition(screenPos); } int minLight = ShadersHelper.ShaderLight(); @@ -678,8 +678,11 @@ public static void renderGuiLayer(float partialTicks, boolean depthAlways, PoseS poseStack.pushPose(); poseStack.last().pose() .translate( - dh.vrPlayer.vrdata_world_render.origin.toVector3f() - .sub(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition().toVector3f()) + dh.vrPlayer.vrdata_world_render.origin + .sub( + dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f()), + new Vector3f() + ) ) // remove world rotation or the room doesn't align with the screen .rotateY(dh.vrPlayer.vrdata_world_render.rotation_radians); @@ -707,15 +710,15 @@ public static void renderGuiLayer(float partialTicks, boolean depthAlways, PoseS } } - public static void render2D(float partialTicks, RenderTarget framebuffer, Vec3 pos, Matrix4f rot, boolean depthAlways, PoseStack poseStack) { + public static void render2D(float partialTicks, RenderTarget framebuffer, Vector3fc pos, Matrix4f rot, boolean depthAlways, PoseStack poseStack) { if (!dh.bowTracker.isDrawing) { setupScreenRendering(poseStack, partialTicks); mc.getProfiler().push("apply2DModelView"); - Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition().toVector3f(); + Vector3f eye = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f()); - Vector3f guiPos = VRPlayer.room_to_world_pos(pos, dh.vrPlayer.vrdata_world_render).toVector3f(); + Vector3f guiPos = VRPlayer.room_to_world_pos(pos, dh.vrPlayer.vrdata_world_render, new Vector3f()); poseStack.last().pose() .translate(guiPos.sub(eye)) @@ -815,47 +818,48 @@ public static void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseSta // white crosshair, with blending RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - Vec3 crosshairRenderPos = ((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec(); - Vec3 aim = crosshairRenderPos.subtract(dh.vrPlayer.vrdata_world_render.getController(0).getPosition()); - float crossDepth = (float) aim.length(); + Vector3f crosshairRenderPos = ((GameRendererExtension) mc.gameRenderer).vivecraft$getCrossVec(new Vector3f()); + Vector3f aim = dh.vrPlayer.vrdata_world_render.getController(0).getPosition(new Vector3f()); + float crossDepth = crosshairRenderPos.sub(aim, aim).length(); float scale = 0.125F * dh.vrSettings.crosshairScale * sqrt(dh.vrPlayer.vrdata_world_render.worldScale); //scooch closer a bit for light calc. - crosshairRenderPos = crosshairRenderPos.add(aim.normalize().scale(-0.01D)); + crosshairRenderPos.add(aim.normalize().mul(-0.01F)); poseStack.pushPose(); poseStack.setIdentity(); RenderHelper.applyVRModelView(dh.currentPass, poseStack); - Vec3 translate = crosshairRenderPos.subtract(mc.getCameraEntity().position()); - poseStack.last().pose().translate((float) translate.x, (float) translate.y, (float) translate.z); + Vector3f translate = convertToVector3f(mc.getCameraEntity().position(), new Vector3f()); + crosshairRenderPos.sub(translate, translate); + poseStack.last().pose().translate(translate.x, translate.y, translate.z); if (mc.hitResult instanceof BlockHitResult hit && hit.getType() == Type.BLOCK) { switch (hit.getDirection()) { case DOWN -> { float ang1 = toRadians(dh.vrPlayer.vrdata_world_render.getController(0).getYaw()); - float ang2 = toRadians(-90.0F); + float ang2 = (float) PI / -2.0F; poseStack.last().pose().rotateY(ang1).rotateX(ang2); poseStack.last().normal().rotateY(ang1).rotateX(ang2); } case UP -> { float ang1 = toRadians(-dh.vrPlayer.vrdata_world_render.getController(0).getYaw()); - float ang2 = toRadians(90.0F); + float ang2 = (float) PI / 2.0F; poseStack.last().pose().rotateY(ang1).rotateX(ang2); poseStack.last().normal().rotateY(ang1).rotateX(ang2); } case WEST -> { - float ang = toRadians(90.0F); + float ang = (float) PI / 2.0F; poseStack.last().pose().rotateY(ang); poseStack.last().normal().rotateY(ang); } case EAST -> { - float ang = toRadians(-90.0F); + float ang = (float) PI / -2.0F; poseStack.last().pose().rotateY(ang); poseStack.last().normal().rotateY(ang); } case SOUTH -> { - float ang = toRadians(180.0F); + float ang = (float) PI; poseStack.last().pose().rotateY(ang); poseStack.last().normal().rotateY(ang); } @@ -891,11 +895,13 @@ public static void renderCrosshairAtDepth(boolean depthAlways, PoseStack poseSta RenderSystem.blendFuncSeparate( SourceFactor.ONE_MINUS_DST_COLOR, DestFactor.ZERO, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA ); - int light = LevelRenderer.getLightColor(mc.level, BlockPos.containing(crosshairRenderPos)); - float brightness = 1.0F; + int light = LevelRenderer.getLightColor(mc.level, BlockPos.containing(crosshairRenderPos.x(), crosshairRenderPos.y(), crosshairRenderPos.z())); + float brightness; if (mc.hitResult == null || mc.hitResult.getType() == Type.MISS) { brightness = 0.5F; + } else { + brightness = 1.0F; } TextureAtlasSprite crosshairSprite = mc.getGuiSprites().getSprite(Gui.CROSSHAIR_SPRITE); diff --git a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java index ada5b11ae..c9c5c41e5 100644 --- a/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java +++ b/common/src/main/java/org/vivecraft/client_vr/render/helpers/VRWidgetHelper.java @@ -17,6 +17,7 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.vivecraft.client_vr.extensions.GameRendererExtension; import org.vivecraft.client_vr.gameplay.trackers.CameraTracker; import org.vivecraft.client_vr.render.RenderPass; @@ -25,10 +26,12 @@ import java.util.function.Function; +import static org.joml.Math.PI; import static org.joml.Math.toRadians; import static org.vivecraft.client.utils.Utils.getCombinedLightWithMin; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; public class VRWidgetHelper { private static final RandomSource random = RandomSource.create(); @@ -70,7 +73,7 @@ public static void renderVRHandheldCameraWidget() { renderVRCameraWidget(-0.5F, -0.25F, -0.22F, f, RenderPass.CAMERA, CameraTracker.cameraModel, CameraTracker.cameraDisplayModel, () -> { - if (VREffectsHelper.getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(), ((GameRendererExtension) mc.gameRenderer).vivecraft$getMinClipDistance()) == null) { + if (VREffectsHelper.getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CAMERA).getPosition(new Vector3f()), ((GameRendererExtension) mc.gameRenderer).vivecraft$getMinClipDistance()) == null) { dh.vrRenderer.cameraFramebuffer.bindRead(); RenderSystem.setShaderTexture(0, dh.vrRenderer.cameraFramebuffer.getColorTextureId()); } else { @@ -88,18 +91,17 @@ public static void renderVRCameraWidget(float offsetX, float offsetY, float offs poseStack.setIdentity(); RenderHelper.applyVRModelView(dh.currentPass, poseStack); - Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition(); - Vec3 vec31 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); - Vec3 vec32 = vec3.subtract(vec31); + Vector3f vec32 = dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition(new Vector3f()) + .sub(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f())); poseStack.last().pose() - .translate((float) vec32.x, (float) vec32.y, (float) vec32.z) + .translate(vec32.x, vec32.y, vec32.z) .mul(dh.vrPlayer.vrdata_world_render.getEye(renderPass).getMatrix()); scale *= dh.vrPlayer.vrdata_world_render.worldScale; poseStack.scale(scale, scale, scale); if (debug) { - float ang = toRadians(180.0F); + float ang = (float) PI; poseStack.last().pose().rotateY(ang); poseStack.last().normal().rotateY(ang); RenderHelper.renderDebugAxes(0, 0, 0, 0.08F); @@ -110,7 +112,7 @@ public static void renderVRCameraWidget(float offsetX, float offsetY, float offs poseStack.last().pose().translate(offsetX, offsetY, offsetZ); RenderSystem.applyModelViewMatrix(); - BlockPos blockpos = BlockPos.containing(dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition()); + BlockPos blockpos = BlockPos.containing(convertToVec3(dh.vrPlayer.vrdata_world_render.getEye(renderPass).getPosition(new Vector3f()))); int i = getCombinedLightWithMin(mc.level, blockpos, 0); RenderSystem.enableDepthTest(); diff --git a/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java b/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java index f27ca840b..63bd42e44 100644 --- a/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java +++ b/common/src/main/java/org/vivecraft/client_vr/settings/VRHotkeys.java @@ -232,24 +232,24 @@ private static void adjustCamRot(float axisX, float axisY, float axisZ, float de } public static void snapMRCam(int controller) { - Vec3 vec3 = dh.vrPlayer.vrdata_room_pre.getController(controller).getPosition(); - dh.vrSettings.vrFixedCamposX = (float) vec3.x; - dh.vrSettings.vrFixedCamposY = (float) vec3.y; - dh.vrSettings.vrFixedCamposZ = (float) vec3.z; + Vector3f vec3 = dh.vrPlayer.vrdata_room_pre.getController(controller).getPosition(new Vector3f()); + dh.vrSettings.vrFixedCamposX = vec3.x; + dh.vrSettings.vrFixedCamposY = vec3.y; + dh.vrSettings.vrFixedCamposZ = vec3.z; dh.vrSettings.vrFixedCamrotQuat.setFromNormalized(dh.vrPlayer.vrdata_room_pre.getController(controller).getMatrix()); } public static void updateMovingThirdPersonCam() { if (startControllerPose != null) { VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_room_pre.getController(startController); - Vec3 vec3 = startControllerPose.getPosition(); - Vec3 vec31 = vrdata$vrdevicepose.getPosition().subtract(vec3); + Vector3f vec3 = startControllerPose.getPosition(new Vector3f()); + Vector3f vec31 = vrdata$vrdevicepose.getPosition(new Vector3f()).sub(vec3); Matrix4f matrix4f = vrdata$vrdevicepose.getMatrix().mul0(startControllerPose.getMatrix().invertAffine(), new Matrix4f()); - Vector3f vector3 = new Vector3f(startCamposX - (float) vec3.x, startCamposY - (float) vec3.y, startCamposZ - (float) vec3.z); + Vector3f vector3 = new Vector3f(startCamposX - vec3.x, startCamposY - vec3.y, startCamposZ - vec3.z); Vector3f vector31 = matrix4f.transformProject(vector3, new Vector3f()); - dh.vrSettings.vrFixedCamposX = startCamposX + (float) vec31.x + (vector31.x - vector3.x); - dh.vrSettings.vrFixedCamposY = startCamposY + (float) vec31.y + (vector31.y - vector3.y); - dh.vrSettings.vrFixedCamposZ = startCamposZ + (float) vec31.z + (vector31.z - vector3.z); + dh.vrSettings.vrFixedCamposX = startCamposX + vec31.x + (vector31.x - vector3.x); + dh.vrSettings.vrFixedCamposY = startCamposY + vec31.y + (vector31.y - vector3.y); + dh.vrSettings.vrFixedCamposZ = startCamposZ + vec31.z + (vector31.z - vector3.z); dh.vrSettings.vrFixedCamrotQuat.setFromNormalized(matrix4f); startCamrotQuat.mul(dh.vrSettings.vrFixedCamrotQuat, dh.vrSettings.vrFixedCamrotQuat); } diff --git a/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java b/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java index 1cf6a883b..687669964 100644 --- a/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java +++ b/common/src/main/java/org/vivecraft/common/network/VRPlayerState.java @@ -3,11 +3,13 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.phys.Vec3; import org.joml.Quaternionf; +import org.joml.Vector3f; import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.render.RenderPass; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; public record VRPlayerState(boolean seated, Pose hmd, boolean reverseHands, Pose controller0, boolean reverseHands1legacy, Pose controller1) { @@ -24,13 +26,13 @@ public static VRPlayerState create(VRPlayer vrPlayer) { } private static Pose hmdPose(VRPlayer vrPlayer) { - Vec3 vec3 = vrPlayer.vrdata_world_post.getEye(RenderPass.CENTER).getPosition().subtract(mc.player.position()); + Vec3 vec3 = convertToVec3(vrPlayer.vrdata_world_post.getEye(RenderPass.CENTER).getPosition(new Vector3f())).subtract(mc.player.position()); Quaternionf quaternion = new Quaternionf().setFromNormalized(vrPlayer.vrdata_world_post.hmd.getMatrix()); return new Pose(vec3, quaternion); } private static Pose controllerPose(VRPlayer vrPlayer, int i) { - Vec3 position = vrPlayer.vrdata_world_post.getController(i).getPosition().subtract(mc.player.position()); + Vec3 position = convertToVec3(vrPlayer.vrdata_world_post.getController(i).getPosition(new Vector3f())).subtract(mc.player.position()); Quaternionf orientation = new Quaternionf().setFromNormalized(vrPlayer.vrdata_world_post.getController(i).getMatrix()); return new Pose(position, orientation); } diff --git a/common/src/main/java/org/vivecraft/common/utils/Utils.java b/common/src/main/java/org/vivecraft/common/utils/Utils.java index 698d90a51..d03c4876b 100644 --- a/common/src/main/java/org/vivecraft/common/utils/Utils.java +++ b/common/src/main/java/org/vivecraft/common/utils/Utils.java @@ -86,7 +86,7 @@ public static Color convertToColor(@Nullable net.minecraft.world.phys.Vec3 vecto * This function is helpful for handling Optfine methods. * * @param color the color to convert. - * @return a new {@link net.minecraft.world.phys.Vec3} whose x, y, and z components are equal to the {@link Color#r}, {@link Color#g}, and {@link Color#b} components of {@code color}. + * @return a new {@link net.minecraft.world.phys.Vec3} whose x, y, and z components are equal to the {@link Color#r}, {@link Color#g}, and {@link Color#b} components as {@code color}. * @apiNote Use this function whenever reasonably possible. *
* {@link net.minecraft.world.phys.Vec3} is superseded by {@link Vector3d} in any color context. @@ -101,7 +101,7 @@ public static net.minecraft.world.phys.Vec3 convertToVec3(Color color) { * * @param vector the vector to copy. * @param dest the {@link Vector3d} to save to. - * @return the {@code dest} containing the same x, y, and z components of vector. + * @return the {@code dest} containing the same x, y, and z components as {@code vector}. * @apiNote Use this function whenever reasonably possible. *
* {@link net.minecraft.world.phys.Vec3} is superseded by {@link Vector3d} in any math context. @@ -116,7 +116,7 @@ public static Vector3d convertToVector3d(@Nullable net.minecraft.world.phys.Vec3 * * @param vector the vector to copy. * @param dest the {@link Vector3f} to save to. - * @return the {@code dest} containing the same x, y, and z components of vector. + * @return the {@code dest} containing the same x, y, and z components as {@code vector}. * @apiNote Use this function only when float values are required! *
* When converting {@link net.minecraft.world.phys.Vec3}, prefer this function over @@ -128,11 +128,28 @@ public static Vector3f convertToVector3f(@Nullable net.minecraft.world.phys.Vec3 return vector != null ? dest.set((float) vector.x, (float) vector.y, (float) vector.z) : dest; } + /** + * Convert a {@link net.minecraft.core.Vec3i} to a {@link Vector3f}. + * + * @param vector the vector to copy. + * @param dest the {@link Vector3f} to save to. + * @return the {@code dest} containing the same x, y, and z components as {@code vector}. + * @apiNote Use this function only when float values are required! + *
+ * When converting {@link net.minecraft.world.phys.Vec3}, prefer this function over + * {@link net.minecraft.world.phys.Vec3#toVector3f()} + * to avoid creating multiple objects. + * @see Utils#convertToVec3(Vector3fc) + */ + public static Vector3f convertToVector3f(@Nullable net.minecraft.core.Vec3i vector, @Nonnull Vector3f dest) { + return vector != null ? dest.set(vector.getX(), vector.getY(), vector.getZ()) : dest; + } + /** * Convert a JOML {@link Vector3d} to a {@link net.minecraft.world.phys.Vec3}. * * @param vector the vector to copy. - * @return a new Vec3 containing the same x, y, and z components of vector. + * @return a new Vec3 containing the same x, y, and z components as {@code vector}. * @apiNote Avoid this function whenever reasonably possible. *
* If there is an x, y, z signature alternative, @@ -148,7 +165,7 @@ public static net.minecraft.world.phys.Vec3 convertToVec3(Vector3dc vector) { * Convert a JOML {@link Vector3f} to a {@link net.minecraft.world.phys.Vec3}. * * @param vector the vector to copy. - * @return a new Vec3 containing the same x, y, and z components of vector. + * @return a new Vec3 containing the same x, y, and z components as {@code vector}. * @apiNote Avoid this function whenever reasonably possible. *
* If there is an x, y, z signature alternative, diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java index 03bf43982..d6f065333 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/MinecraftVRMixin.java @@ -971,15 +971,15 @@ public abstract class MinecraftVRMixin implements MinecraftExtension { // set viewport to fullscreen, since it would be still on the one from the last pass RenderSystem.viewport(0, 0, this.window.getScreenWidth(), this.window.getScreenHeight()); - Vec3 camPlayer = dh.vrPlayer.vrdata_room_pre.getHeadPivot() - .subtract(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition()); + Vector3f camPlayer = dh.vrPlayer.vrdata_room_pre.getHeadPivot(new Vector3f()) + .sub(dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getPosition(new Vector3f())); Matrix4f viewMatrix = dh.vrPlayer.vrdata_room_pre.getEye(RenderPass.THIRD).getMatrix(); Vector3f cameraLook = viewMatrix.transformProject(forward, new Vector3f()); // set uniforms VRShaders._DepthMask_projectionMatrix.set(((GameRendererExtension) mc.gameRenderer).vivecraft$getThirdPassProjectionMatrix()); VRShaders._DepthMask_viewMatrix.set(viewMatrix); - VRShaders._DepthMask_hmdViewPosition.set((float) camPlayer.x, (float) camPlayer.y, (float) camPlayer.z); + VRShaders._DepthMask_hmdViewPosition.set(camPlayer.x, camPlayer.y, camPlayer.z); VRShaders._DepthMask_hmdPlaneNormal.set(-cameraLook.x(), 0.0F, -cameraLook.z()); boolean alphaMask = dh.vrSettings.mixedRealityUnityLike && dh.vrSettings.mixedRealityAlphaMask; diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java index 0367e5338..6110b80c2 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/ClientPacketListenerVRMixin.java @@ -10,6 +10,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -100,7 +101,7 @@ protected ClientPacketListenerVRMixin(net.minecraft.client.Minecraft minecraft, } if (dh.vrSettings.chatNotifications == ChatNotifications.SOUND || dh.vrSettings.chatNotifications == ChatNotifications.BOTH) { - Vec3 vec3 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(); + Vector3f vec3 = dh.vrPlayer.vrdata_world_pre.getController(1).getPosition(new Vector3f()); mc.level.playLocalSound(vec3.x(), vec3.y(), vec3.z(), BuiltInRegistries.SOUND_EVENT.get(new ResourceLocation(dh.vrSettings.chatNotificationSound)), SoundSource.NEUTRAL, 0.3F, 0.1F, false); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java index e490aae8b..28f1632d1 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/multiplayer/MultiPlayerGameModeVRMixin.java @@ -5,6 +5,7 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -14,6 +15,7 @@ import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.vrRunning; +import static org.vivecraft.common.utils.Utils.convertToVector3f; @Mixin(net.minecraft.client.multiplayer.MultiPlayerGameMode.class) @@ -36,7 +38,7 @@ public class MultiPlayerGameModeVRMixin { @Inject(at = @At("HEAD"), method = "useItemOn") public void vivecraft$overrideUseOn(LocalPlayer localPlayer, InteractionHand interactionHand, BlockHitResult blockHitResult, CallbackInfoReturnable cir) { if (vrRunning) { - ClientNetworking.overrideLook(localPlayer, blockHitResult.getLocation().subtract(localPlayer.getEyePosition(1.0F)).normalize()); + ClientNetworking.overrideLook(localPlayer, convertToVector3f(blockHitResult.getLocation().subtract(localPlayer.getEyePosition(1.0F)).normalize(), new Vector3f())); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java index 33026e272..2fa7d4592 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/particle/ItemPickupParticleVRMixin.java @@ -1,7 +1,7 @@ package org.vivecraft.mixin.client_vr.particle; import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -27,12 +27,12 @@ public class ItemPickupParticleVRMixin { private Entity itemEntity; @Unique - private Vec3 vivecraft$playerPos; + private final Vector3f vivecraft$playerPos = new Vector3f(); @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;lerp(DDD)D", ordinal = 0), method = "render") public double vivecraft$updateX(double d, double e, double f) { if (vrRunning && this.target == mc.player) { - this.vivecraft$playerPos = RenderHelper.getControllerRenderPos(0); + RenderHelper.getControllerRenderPos(0, this.vivecraft$playerPos); e = f = this.vivecraft$playerPos.x; } @@ -59,7 +59,6 @@ public class ItemPickupParticleVRMixin { public double vivecraft$updateZ(double d, double e, double f) { if (vrRunning && this.target == mc.player) { e = f = this.vivecraft$playerPos.z; - this.vivecraft$playerPos = null; } return lerp(e, f, d); diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java index 795144ce6..4af1f1641 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/player/LocalPlayerVRMixin.java @@ -3,7 +3,6 @@ import com.mojang.authlib.GameProfile; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.player.AbstractClientPlayer; @@ -26,6 +25,7 @@ import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -61,9 +61,6 @@ public abstract class LocalPlayerVRMixin extends AbstractClientPlayer implements private double vivecraft$additionX; @Unique private double vivecraft$additionZ; - @Final - @Shadow - protected Minecraft minecraft; @Shadow private boolean startedUsingItem; @Shadow @@ -143,21 +140,21 @@ public LocalPlayerVRMixin(ClientLevel clientLevel, GameProfile gameProfile) { // clear teleport here, after all the packets would be sent this.vivecraft$teleported = false; if (vrRunning && dh.vrSettings.walkUpBlocks) { - this.minecraft.options.autoJump().set(false); + mc.options.autoJump().set(false); } } @Override @Unique public void vivecraft$swingArm(InteractionHand interactionhand, VRFirstPersonArmSwing interact) { - ((ItemInHandRendererExtension) this.minecraft.getEntityRenderDispatcher().getItemInHandRenderer()).vivecraft$setSwingType(interact); + ((ItemInHandRendererExtension) mc.getEntityRenderDispatcher().getItemInHandRenderer()).vivecraft$setSwingType(interact); this.swing(interactionhand); } @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;aiStep()V"), method = "aiStep") public void vivecraft$ai(CallbackInfo ci) { if (vrRunning) { - dh.vrPlayer.tick((LocalPlayer) (Object) this, this.minecraft, this.random); + dh.vrPlayer.tick((LocalPlayer) (Object) this); } } @@ -179,7 +176,7 @@ public LocalPlayerVRMixin(ClientLevel clientLevel, GameProfile gameProfile) { flag1 = true; } - Vec3 vec3 = dh.vrPlayer.roomOrigin; + Vector3f vec3 = dh.vrPlayer.roomOrigin; if ((dh.climbTracker.isGrabbingLadder() || flag || dh.swimTracker.isActive()) @@ -282,15 +279,13 @@ public void setPos(double x, double y, double z) { Entity entity = this.getVehicle(); if (this.isPassenger()) { - Vec3 vec3 = dh.vehicleTracker.Premount_Pos_Room; - vec3 = vec3.yRot(dh.vrPlayer.vrdata_world_pre.rotation_radians); - x = x - vec3.x; + Vector3f vec3 = dh.vehicleTracker.Premount_Pos_Room.rotateY(dh.vrPlayer.vrdata_world_pre.rotation_radians, new Vector3f()); + x -= vec3.x; y = dh.vehicleTracker.getVehicleFloor(entity, y); - z = z - vec3.z; + z -= vec3.z; dh.vrPlayer.setRoomOrigin(x, y, z, x + y + z == 0.0D); } else { - Vec3 vec31 = dh.vrPlayer.roomOrigin; - dh.vrPlayer.setRoomOrigin(vec31.x + (d3 - d0), vec31.y + (d4 - d1), vec31.z + (d5 - d2), x + y + z == 0.0D); + dh.vrPlayer.setRoomOrigin(dh.vrPlayer.roomOrigin.x + (d3 - d0), dh.vrPlayer.roomOrigin.y + (d4 - d1), dh.vrPlayer.roomOrigin.z + (d5 - d2), x + y + z == 0.0D); } } @@ -412,10 +407,10 @@ public void moveRelative(float pAmount, Vec3 pRelative) { case RUN_IN_PLACE -> { vec3 = vec3.yRot((float) -dh.runTracker.getYaw()); vec3 = vec3.scale(dh.runTracker.getSpeed()); - vec3 = vec3.yRot(toRadians(180.0F + dh.vrSettings.worldRotation)); + vec3 = vec3.yRot((float) PI + toRadians(dh.vrSettings.worldRotation)); } case ROOM -> { - vec3 = vec3.yRot(toRadians(180.0F + dh.vrSettings.worldRotation)); + vec3 = vec3.yRot((float) PI + toRadians(dh.vrSettings.worldRotation)); } } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java index e4d04387a..c67eeca0f 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/GameRendererVRMixin.java @@ -20,6 +20,7 @@ import net.minecraft.world.phys.Vec3; import org.apache.commons.lang3.tuple.Triple; import org.joml.Matrix4f; +import org.joml.Vector3f; import org.lwjgl.opengl.GL11C; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -50,6 +51,8 @@ import static org.joml.Math.*; import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.convertToVec3; +import static org.vivecraft.common.utils.Utils.convertToVector3f; @Mixin(GameRenderer.class) public abstract class GameRendererVRMixin @@ -57,8 +60,10 @@ public abstract class GameRendererVRMixin @Unique public float vivecraft$minClipDistance = 0.02F; + + // TODO: @Nonnull and remove @CheckForNull @Unique - public Vec3 vivecraft$crossVec; + public Vector3f vivecraft$crossVec; @Unique public Matrix4f vivecraft$thirdPassProjectionMatrix = new Matrix4f(); @Unique @@ -195,8 +200,10 @@ public abstract class GameRendererVRMixin return original; } mc.hitResult = dh.vrPlayer.rayTraceBlocksVR(dh.vrPlayer.vrdata_world_render, 0, mc.gameMode.getPickRange(), false); - this.vivecraft$crossVec = dh.vrPlayer.AimedPointAtDistance(dh.vrPlayer.vrdata_world_render, 0, mc.gameMode.getPickRange()); - return dh.vrPlayer.vrdata_world_render.getController(0).getPosition(); + Vector3f dest = new Vector3f(); + this.vivecraft$getCrossVec(dest); + this.vivecraft$crossVec = dh.vrPlayer.AimedPointAtDistance(dh.vrPlayer.vrdata_world_render, 0, mc.gameMode.getPickRange(), dest); + return convertToVec3(dh.vrPlayer.vrdata_world_render.getController(0).getPosition(new Vector3f())); } @ModifyVariable(at = @At("STORE"), method = "pick(F)V", ordinal = 1) @@ -204,7 +211,7 @@ public abstract class GameRendererVRMixin if (!vrRunning) { return original; } - return dh.vrPlayer.vrdata_world_render.getController(0).getDirection(); + return convertToVec3(dh.vrPlayer.vrdata_world_render.getController(0).getDirection(new Vector3f())); } //TODO Vivecraft add riding check in case your hand is somewhere inappropriate @@ -268,7 +275,7 @@ public abstract class GameRendererVRMixin posestack.scale(this.zoom, this.zoom, 1.0F); } yield view.perspective( - (float) toRadians(d), + toRadians((float) d), (float) mc.getWindow().getScreenWidth() / (float) mc.getWindow().getScreenHeight(), 0.05F, this.vivecraft$clipDistance @@ -468,7 +475,9 @@ public abstract class GameRendererVRMixin this.pick(pPartialTicks); if (mc.hitResult != null && mc.hitResult.getType() != Type.MISS) { - this.vivecraft$crossVec = mc.hitResult.getLocation(); + Vector3f dest = new Vector3f(); + this.vivecraft$getCrossVec(dest); + this.vivecraft$crossVec = convertToVector3f(mc.hitResult.getLocation(), dest); } if (mc.screen == null) { @@ -539,7 +548,7 @@ public abstract class GameRendererVRMixin public void vivecraft$setupRVE() { if (this.vivecraft$cached) { VRDevicePose vrdata$vrdevicepose = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass); - Vec3 vec3 = vrdata$vrdevicepose.getPosition(); + Vector3f vec3 = vrdata$vrdevicepose.getPosition(new Vector3f()); LivingEntity livingentity = (LivingEntity) mc.getCameraEntity(); livingentity.setPosRaw(vec3.x, vec3.y, vec3.z); livingentity.xOld = vec3.x; @@ -611,8 +620,8 @@ public abstract class GameRendererVRMixin @Override @Unique - public Vec3 vivecraft$getRvePos(float partialTicks) { - return new Vec3( + public Vector3f vivecraft$getRvePos(float partialTicks, Vector3f dest) { + return dest.set( lerp(this.vivecraft$rvelastX, this.vivecraft$rveX, partialTicks), lerp(this.vivecraft$rvelastY, this.vivecraft$rveY, partialTicks), lerp(this.vivecraft$rvelastZ, this.vivecraft$rveZ, partialTicks) @@ -626,8 +635,7 @@ public abstract class GameRendererVRMixin this.vivecraft$onfire = false; if (!mc.player.isSpectator() && !this.vivecraft$isInMenuRoom() && mc.player.isAlive()) { - Vec3 vec3 = dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(); - Triple triple = VREffectsHelper.getNearOpaqueBlock(vec3, this.vivecraft$minClipDistance); + Triple triple = VREffectsHelper.getNearOpaqueBlock(dh.vrPlayer.vrdata_world_render.getEye(dh.currentPass).getPosition(new Vector3f()), this.vivecraft$minClipDistance); if (triple != null && !Xevents.renderBlockOverlay(mc.player, new PoseStack(), triple.getMiddle(), triple.getRight())) { this.vivecraft$inBlock = triple.getLeft(); @@ -704,8 +712,8 @@ public abstract class GameRendererVRMixin @Override @Unique @CheckForNull - public Vec3 vivecraft$getCrossVec() { - return this.vivecraft$crossVec; + public Vector3f vivecraft$getCrossVec(Vector3f dest) { + return this.vivecraft$crossVec != null ? dest.set(this.vivecraft$crossVec) : null; } @Override diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java index a5a9a3aa8..40f683ee5 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/ItemInHandRendererVRMixin.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.Minecraft; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.ItemInHandRenderer; import net.minecraft.client.renderer.MultiBufferSource; @@ -33,18 +32,13 @@ import org.vivecraft.client_vr.render.helpers.VREffectsHelper; import static org.joml.Math.*; -import static org.vivecraft.client_vr.VRState.dh; -import static org.vivecraft.client_vr.VRState.vrRunning; +import static org.vivecraft.client_vr.VRState.*; @Mixin(value = ItemInHandRenderer.class, priority = 999) public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExtension { @Unique private VRFirstPersonArmSwing vivecraft$swingType = VRFirstPersonArmSwing.Attack; - - @Final - @Shadow - private Minecraft minecraft; @Final @Shadow private EntityRenderDispatcher entityRenderDispatcher; @@ -139,14 +133,14 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt pMatrixStack.pushPose(); pMatrixStack.scale(0.625F, 0.625F, 0.625F); pMatrixStack.last().pose().translate(mainHand ? -0.53F : -0.47F, -0.5F, -0.6F); - //pMatrixStack.last().pose().rotateX(toRadians(180.0F)); - //pMatrixStack.last().normal().rotateX(toRadians(180.0F)); - this.minecraft.getBlockRenderer().getModelRenderer().renderModel(pMatrixStack.last(), pBuffer.getBuffer(Sheets.solidBlockSheet()), null, this.minecraft.getModelManager().getModel(TelescopeTracker.scopeModel), 0.5F, 0.5F, 1.0F, pCombinedLight, OverlayTexture.NO_OVERLAY); + //pMatrixStack.last().pose().rotateX((float) PI); + //pMatrixStack.last().normal().rotateX((float) PI); + mc.getBlockRenderer().getModelRenderer().renderModel(pMatrixStack.last(), pBuffer.getBuffer(Sheets.solidBlockSheet()), null, mc.getModelManager().getModel(TelescopeTracker.scopeModel), 0.5F, 0.5F, 1.0F, pCombinedLight, OverlayTexture.NO_OVERLAY); pMatrixStack.popPose(); } - float ang1 = toRadians(90.0F); - float ang2 = toRadians(180.0F); + float ang1 = (float) PI / 2.0F; + float ang2 = (float) PI; pMatrixStack.pushPose(); pMatrixStack.last().pose() @@ -186,7 +180,7 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt private void vivecraft$vrPlayerArm(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, float g, HumanoidArm humanoidArm) { boolean flag = humanoidArm != HumanoidArm.LEFT; float h = flag ? 1.0F : -1.0F; - AbstractClientPlayer abstractclientplayer = this.minecraft.player; + AbstractClientPlayer abstractclientplayer = mc.player; RenderSystem.setShaderTexture(0, abstractclientplayer.getSkin().texture()); VRArmRenderer vrarmrenderer = ((EntityRenderDispatcherVRExtension) this.entityRenderDispatcher).vivecraft$getArmSkinMap().get(abstractclientplayer.getSkin().model().id()); poseStack.pushPose(); @@ -212,8 +206,8 @@ public abstract class ItemInHandRendererVRMixin implements ItemInHandRendererExt x offset: (5 - 1 + 4*0.5) / 16 = 0.375 z offset: (-2 + 2 + 12) / 16 = 0.75 */ - float ang1 = toRadians(-90); - float ang2 = toRadians(180); + float ang1 = (float) PI / -2.0F; + float ang2 = (float) PI; poseStack.last().pose() .translate((slim ? -0.34375F : -0.375F) * h, 0.0F, slim ? 0.78125F : 0.75F) diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java index 69d5263ea..b0547b6bf 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/LevelRendererVRMixin.java @@ -15,6 +15,7 @@ import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.phys.shapes.VoxelShape; import org.joml.Matrix4f; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -36,6 +37,7 @@ import javax.annotation.Nullable; import static org.vivecraft.client_vr.VRState.*; +import static org.vivecraft.common.utils.Utils.convertToVec3; // priority 999 to inject before iris, for the vrFast rendering @Mixin(value = LevelRenderer.class, priority = 999) @@ -100,7 +102,7 @@ private static void renderShape(PoseStack poseStack, VertexConsumer vertexConsum @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 0), method = "renderSnowAndRain") public double vivecraft$rainX(double x) { if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { - return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().x; + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition(new Vector3f()).x; } return x; } @@ -108,7 +110,7 @@ private static void renderShape(PoseStack poseStack, VertexConsumer vertexConsum @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 1), method = "renderSnowAndRain") public double vivecraft$rainY(double y) { if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { - return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().y; + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition(new Vector3f()).y; } return y; } @@ -116,7 +118,7 @@ private static void renderShape(PoseStack poseStack, VertexConsumer vertexConsum @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;floor(D)I", ordinal = 2), method = "renderSnowAndRain") public double vivecraft$rainZ(double z) { if (!RenderPassType.isVanilla() && (dh.currentPass == RenderPass.LEFT || dh.currentPass == RenderPass.RIGHT)) { - return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition().z; + return dh.vrPlayer.vrdata_world_render.getEye(RenderPass.CENTER).getPosition(new Vector3f()).z; } return z; } @@ -208,7 +210,7 @@ private static void renderShape(PoseStack poseStack, VertexConsumer vertexConsum } for (int c = 0; c < 2; c++) { if (dh.interactTracker.isInteractActive(c) && (dh.interactTracker.inBlockHit[c] != null || dh.interactTracker.bukkit[c])) { - BlockPos blockpos = dh.interactTracker.inBlockHit[c] != null ? dh.interactTracker.inBlockHit[c].getBlockPos() : BlockPos.containing(dh.vrPlayer.vrdata_world_render.getController(c).getPosition()); + BlockPos blockpos = dh.interactTracker.inBlockHit[c] != null ? dh.interactTracker.inBlockHit[c].getBlockPos() : BlockPos.containing(convertToVec3(dh.vrPlayer.vrdata_world_render.getController(c).getPosition(new Vector3f()))); BlockState blockstate = this.level.getBlockState(blockpos); this.renderHitOutline(poseStack, this.renderBuffers.bufferSource().getBuffer(RenderType.lines()), camera.getEntity(), vec3.x, vec3.y, vec3.z, blockpos, blockstate); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java index 7190f8098..d734c7bc8 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/EntityRenderDispatcherVRMixin.java @@ -3,8 +3,8 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.world.entity.Entity; -import net.minecraft.world.phys.Vec3; import org.joml.Quaternionf; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; @@ -26,6 +26,7 @@ import static org.joml.Math.atan2; import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVector3f; @Mixin(net.minecraft.client.renderer.entity.EntityRenderDispatcher.class) @@ -51,14 +52,19 @@ public abstract class EntityRenderDispatcherVRMixin implements if (entity == null) { cir.setReturnValue(this.camera.rotation()); } else { - Vec3 vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + final Vector3f vec3; if (dh.currentPass == RenderPass.THIRD || dh.currentPass == RenderPass.CAMERA) { - vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); + vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(new Vector3f()); + } else { + vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f()); } - Vec3 vec31 = entity.position().add(0.0D, entity.getBbHeight() / 2.0F, 0.0D).subtract(vec3).normalize(); + Vector3f vec31 = convertToVector3f(entity.position(), new Vector3f()) + .add(0.0F, entity.getBbHeight() / 2.0F, 0.0F) + .sub(vec3) + .normalize(); cir.setReturnValue(new Quaternionf() - .mul(new Quaternionf().rotationY((float) -atan2(-vec31.x, vec31.z))) - .mul(new Quaternionf().rotationX((float) -asin(vec31.y / vec31.length()))) + .mul(new Quaternionf().rotationY(-atan2(-vec31.x, vec31.z))) + .mul(new Quaternionf().rotationX(-asin(vec31.y / vec31.length()))) ); } } @@ -82,14 +88,19 @@ public abstract class EntityRenderDispatcherVRMixin implements if (entity == null) { return this.camera.rotation(); } else { - Vec3 vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + final Vector3f vec3; if (dh.currentPass == RenderPass.THIRD || dh.currentPass == RenderPass.CAMERA) { - vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); + vec3 = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(new Vector3f()); + } else { + vec3 = dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f()); } - Vec3 vec31 = entity.position().add(0.0D, entity.getBbHeight() + offset, 0.0D).subtract(vec3).normalize(); + Vector3f vec31 = convertToVector3f(entity.position(), new Vector3f()) + .add(0.0F, entity.getBbHeight() + offset, 0.0F) + .sub(vec3) + .normalize(); return (new Quaternionf() - .mul(new Quaternionf().rotationY((float) -atan2(-vec31.x, vec31.z))) - .mul(new Quaternionf().rotationX((float) -asin(vec31.y / vec31.length()))) + .mul(new Quaternionf().rotationY(-atan2(-vec31.x, vec31.z))) + .mul(new Quaternionf().rotationX(-asin(vec31.y / vec31.length()))) ); } } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java index 7c41282f0..0aeae039a 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/FishingHookRendererVRMixin.java @@ -3,8 +3,9 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider.Context; import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.FishingRodItem; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.vivecraft.client_vr.render.helpers.RenderHelper; @@ -21,20 +22,26 @@ protected FishingHookRendererVRMixin(Context context) { super(context); } - private Vec3 vivecraft$CachedHandPos; + @Unique + private final Vector3f vivecraft$CachedHandPos = new Vector3f(); @ModifyVariable(at = @At("LOAD"), method = "render(Lnet/minecraft/world/entity/projectile/FishingHook;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", index = 25) private double vivecraft$fishingLineStartX(double value, FishingHook fishingHook) { if (!RenderPassType.isVanilla() && (this.entityRenderDispatcher.options == null || this.entityRenderDispatcher.options.getCameraType().isFirstPerson()) && fishingHook.getPlayerOwner() == mc.player) { - int j = 1; + final int j; if (fishingHook.getPlayerOwner().getMainHandItem().getItem() instanceof FishingRodItem) { j = 0; + } else { + j = 1; } - Vec3 vec31 = RenderHelper.getControllerRenderPos(j); - Vec3 vec32 = dh.vrPlayer.vrdata_world_render.getHand(j).getDirection(); - this.vivecraft$CachedHandPos = vec31.add(vec32.scale(0.47 * dh.vrPlayer.vrdata_world_render.worldScale)); - return this.vivecraft$CachedHandPos.x; + RenderHelper.getControllerRenderPos(j, this.vivecraft$CachedHandPos); + return ( + this.vivecraft$CachedHandPos.add( + dh.vrPlayer.vrdata_world_render.getHand(j).getDirection(new Vector3f()) + .mul(0.47F * dh.vrPlayer.vrdata_world_render.worldScale) + ).x + ); } else { return value; } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java index d66ad5bbe..8cc08f99f 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/GuardianRendererVRMixin.java @@ -3,6 +3,7 @@ import net.minecraft.client.renderer.entity.GuardianRenderer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -12,6 +13,7 @@ import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; @Mixin(GuardianRenderer.class) public abstract class GuardianRendererVRMixin { @@ -22,7 +24,7 @@ public abstract class GuardianRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/GuardianRenderer;getPosition(Lnet/minecraft/world/entity/LivingEntity;DF)Lnet/minecraft/world/phys/Vec3;"), method = "render(Lnet/minecraft/world/entity/monster/Guardian;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V") public Vec3 vivecraft$changeEye(GuardianRenderer instance, LivingEntity livingEntity, double d, float f) { if (!RenderPassType.isVanilla() && livingEntity == mc.getCameraEntity()) { - return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().subtract(0.0D, 0.3D * (double) dh.vrPlayer.worldScale, 0.0D); + return convertToVec3(dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f()).sub(0.0F, 0.3F * dh.vrPlayer.worldScale, 0.0F)); } return this.getPosition(livingEntity, d, f); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java index e9762a607..484464a04 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/renderer/entity/MobRendererVRMixin.java @@ -1,6 +1,7 @@ package org.vivecraft.mixin.client_vr.renderer.entity; import net.minecraft.world.entity.Entity; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @@ -8,6 +9,7 @@ import static org.vivecraft.client_vr.VRState.dh; import static org.vivecraft.client_vr.VRState.mc; +import static org.vivecraft.common.utils.Utils.convertToVec3; @Mixin(net.minecraft.client.renderer.entity.MobRenderer.class) @@ -16,7 +18,7 @@ public class MobRendererVRMixin { @Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getRopeHoldPosition(F)Lnet/minecraft/world/phys/Vec3;"), method = "renderLeash") public net.minecraft.world.phys.Vec3 leash(Entity instance, float f) { if (!RenderPassType.isVanilla() && instance == mc.player) { - return dh.vrPlayer.vrdata_world_render.getController(0).getPosition(); + return convertToVec3(dh.vrPlayer.vrdata_world_render.getController(0).getPosition(new Vector3f())); } return instance.getRopeHoldPosition(f); } diff --git a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java index 5a8e16e5f..982d0d1bc 100644 --- a/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/client_vr/world/entity/projectile/FireworkRocketEntityVRMixin.java @@ -3,12 +3,13 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.Items; -import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.vivecraft.client_vr.VRData.VRDevicePose; import javax.annotation.Nullable; @@ -21,13 +22,17 @@ public class FireworkRocketEntityVRMixin { private @Nullable LivingEntity attachedToEntity; @Unique - private Vec3 vivecraft$handPos = null; + private final Vector3f vivecraft$handPos = new Vector3f(); + + @Unique + private boolean vivecraft$doHandPos = true; @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 1, method = "tick") private double vivecraft$modifyX(double x) { if (this.attachedToEntity instanceof LocalPlayer localPlayer && this.attachedToEntity == mc.player && vrRunning) { - var controller = dh.vrPlayer.getVRDataWorld().getHand(!localPlayer.getOffhandItem().is(Items.FIREWORK_ROCKET) && localPlayer.getMainHandItem().is(Items.FIREWORK_ROCKET) ? 0 : 1); - this.vivecraft$handPos = controller.getPosition().add(controller.getDirection().scale(0.25)); + VRDevicePose controller = dh.vrPlayer.getVRDataWorld().getHand(!localPlayer.getOffhandItem().is(Items.FIREWORK_ROCKET) && localPlayer.getMainHandItem().is(Items.FIREWORK_ROCKET) ? 0 : 1); + controller.getPosition(this.vivecraft$handPos).add(controller.getDirection(new Vector3f()).mul(0.25F)); + this.vivecraft$doHandPos = true; return this.vivecraft$handPos.x; } return x; @@ -35,7 +40,7 @@ public class FireworkRocketEntityVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 2, method = "tick") private double vivecraft$modifyY(double y) { - if (this.vivecraft$handPos != null) { + if (this.vivecraft$doHandPos) { return this.vivecraft$handPos.y; } return y; @@ -43,9 +48,9 @@ public class FireworkRocketEntityVRMixin { @ModifyArg(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addParticle(Lnet/minecraft/core/particles/ParticleOptions;DDDDDD)V"), index = 3, method = "tick") private double vivecraft$modifyZ(double z) { - if (this.vivecraft$handPos != null) { + if (this.vivecraft$doHandPos) { z = this.vivecraft$handPos.z; - this.vivecraft$handPos = null; + this.vivecraft$doHandPos = false; } return z; } diff --git a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java index 40cb020c6..4e98a617c 100644 --- a/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java +++ b/common/src/main/java/org/vivecraft/mixin/world/entity/projectile/ProjectileMixin.java @@ -22,23 +22,32 @@ public class ProjectileMixin { @Unique private Vec3 vivecraft$controllerDir; - @ModifyVariable(method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", - at = @At("HEAD"), ordinal = 3, argsOnly = true) + @ModifyVariable( + method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", + at = @At("HEAD"), + ordinal = 3, + argsOnly = true + ) public float vivecraft$pVelocity(float pVelocity, Entity pProjectile) { if (pProjectile instanceof ServerPlayer player) { ServerVivePlayer serverVivePlayer = ServerVRPlayers.getVivePlayer(player); if (serverVivePlayer != null && serverVivePlayer.isVR()) { - this.vivecraft$controllerDir = serverVivePlayer.getControllerDir(serverVivePlayer.activeHand); if (((Projectile) (Object) this) instanceof AbstractArrow && !(((Projectile) (Object) this) instanceof ThrownTrident) && !serverVivePlayer.isSeated() && serverVivePlayer.getDraw() > 0.0F) { this.vivecraft$controllerDir = serverVivePlayer.getControllerPos(1, (Player) pProjectile).subtract(serverVivePlayer.getControllerPos(0, (Player) pProjectile)).normalize(); + } else { + this.vivecraft$controllerDir = serverVivePlayer.getControllerDir(serverVivePlayer.activeHand); } } } return pVelocity; } - @ModifyVariable(method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", - at = @At("HEAD"), ordinal = 0, argsOnly = true) + @ModifyVariable( + method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", + at = @At("HEAD"), + ordinal = 0, + argsOnly = true + ) public float vivecraft$pX(float pXIn, Entity pProjectile) { if (this.vivecraft$controllerDir != null) { return -((float) toDegrees(asin(this.vivecraft$controllerDir.y / this.vivecraft$controllerDir.length()))); @@ -46,8 +55,12 @@ public class ProjectileMixin { return pXIn; } - @ModifyVariable(method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", - at = @At("HEAD"), ordinal = 1, argsOnly = true) + @ModifyVariable( + method = "shootFromRotation(Lnet/minecraft/world/entity/Entity;FFFFF)V", + at = @At("HEAD"), + ordinal = 1, + argsOnly = true + ) public float vivecraft$pY(float pYIn, Entity pProjectile) { if (this.vivecraft$controllerDir != null) { float toRet = (float) toDegrees(atan2(-this.vivecraft$controllerDir.x, this.vivecraft$controllerDir.z)); diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java index c3906edf4..488f56a08 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/iris/mixin/IrisShadowMatricesMixin.java @@ -1,8 +1,8 @@ package org.vivecraft.mod_compat_vr.iris.mixin; import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.world.phys.Vec3; import org.joml.Matrix4f; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.Unique; @@ -20,9 +20,9 @@ public class IrisShadowMatricesMixin { @Unique private static float vivecraft$cachedShadowIntervalSize; @Unique - private static Vec3 vivecraft$leftPass; + private static final Vector3f vivecraft$leftPass = new Vector3f(); @Unique - private static Vec3 vivecraft$currentPass; + private static final Vector3f vivecraft$currentPass = new Vector3f(); // iris 1.4.2- @@ -43,11 +43,12 @@ public class IrisShadowMatricesMixin { @ModifyVariable(method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 1, remap = false) private static float vivecraft$modifyOffsetX(float original) { if (!RenderPassType.isVanilla()) { - vivecraft$currentPass = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(); if (dh.currentPass == RenderPass.LEFT) { - vivecraft$leftPass = vivecraft$currentPass; + vivecraft$leftPass.set(dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(vivecraft$currentPass)); + } else { + dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(vivecraft$currentPass); } - return (float) (vivecraft$leftPass.x % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.x - vivecraft$currentPass.x)); + return vivecraft$leftPass.x % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.x - vivecraft$currentPass.x); } else { return original; } @@ -56,7 +57,7 @@ public class IrisShadowMatricesMixin { @ModifyVariable(method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 2, remap = false) private static float vivecraft$modifyOffsetY(float original) { if (!RenderPassType.isVanilla()) { - return (float) (vivecraft$leftPass.y % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.y - vivecraft$currentPass.y)); + return vivecraft$leftPass.y % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.y - vivecraft$currentPass.y); } else { return original; } @@ -65,7 +66,7 @@ public class IrisShadowMatricesMixin { @ModifyVariable(method = "snapModelViewToGrid", at = @At("STORE"), ordinal = 3, remap = false) private static float vivecraft$modifyOffsetZ(float original) { if (!RenderPassType.isVanilla()) { - return (float) (vivecraft$leftPass.z % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.z - vivecraft$currentPass.z)); + return vivecraft$leftPass.z % vivecraft$cachedShadowIntervalSize - (vivecraft$leftPass.z - vivecraft$currentPass.z); } else { return original; } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java index c4793ce9a..e8dc370b8 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/OptifineHelper.java @@ -5,13 +5,14 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import static org.vivecraft.client_vr.VRState.mc; -import static org.vivecraft.common.utils.Utils.logger; +import static org.vivecraft.common.utils.Utils.*; public class OptifineHelper { @@ -191,18 +192,18 @@ public static void setRenderRegions(boolean active) { } } - public static Vec3 getCustomSkyColor(Vec3 skyColor, BlockAndTintGetter blockAccess, double x, double y, double z) { + public static Vector3f getCustomSkyColor(Vector3f skyColor, BlockAndTintGetter blockAccess, double x, double y, double z) { try { - return (Vec3) customColorsGetSkyColorMethod.invoke(customColors, skyColor, blockAccess, x, y, z); + return convertToVector3f((Vec3) customColorsGetSkyColorMethod.invoke(customColors, convertToVec3(skyColor), blockAccess, x, y, z), skyColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return skyColor; } } - public static Vec3 getCustomSkyColorEnd(Vec3 skyColor) { + public static Vector3f getCustomSkyColorEnd(Vector3f skyColor) { try { - return (Vec3) customColorsGetSkyColorEndMethod.invoke(customColors, skyColor); + return convertToVector3f((Vec3) customColorsGetSkyColorEndMethod.invoke(customColors, convertToVec3(skyColor)), skyColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return skyColor; @@ -228,27 +229,27 @@ public static Vec3 getCustomUnderlavaColor(BlockAndTintGetter blockAccess, doubl } } - public static Vec3 getCustomFogColor(Vec3 fogColor, BlockAndTintGetter blockAccess, double x, double y, double z) { + public static Vector3f getCustomFogColor(Vector3f fogColor, BlockAndTintGetter blockAccess, double x, double y, double z) { try { - return (Vec3) customColorsGetFogColorMethod.invoke(customColors, fogColor, blockAccess, x, y, z); + return convertToVector3f((Vec3) customColorsGetFogColorMethod.invoke(customColors, convertToVec3(fogColor), blockAccess, x, y, z), fogColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return fogColor; } } - public static Vec3 getCustomFogColorEnd(Vec3 fogColor) { + public static Vector3f getCustomFogColorEnd(Vector3f fogColor) { try { - return (Vec3) customColorsGetFogColorEndMethod.invoke(customColors, fogColor); + return convertToVector3f((Vec3) customColorsGetFogColorEndMethod.invoke(customColors, convertToVec3(fogColor)), fogColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return fogColor; } } - public static Vec3 getCustomFogColorNether(Vec3 fogColor) { + public static Vector3f getCustomFogColorNether(Vector3f fogColor) { try { - return (Vec3) customColorsGetFogColorNetherMethod.invoke(customColors, fogColor); + return convertToVector3f((Vec3) customColorsGetFogColorNetherMethod.invoke(customColors, convertToVec3(fogColor)), fogColor); } catch (IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); return fogColor; diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java index 4f4fc35b9..6af4554e2 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/optifine/mixin/ShadersVRMixin.java @@ -5,6 +5,7 @@ import net.minecraft.client.Camera; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; +import org.joml.Vector3f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Pseudo; import org.spongepowered.asm.mixin.injection.At; @@ -17,6 +18,7 @@ import org.vivecraft.client_xr.render_pass.RenderPassType; import static org.vivecraft.client_vr.VRState.dh; +import static org.vivecraft.common.utils.Utils.convertToVec3; @Pseudo @Mixin(targets = "net.optifine.shaders.Shaders") @@ -32,15 +34,15 @@ public class ShadersVRMixin { if (RenderPassType.isVanilla()) { return camera.getPosition(); } else { - return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(); + return convertToVec3(dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f())); } } @ModifyVariable(at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack$Pose;pose()Lorg/joml/Matrix4f;", shift = Shift.AFTER, remap = true), method = "setCameraShadow", remap = false) private static PoseStack vivecraft$offsetShadow(PoseStack shadowModelViewMat) { if (!RenderPassType.isVanilla()) { - Vec3 offset = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition().subtract(dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition()); - shadowModelViewMat.last().pose().translate((float) offset.x, (float) offset.y, (float) offset.z); + Vector3f offset = dh.vrPlayer.getVRDataWorld().getEye(dh.currentPass).getPosition(new Vector3f()).sub(dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f())); + shadowModelViewMat.last().pose().translate(offset.x, offset.y, offset.z); } return shadowModelViewMat; } @@ -50,7 +52,7 @@ public class ShadersVRMixin { if (RenderPassType.isVanilla()) { return entity.getX(); } else { - return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().x; + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f()).x; } } @@ -59,7 +61,7 @@ public class ShadersVRMixin { if (RenderPassType.isVanilla()) { return entity.getZ(); } else { - return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition().z; + return dh.vrPlayer.getVRDataWorld().getEye(RenderPass.CENTER).getPosition(new Vector3f()).z; } } } diff --git a/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java b/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java index 5e6e36f8d..12b234953 100644 --- a/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java +++ b/common/src/main/java/org/vivecraft/server/config/ConfigBuilder.java @@ -3,7 +3,6 @@ import com.electronwill.nightconfig.core.CommentedConfig; import com.electronwill.nightconfig.core.ConfigSpec; import com.electronwill.nightconfig.core.ConfigSpec.CorrectionListener; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.*; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -13,6 +12,8 @@ import java.util.*; import java.util.function.Predicate; +import static org.vivecraft.client_vr.VRState.mc; + public class ConfigBuilder { private final CommentedConfig config; @@ -285,7 +286,7 @@ public StringValue(CommentedConfig config, List path, String defaultValu @Override public AbstractWidget getWidget(int width, int height) { - EditBox box = new EditBox(Minecraft.getInstance().font, 0, 0, width - 1, height, Component.literal(get())) { + EditBox box = new EditBox(mc.font, 0, 0, width - 1, height, Component.literal(get())) { @Override public boolean charTyped(char c, int i) { boolean ret = super.charTyped(c, i); @@ -318,10 +319,10 @@ public AbstractWidget getWidget(int width, int height) { return Button .builder( Component.translatable("vivecraft.options.editlist"), - button -> Minecraft.getInstance() - .setScreen( - new GuiListValueEditScreen(Component.literal(getPath().substring(getPath().lastIndexOf("."))), Minecraft.getInstance().screen, (ListValue) this) - )) + button -> mc.setScreen( + new GuiListValueEditScreen(Component.literal(getPath().substring(getPath().lastIndexOf("."))), mc.screen, (ListValue) this) + ) + ) .size(width, height) .tooltip(Tooltip.create(Component.literal(getComment()))) .build(); From f3ac3fff28e03aec324fa884c4a720f250f37467 Mon Sep 17 00:00:00 2001 From: NicBOMB <19939315+NicBOMB@users.noreply.github.com> Date: Sun, 8 Oct 2023 14:26:23 -0700 Subject: [PATCH 12/12] missed in merge --- .../org/vivecraft/client/gui/settings/GuiListScreen.java | 5 ----- .../client/gui/settings/GuiRenderOpticsSettings.java | 5 ----- .../dynamicfps/mixin/DynamicFPSModVRMixin.java | 2 +- .../org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java | 7 ++++--- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java index dfb9c5fee..98c4aa4bf 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiListScreen.java @@ -48,11 +48,6 @@ public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) { this.renderDirtBackground(guiGraphics); } - @Override - public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) { - this.renderDirtBackground(guiGraphics); - } - @Override public void render(GuiGraphics guiGraphics, int i, int j, float f) { if (reinit) { diff --git a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java index 3f4ff80d0..30b345537 100644 --- a/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java +++ b/common/src/main/java/org/vivecraft/client/gui/settings/GuiRenderOpticsSettings.java @@ -123,11 +123,6 @@ protected void actionPerformed(AbstractWidget widget) { this.reinit = true; } } - if (guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_ALPHA_MASK.ordinal() - || guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNITY_LIKE.ordinal() - || guivroption.getId() == VRSettings.VrOptions.MIXED_REALITY_UNDISTORTED.ordinal()) { - this.reinit = true; - } } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java index a96fc6f2c..3c7c82916 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin.java @@ -24,6 +24,6 @@ public class DynamicFPSModVRMixin { @ModifyVariable(at = @At(value = "LOAD", target = "Lorg/vivecraft/mod_compat_vr/dynamicfps/mixin/DynamicFPSModVRMixin;state:Ldynamic_fps/impl/PowerState;"), method = "checkForStateChanges()V", remap = false) private static PowerState vivecraft$alwaysFocused(PowerState value) { // always focused in VR - return VRState.vrRunning ? PowerState.FOCUSED : value; + return vrRunning ? PowerState.FOCUSED : value; } } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java index 0fc305528..dc887d683 100644 --- a/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/sodium/SodiumHelper.java @@ -5,10 +5,11 @@ import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import org.vivecraft.client.Xplat; -import org.vivecraft.client_vr.settings.VRSettings; import java.lang.reflect.Field; +import static org.vivecraft.common.utils.Utils.logger; + public class SodiumHelper { public static boolean isLoaded() { @@ -49,7 +50,7 @@ public static void copyModelCuboidUV(ModelPart source, ModelPart dest, int sourc } catch (ClassNotFoundException ignored) { return; } catch (NoSuchFieldException e) { - VRSettings.logger.error("sodium version has ModelCuboids, but field was not found. VR hands will probably look wrong"); + logger.error("sodium version has ModelCuboids, but field was not found. VR hands will probably look wrong"); return; } } @@ -63,7 +64,7 @@ public static void copyModelCuboidUV(ModelPart source, ModelPart dest, int sourc destQuad.textures[i].y = sourceQuad.textures[i].y; } } catch (IllegalAccessException | ClassCastException ignored) { - VRSettings.logger.error("sodium version has ModelCuboids, but field has wrong type. VR hands will probably look wrong"); + logger.error("sodium version has ModelCuboids, but field has wrong type. VR hands will probably look wrong"); hasModelCuboid = false; } }