diff --git a/build.gradle b/build.gradle index 7cb380fff..752c8e4b7 100644 --- a/build.gradle +++ b/build.gradle @@ -133,6 +133,18 @@ allprojects { } } + exclusiveContent { + forRepository { + maven { + name = "quiltmc" + url = "https://maven.quiltmc.org/repository/release" + } + } + filter { + includeGroup "org.quiltmc.parsers" + } + } + exclusiveContent { forRepository { ivy { diff --git a/common/build.gradle b/common/build.gradle index 72e9b7261..4d0b16b9b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -45,6 +45,9 @@ dependencies { transitive(false) } + // for origins compat + modCompileOnlyApi "com.github.apace100:apoli:2.9.0" + // needed dependencies compileOnly("com.google.code.findbugs:jsr305:3.0.2") compileOnly('com.electronwill.night-config:toml:3.6.6') 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 97b1cad42..fc404fb98 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 @@ -25,6 +25,7 @@ import org.vivecraft.client_vr.gameplay.VRPlayer; import org.vivecraft.client_vr.provider.ControllerType; import org.vivecraft.common.network.CommonNetworkHelper; +import org.vivecraft.mod_compat_vr.origins.OriginsHelper; import java.util.*; @@ -115,7 +116,7 @@ public boolean isClimbeyClimb() { } public boolean isClimbeyClimbEquipped() { - return ClientNetworking.serverAllowsClimbey && ((PlayerExtension) this.mc.player).vivecraft$isClimbeyClimbEquipped(); + return ClientNetworking.serverAllowsClimbey && (((PlayerExtension) this.mc.player).vivecraft$isClimbeyClimbEquipped() || (OriginsHelper.isLoaded() && OriginsHelper.hasClimbingPower(this.mc.player))); } private boolean canstand(BlockPos bp, LocalPlayer p) { 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 b7459cb45..6a3b2f60b 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,7 @@ import org.vivecraft.client.network.ClientNetworking; import org.vivecraft.client_vr.ClientDataHolderVR; import org.vivecraft.client_vr.extensions.GameRendererExtension; +import org.vivecraft.client_vr.extensions.PlayerExtension; import org.vivecraft.client_vr.gameplay.trackers.BowTracker; import org.vivecraft.client_vr.render.RenderPass; import org.vivecraft.client_vr.settings.VRSettings; @@ -142,7 +143,8 @@ public static void renderVRHand_Main(PoseStack poseStack, float partialTicks) { item = override; } - if (dataHolder.climbTracker.isClimbeyClimb() && !dataHolder.climbTracker.isClaws(item) && override == null) { + if (dataHolder.climbTracker.isClimbeyClimb() && ((PlayerExtension) mc.player).vivecraft$isClimbeyClimbEquipped() && + !dataHolder.climbTracker.isClaws(item) && override == null) { item = mc.player.getOffhandItem(); } @@ -205,7 +207,8 @@ public static void renderVRHand_Offhand(float partialTicks, boolean renderTelepo item = override; } - if (dataHolder.climbTracker.isClimbeyClimb() && !dataHolder.climbTracker.isClaws(item) && override == null) { + if (dataHolder.climbTracker.isClimbeyClimb() && ((PlayerExtension) mc.player).vivecraft$isClimbeyClimbEquipped() && + !dataHolder.climbTracker.isClaws(item) && override == null) { item = mc.player.getMainHandItem(); } diff --git a/common/src/main/java/org/vivecraft/mod_compat_vr/origins/OriginsHelper.java b/common/src/main/java/org/vivecraft/mod_compat_vr/origins/OriginsHelper.java new file mode 100644 index 000000000..9ae533387 --- /dev/null +++ b/common/src/main/java/org/vivecraft/mod_compat_vr/origins/OriginsHelper.java @@ -0,0 +1,19 @@ +package org.vivecraft.mod_compat_vr.origins; + +import org.vivecraft.client.Xplat; +import io.github.apace100.apoli.component.PowerHolderComponent; +import io.github.apace100.apoli.power.ClimbingPower; +import io.github.apace100.apoli.power.TogglePower; +import net.minecraft.world.entity.LivingEntity; + +public class OriginsHelper { + public static boolean isLoaded() { + return Xplat.isModLoaded("origins"); + } + + public static boolean hasClimbingPower(LivingEntity entity) { + // assumes toggle is for climbing, which is correct at least for stock origins + return !PowerHolderComponent.KEY.get(entity).getPowers(ClimbingPower.class, true).isEmpty() + && !PowerHolderComponent.KEY.get(entity).getPowers(TogglePower.class, false).isEmpty(); + } +}