mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer-physics.git
synced 2025-09-22 11:56:56 -04:00
fix crash, extract player speed
This commit is contained in:
parent
78fdfb7490
commit
17f5a1d79d
@ -1,10 +1,7 @@
|
||||
package de.bixilon.pixlyzer.physics
|
||||
|
||||
import de.bixilon.pixlyzer.PixLyzer
|
||||
import de.bixilon.pixlyzer.physics.tests.AbstractTest
|
||||
import de.bixilon.pixlyzer.physics.tests.EmptyTest
|
||||
import de.bixilon.pixlyzer.physics.tests.GravityTest
|
||||
import de.bixilon.pixlyzer.physics.tests.PhysicsTest
|
||||
import de.bixilon.pixlyzer.physics.tests.*
|
||||
import de.bixilon.pixlyzer.physics.tests.packet.PacketReceiveTest
|
||||
import java.lang.reflect.Method
|
||||
import kotlin.system.exitProcess
|
||||
@ -14,6 +11,7 @@ object PhysicsExtractor {
|
||||
EmptyTest::class.java,
|
||||
PacketReceiveTest::class.java,
|
||||
GravityTest::class.java,
|
||||
AttributeTest::class.java,
|
||||
)
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ object PhysicsUtil {
|
||||
private val SIMPLE_OPTION_BOOLEAN = SIMPLE_OPTION?.getMethod("ofBoolean", String::class.java, Boolean::class.java)?.apply { isAccessible = true }
|
||||
private val PLAYER_ENTRY = getField(AbstractClientPlayerEntity::class.java, "playerListEntry") ?: getField(ClientPlayerEntity::class.java, "playerListEntry", "cachedScoreboardEntry")
|
||||
|
||||
private val PROFILE_KEYS = getClass("net.minecraft.client.util.ProfileKeys")
|
||||
private val PROFILE_KEYS = getClass("net.minecraft.client.util.ProfileKeysImpl", "net.minecraft.client.util.ProfileKeys")
|
||||
private val PROFILE_KEYS_KEY_FUTURE = getField(PROFILE_KEYS, "keyFuture")
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ object PhysicsUtil {
|
||||
|
||||
private val SPRINT_KEY = getField(GameOptions::class.java, "sprintKey", "sprintToggle", "keySprint")
|
||||
|
||||
private val REGISTRY_ENTRY = "net.minecraft.util.registry.RegistryEntry"
|
||||
|
||||
fun createChunkManager(native: ClientWorld): ClientChunkManager {
|
||||
val chunkManager = OBJENESIS.newInstance(ClientChunkManager::class.java)
|
||||
@ -77,7 +76,7 @@ object PhysicsUtil {
|
||||
native.setDimension()
|
||||
native.entityManager = ClientEntityManager(Entity::class.java, native.ClientEntityHandler())
|
||||
|
||||
native.biomeAccess = BiomeAccess(BiomeAccess.Storage { biomeX, biomeY, biomeZ -> return@Storage RegistryEntry.Direct<Biome>(null) }, 0L)
|
||||
native.biomeAccess = BiomeAccess(BiomeAccess.Storage { _, _, _ -> return@Storage RegistryEntry.Direct<Biome>(null) }, 0L)
|
||||
//native.biomeAccess = BiomeAccess(BiomeAccess.Storage { biomeX, biomeY, biomeZ -> return@Storage null }, 0L, BiomeAccessType {_,_,_,_,_->null})
|
||||
|
||||
return MinecraftWorld(native)
|
||||
|
@ -5,9 +5,9 @@ import net.minecraft.client.input.KeyboardInput
|
||||
|
||||
class CustomInput : Input() {
|
||||
|
||||
override fun tick(slowDown: Boolean) {
|
||||
tick(slowDown, 0.3f)
|
||||
}
|
||||
fun tick(slowDown: Boolean) {
|
||||
tick(slowDown, 0.3f)
|
||||
}
|
||||
|
||||
fun getMovementMultiplier(positive: Boolean, negative: Boolean): Float {
|
||||
return if (positive == negative) {
|
||||
@ -17,7 +17,7 @@ class CustomInput : Input() {
|
||||
}
|
||||
}
|
||||
|
||||
fun tick(slowDown: Boolean, multiplier: Float) {
|
||||
override fun tick(slowDown: Boolean, multiplier: Float) {
|
||||
movementForward = getMovementMultiplier(pressingForward, pressingBack)
|
||||
movementSideways = getMovementMultiplier(pressingLeft, pressingRight)
|
||||
if (slowDown) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user