From 5a525692503d9697b41dd30acc31c4bae6eb7ec8 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Sun, 4 Dec 2022 15:58:19 +0100 Subject: [PATCH] abstract stone walk test --- ReadME.md | 6 ++- .../pixlyzer/physics/PhysicsExtractor.kt | 4 +- .../walk/AbstractWalkExtractor.kt} | 35 +++++--------- .../physics/tests/blocks/walk/StoneWalk.kt | 47 +++++++++++++++++++ 4 files changed, 67 insertions(+), 25 deletions(-) rename src/main/kotlin/de/bixilon/pixlyzer/physics/tests/{ground/GroundWalk.kt => blocks/walk/AbstractWalkExtractor.kt} (63%) create mode 100644 src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/StoneWalk.kt diff --git a/ReadME.md b/ReadME.md index 3a07fc1..f5fcfc7 100644 --- a/ReadME.md +++ b/ReadME.md @@ -49,14 +49,18 @@ This [pixlyzer](https://gitlab.bixilon.de/bixilon/pixlyzer) module runs physics - climbing (e.g. ladders) - scaffolding - stepping (e.g. stairs) - - bed/slime - honey - soul sand - fences + - bouncing + - bed + - slime - slow movement - powder snow - sweet berry bush - cobweb + - slippery movement + - ice - vehicles - riding (e.g. horse, strider, ...) - jump strength diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt index 714c58a..eb539fc 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/PhysicsExtractor.kt @@ -8,7 +8,7 @@ import de.bixilon.pixlyzer.physics.tests.enchantments.NoEnchantmentExtractor import de.bixilon.pixlyzer.physics.tests.enchantments.SoulSpeed2Extractor import de.bixilon.pixlyzer.physics.tests.enchantments.SoulSpeedExtractor import de.bixilon.pixlyzer.physics.tests.enchantments.SwiftSneakExtractor -import de.bixilon.pixlyzer.physics.tests.ground.GroundWalk +import de.bixilon.pixlyzer.physics.tests.blocks.walk.StoneWalk import de.bixilon.pixlyzer.physics.tests.input.* import de.bixilon.pixlyzer.physics.tests.packet.PacketReceiveExtractor import de.bixilon.pixlyzer.physics.tests.potion.* @@ -26,7 +26,7 @@ object PhysicsExtractor { BiomeNoiseExtractor::class.java, CollisionExtractor::class.java, SpectatorExtractor::class.java, - GroundWalk::class.java, + StoneWalk::class.java, LevitationExtractor::class.java, SlowFallingExtractor::class.java, JumpExtractor::class.java, diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/AbstractWalkExtractor.kt similarity index 63% rename from src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt rename to src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/AbstractWalkExtractor.kt index 80e3ede..71ace34 100644 --- a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/ground/GroundWalk.kt +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/AbstractWalkExtractor.kt @@ -1,27 +1,24 @@ -package de.bixilon.pixlyzer.physics.tests.ground +package de.bixilon.pixlyzer.physics.tests.blocks.walk import de.bixilon.pixlyzer.physics.abstractions.MinecraftWorld -import de.bixilon.pixlyzer.physics.tests.AbstractTest -import de.bixilon.pixlyzer.physics.tests.ExtractorMethod -import net.minecraft.block.Blocks +import de.bixilon.pixlyzer.physics.tests.AbstractExtractor +import net.minecraft.block.BlockState -class GroundWalk : AbstractTest() { +abstract class AbstractWalkExtractor(private val state: BlockState) : AbstractExtractor() { override fun createWorld(): MinecraftWorld { val world = super.createWorld() - world.fill(-20, 0, -20, 20, 0, 20, Blocks.RED_WOOL.getDefaultState()) + world.fill(-20, 0, -20, 20, 0, 20, state) return world } - @ExtractorMethod("ground_walk_landing") - fun landing() { + protected fun landing() { player.teleport(6.0, 5.0, 6.0) player.tick(15) storePosition() storeVelocity() } - @ExtractorMethod("ground_walk_walking_1") - fun walking1() { + protected fun walking1() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) player.tick(2) @@ -29,8 +26,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_2") - fun walking2() { + protected fun walking2() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) player.tick(10) @@ -38,8 +34,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_3") - fun walking3() { + protected fun walking3() { player.teleport(6.0, 1.0, 6.0) player.setKeys(forwards = true) player.tick(50) @@ -47,8 +42,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_4") - fun walking4() { + protected fun walking4() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) player.tick(10) @@ -56,8 +50,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_5") - fun walking5() { + protected fun walking5() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) player.tick(50) @@ -65,8 +58,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_6") - fun walking6() { + protected fun walking6() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) player.rotate(180.0, 0.0) @@ -75,8 +67,7 @@ class GroundWalk : AbstractTest() { storeVelocity() } - @ExtractorMethod("ground_walk_walking_7") - fun walking7() { + protected fun walking7() { player.teleport(-6.0, 1.0, -6.0) player.setKeys(forwards = true) player.rotate(180.0, 0.0) diff --git a/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/StoneWalk.kt b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/StoneWalk.kt new file mode 100644 index 0000000..69a0a73 --- /dev/null +++ b/src/main/kotlin/de/bixilon/pixlyzer/physics/tests/blocks/walk/StoneWalk.kt @@ -0,0 +1,47 @@ +package de.bixilon.pixlyzer.physics.tests.blocks.walk + +import de.bixilon.pixlyzer.physics.tests.ExtractorMethod +import net.minecraft.block.Blocks + +class StoneWalk : AbstractWalkExtractor(Blocks.STONE.defaultState) { + + @ExtractorMethod + fun stoneLanding() { + super.landing() + } + + @ExtractorMethod + fun stoneWalking1() { + super.walking1() + } + + @ExtractorMethod + fun stoneWalking2() { + super.walking2() + } + + @ExtractorMethod + fun stoneWalking3() { + super.walking3() + } + + @ExtractorMethod + fun stoneWalking4() { + super.walking4() + } + + @ExtractorMethod + fun stoneWalking5() { + super.walking5() + } + + @ExtractorMethod + fun stoneWalking6() { + super.walking6() + } + + @ExtractorMethod + fun stoneWalking7() { + super.walking7() + } +}