drop AI-improvements

This commit is contained in:
Simon Gardling 2021-04-13 13:14:59 -04:00
parent 3c54591bd2
commit 1136c0423b
3 changed files with 0 additions and 96 deletions

View File

@ -6,6 +6,5 @@
All patches (.patch files) marked with "Cadmium" are licensed under MIT found [here](https://github.com/LucilleTea/cadmium-fabric/blob/1.16.x/dev-my-fork/LICENSE.txt).<br>
All patches (.patch files) marked with "LazyDFU" are licensed under MIT found [here](https://github.com/astei/lazydfu/blob/master/LICENSE).<br>
All patches (.patch files) marked with "Tic-Tacs" are licensed under LGPLv3 found [here](https://github.com/Gegy/tic-tacs/blob/1.16.4/LICENSE).<br>
All patches (.patch files) marked with "AI-Improvements" are licensed under MIT found [here](https://github.com/BuiltBrokenModding/AI-Improvements/blob/1.16/LICENSEhttps://github.com/BuiltBrokenModding/AI-Improvements/blob/1.16/LICENSE).<br>
All other patches (.patch files) included in this repo are licensed under the MIT license found [here](MIT.md).<br>
See [EMC](https://github.com/starlis/empirecraft/blob/master/README.md), [Akarin](https://github.com/Akarin-project/Akarin/blob/1.16.5/LICENSE.md), [Purpur](https://github.com/pl3xgaming/Purpur/blob/ver/1.16.5/LICENSE), [Airplane](https://github.com/Technove/Airplane/blob/master/PATCHES-LICENSE), [Origami](https://github.com/Minebench/Origami/blob/1.16/PATCHES-LICENSE), and [Tuinity](https://github.com/Spottedleaf/Tuinity/blob/master/PATCHES-LICENSE) for the license of patches automatically pulled during upstream updates.

View File

@ -21,7 +21,6 @@ ## So what is Yatopia?
* [Cadmium](https://github.com/LucilleTea/cadmium-fabric)
* [LazyDFU](https://github.com/astei/lazydfu)
* [Tic-Tacs](https://github.com/Gegy/tic-tacs)
* [AI-Improvements](https://github.com/BuiltBrokenModding/AI-Improvements/tree/1.16)
## Try it out

View File

@ -1,94 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: bl4ckscor3 <bl4ckscor33@gmail.com>
Date: Tue, 2 Feb 2021 21:38:12 -0500
Subject: [PATCH] (AI-Improvements) Optimized tan for ControllerLook
Code originally licenced under MIT from: https://github.com/BuiltBrokenModding/AI-Improvements/tree/1.16
diff --git a/src/main/java/com/builtbroken/ai/improvements/FastTrig.java b/src/main/java/com/builtbroken/ai/improvements/FastTrig.java
new file mode 100644
index 0000000000000000000000000000000000000000..82150126c0d1608de0af9a8582571628efe53c2d
--- /dev/null
+++ b/src/main/java/com/builtbroken/ai/improvements/FastTrig.java
@@ -0,0 +1,59 @@
+package com.builtbroken.ai.improvements;
+
+public class FastTrig {
+ private static final int ATAN2_BITS = 8;
+
+ private static final int ATAN2_BITS2 = ATAN2_BITS << 1;
+ private static final int ATAN2_MASK = ~(-1 << ATAN2_BITS2);
+ private static final int ATAN2_COUNT = ATAN2_MASK + 1;
+ private static final int ATAN2_DIM = (int) Math.sqrt(ATAN2_COUNT);
+
+ private static final float INV_ATAN2_DIM_MINUS_1 = 1.0f / (ATAN2_DIM - 1);
+
+ private static final float[] atan2 = new float[ATAN2_COUNT];
+ static {
+ for (int i = 0; i < ATAN2_DIM; i++) {
+ for (int j = 0; j < ATAN2_DIM; j++) {
+ float x0 = (float) i / ATAN2_DIM;
+ float y0 = (float) j / ATAN2_DIM;
+
+ atan2[j * ATAN2_DIM + i] = (float) Math.atan2(y0, x0);
+ }
+ }
+ }
+
+
+ public static final float atan2(double y, double x) {
+ float add, mul;
+
+ if (x < 0.0f) {
+ if (y < 0.0f) {
+ x = -x;
+ y = -y;
+
+ mul = 1.0f;
+ } else {
+ x = -x;
+ mul = -1.0f;
+ }
+
+ add = -3.141592653f;
+ } else {
+ if (y < 0.0f) {
+ y = -y;
+ mul = -1.0f;
+ } else {
+ mul = 1.0f;
+ }
+
+ add = 0.0f;
+ }
+
+ double invDiv = 1.0f / (((x < y) ? y : x) * INV_ATAN2_DIM_MINUS_1);
+
+ int xi = (int) (x * invDiv);
+ int yi = (int) (y * invDiv);
+
+ return (atan2[yi * ATAN2_DIM + xi] + add) * mul;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerLook.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerLook.java
index 3ce9edde641c8b8eea75479615bcd2866ffd2198..b44481633a798c560af5b55723daa32264bb2be3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerLook.java
+++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerLook.java
@@ -86,14 +86,14 @@ public class ControllerLook {
double d2 = this.g - this.a.locZ();
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
- return (float) (-(MathHelper.d(d1, d3) * 57.2957763671875D));
+ return (float) (-(com.builtbroken.ai.improvements.FastTrig.atan2(d1, d3) * 57.2957763671875D)); // Yatopia - Optimized tan implementation
}
protected float h() {
double d0 = this.e - this.a.locX();
double d1 = this.g - this.a.locZ();
- return (float) (MathHelper.d(d1, d0) * 57.2957763671875D) - 90.0F;
+ return (float) (com.builtbroken.ai.improvements.FastTrig.atan2(d1, d0) * 57.2957763671875D) - 90.0F; // Yatopia - Optimized tan implementation
}
protected float a(float f, float f1, float f2) {