diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/init/ClientSetupEvent.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/init/ClientSetupEvent.java index 42525f93e..8223ca945 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/init/ClientSetupEvent.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/init/ClientSetupEvent.java @@ -6,6 +6,7 @@ import com.github.tartaricacid.touhoulittlemaid.client.overlay.BroomTipsOverlay; import com.github.tartaricacid.touhoulittlemaid.client.overlay.MaidTipsOverlay; import com.github.tartaricacid.touhoulittlemaid.compat.immersivemelodies.ImmersiveMelodiesCompat; +import com.github.tartaricacid.touhoulittlemaid.compat.oculus.OculusCompat; import com.github.tartaricacid.touhoulittlemaid.compat.simplehats.SimpleHatsCompat; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; @@ -26,6 +27,7 @@ public static void onClientSetup(FMLClientSetupEvent event) { // 客户端兼容 SimpleHatsCompat.init(); ImmersiveMelodiesCompat.init(); + OculusCompat.init(); } @SubscribeEvent diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/MaidFishingHookRenderer.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/MaidFishingHookRenderer.java index 861553409..315c81d0a 100644 --- a/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/MaidFishingHookRenderer.java +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/client/renderer/entity/MaidFishingHookRenderer.java @@ -1,9 +1,9 @@ package com.github.tartaricacid.touhoulittlemaid.client.renderer.entity; +import com.github.tartaricacid.touhoulittlemaid.compat.oculus.OculusCompat; import com.github.tartaricacid.touhoulittlemaid.entity.passive.EntityMaid; import com.github.tartaricacid.touhoulittlemaid.entity.projectile.MaidFishingHook; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.*; import com.mojang.math.Axis; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -92,6 +92,9 @@ protected void renderFishingLine(T fishingHook, float partialTicks, PoseStack po for (int i = 0; i <= 16; ++i) { stringVertex(x, y, z, lineConsumer, lasted, fraction(i), fraction(i + 1), colors[0], colors[1], colors[2]); } + if (OculusCompat.isOculusInstalled()) { + lineConsumer.vertex(0.0, 0.0, 0.0).color(0, 0, 0, 255).normal(0.0F, 0.0F, 0.0F).endVertex(); + } } protected float fraction(int numerator) { diff --git a/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/oculus/OculusCompat.java b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/oculus/OculusCompat.java new file mode 100644 index 000000000..441552439 --- /dev/null +++ b/src/main/java/com/github/tartaricacid/touhoulittlemaid/compat/oculus/OculusCompat.java @@ -0,0 +1,16 @@ +package com.github.tartaricacid.touhoulittlemaid.compat.oculus; + +import net.minecraftforge.fml.ModList; + +public final class OculusCompat { + public static final String OCULUS = "oculus"; + public static boolean IS_OCULUS_INSTALLED = false; + + public static void init() { + IS_OCULUS_INSTALLED = ModList.get().getModContainerById(OCULUS).isPresent(); + } + + public static boolean isOculusInstalled() { + return IS_OCULUS_INSTALLED; + } +}