fix sentinel, remove broken test and unused method it was testing
This commit is contained in:
parent
609e018f9e
commit
0bdfa15aa2
5 changed files with 4 additions and 41 deletions
|
@ -36,19 +36,3 @@ object QuaternionfUtils {
|
|||
return quaternion
|
||||
}
|
||||
}
|
||||
|
||||
fun Quaternionf.toXYZ(): Vector3f {
|
||||
val f: Float = this.w() * this.w()
|
||||
val g: Float = this.x() * this.x()
|
||||
val h: Float = this.y() * this.y()
|
||||
val i: Float = this.z() * this.z()
|
||||
val j = f + g + h + i
|
||||
val k: Float = 2.0f * this.w() * this.x() - 2.0f * this.y() * this.z()
|
||||
val l = asin(k / j)
|
||||
return if (abs(k) > 0.999f * j)
|
||||
Vector3f(2.0f * atan2(this.x(), this.w()), l, 0.0f)
|
||||
else Vector3f(
|
||||
atan2(2.0f * this.y() * this.z() + 2.0f * this.x() * this.w(), f - g - h + i),
|
||||
l,
|
||||
atan2(2.0f * this.x() * this.y() + 2.0f * this.w() * this.z(), f + g - h - i))
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package at.petrak.hexcasting.api.utils
|
||||
|
||||
import org.joml.Vector3f
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import kotlin.random.Random
|
||||
|
||||
class QuaternionfUtilsTest {
|
||||
@Test
|
||||
fun testXYZ() {
|
||||
val random = Random(System.currentTimeMillis())
|
||||
|
||||
repeat(500) {
|
||||
val expected = Vector3f(random.nextFloat(), random.nextFloat(), random.nextFloat())
|
||||
val output = QuaternionfUtils.fromXYZ(expected).toXYZ()
|
||||
assertTrue(expected.distanceSquared(output) < 0.000001)
|
||||
{ "Expected distance between $expected and $output to be less than 0.000001, was ${expected.distanceSquared(output)}." }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,7 +40,7 @@ public class CCSentinel implements Component, AutoSyncedComponent {
|
|||
var hasSentinel = tag.getBoolean(TAG_HAS_SENTINEL);
|
||||
if (hasSentinel) {
|
||||
var extendsRange = tag.getBoolean(TAG_EXTENDS_RANGE);
|
||||
var position = HexUtils.vecFromNBT(tag.getLongArray(TAG_POSITION));
|
||||
var position = HexUtils.vecFromNBT(tag.getCompound(TAG_POSITION));
|
||||
var dim = ResourceKey.create(Registries.DIMENSION,
|
||||
new ResourceLocation(tag.getString(TAG_DIMENSION)));
|
||||
this.sentinel = new Sentinel(extendsRange, position, dim);
|
||||
|
|
|
@ -34,8 +34,7 @@ public abstract class ForgeMixinDatagenModLoader {
|
|||
private static boolean runningDataGen;
|
||||
|
||||
/**
|
||||
* @author Talia
|
||||
* @reason Make it so non-vanilla registries can actually be tagged.
|
||||
* Make it so non-vanilla registries can actually be tagged.
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public static void begin(final Set<String> mods, final Path path, final Collection<Path> inputs, Collection<Path> existingPacks,
|
||||
|
|
|
@ -200,7 +200,7 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
@Override
|
||||
public void setSentinel(Player player, @Nullable Sentinel sentinel) {
|
||||
CompoundTag tag = player.getPersistentData();
|
||||
tag.putBoolean(TAG_SENTINEL_EXISTS, sentinel == null);
|
||||
tag.putBoolean(TAG_SENTINEL_EXISTS, sentinel != null);
|
||||
if (sentinel != null) {
|
||||
tag.putBoolean(TAG_SENTINEL_GREATER, sentinel.extendsRange());
|
||||
tag.put(TAG_SENTINEL_POSITION, HexUtils.serializeToNBT(sentinel.position()));
|
||||
|
@ -274,7 +274,7 @@ public class ForgeXplatImpl implements IXplatAbstractions {
|
|||
return null;
|
||||
}
|
||||
var extendsRange = tag.getBoolean(TAG_SENTINEL_GREATER);
|
||||
var position = HexUtils.vecFromNBT(tag.getLongArray(TAG_SENTINEL_POSITION));
|
||||
var position = HexUtils.vecFromNBT(tag.getCompound(TAG_SENTINEL_POSITION));
|
||||
var dimension = ResourceKey.create(Registries.DIMENSION,
|
||||
new ResourceLocation(tag.getString(TAG_SENTINEL_DIMENSION)));
|
||||
|
||||
|
|
Loading…
Reference in a new issue