aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/features/EndermanMacro.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/rosegoldaddons/features/EndermanMacro.java')
-rw-r--r--src/main/java/rosegoldaddons/features/EndermanMacro.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/rosegoldaddons/features/EndermanMacro.java b/src/main/java/rosegoldaddons/features/EndermanMacro.java
index b0ff72a..c0f3c6a 100644
--- a/src/main/java/rosegoldaddons/features/EndermanMacro.java
+++ b/src/main/java/rosegoldaddons/features/EndermanMacro.java
@@ -1,14 +1,16 @@
package rosegoldaddons.features;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEnderman;
+import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import rosegoldaddons.Main;
import rosegoldaddons.utils.RenderUtils;
-import rosegoldaddons.utils.RotationUtils;
+import rosegoldaddons.utils.ShadyRotation;
import java.awt.*;
@@ -18,9 +20,21 @@ public class EndermanMacro {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (!Main.configFile.EndermanESP && !Main.endermanMacro) return;
+ if(event.phase == TickEvent.Phase.END) return;
enderman = getClosestEnderman();
- if(enderman != null && Main.endermanMacro) {
- RotationUtils.faceEntity(enderman);
+ if(enderman != null && Main.endermanMacro && !ShadyRotation.running) {
+ ShadyRotation.smoothLook(ShadyRotation.getRotationToEntity(enderman), Main.configFile.smoothLookVelocity, () -> {
+ KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), true);
+ KeyBinding.setKeyBindState(Main.mc.gameSettings.keyBindSneak.getKeyCode(), false);
+
+ if(!Main.mc.thePlayer.movementInput.sneak) {
+ Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));
+ Main.mc.thePlayer.movementInput.sneak = true;
+ } else {
+ Main.mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(Main.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
+ Main.mc.thePlayer.movementInput.sneak = false;
+ }
+ });
}
}