mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer-physics.git
synced 2025-09-20 18:43:58 -04:00
flowing tests
This commit is contained in:
parent
01d908ed36
commit
12a8686608
@ -3,23 +3,10 @@ package de.bixilon.pixlyzer.physics
|
||||
import de.bixilon.kutil.string.StringUtil.toSnakeCase
|
||||
import de.bixilon.pixlyzer.PixLyzer
|
||||
import de.bixilon.pixlyzer.physics.tests.*
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.bouncing.BedExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.bouncing.HoneyExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.bouncing.SlimeExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.slow.CobwebExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.slow.PowderSnowExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.slow.SweetBerryBushExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.blocks.walk.*
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.still.LavaStillExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.flowing.LavaFlowingExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.flowing.ULavaFlowingExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.flowing.WaterFlowingExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.still.MixedFluidExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.still.WaterStillExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.health.DamageExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.input.SneakExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.item.ItemEntityExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.precision.VelocityFlatteningExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.riding.*
|
||||
import de.bixilon.pixlyzer.physics.tests.server.AbilitiesExtractor
|
||||
import net.minecraft.entity.ItemEntity
|
||||
import java.lang.reflect.Method
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
@ -87,7 +74,10 @@ object PhysicsExtractor {
|
||||
// MinecartExtractor::class.java,
|
||||
// SpiderExtractor::class.java,
|
||||
// ItemEntityExtractor::class.java,
|
||||
WaterStillExtractor::class.java,
|
||||
WaterFlowingExtractor::class.java,
|
||||
LavaFlowingExtractor::class.java,
|
||||
ULavaFlowingExtractor::class.java,
|
||||
MixedFluidExtractor::class.java,
|
||||
)
|
||||
|
||||
|
||||
|
@ -0,0 +1,86 @@
|
||||
package de.bixilon.pixlyzer.physics.tests.fluid.flowing
|
||||
|
||||
import de.bixilon.pixlyzer.physics.tests.AbstractExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.LocalPlayerExtractor
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.FluidUtil.addTags
|
||||
import de.bixilon.pixlyzer.physics.tests.fluid.FluidUtil.withLevel
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.block.FluidBlock
|
||||
import net.minecraft.fluid.Fluid
|
||||
import net.minecraft.tag.TagKey
|
||||
import kotlin.math.abs
|
||||
|
||||
abstract class FlowingFluidExtractor(
|
||||
protected val fluid: FluidBlock,
|
||||
) : LocalPlayerExtractor() {
|
||||
private val levels = arrayOf(
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 7),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 6),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 5),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 4),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 3),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 2),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 1),
|
||||
fluid.defaultState.with(FluidBlock.LEVEL, 0),
|
||||
)
|
||||
|
||||
protected fun star(x: Int = 4, y: Int = 4, z: Int = 4, start: Int = 7, size: Int = 8) {
|
||||
world.fill(x - size - 2, y - 1, z - size - 2, x + size + 2, y - 1, z + size + 2, Blocks.STONE.defaultState)
|
||||
|
||||
for (offsetX in -size..size) {
|
||||
for (offsetZ in -size..size) {
|
||||
val distance = abs(offsetX) + abs(offsetZ)
|
||||
val level = start - distance
|
||||
if (level < 0) continue
|
||||
|
||||
world[x + offsetX, y, z + offsetZ] = this.levels[level]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected fun starMiddle() {
|
||||
star()
|
||||
player.teleport(4.5, 5.0, 4.5)
|
||||
player.tick(16)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
protected fun starOffset() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 3.5)
|
||||
player.tick(16)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
protected fun starOffset2() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 3.5)
|
||||
player.tick(25)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
protected fun starOffset3() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 9.5)
|
||||
player.tick(25)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
protected fun startJumping() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 3.5)
|
||||
player.tick(10)
|
||||
player.setKeys(jump = true)
|
||||
player.tick(10)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
protected fun lowJumping() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 3.5)
|
||||
player.tick(20)
|
||||
player.setKeys(jump = true)
|
||||
player.tick(5)
|
||||
storeMovement()
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package de.bixilon.pixlyzer.physics.tests.fluid.flowing
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.pixlyzer.physics.tests.ExtractorMethod
|
||||
import net.minecraft.block.Blocks
|
||||
|
||||
class LavaFlowingExtractor : FlowingFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaStarMiddle() {
|
||||
super.starMiddle()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaStarOffset() {
|
||||
super.starOffset()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaStarOffset2() {
|
||||
super.starOffset2()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaStarOffset3() {
|
||||
super.starOffset3()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaStartJumping() {
|
||||
super.startJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaLowJumping() {
|
||||
super.lowJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun lavaLowJumping2() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 0.5)
|
||||
player.tick(20)
|
||||
player.setKeys(jump = true)
|
||||
player.tick(5)
|
||||
storeMovement()
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package de.bixilon.pixlyzer.physics.tests.fluid.flowing
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.pixlyzer.physics.abstractions.MinecraftWorld
|
||||
import de.bixilon.pixlyzer.physics.tests.ExtractorMethod
|
||||
import de.bixilon.pixlyzer.util.ReflectionUtil.getField
|
||||
import net.minecraft.block.Blocks
|
||||
|
||||
class ULavaFlowingExtractor : FlowingFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
|
||||
override fun createWorld(): MinecraftWorld {
|
||||
val world = super.createWorld()
|
||||
getField(world.native.getDimension()::class.java, "ultrawarm")!!.set(world.native.getDimension(), true)
|
||||
return world
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaStarMiddle() {
|
||||
super.starMiddle()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaStarOffset() {
|
||||
super.starOffset()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaStarOffset2() {
|
||||
super.starOffset2()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaStarOffset3() {
|
||||
super.starOffset3()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaStartJumping() {
|
||||
super.startJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaLowJumping() {
|
||||
super.lowJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun ulavaLowJumping2() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 0.5)
|
||||
player.tick(20)
|
||||
player.setKeys(jump = true)
|
||||
player.tick(5)
|
||||
storeMovement()
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package de.bixilon.pixlyzer.physics.tests.fluid.flowing
|
||||
|
||||
import de.bixilon.kutil.cast.CastUtil.unsafeCast
|
||||
import de.bixilon.pixlyzer.physics.tests.ExtractorMethod
|
||||
import net.minecraft.block.Blocks
|
||||
|
||||
class WaterFlowingExtractor : FlowingFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterStarMiddle() {
|
||||
super.starMiddle()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterStarOffset() {
|
||||
super.starOffset()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterStarOffset2() {
|
||||
super.starOffset2()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterStarOffset3() {
|
||||
super.starOffset3()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterStartJumping() {
|
||||
super.startJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterLowJumping() {
|
||||
super.lowJumping()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun waterLowJumping2() {
|
||||
star()
|
||||
player.teleport(3.5, 5.0, 10.0)
|
||||
player.tick(30)
|
||||
player.setKeys(jump = true)
|
||||
player.tick(5)
|
||||
storeMovement()
|
||||
}
|
||||
}
|
@ -55,4 +55,52 @@ class MixedFluidExtractor : LocalPlayerExtractor() {
|
||||
player.tick(10)
|
||||
storeMovement()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun mixedHeight1() {
|
||||
world.set(10, 1, 4, Blocks.STONE.defaultState)
|
||||
world.set(10, 2, 4, lava.withLevel(7))
|
||||
world.set(10, 3, 4, water.withLevel(7))
|
||||
player.teleport(10.0, 2.0, 3.8)
|
||||
player.tick(2)
|
||||
player.setKeys(jump = true, forwards = true)
|
||||
player.tick(3)
|
||||
player.storeMovement()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun mixedHeight1M() {
|
||||
world.set(10, 1, 4, Blocks.STONE.defaultState)
|
||||
world.set(10, 2, 4, lava.withLevel(7))
|
||||
world.set(10, 3, 4, water.withLevel(7))
|
||||
player.teleport(10.0, 2.0, 3.8)
|
||||
player.tick(2)
|
||||
player.setKeys(jump = true, forwards = true)
|
||||
player.tick(2)
|
||||
player.storeMovement()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun mixedHeight2() {
|
||||
world.set(10, 1, 4, Blocks.STONE.defaultState)
|
||||
world.set(10, 2, 4, water.withLevel(7))
|
||||
world.set(10, 3, 4, lava.withLevel(7))
|
||||
player.teleport(10.0, 2.0, 3.8)
|
||||
player.tick(2)
|
||||
player.setKeys(jump = true, forwards = true)
|
||||
player.tick(3)
|
||||
player.storeMovement()
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun mixedHeight2M() {
|
||||
world.set(10, 1, 4, Blocks.STONE.defaultState)
|
||||
world.set(10, 2, 4, water.withLevel(7))
|
||||
world.set(10, 3, 4, lava.withLevel(7))
|
||||
player.teleport(10.0, 2.0, 3.8)
|
||||
player.tick(2)
|
||||
player.setKeys(jump = true, forwards = true)
|
||||
player.tick(2)
|
||||
player.storeMovement()
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUp() {
|
||||
fun bubbleColumnUp() {
|
||||
bubbleColumn(5, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.tick(4)
|
||||
@ -84,7 +84,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUp2() {
|
||||
fun bubbleColumnUp2() {
|
||||
bubbleColumn(5, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.tick(10)
|
||||
@ -92,7 +92,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUpForward() {
|
||||
fun bubbleColumnUpForward() {
|
||||
bubbleColumn(5, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.setKeys(forwards = true)
|
||||
@ -101,7 +101,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUpForward2() {
|
||||
fun bubbleColumnUpForward2() {
|
||||
bubbleColumn(5, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.setKeys(forwards = true)
|
||||
@ -110,7 +110,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUpSurface() {
|
||||
fun bubbleColumnUpSurface() {
|
||||
bubbleColumn(1, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.tick(10)
|
||||
@ -118,7 +118,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUpSurface2() {
|
||||
fun bubbleColumnUpSurface2() {
|
||||
bubbleColumn(1, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.tick(18)
|
||||
@ -126,7 +126,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumUpSurfaceForward() {
|
||||
fun bubbleColumnUpSurfaceForward() {
|
||||
bubbleColumn(1, false)
|
||||
player.teleport(4.0, 17.0, 7.0)
|
||||
player.setKeys(forwards = true)
|
||||
@ -135,7 +135,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDown() {
|
||||
fun bubbleColumnDown() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.tick(4)
|
||||
@ -143,7 +143,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDown2() {
|
||||
fun bubbleColumnDown2() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.tick(10)
|
||||
@ -151,7 +151,29 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDown3() {
|
||||
fun bubbleColumnStartSwimming() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.setKeys(forwards = true, sprint = true)
|
||||
player.tick(10)
|
||||
storeMovement()
|
||||
result["pose"] = player.pose
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumnContinueSwimming() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.setKeys(forwards = true, sprint = true)
|
||||
player.tick(10)
|
||||
player.setKeys()
|
||||
player.tick(1)
|
||||
storeMovement()
|
||||
result["pose"] = player.pose
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumnDown3() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.tick(20)
|
||||
@ -159,7 +181,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDown4() {
|
||||
fun bubbleColumnDown4() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.tick(30)
|
||||
@ -167,7 +189,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDownForward() {
|
||||
fun bubbleColumnDownForward() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.setKeys(forwards = true)
|
||||
@ -176,7 +198,7 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
}
|
||||
|
||||
@ExtractorMethod
|
||||
fun bubbleColumDownForward2() {
|
||||
fun bubbleColumnDownForward2() {
|
||||
bubbleColumn(5, true)
|
||||
player.teleport(4.0, 19.0, 7.0)
|
||||
player.setKeys(forwards = true)
|
||||
@ -210,8 +232,8 @@ class WaterStillExtractor : StillFluidExtractor(Blocks.WATER.unsafeCast()) {
|
||||
|
||||
|
||||
protected fun falling() {
|
||||
world.fill(-10, 16, -10, 20, 20, 20, fluid.withLevel(8))
|
||||
world.fill(-10, 15, -10, 20, 15, 20, Blocks.STONE.defaultState)
|
||||
world.fill(-10, 16, -10, 10, 20, 10, fluid.withLevel(8))
|
||||
world.fill(-10, 15, -10, 10, 15, 10, Blocks.STONE.defaultState)
|
||||
}
|
||||
|
||||
protected fun bubbleColumn(height: Int, drag: Boolean) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user