From 21169b5e52c264dbfe8e0c24edf7d41696681786 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Tue, 22 Nov 2022 17:57:02 +0100 Subject: [PATCH] rename PhysicsTest to ExtractorMethod --- .../pixlyzer/physics/PhysicsExtractor.kt | 4 +-- .../pixlyzer/physics/tests/AttributeTest.kt | 32 +++++++++---------- .../pixlyzer/physics/tests/BiomeNoiseTest.kt | 14 ++++---- .../pixlyzer/physics/tests/CollisionTest.kt | 10 +++--- .../pixlyzer/physics/tests/EmptyTest.kt | 4 +-- .../pixlyzer/physics/tests/GravityTest.kt | 32 +++++++++---------- .../pixlyzer/physics/tests/PhysicsTest.kt | 3 -- .../pixlyzer/physics/tests/SpectatorTest.kt | 10 +++--- .../physics/tests/ground/GroundWalk.kt | 18 +++++------ .../physics/tests/packet/PacketReceiveTest.kt | 8 ++--- 10 files changed, 66 insertions(+), 69 deletions(-) delete mode 100644 src/main/kotlin/de/bixilon/pixlyzer/physics/tests/PhysicsTest.kt diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt index 2864f3e..8b629bc 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt @@ -41,10 +41,10 @@ object PhysicsExtractor { for (method in tests.declaredMethods) { method.isAccessible = true - if (!method.isAnnotationPresent(PhysicsTest::class.java)) { + if (!method.isAnnotationPresent(ExtractorMethod::class.java)) { continue } - val id = method.getAnnotation(PhysicsTest::class.java).id + val id = method.getAnnotation(ExtractorMethod::class.java).id try { run(method, instance) data.put(id, instance.result)?.let { throw IllegalStateException("Duplicated test: $id") } diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/AttributeTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/AttributeTest.kt index d8c6ace..b3c7b6d 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/AttributeTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/AttributeTest.kt @@ -5,94 +5,94 @@ import net.minecraft.entity.attribute.EntityAttributes class AttributeTest : AbstractTest() { - @PhysicsTest("speed_0") + @ExtractorMethod("speed_0") fun speed0() { result["speed"] = player.movementSpeed } - @PhysicsTest("speed_1") + @ExtractorMethod("speed_1") fun speed1() { player.applySpeed(1) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_2") + @ExtractorMethod("speed_2") fun speed2() { player.applySpeed(2) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_3") + @ExtractorMethod("speed_3") fun speed3() { player.applySpeed(3) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_4") + @ExtractorMethod("speed_4") fun speed4() { player.applySpeed(4) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_123") + @ExtractorMethod("speed_123") fun speed123() { player.applySpeed(123) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_1024") + @ExtractorMethod("speed_1024") fun speed1024() { player.applySpeed(1024) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_sprint") + @ExtractorMethod("speed_sprint") fun speedSprint() { player.native.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED)!!.addTemporaryModifier(LivingEntity.SPRINTING_SPEED_BOOST) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_sprint_speed1") + @ExtractorMethod("speed_sprint_speed1") fun speedSprintSpeed1() { player.native.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED)!!.addTemporaryModifier(LivingEntity.SPRINTING_SPEED_BOOST) player.applySpeed(1) result["speed"] = player.movementSpeed } - @PhysicsTest("speed_sprint_speed5") + @ExtractorMethod("speed_sprint_speed5") fun speedSprintSpeed5() { player.native.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED)!!.addTemporaryModifier(LivingEntity.SPRINTING_SPEED_BOOST) player.applySpeed(5) result["speed"] = player.movementSpeed } - @PhysicsTest("slowness_1") + @ExtractorMethod("slowness_1") fun slowness1() { player.applySlowness(1) result["speed"] = player.movementSpeed } - @PhysicsTest("slowness_5") + @ExtractorMethod("slowness_5") fun slowness5() { player.applySlowness(5) result["speed"] = player.movementSpeed } - @PhysicsTest("speed1_slowness1") + @ExtractorMethod("speed1_slowness1") fun speed1Slowness1() { player.applySpeed(1) player.applySlowness(1) result["speed"] = player.movementSpeed } - @PhysicsTest("speed3_slowness5") + @ExtractorMethod("speed3_slowness5") fun speed3Slowness5() { player.applySpeed(3) player.applySlowness(5) result["speed"] = player.movementSpeed } - @PhysicsTest("speed9_slowness6_sprint") + @ExtractorMethod("speed9_slowness6_sprint") fun speed9Slowness6Sprint() { player.applySpeed(9) player.applySlowness(6) @@ -100,7 +100,7 @@ class AttributeTest : AbstractTest() { result["speed"] = player.movementSpeed } - @PhysicsTest("speed9_slowness1_sprint") + @ExtractorMethod("speed9_slowness1_sprint") fun speed9Slowness1Sprint() { player.applySpeed(9) player.applySlowness(1) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/BiomeNoiseTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/BiomeNoiseTest.kt index 0b41bc9..f79e2bd 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/BiomeNoiseTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/BiomeNoiseTest.kt @@ -7,37 +7,37 @@ import net.minecraft.world.biome.source.BiomeAccess class BiomeNoiseTest : AbstractTest() { - @PhysicsTest("biome_noise_1") + @ExtractorMethod("biome_noise_1") fun testBiomeNoise1() { getBiomeCoordinate(129, 3274, 91, 1823123L).put() } - @PhysicsTest("biome_noise_2") + @ExtractorMethod("biome_noise_2") fun testBiomeNoise2() { getBiomeCoordinate(129, 3274, 91, -123213L).put() } - @PhysicsTest("biome_noise_3") + @ExtractorMethod("biome_noise_3") fun testBiomeNoise3() { getBiomeCoordinate(-17, 3274, 91, -123213L).put() } - @PhysicsTest("biome_noise_4") + @ExtractorMethod("biome_noise_4") fun testBiomeNoise4() { getBiomeCoordinate(-1123, 3, 1, -18209371253621313L).put() } - @PhysicsTest("biome_noise_5") + @ExtractorMethod("biome_noise_5") fun testBiomeNoise5() { getBiomeCoordinate(0, 3, 1, -33135639).put() } - @PhysicsTest("biome_noise_6") + @ExtractorMethod("biome_noise_6") fun testBiomeNoise6() { getBiomeCoordinate(16, 15, -16, 561363374).put() } - @PhysicsTest("biome_noise_7") + @ExtractorMethod("biome_noise_7") fun testBiomeNoise7() { getBiomeCoordinate(16, -15, -16, 79707367).put() } diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/CollisionTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/CollisionTest.kt index ed46a56..a4fb7bc 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/CollisionTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/CollisionTest.kt @@ -4,7 +4,7 @@ import net.minecraft.block.Blocks class CollisionTest : AbstractTest() { - @PhysicsTest("collision_dirt_1") + @ExtractorMethod("collision_dirt_1") fun collisionDirt1() { player.teleport(0.0, 5.0, 0.0) world.set(0, 4, 0, Blocks.DIRT.defaultState) @@ -13,7 +13,7 @@ class CollisionTest : AbstractTest() { storeVelocity() } - @PhysicsTest("collision_dirt_2") + @ExtractorMethod("collision_dirt_2") fun collisionDirt2() { player.teleport(0.0, 5.0, 0.0) world.set(0, 2, 0, Blocks.DIRT.defaultState) @@ -22,7 +22,7 @@ class CollisionTest : AbstractTest() { storeVelocity() } - @PhysicsTest("collision_dirt_3") + @ExtractorMethod("collision_dirt_3") fun collisionDirt3() { player.teleport(0.0, 300.0, 0.0) world.set(0, 0, 0, Blocks.DIRT.defaultState) @@ -31,7 +31,7 @@ class CollisionTest : AbstractTest() { storeVelocity() } - @PhysicsTest("collision_slab") + @ExtractorMethod("collision_slab") fun collisionSlab() { player.teleport(0.0, 2.0, 0.0) world.set(0, 0, 0, Blocks.OAK_SLAB.defaultState) @@ -40,7 +40,7 @@ class CollisionTest : AbstractTest() { storeVelocity() } - @PhysicsTest("collision_high_velocity") + @ExtractorMethod("collision_high_velocity") fun collisionHighVelocity() { player.teleport(0.0, 3.0, 0.0) world.set(0, 1, 0, Blocks.OAK_SLAB.defaultState) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/EmptyTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/EmptyTest.kt index cf5d737..bcd1056 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/EmptyTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/EmptyTest.kt @@ -2,12 +2,12 @@ package de.bixilon.pixlyzer.physics.tests class EmptyTest : AbstractTest() { - @PhysicsTest("initial_position") + @ExtractorMethod("initial_position") fun testInitialPosition() { storePosition() } - @PhysicsTest("empty_teleport") + @ExtractorMethod("empty_teleport") fun testTeleporting() { player.teleport(123.0, 535.0, 19.0) storePosition() diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/GravityTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/GravityTest.kt index e62878a..59890bd 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/GravityTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/GravityTest.kt @@ -2,35 +2,35 @@ package de.bixilon.pixlyzer.physics.tests class GravityTest : AbstractTest() { - @PhysicsTest("blank_falling_1") + @ExtractorMethod("blank_falling_1") fun blankFalling1() { player.teleport(45.0, 178.0, 13.0) player.tick() storeMovement() } - @PhysicsTest("blank_falling_2") + @ExtractorMethod("blank_falling_2") fun blankFalling2() { player.teleport(45.0, 178.0, 13.0) player.tick(2) storeMovement() } - @PhysicsTest("blank_falling_3") + @ExtractorMethod("blank_falling_3") fun blankFalling3() { player.teleport(45.0, 178.0, 13.0) player.tick(3) storeMovement() } - @PhysicsTest("blank_falling_90") + @ExtractorMethod("blank_falling_90") fun blankFalling90() { player.teleport(45.0, 178.0, 13.0) player.tick(90) storeMovement() } - @PhysicsTest("forwards_falling_1") + @ExtractorMethod("forwards_falling_1") fun forwardFalling1() { player.teleport(45.0, 178.0, 13.0) player.setKeys(forwards = true) @@ -38,7 +38,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("forwards_falling_2") + @ExtractorMethod("forwards_falling_2") fun forwardFalling2() { player.teleport(45.0, 178.0, 13.0) player.setKeys(forwards = true) @@ -46,7 +46,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("forwards_falling_3") + @ExtractorMethod("forwards_falling_3") fun forwardFalling3() { player.teleport(45.0, 178.0, 13.0) player.setKeys(forwards = true) @@ -54,7 +54,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("forwards_falling_90") + @ExtractorMethod("forwards_falling_90") fun forwardFalling90() { player.teleport(45.0, 178.0, 13.0) player.setKeys(forwards = true) @@ -62,7 +62,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("backwards_falling_1") + @ExtractorMethod("backwards_falling_1") fun backwardsFalling1() { player.teleport(45.0, 178.0, 13.0) player.setKeys(backwards = true) @@ -70,7 +70,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("backwards_falling_2") + @ExtractorMethod("backwards_falling_2") fun backwardsFalling2() { player.teleport(45.0, 178.0, 13.0) player.setKeys(backwards = true) @@ -78,7 +78,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("backwards_falling_3") + @ExtractorMethod("backwards_falling_3") fun backwardsFalling3() { player.teleport(45.0, 178.0, 13.0) player.setKeys(backwards = true) @@ -86,7 +86,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("backwards_falling_90") + @ExtractorMethod("backwards_falling_90") fun backwardsFalling90() { player.teleport(45.0, 178.0, 13.0) player.setKeys(backwards = true) @@ -94,7 +94,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("positive_falling_37") + @ExtractorMethod("positive_falling_37") fun positiveFalling37() { player.teleport(45.0, 178.0, 13.0) player.setKeys(forwards = true, right = true) @@ -102,7 +102,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("negative_falling_124") + @ExtractorMethod("negative_falling_124") fun negativeFalling124() { player.teleport(45.0, 178.0, 13.0) player.setKeys(backwards = true, left = true) @@ -110,7 +110,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("rotated_falling_5") + @ExtractorMethod("rotated_falling_5") fun rotatedFalling5() { player.teleport(45.0, 178.0, 13.0) player.rotate(23.0, 86.0) @@ -119,7 +119,7 @@ class GravityTest : AbstractTest() { storeMovement() } - @PhysicsTest("rotated_falling_12") + @ExtractorMethod("rotated_falling_12") fun rotatedFalling12() { player.teleport(45.0, 178.0, 13.0) player.rotate(123.0, 23.0) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/PhysicsTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/PhysicsTest.kt deleted file mode 100644 index a049abf..0000000 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/PhysicsTest.kt +++ /dev/null @@ -1,3 +0,0 @@ -package de.bixilon.pixlyzer.physics.tests - -annotation class PhysicsTest(val id: String) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/SpectatorTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/SpectatorTest.kt index 8ab15b8..cf610be 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/SpectatorTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/SpectatorTest.kt @@ -2,7 +2,7 @@ package de.bixilon.pixlyzer.physics.tests class SpectatorTest : AbstractTest() { - @PhysicsTest("spectator_test_1") + @ExtractorMethod("spectator_test_1") fun spectatorTest1() { player.teleport(0.0, 5.0, 0.0) player.setKeys(forwards = true) @@ -11,7 +11,7 @@ class SpectatorTest : AbstractTest() { storeVelocity() } - @PhysicsTest("spectator_test_2") + @ExtractorMethod("spectator_test_2") fun spectatorTest2() { player.teleport(12.0, 5.0, 12.0) player.setKeys(forwards = true) @@ -20,7 +20,7 @@ class SpectatorTest : AbstractTest() { storeVelocity() } - @PhysicsTest("spectator_test_3") + @ExtractorMethod("spectator_test_3") fun spectatorTest3() { player.teleport(12.0, 5.0, 12.0) player.setKeys(forwards = true, left = true) @@ -30,7 +30,7 @@ class SpectatorTest : AbstractTest() { storeVelocity() } - @PhysicsTest("spectator_test_4") + @ExtractorMethod("spectator_test_4") fun spectatorTest4() { player.teleport(12.0, 5.0, -19.0) player.setKeys(forwards = true, right = true) @@ -40,7 +40,7 @@ class SpectatorTest : AbstractTest() { storeVelocity() } - @PhysicsTest("spectator_test_5") + @ExtractorMethod("spectator_test_5") fun spectatorTest5() { player.teleport(12.0, 5.0, -19.0) player.setKeys(forwards = true, right = true) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt index 57b4c71..80e3ede 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt @@ -2,7 +2,7 @@ package de.bixilon.pixlyzer.physics.tests.ground import de.bixilon.pixlyzer.physics.abstractions.MinecraftWorld import de.bixilon.pixlyzer.physics.tests.AbstractTest -import de.bixilon.pixlyzer.physics.tests.PhysicsTest +import de.bixilon.pixlyzer.physics.tests.ExtractorMethod import net.minecraft.block.Blocks class GroundWalk : AbstractTest() { @@ -12,7 +12,7 @@ class GroundWalk : AbstractTest() { return world } - @PhysicsTest("ground_walk_landing") + @ExtractorMethod("ground_walk_landing") fun landing() { player.teleport(6.0, 5.0, 6.0) player.tick(15) @@ -20,7 +20,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_1") + @ExtractorMethod("ground_walk_walking_1") fun walking1() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) @@ -29,7 +29,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_2") + @ExtractorMethod("ground_walk_walking_2") fun walking2() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) @@ -38,7 +38,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_3") + @ExtractorMethod("ground_walk_walking_3") fun walking3() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) @@ -47,7 +47,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_4") + @ExtractorMethod("ground_walk_walking_4") fun walking4() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) @@ -56,7 +56,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_5") + @ExtractorMethod("ground_walk_walking_5") fun walking5() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) @@ -65,7 +65,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_6") + @ExtractorMethod("ground_walk_walking_6") fun walking6() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) @@ -75,7 +75,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @PhysicsTest("ground_walk_walking_7") + @ExtractorMethod("ground_walk_walking_7") fun walking7() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/packet/PacketReceiveTest.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/packet/PacketReceiveTest.kt index 13db87b..171d56f 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/packet/PacketReceiveTest.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/packet/PacketReceiveTest.kt @@ -1,7 +1,7 @@ package de.bixilon.pixlyzer.physics.tests.packet import de.bixilon.pixlyzer.physics.tests.AbstractTest -import de.bixilon.pixlyzer.physics.tests.PhysicsTest +import de.bixilon.pixlyzer.physics.tests.ExtractorMethod import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket.Flag @@ -28,7 +28,7 @@ class PacketReceiveTest : AbstractTest() { return PlayerPositionLookS2CPacket(x, y, z, yaw, pitch, flags, 0, dismount) } - @PhysicsTest("receive_empty") + @ExtractorMethod("receive_empty") fun testEmpty() { val packet = createPacket(0.0, true, 0.0, true, 0.0, true, 0.0f, true, 0.0f, true, false) player.handlePacket(packet) @@ -36,7 +36,7 @@ class PacketReceiveTest : AbstractTest() { result["mount"] = player.jumpingMount != null } - @PhysicsTest("receive_relative") + @ExtractorMethod("receive_relative") fun testRelative() { player.teleport(623.0, 71.0, 782.0) val packet = createPacket(14.0, true, 87.0, true, 91.0, true, 9.0f, true, 92.0f, true, false) @@ -46,7 +46,7 @@ class PacketReceiveTest : AbstractTest() { result["mount"] = player.jumpingMount != null } - @PhysicsTest("receive_absolute") + @ExtractorMethod("receive_absolute") fun testAbsolut() { player.teleport(623.0, 71.0, 782.0) val packet = createPacket(14.0, false, 87.0, false, 91.0, false, 9.0f, false, 92.0f, false, false)