MCPcopy Create free account
hub / github.com/SplashAni/RandomMeteor / rotate

Method rotate

src/main/java/random/meteor/utils/Utils.java:121–141  ·  view source on GitHub ↗
(EntityType en)

Source from the content-addressed store, hash-verified

119 }
120
121 public static void rotate(EntityType en) {
122 double closest = Double.MAX_VALUE;
123 Vec3d pos = mc.player.getPos();
124 Vec3d nearest = null;
125
126 for (Entity entity : mc.world.getEntities()) {
127 if (entity.getType() == en) {
128 double distance = entity.getPos().squaredDistanceTo(pos);
129 if (distance < closest) {
130 closest = distance;
131 nearest = entity.getPos();
132 }
133 }
134 }
135
136 if (nearest != null) {
137 double yaw = Math.atan2(nearest.getZ() - pos.getZ(), nearest.getX() - pos.getX()) * (180 / Math.PI) - 90;
138 double pitch = Math.atan2(nearest.getY() - pos.getY(), Math.sqrt(Math.pow(nearest.getX() - pos.getX(), 2) + Math.pow(nearest.getZ() - pos.getZ(), 2))) * (180 / Math.PI);
139 Rotations.rotate(yaw, pitch, 100);
140 }
141 }
142
143
144 public static void switchToGold() {

Callers 10

onTickMethod · 0.95
throwPearlMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
tickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onTickMethod · 0.80
onDeactivateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected