Skip to content

Commit

Permalink
AxolotlTools - Added rotation priority overrides.
Browse files Browse the repository at this point in the history
- this should allow for faster rotations without desyncing.
  • Loading branch information
0xTas committed Apr 7, 2024
1 parent 274167d commit 45ffe49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/dev/stardust/modules/AxolotlTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraft.entity.ai.TargetPredicate;
import meteordevelopment.meteorclient.settings.*;
import net.minecraft.entity.passive.AxolotlEntity;
import meteordevelopment.meteorclient.utils.Utils;
import java.util.concurrent.atomic.AtomicReference;
import net.minecraft.entity.passive.TropicalFishEntity;
import meteordevelopment.meteorclient.renderer.ShapeMode;
Expand Down Expand Up @@ -267,6 +268,7 @@ public enum VariantBehavior { @SuppressWarnings("unused") Esp, Interact, Both, N
);

private int timer = 0;
private int rotPriority = 69420;
private final Set<String> interactVariants = new HashSet<>();

private void disableFishModes() {
Expand Down Expand Up @@ -327,10 +329,10 @@ private <T extends LivingEntity> boolean tryInteractMobFull(T entity, Item bucke
AtomicReference<ActionResult> result = new AtomicReference<>();
Rotations.rotate(
Rotations.getYaw(entity),
Rotations.getPitch(entity, Target.Body),
69420,
Rotations.getPitch(entity, Target.Body), rotPriority,
() -> result.set(mc.interactionManager.interactEntity(mc.player, entity, Hand.MAIN_HAND))
);
++rotPriority;
return result.get() == ActionResult.SUCCESS || result.get() == ActionResult.CONSUME;
}

Expand Down Expand Up @@ -393,6 +395,7 @@ public void onActivate() {
@Override
public void onDeactivate() {
timer = 0;
rotPriority = 69420;
interactVariants.clear();
}

Expand All @@ -402,7 +405,7 @@ public void onDeactivate() {
if (axolotlMode.get() == AxolotlMode.None && !catchFish.get()) return;

ItemStack current = mc.player.getInventory().getMainHandStack();
if (current.isFood() && mc.mouse.wasRightButtonClicked()) {
if ((current.isFood() || Utils.isThrowable(current.getItem())) && mc.player.getItemUseTime() > 0) {
++timer;
return;
}
Expand Down

0 comments on commit 45ffe49

Please sign in to comment.