From be6e7f13afcd0e4064f2a6040b895a6c6108e34e Mon Sep 17 00:00:00 2001 From: Waterpicker Date: Mon, 14 Mar 2022 21:13:35 -0500 Subject: [PATCH 1/3] Disabled testing for now. --- build.gradle | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 1d913597..5dfe2804 100644 --- a/build.gradle +++ b/build.gradle @@ -199,7 +199,7 @@ curseforge { id = "284876" changelog = file("changelog.txt").text releaseType = "beta" - addGameVersion "1.18.1" + addGameVersion "1.18.2" addGameVersion "Fabric" mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) { displayName = "[1.18.1] Dimensional Doors ${version}" @@ -213,15 +213,15 @@ curseforge { } } -test { - workingDir = file("test") - - systemProperty("fabric.dli.config", file(".gradle/loom-cache/launch.cfg").getAbsolutePath()) - //useJUnitPlatform() -} - -tasks.test.doFirst {test -> - if (!test.workingDir.exists()) { - test.workingDir.mkdirs(); - } -} +//test { +// workingDir = file("test") +// +// systemProperty("fabric.dli.config", file(".gradle/loom-cache/launch.cfg").getAbsolutePath()) +// //useJUnitPlatform() +//} +// +//tasks.test.doFirst {test -> +// if (!test.workingDir.exists()) { +// test.workingDir.mkdirs(); +// } +//} From 3da8800bc206697341fc6345dbdec039d0b5dced Mon Sep 17 00:00:00 2001 From: Waterpicker Date: Tue, 15 Mar 2022 00:10:29 -0500 Subject: [PATCH 2/3] Fixed day time in limbo. ALso finished disabling testing. --- build.gradle | 4 +- .../DetachedRiftBlockEntityRenderer.java | 16 ++ .../EntranceRiftBlockEntityRenderer.java | 17 ++ .../data/dimdoors/dimension/limbo.json | 20 +- src/main/resources/dimdoors.accesswidener | 1 - .../dimdev/dimdoors/MiscellaneousTest.java | 18 +- .../dimdoors/api/DimensionalDoorsApiTest.java | 200 +++++++------- .../dimdoors/api/util/math/EquationTest.java | 104 +++---- .../dimdoors/api/util/math/GridUtilTest.java | 54 ++-- .../dimdoors/api/util/math/MathUtilTest.java | 92 +++---- .../util/math/TransformationMatrix3dTest.java | 260 +++++++++--------- .../world/pocket/PocketDirectoryTest.java | 96 +++---- .../org/dimdev/test/ClientTestRunner.java | 32 +-- .../org/dimdev/test/ServerTestRunner.java | 32 +-- src/test/java/org/dimdev/test/TestUtil.java | 96 +++---- 15 files changed, 529 insertions(+), 513 deletions(-) diff --git a/build.gradle b/build.gradle index 5dfe2804..14e1d6b7 100644 --- a/build.gradle +++ b/build.gradle @@ -151,8 +151,8 @@ dependencies { modCompileOnly "curse.maven:worldedit-225608:3559499" - testImplementation("junit:junit:4.13.2") - testImplementation("net.devtech:PotatoUnit:1.0.2") +// testImplementation("junit:junit:4.13.2") +// testImplementation("net.devtech:PotatoUnit:1.0.2") } version = computeVersion(project.mod_version) diff --git a/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java b/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java index 3cf12862..5f5d9f44 100644 --- a/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java +++ b/src/main/java/org/dimdev/dimdoors/client/DetachedRiftBlockEntityRenderer.java @@ -3,6 +3,11 @@ package org.dimdev.dimdoors.client; import java.util.Objects; import com.flowpowered.math.TrigMath; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.LightmapTextureManager; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.text.Text; +import net.minecraft.util.Hand; import org.dimdev.dimdoors.DimensionalDoorsInitializer; import org.dimdev.dimdoors.block.entity.DetachedRiftBlockEntity; import org.dimdev.dimdoors.block.entity.RiftBlockEntity; @@ -17,6 +22,8 @@ import net.minecraft.util.Identifier; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import org.dimdev.dimdoors.item.ModItems; +import org.dimdev.dimdoors.rift.targets.IdMarker; @Environment(EnvType.CLIENT) public class DetachedRiftBlockEntityRenderer implements BlockEntityRenderer { @@ -28,6 +35,15 @@ public class DetachedRiftBlockEntityRenderer implements BlockEntityRenderer { @Override public void render(EntranceRiftBlockEntity blockEntity, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay) { + if (MinecraftClient.getInstance().player != null) + if (MinecraftClient.getInstance().player.getStackInHand(Hand.MAIN_HAND).isOf(ModItems.RIFT_CONFIGURATION_TOOL)) + if (blockEntity.getData().getDestination() instanceof IdMarker idMarker) { + matrixStack.push(); + matrixStack.translate(0.5, 0.5, 0.5); + + MinecraftClient.getInstance().textRenderer.draw(Text.of(String.valueOf(idMarker.getId())), 0f, 0f, 0xffffffff, false, matrixStack.peek().getPositionMatrix(), vertexConsumerProvider, true, 0x000000, LightmapTextureManager.MAX_LIGHT_COORDINATE); + + matrixStack.pop(); + } + DimensionalPortalRenderer.renderDimensionalPortal(matrixStack, vertexConsumerProvider, blockEntity.getTransformer(), tickDelta, light, overlay, blockEntity.isTall()); } } diff --git a/src/main/resources/data/dimdoors/dimension/limbo.json b/src/main/resources/data/dimdoors/dimension/limbo.json index 4ed60b61..64e4640a 100644 --- a/src/main/resources/data/dimdoors/dimension/limbo.json +++ b/src/main/resources/data/dimdoors/dimension/limbo.json @@ -1,24 +1,8 @@ { - "type": { - "ultrawarm": false, - "natural": false, - "piglin_safe": false, - "respawn_anchor_works": false, - "bed_works": false, - "has_raids": false, - "has_skylight": false, - "has_ceiling": false, - "coordinate_scale": 1, - "ambient_light": 0, - "logical_height": 256, - "infiniburn": "#minecraft:infiniburn_overworld", - "effects":"dimdoor:limbo", - "min_y": 0, - "height": 256 - }, + "type": "dimdoors:limbo", "generator": { "type": "minecraft:noise", - "seed": 42, + "seed": 0, "settings": "dimdoors:limbo", "biome_source": { "type": "minecraft:fixed", diff --git a/src/main/resources/dimdoors.accesswidener b/src/main/resources/dimdoors.accesswidener index 3cf03f6a..5eda2a2c 100644 --- a/src/main/resources/dimdoors.accesswidener +++ b/src/main/resources/dimdoors.accesswidener @@ -5,7 +5,6 @@ accessible class net/minecraft/client/render/RenderLayer$MultiPhase accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters accessible class net/minecraft/client/render/RenderPhase$Shader accessible class net/minecraft/client/render/RenderPhase$Textures -accessible class net/minecraft/world/gen/feature/ConfiguredFeatures$Decorators accessible method net/minecraft/entity/Entity setRotation (FF)V # for MutableBlockEntityType diff --git a/src/test/java/org/dimdev/dimdoors/MiscellaneousTest.java b/src/test/java/org/dimdev/dimdoors/MiscellaneousTest.java index 0dbd0577..3746a703 100644 --- a/src/test/java/org/dimdev/dimdoors/MiscellaneousTest.java +++ b/src/test/java/org/dimdev/dimdoors/MiscellaneousTest.java @@ -1,9 +1,9 @@ -package org.dimdev.dimdoors; - -import org.junit.Test; - -public class MiscellaneousTest { - @Test - public void runSomeTestStuff() { - } -} +//package org.dimdev.dimdoors; +// +//import org.junit.Test; +// +//public class MiscellaneousTest { +// @Test +// public void runSomeTestStuff() { +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/api/DimensionalDoorsApiTest.java b/src/test/java/org/dimdev/dimdoors/api/DimensionalDoorsApiTest.java index 7087e5d5..98bdbfcf 100644 --- a/src/test/java/org/dimdev/dimdoors/api/DimensionalDoorsApiTest.java +++ b/src/test/java/org/dimdev/dimdoors/api/DimensionalDoorsApiTest.java @@ -1,100 +1,100 @@ -package org.dimdev.dimdoors.api; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.Bootstrap; -import net.minecraft.SharedConstants; -import net.minecraft.util.registry.Registry; -import org.dimdev.dimdoors.DimensionalDoorsInitializer; -import org.dimdev.dimdoors.block.door.data.condition.Condition; -import org.dimdev.dimdoors.pockets.generator.PocketGenerator; -import org.dimdev.dimdoors.pockets.modifier.Modifier; -import org.dimdev.dimdoors.pockets.virtual.ImplementedVirtualPocket; -import org.dimdev.dimdoors.rift.targets.VirtualTarget; -import org.dimdev.dimdoors.world.pocket.type.AbstractPocket; -import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon; -import org.dimdev.test.ServerTestRunner; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -@RunWith(ServerTestRunner.class) -public class DimensionalDoorsApiTest { - - @Test - public void apiTest() { - SharedConstants.createGameVersion(); - Bootstrap.initialize(); - FabricLoader.getInstance().getEntrypoints("main", ModInitializer.class).stream() - .filter(DimensionalDoorsInitializer.class::isInstance) - .map(DimensionalDoorsInitializer.class::cast) - .forEach(DimensionalDoorsInitializer::onInitialize); - - DimDoorsTestApi apiTest = FabricLoader.getInstance().getEntrypoints("dimdoors:api", DimensionalDoorsApi.class).stream() - .filter(DimDoorsTestApi.class::isInstance) - .map(DimDoorsTestApi.class::cast) - .findFirst() - .orElseThrow(RuntimeException::new); - - assertTrue(apiTest.hasCalledRegisterVirtualTargetTypes); - assertTrue(apiTest.hasCalledRegisterVirtualSingularPocketTypes); - assertTrue(apiTest.hasCalledRegisterModifierTypes); - assertTrue(apiTest.hasCalledRegisterPocketGeneratorTypes); - assertTrue(apiTest.hasCalledRegisterAbstractPocketTypes); - assertTrue(apiTest.hasCalledRegisterPocketAddonTypes); - assertTrue(apiTest.hasCalledRegisterConditionTypes); - assertTrue(apiTest.hasCalledPostInitialize); - } - - public static class DimDoorsTestApi implements DimensionalDoorsApi { - private boolean hasCalledRegisterVirtualTargetTypes = false; - private boolean hasCalledRegisterVirtualSingularPocketTypes = false; - private boolean hasCalledRegisterModifierTypes = false; - private boolean hasCalledRegisterPocketGeneratorTypes = false; - private boolean hasCalledRegisterAbstractPocketTypes = false; - private boolean hasCalledRegisterPocketAddonTypes = false; - private boolean hasCalledRegisterConditionTypes = false; - private boolean hasCalledPostInitialize = false; - - @Override - public void registerVirtualTargetTypes(Registry> registry) { - hasCalledRegisterVirtualTargetTypes = true; - } - - @Override - public void registerVirtualSingularPocketTypes(Registry> registry) { - hasCalledRegisterVirtualSingularPocketTypes = true; - } - - @Override - public void registerModifierTypes(Registry> registry) { - hasCalledRegisterModifierTypes = true; - } - - @Override - public void registerPocketGeneratorTypes(Registry> registry) { - hasCalledRegisterPocketGeneratorTypes = true; - } - - @Override - public void registerAbstractPocketTypes(Registry> registry) { - hasCalledRegisterAbstractPocketTypes = true; - } - - @Override - public void registerPocketAddonTypes(Registry> registry) { - hasCalledRegisterPocketAddonTypes = true; - } - - @Override - public void registerConditionTypes(Registry> registry) { - hasCalledRegisterConditionTypes= true; - } - - @Override - public void postInitialize() { - hasCalledPostInitialize = true; - } - } -} +//package org.dimdev.dimdoors.api; +// +//import net.fabricmc.api.ModInitializer; +//import net.fabricmc.loader.api.FabricLoader; +//import net.minecraft.Bootstrap; +//import net.minecraft.SharedConstants; +//import net.minecraft.util.registry.Registry; +//import org.dimdev.dimdoors.DimensionalDoorsInitializer; +//import org.dimdev.dimdoors.block.door.data.condition.Condition; +//import org.dimdev.dimdoors.pockets.generator.PocketGenerator; +//import org.dimdev.dimdoors.pockets.modifier.Modifier; +//import org.dimdev.dimdoors.pockets.virtual.ImplementedVirtualPocket; +//import org.dimdev.dimdoors.rift.targets.VirtualTarget; +//import org.dimdev.dimdoors.world.pocket.type.AbstractPocket; +//import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon; +//import org.dimdev.test.ServerTestRunner; +//import org.junit.Test; +//import org.junit.runner.RunWith; +// +//import static org.junit.Assert.*; +// +//@RunWith(ServerTestRunner.class) +//public class DimensionalDoorsApiTest { +// +// @Test +// public void apiTest() { +// SharedConstants.createGameVersion(); +// Bootstrap.initialize(); +// FabricLoader.getInstance().getEntrypoints("main", ModInitializer.class).stream() +// .filter(DimensionalDoorsInitializer.class::isInstance) +// .map(DimensionalDoorsInitializer.class::cast) +// .forEach(DimensionalDoorsInitializer::onInitialize); +// +// DimDoorsTestApi apiTest = FabricLoader.getInstance().getEntrypoints("dimdoors:api", DimensionalDoorsApi.class).stream() +// .filter(DimDoorsTestApi.class::isInstance) +// .map(DimDoorsTestApi.class::cast) +// .findFirst() +// .orElseThrow(RuntimeException::new); +// +// assertTrue(apiTest.hasCalledRegisterVirtualTargetTypes); +// assertTrue(apiTest.hasCalledRegisterVirtualSingularPocketTypes); +// assertTrue(apiTest.hasCalledRegisterModifierTypes); +// assertTrue(apiTest.hasCalledRegisterPocketGeneratorTypes); +// assertTrue(apiTest.hasCalledRegisterAbstractPocketTypes); +// assertTrue(apiTest.hasCalledRegisterPocketAddonTypes); +// assertTrue(apiTest.hasCalledRegisterConditionTypes); +// assertTrue(apiTest.hasCalledPostInitialize); +// } +// +// public static class DimDoorsTestApi implements DimensionalDoorsApi { +// private boolean hasCalledRegisterVirtualTargetTypes = false; +// private boolean hasCalledRegisterVirtualSingularPocketTypes = false; +// private boolean hasCalledRegisterModifierTypes = false; +// private boolean hasCalledRegisterPocketGeneratorTypes = false; +// private boolean hasCalledRegisterAbstractPocketTypes = false; +// private boolean hasCalledRegisterPocketAddonTypes = false; +// private boolean hasCalledRegisterConditionTypes = false; +// private boolean hasCalledPostInitialize = false; +// +// @Override +// public void registerVirtualTargetTypes(Registry> registry) { +// hasCalledRegisterVirtualTargetTypes = true; +// } +// +// @Override +// public void registerVirtualSingularPocketTypes(Registry> registry) { +// hasCalledRegisterVirtualSingularPocketTypes = true; +// } +// +// @Override +// public void registerModifierTypes(Registry> registry) { +// hasCalledRegisterModifierTypes = true; +// } +// +// @Override +// public void registerPocketGeneratorTypes(Registry> registry) { +// hasCalledRegisterPocketGeneratorTypes = true; +// } +// +// @Override +// public void registerAbstractPocketTypes(Registry> registry) { +// hasCalledRegisterAbstractPocketTypes = true; +// } +// +// @Override +// public void registerPocketAddonTypes(Registry> registry) { +// hasCalledRegisterPocketAddonTypes = true; +// } +// +// @Override +// public void registerConditionTypes(Registry> registry) { +// hasCalledRegisterConditionTypes= true; +// } +// +// @Override +// public void postInitialize() { +// hasCalledPostInitialize = true; +// } +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/api/util/math/EquationTest.java b/src/test/java/org/dimdev/dimdoors/api/util/math/EquationTest.java index 8ce6d9e1..8dfc5350 100644 --- a/src/test/java/org/dimdev/dimdoors/api/util/math/EquationTest.java +++ b/src/test/java/org/dimdev/dimdoors/api/util/math/EquationTest.java @@ -1,52 +1,52 @@ -package org.dimdev.dimdoors.api.util.math; - -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.*; - -public class EquationTest { - - @Test - public void parseAndApply() throws Equation.EquationParseException { - Map empty = new HashMap<>(); - double expected; - String equation; - - assertThrows(Equation.EquationParseException.class, () -> Equation.parse(".")); - - expected = 15d; - equation = Double.toString(expected); - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - - - expected = 4d; - equation = "2 + 2"; - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - - - expected = 1; - equation = "1 ? 1 : 0"; - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - - expected = 0; - equation = "0 ? 1 : 0"; - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - - expected = 1; - equation = (Math.random() + 1d) + "? 1 : 0"; - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - - expected = 1; - equation = (Math.random() - 1d) + "? 1 : 0"; - assertEquals(expected, Equation.parse(equation).apply(empty), 0); - } - - public void parseAndAsBoolean() throws Equation.EquationParseException { - Map empty = new HashMap<>(); - - - } -} +//package org.dimdev.dimdoors.api.util.math; +// +//import org.junit.Test; +// +//import java.util.HashMap; +//import java.util.Map; +// +//import static org.junit.Assert.*; +// +//public class EquationTest { +// +// @Test +// public void parseAndApply() throws Equation.EquationParseException { +// Map empty = new HashMap<>(); +// double expected; +// String equation; +// +// assertThrows(Equation.EquationParseException.class, () -> Equation.parse(".")); +// +// expected = 15d; +// equation = Double.toString(expected); +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// +// +// expected = 4d; +// equation = "2 + 2"; +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// +// +// expected = 1; +// equation = "1 ? 1 : 0"; +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// +// expected = 0; +// equation = "0 ? 1 : 0"; +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// +// expected = 1; +// equation = (Math.random() + 1d) + "? 1 : 0"; +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// +// expected = 1; +// equation = (Math.random() - 1d) + "? 1 : 0"; +// assertEquals(expected, Equation.parse(equation).apply(empty), 0); +// } +// +// public void parseAndAsBoolean() throws Equation.EquationParseException { +// Map empty = new HashMap<>(); +// +// +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/api/util/math/GridUtilTest.java b/src/test/java/org/dimdev/dimdoors/api/util/math/GridUtilTest.java index 8a4767fe..5d5b5325 100644 --- a/src/test/java/org/dimdev/dimdoors/api/util/math/GridUtilTest.java +++ b/src/test/java/org/dimdev/dimdoors/api/util/math/GridUtilTest.java @@ -1,27 +1,27 @@ -package org.dimdev.dimdoors.api.util.math; - -import org.junit.Test; - -import static org.junit.Assert.*; - -public class GridUtilTest { - - @Test - public void idToGridPos() { - GridUtil.GridPos pos; - // I scribbled the grid down so I could figure out these tests, lmao - pos = GridUtil.idToGridPos(86); - assertEquals(new GridUtil.GridPos(8, 1), pos); - pos = GridUtil.idToGridPos(90); - assertEquals(new GridUtil.GridPos(12, 0), pos); - pos = GridUtil.idToGridPos(100); - assertEquals(new GridUtil.GridPos(7, 0), pos); - } - - @Test - public void conversionConsistencyTest() { - for (int i = 0; i < 1000; i++) { - assertEquals(i, GridUtil.gridPosToID(GridUtil.idToGridPos(i))); - } - } -} +//package org.dimdev.dimdoors.api.util.math; +// +//import org.junit.Test; +// +//import static org.junit.Assert.*; +// +//public class GridUtilTest { +// +// @Test +// public void idToGridPos() { +// GridUtil.GridPos pos; +// // I scribbled the grid down so I could figure out these tests, lmao +// pos = GridUtil.idToGridPos(86); +// assertEquals(new GridUtil.GridPos(8, 1), pos); +// pos = GridUtil.idToGridPos(90); +// assertEquals(new GridUtil.GridPos(12, 0), pos); +// pos = GridUtil.idToGridPos(100); +// assertEquals(new GridUtil.GridPos(7, 0), pos); +// } +// +// @Test +// public void conversionConsistencyTest() { +// for (int i = 0; i < 1000; i++) { +// assertEquals(i, GridUtil.gridPosToID(GridUtil.idToGridPos(i))); +// } +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/api/util/math/MathUtilTest.java b/src/test/java/org/dimdev/dimdoors/api/util/math/MathUtilTest.java index f4f2b9ac..0b611712 100644 --- a/src/test/java/org/dimdev/dimdoors/api/util/math/MathUtilTest.java +++ b/src/test/java/org/dimdev/dimdoors/api/util/math/MathUtilTest.java @@ -1,46 +1,46 @@ -package org.dimdev.dimdoors.api.util.math; - -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.EulerAngle; -import net.minecraft.util.math.Vec3d; - -import org.dimdev.test.TestUtil; -import org.junit.Test; - -import static org.junit.Assert.*; - -public class MathUtilTest { - - @Test - public void eulerAngle() { - EulerAngle expected = new EulerAngle(0, 0, 0); - - Vec3d direction = new Vec3d(0, 0, 1); - Vec3d upwards = new Vec3d(0, 1, 0); - EulerAngle angle = MathUtil.eulerAngle(direction, upwards); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(-90, 0, 0); - direction = new Vec3d(0, 1, 0); - upwards = new Vec3d(0, 0, -1); - angle = MathUtil.eulerAngle(direction, upwards); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(0, -45, 0); - direction = new Vec3d(Math.cos(Math.PI / 2), 0, Math.cos(Math.PI / 2)); - upwards = new Vec3d(0, 1, 0); - angle = MathUtil.eulerAngle(direction, upwards); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - } - - @Test - public void directionEulerAngle() { - for (Direction direction : Direction.values()) { - EulerAngle expected = MathUtil.directionEulerAngle(direction); - Vec3d dir = Vec3d.of(direction.getVector()); - EulerAngle angle = new EulerAngle(MathUtil.pitch(dir), MathUtil.yaw(dir), 0); - - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - } - } -} +//package org.dimdev.dimdoors.api.util.math; +// +//import net.minecraft.util.math.Direction; +//import net.minecraft.util.math.EulerAngle; +//import net.minecraft.util.math.Vec3d; +// +//import org.dimdev.test.TestUtil; +//import org.junit.Test; +// +//import static org.junit.Assert.*; +// +//public class MathUtilTest { +// +// @Test +// public void eulerAngle() { +// EulerAngle expected = new EulerAngle(0, 0, 0); +// +// Vec3d direction = new Vec3d(0, 0, 1); +// Vec3d upwards = new Vec3d(0, 1, 0); +// EulerAngle angle = MathUtil.eulerAngle(direction, upwards); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(-90, 0, 0); +// direction = new Vec3d(0, 1, 0); +// upwards = new Vec3d(0, 0, -1); +// angle = MathUtil.eulerAngle(direction, upwards); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(0, -45, 0); +// direction = new Vec3d(Math.cos(Math.PI / 2), 0, Math.cos(Math.PI / 2)); +// upwards = new Vec3d(0, 1, 0); +// angle = MathUtil.eulerAngle(direction, upwards); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// } +// +// @Test +// public void directionEulerAngle() { +// for (Direction direction : Direction.values()) { +// EulerAngle expected = MathUtil.directionEulerAngle(direction); +// Vec3d dir = Vec3d.of(direction.getVector()); +// EulerAngle angle = new EulerAngle(MathUtil.pitch(dir), MathUtil.yaw(dir), 0); +// +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// } +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/api/util/math/TransformationMatrix3dTest.java b/src/test/java/org/dimdev/dimdoors/api/util/math/TransformationMatrix3dTest.java index 7be2739b..f585eb17 100644 --- a/src/test/java/org/dimdev/dimdoors/api/util/math/TransformationMatrix3dTest.java +++ b/src/test/java/org/dimdev/dimdoors/api/util/math/TransformationMatrix3dTest.java @@ -1,130 +1,130 @@ -package org.dimdev.dimdoors.api.util.math; - -import net.minecraft.util.math.EulerAngle; -import net.minecraft.util.math.Vec3d; - -import org.dimdev.test.TestUtil; -import org.junit.Test; - -import static org.junit.Assert.*; - -public class TransformationMatrix3dTest { - - @Test - public void identity() { - double[][] matrix = new double[4][4]; - matrix[0] = new double[]{1, 0, 0, 0}; - matrix[1] = new double[]{0, 1, 0, 0}; - matrix[2] = new double[]{0, 0, 1, 0}; - matrix[3] = new double[]{0, 0, 0, 1}; - TransformationMatrix3d identity = new TransformationMatrix3d(matrix); - assertEquals(identity, TransformationMatrix3d.identity()); - - matrix[3] = new double[]{1, 0, 0, 1}; - TransformationMatrix3d matrix3d = new TransformationMatrix3d(matrix); - assertNotEquals(matrix3d, TransformationMatrix3d.identity()); - } - - @Test - public void transformVec3d() { - // rotate around - Vec3d vector = new Vec3d(1, 0, 0); - Vec3d expected; - TransformationMatrix3d rotate90DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 2).build(); - - vector = rotate90DegreesY.transform(vector); - expected = new Vec3d(0, 0, -1); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - vector = rotate90DegreesY.transform(vector); - expected = new Vec3d(-1, 0, 0); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - vector = rotate90DegreesY.transform(vector); - expected = new Vec3d(0, 0, 1); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - vector = rotate90DegreesY.transform(vector); - expected = new Vec3d(1, 0, 0); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - TransformationMatrix3d rotate45DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 4).build(); - - vector = rotate45DegreesY.transform(vector); - expected = new Vec3d(Math.cos(Math.PI/4), 0, -Math.sin(Math.PI/4)); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - double random = Math.random()*2*Math.PI; - expected = new Vec3d(Math.cos(random), 0, -Math.sin(random)); - TransformationMatrix3d.TransformationMatrix3dBuilder builder = TransformationMatrix3d.builder() - .rotate(new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360)) - .translate(new Vec3d(Math.random()*100, Math.random()*100, Math.random()*100)) - .rotate(new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360)) - .translate(new Vec3d(Math.random()*100, Math.random()*100, Math.random()*100)); - - vector = builder.buildReverse().transform(builder.build().transform(expected)); - assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); - - } - - @Test - public void transformEulerAngle() { - EulerAngle expected; - EulerAngle angle; - - TransformationMatrix3d identity = TransformationMatrix3d.identity(); - - expected = new EulerAngle(0, 0, 0); - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(90, 0, 0); - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(0, 90, 0); - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(0, 0, 90); - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - expected = new EulerAngle(90, 90, 90); - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - // randomize EulerAngle - expected = new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360); - - angle = identity.transform(expected); - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - angle = expected; - TransformationMatrix3d rotate90DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 2).build(); - for (int i = 0; i < 4; i++) { - angle = rotate90DegreesY.transform(angle); - } - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - angle = expected; - TransformationMatrix3d rotate90DegreesX = TransformationMatrix3d.builder().rotateX(Math.PI / 2).build(); - for (int i = 0; i < 4; i++) { - angle = rotate90DegreesX.transform(angle); - } - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - - angle = expected; - TransformationMatrix3d rotate90DegreesZ = TransformationMatrix3d.builder().rotateZ(Math.PI / 2).build(); - for (int i = 0; i < 4; i++) { - angle = rotate90DegreesZ.transform(angle); - } - assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); - } - - @Test - public void product() { - // compare I and I^2 - assertEquals(TransformationMatrix3d.identity(), TransformationMatrix3d.identity().product(TransformationMatrix3d.identity())); - } -} +//package org.dimdev.dimdoors.api.util.math; +// +//import net.minecraft.util.math.EulerAngle; +//import net.minecraft.util.math.Vec3d; +// +//import org.dimdev.test.TestUtil; +//import org.junit.Test; +// +//import static org.junit.Assert.*; +// +//public class TransformationMatrix3dTest { +// +// @Test +// public void identity() { +// double[][] matrix = new double[4][4]; +// matrix[0] = new double[]{1, 0, 0, 0}; +// matrix[1] = new double[]{0, 1, 0, 0}; +// matrix[2] = new double[]{0, 0, 1, 0}; +// matrix[3] = new double[]{0, 0, 0, 1}; +// TransformationMatrix3d identity = new TransformationMatrix3d(matrix); +// assertEquals(identity, TransformationMatrix3d.identity()); +// +// matrix[3] = new double[]{1, 0, 0, 1}; +// TransformationMatrix3d matrix3d = new TransformationMatrix3d(matrix); +// assertNotEquals(matrix3d, TransformationMatrix3d.identity()); +// } +// +// @Test +// public void transformVec3d() { +// // rotate around +// Vec3d vector = new Vec3d(1, 0, 0); +// Vec3d expected; +// TransformationMatrix3d rotate90DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 2).build(); +// +// vector = rotate90DegreesY.transform(vector); +// expected = new Vec3d(0, 0, -1); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// vector = rotate90DegreesY.transform(vector); +// expected = new Vec3d(-1, 0, 0); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// vector = rotate90DegreesY.transform(vector); +// expected = new Vec3d(0, 0, 1); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// vector = rotate90DegreesY.transform(vector); +// expected = new Vec3d(1, 0, 0); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// TransformationMatrix3d rotate45DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 4).build(); +// +// vector = rotate45DegreesY.transform(vector); +// expected = new Vec3d(Math.cos(Math.PI/4), 0, -Math.sin(Math.PI/4)); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// double random = Math.random()*2*Math.PI; +// expected = new Vec3d(Math.cos(random), 0, -Math.sin(random)); +// TransformationMatrix3d.TransformationMatrix3dBuilder builder = TransformationMatrix3d.builder() +// .rotate(new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360)) +// .translate(new Vec3d(Math.random()*100, Math.random()*100, Math.random()*100)) +// .rotate(new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360)) +// .translate(new Vec3d(Math.random()*100, Math.random()*100, Math.random()*100)); +// +// vector = builder.buildReverse().transform(builder.build().transform(expected)); +// assertTrue(TestUtil.expectedActual(expected, vector), TestUtil.closeEnough(expected, vector)); +// +// } +// +// @Test +// public void transformEulerAngle() { +// EulerAngle expected; +// EulerAngle angle; +// +// TransformationMatrix3d identity = TransformationMatrix3d.identity(); +// +// expected = new EulerAngle(0, 0, 0); +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(90, 0, 0); +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(0, 90, 0); +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(0, 0, 90); +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// expected = new EulerAngle(90, 90, 90); +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// // randomize EulerAngle +// expected = new EulerAngle((((float) Math.random()) - 0.5F) * 180, (((float) Math.random()) - 0.5F) * 360, (((float) Math.random()) - 0.5F) * 360); +// +// angle = identity.transform(expected); +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// angle = expected; +// TransformationMatrix3d rotate90DegreesY = TransformationMatrix3d.builder().rotateY(Math.PI / 2).build(); +// for (int i = 0; i < 4; i++) { +// angle = rotate90DegreesY.transform(angle); +// } +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// angle = expected; +// TransformationMatrix3d rotate90DegreesX = TransformationMatrix3d.builder().rotateX(Math.PI / 2).build(); +// for (int i = 0; i < 4; i++) { +// angle = rotate90DegreesX.transform(angle); +// } +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// +// angle = expected; +// TransformationMatrix3d rotate90DegreesZ = TransformationMatrix3d.builder().rotateZ(Math.PI / 2).build(); +// for (int i = 0; i < 4; i++) { +// angle = rotate90DegreesZ.transform(angle); +// } +// assertTrue(TestUtil.expectedActual(TestUtil.toString(expected), TestUtil.toString(angle)), TestUtil.closeEnough(expected, angle)); +// } +// +// @Test +// public void product() { +// // compare I and I^2 +// assertEquals(TransformationMatrix3d.identity(), TransformationMatrix3d.identity().product(TransformationMatrix3d.identity())); +// } +//} diff --git a/src/test/java/org/dimdev/dimdoors/world/pocket/PocketDirectoryTest.java b/src/test/java/org/dimdev/dimdoors/world/pocket/PocketDirectoryTest.java index 2c22c125..d560cd08 100644 --- a/src/test/java/org/dimdev/dimdoors/world/pocket/PocketDirectoryTest.java +++ b/src/test/java/org/dimdev/dimdoors/world/pocket/PocketDirectoryTest.java @@ -1,48 +1,48 @@ -package org.dimdev.dimdoors.world.pocket; - -import net.minecraft.util.math.Vec3i; -import org.dimdev.dimdoors.world.ModDimensions; -import org.dimdev.dimdoors.world.pocket.type.Pocket; -import org.dimdev.test.ServerTestRunner; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -//@RunWith(ServerTestRunner.class) -public class PocketDirectoryTest { - - //@Test - public void newPocket() { - PocketDirectory directory = new PocketDirectory(ModDimensions.DUNGEON, 13);// - - Pocket.PocketBuilder builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize(), 1, 1)); - - assertEquals(0, directory.newPocket(builder).getId()); // from 0 to 0 - assertEquals(1, directory.newPocket(builder).getId()); // from 1 to 1 - assertEquals(2, directory.newPocket(builder).getId()); // from 2 to 2 - assertEquals(3, directory.newPocket(builder).getId()); // from 3 to 3 - assertEquals(4, directory.newPocket(builder).getId()); // from 4 to 4 - assertEquals(5, directory.newPocket(builder).getId()); // from 5 to 5 - assertEquals(6, directory.newPocket(builder).getId()); // from 6 to 6 - - - - builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1)); - assertEquals(17, directory.newPocket(builder).getId()); // from 9 to 17 - assertEquals(26, directory.newPocket(builder).getId()); // from 18 to 26 - - builder = Pocket.builder().expand(new Vec3i(3 * 16 * directory.getGridSize() + 1, 3 * 16 * directory.getGridSize() + 1, 3 * 16 * directory.getGridSize() + 1)); - assertEquals(161, directory.newPocket(builder).getId()); // from 81 to 161 - - - - builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1)); - assertEquals(35, directory.newPocket(builder).getId()); // from 27 to 35 - - builder = Pocket.builder().expand(new Vec3i(1, 1, 1)); - assertEquals(7, directory.newPocket(builder).getId()); // from 7 to 7 - assertEquals(8, directory.newPocket(builder).getId()); // from 8 to 8 - assertEquals(36, directory.newPocket(builder).getId()); // from 36 to 36 - } -} +//package org.dimdev.dimdoors.world.pocket; +// +//import net.minecraft.util.math.Vec3i; +//import org.dimdev.dimdoors.world.ModDimensions; +//import org.dimdev.dimdoors.world.pocket.type.Pocket; +//import org.dimdev.test.ServerTestRunner; +//import org.junit.Test; +//import org.junit.runner.RunWith; +// +//import static org.junit.Assert.*; +// +////@RunWith(ServerTestRunner.class) +//public class PocketDirectoryTest { +// +// //@Test +// public void newPocket() { +// PocketDirectory directory = new PocketDirectory(ModDimensions.DUNGEON, 13);// +// +// Pocket.PocketBuilder builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize(), 1, 1)); +// +// assertEquals(0, directory.newPocket(builder).getId()); // from 0 to 0 +// assertEquals(1, directory.newPocket(builder).getId()); // from 1 to 1 +// assertEquals(2, directory.newPocket(builder).getId()); // from 2 to 2 +// assertEquals(3, directory.newPocket(builder).getId()); // from 3 to 3 +// assertEquals(4, directory.newPocket(builder).getId()); // from 4 to 4 +// assertEquals(5, directory.newPocket(builder).getId()); // from 5 to 5 +// assertEquals(6, directory.newPocket(builder).getId()); // from 6 to 6 +// +// +// +// builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1)); +// assertEquals(17, directory.newPocket(builder).getId()); // from 9 to 17 +// assertEquals(26, directory.newPocket(builder).getId()); // from 18 to 26 +// +// builder = Pocket.builder().expand(new Vec3i(3 * 16 * directory.getGridSize() + 1, 3 * 16 * directory.getGridSize() + 1, 3 * 16 * directory.getGridSize() + 1)); +// assertEquals(161, directory.newPocket(builder).getId()); // from 81 to 161 +// +// +// +// builder = Pocket.builder().expand(new Vec3i(16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1, 16 * directory.getGridSize() + 1)); +// assertEquals(35, directory.newPocket(builder).getId()); // from 27 to 35 +// +// builder = Pocket.builder().expand(new Vec3i(1, 1, 1)); +// assertEquals(7, directory.newPocket(builder).getId()); // from 7 to 7 +// assertEquals(8, directory.newPocket(builder).getId()); // from 8 to 8 +// assertEquals(36, directory.newPocket(builder).getId()); // from 36 to 36 +// } +//} diff --git a/src/test/java/org/dimdev/test/ClientTestRunner.java b/src/test/java/org/dimdev/test/ClientTestRunner.java index 5e10569c..b2562ac5 100644 --- a/src/test/java/org/dimdev/test/ClientTestRunner.java +++ b/src/test/java/org/dimdev/test/ClientTestRunner.java @@ -1,16 +1,16 @@ -package org.dimdev.test; - -import net.devtech.potatounit.TestRunner; -import net.fabricmc.api.EnvType; -import org.junit.runners.model.InitializationError; - -public class ClientTestRunner extends TestRunner { - public ClientTestRunner(Class testClass) throws InitializationError, ReflectiveOperationException { - super(hackyOrderMethod(testClass), EnvType.CLIENT); - } - - private static Class hackyOrderMethod(Class testClass) { - System.setProperty("fabric.dli.main", "net.fabricmc.loader.launch.knot.KnotClient"); - return testClass; - } -} +//package org.dimdev.test; +// +//import net.devtech.potatounit.TestRunner; +//import net.fabricmc.api.EnvType; +//import org.junit.runners.model.InitializationError; +// +//public class ClientTestRunner extends TestRunner { +// public ClientTestRunner(Class testClass) throws InitializationError, ReflectiveOperationException { +// super(hackyOrderMethod(testClass), EnvType.CLIENT); +// } +// +// private static Class hackyOrderMethod(Class testClass) { +// System.setProperty("fabric.dli.main", "net.fabricmc.loader.launch.knot.KnotClient"); +// return testClass; +// } +//} diff --git a/src/test/java/org/dimdev/test/ServerTestRunner.java b/src/test/java/org/dimdev/test/ServerTestRunner.java index 00121836..e5def58a 100644 --- a/src/test/java/org/dimdev/test/ServerTestRunner.java +++ b/src/test/java/org/dimdev/test/ServerTestRunner.java @@ -1,16 +1,16 @@ -package org.dimdev.test; - -import net.devtech.potatounit.TestRunner; -import net.fabricmc.api.EnvType; -import org.junit.runners.model.InitializationError; - -public class ServerTestRunner extends TestRunner { - public ServerTestRunner(Class testClass) throws InitializationError, ReflectiveOperationException { - super(hackyOrderMethod(testClass), EnvType.SERVER); - } - - private static Class hackyOrderMethod(Class testClass) { - System.setProperty("fabric.dli.main", "net.fabricmc.loader.launch.knot.KnotServer"); - return testClass; - } -} +//package org.dimdev.test; +// +//import net.devtech.potatounit.TestRunner; +//import net.fabricmc.api.EnvType; +//import org.junit.runners.model.InitializationError; +// +//public class ServerTestRunner extends TestRunner { +// public ServerTestRunner(Class testClass) throws InitializationError, ReflectiveOperationException { +// super(hackyOrderMethod(testClass), EnvType.SERVER); +// } +// +// private static Class hackyOrderMethod(Class testClass) { +// System.setProperty("fabric.dli.main", "net.fabricmc.loader.launch.knot.KnotServer"); +// return testClass; +// } +//} diff --git a/src/test/java/org/dimdev/test/TestUtil.java b/src/test/java/org/dimdev/test/TestUtil.java index 73835c1b..53cf39e1 100644 --- a/src/test/java/org/dimdev/test/TestUtil.java +++ b/src/test/java/org/dimdev/test/TestUtil.java @@ -1,48 +1,48 @@ -package org.dimdev.test; - -import net.minecraft.util.math.EulerAngle; -import net.minecraft.util.math.Vec3d; -import org.dimdev.dimdoors.api.util.math.AbstractMatrixd; - -import java.util.function.Supplier; - -public class TestUtil { - public static String expectedActual(Object expected,Object actual) { - return "\nexpected:\n" + expected + "\nactual:\n" + actual + "\n"; - } - - public static boolean closeEnough(Vec3d expected, Vec3d actual) { - return expected.squaredDistanceTo(actual) <= expected.lengthSquared() * 1E-10; - } - - public static boolean closeEnough(AbstractMatrixd expected, AbstractMatrixd actual) { - if (expected.getDimensionX() != actual.getDimensionX() || expected.getDimensionY() != actual.getDimensionY()) return false; - - for (int i = 0; i < expected.getDimensionX(); i++) { - for (int j = 0; j < expected.getDimensionY(); j++) { - double entry1 = expected.get(i, j); - double entry2 = actual.get(i, j); - if (entry1 == entry2) continue; - if (entry1 != 0 && entry2 != 0) { - double div = entry1/entry2; - if (0.991 <= div && div <= 0.001) continue; - } - if (Math.abs(entry1 - entry2) <= 1E-10) continue; - return false; - } - } - return true; - } - - public static boolean closeEnough(EulerAngle expected, EulerAngle actual) { - float yawDiff = Math.abs(expected.getYaw() - actual.getYaw()); - float pitchDiff = Math.abs(expected.getPitch() - actual.getPitch()); - float rollDiff = Math.abs(expected.getRoll() - actual.getRoll()); - - return yawDiff <= 1 && pitchDiff <= 1 && rollDiff <= 1; - } - - public static String toString(EulerAngle angle) { - return "{yaw: " + angle.getYaw() + "; pitch: " + angle.getPitch() + "; roll: " + angle.getRoll() + "}"; - } -} +//package org.dimdev.test; +// +//import net.minecraft.util.math.EulerAngle; +//import net.minecraft.util.math.Vec3d; +//import org.dimdev.dimdoors.api.util.math.AbstractMatrixd; +// +//import java.util.function.Supplier; +// +//public class TestUtil { +// public static String expectedActual(Object expected,Object actual) { +// return "\nexpected:\n" + expected + "\nactual:\n" + actual + "\n"; +// } +// +// public static boolean closeEnough(Vec3d expected, Vec3d actual) { +// return expected.squaredDistanceTo(actual) <= expected.lengthSquared() * 1E-10; +// } +// +// public static boolean closeEnough(AbstractMatrixd expected, AbstractMatrixd actual) { +// if (expected.getDimensionX() != actual.getDimensionX() || expected.getDimensionY() != actual.getDimensionY()) return false; +// +// for (int i = 0; i < expected.getDimensionX(); i++) { +// for (int j = 0; j < expected.getDimensionY(); j++) { +// double entry1 = expected.get(i, j); +// double entry2 = actual.get(i, j); +// if (entry1 == entry2) continue; +// if (entry1 != 0 && entry2 != 0) { +// double div = entry1/entry2; +// if (0.991 <= div && div <= 0.001) continue; +// } +// if (Math.abs(entry1 - entry2) <= 1E-10) continue; +// return false; +// } +// } +// return true; +// } +// +// public static boolean closeEnough(EulerAngle expected, EulerAngle actual) { +// float yawDiff = Math.abs(expected.getYaw() - actual.getYaw()); +// float pitchDiff = Math.abs(expected.getPitch() - actual.getPitch()); +// float rollDiff = Math.abs(expected.getRoll() - actual.getRoll()); +// +// return yawDiff <= 1 && pitchDiff <= 1 && rollDiff <= 1; +// } +// +// public static String toString(EulerAngle angle) { +// return "{yaw: " + angle.getYaw() + "; pitch: " + angle.getPitch() + "; roll: " + angle.getRoll() + "}"; +// } +//} From 557df4d2ec1aa7d52b3773b4a23a55a82775dd41 Mon Sep 17 00:00:00 2001 From: Waterpicker Date: Tue, 15 Mar 2022 00:20:19 -0500 Subject: [PATCH 3/3] Adjusted private and public dugeon entrances placement. --- .../data/dimdoors/pockets/generators/private/default.json | 4 ++-- .../data/dimdoors/pockets/generators/public/default.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/private/default.json b/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/private/default.json index 4144a20c..59089c52 100644 --- a/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/private/default.json +++ b/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/private/default.json @@ -23,8 +23,8 @@ "door_type": "dimdoors:quartz_dimensional_door", "x": "width/2", "facing": "north", - "y": "5", - "z": "4", + "y": "0", + "z": "-1", "type": "dimdoors:door", "rift_data": { "destination": { diff --git a/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/public/default.json b/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/public/default.json index 8a51c678..a5456986 100644 --- a/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/public/default.json +++ b/src/main/resources/resourcepacks/default/data/dimdoors/pockets/generators/public/default.json @@ -23,8 +23,8 @@ "door_type": "dimdoors:iron_dimensional_door", "x": "width/2", "facing": "north", - "y": "5", - "z": "4", + "y": "0", + "z": "-1", "type": "dimdoors:door", "rift_data": { "destination": {