Improved Range Combat While Eye Tracking

Adjusted the dynamic camera sensitivity while using an item intended to be used at a distance: the bow, crossbow, trident, and splash potion. The deadzone is now ignored, making slight adjustments to aim a little easier. The deadzone was meant to assist mining and building, but it is a hindrance in ranged combat.
This commit is contained in:
Kabliz
2024-03-17 12:04:24 -07:00
parent 43ffd89a61
commit 8a30b5ee73
2 changed files with 12 additions and 3 deletions

View File

@@ -115,8 +115,15 @@ public abstract class MouseMixin implements MouseAccessor {
cursorXSmoother.clear();
cursorYSmoother.clear();
}
net.minecraft.item.ItemStack items = client.player != null ? client.player.getActiveItem() : net.minecraft.item.ItemStack.EMPTY;
boolean isUsingLongRangedTool = (leftButtonClicked &&
items.getUseAction() == net.minecraft.util.UseAction.BOW &&
items.getUseAction() == net.minecraft.util.UseAction.CROSSBOW &&
items.getUseAction() == net.minecraft.util.UseAction.SPEAR)
||
items.getItem() instanceof net.minecraft.item.ThrowablePotionItem;
EyeTrackerHandler.updateMouseWithEyeTracking(x + cursorDeltaX, y + cursorDeltaY, client,
lastMouseUpdateTime, leftButtonClicked, cursorXSmoother, cursorYSmoother);
lastMouseUpdateTime, leftButtonClicked, isUsingLongRangedTool, cursorXSmoother, cursorYSmoother);
lastMouseUpdateTime = GlfwUtil.getTime();
cursorDeltaX = 0.0;
cursorDeltaY = 0.0;