txnimc / BalancedFlight

MIT License
1 stars 6 forks source link

Limit Y axis #17

Closed robberer closed 1 year ago

robberer commented 1 year ago

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

robberer commented 1 year ago

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 {
robberer commented 1 year ago

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 :-)

nthxny commented 1 year ago

This isn't a bug, if you need modding help you can discuss things on Forge's Discord.