Limit Y axis
robberer opened this issue ยท 3 comments
First things first: I like this mod a lot.
I already modified the code to support even slow RPM to allow short flying distances.
But how would I have to modify the code when want to limit flying on the Y axis too. I guess somewhere around IsWithinFlightRange
and distSqr
. Could you give me an code example ?
regards,
Robert
Ok, got it already.
diff --git a/src/main/java/com/vice/balancedflight/content/flightAnchor/FlightController.java b/src/main/java/com/vice/balancedflight/content/flightAnchor/FlightController.java
index d047a75..a779bd4 100644
--- a/src/main/java/com/vice/balancedflight/content/flightAnchor/FlightController.java
+++ b/src/main/java/com/vice/balancedflight/content/flightAnchor/FlightController.java
@@ -109,8 +109,9 @@ public class FlightController
private static double distSqr(Vec3i vec, Vec3 other) {
double d1 = (double)vec.getX() - other.x;
+ double d2 = (double)vec.getY() - other.y;
double d3 = (double)vec.getZ() - other.z;
- return d1 * d1 + d3 * d3;
+ return d1 * d1 + d2 * d2 + d3 * d3;
}
public enum FlightMode {
Last thing i would like to modify is the beam. I wonder if it is possible to adjust the height of the beam to reflect the flying range/height, or if this is not possible, to completely disable the beam. I never liked those beams in Minecraft.
Hmm, this is done in BeaconRenderer.renderBeaconBeacon
. Last puzzle to solve how to pass the correct value calculated from givin RPM :-)