physics submodule

This commit is contained in:
Bixilon 2022-11-12 20:30:12 +01:00
parent 65bcdb91a5
commit 0dbad55eaa
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 35 additions and 11 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "wrapper/data"]
path = wrapper/data
url = ssh://git@gitlab.bixilon.de:222/bixilon/pixlyzer-data.git
[submodule "pixlyzer-physics"]
path = pixlyzer-physics
url = ssh://git@gitlab.bixilon.de:222/bixilon/pixlyzer-physics.git

1
pixlyzer-physics Submodule

@ -0,0 +1 @@
Subproject commit 04c31297179487ac728e97df5e7108a316516838

View File

@ -99,6 +99,11 @@
<artifactId>jackson-databind</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>de.bixilon</groupId>
<artifactId>kutil</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>

View File

@ -91,6 +91,20 @@ object EntitySpawner {
val CLIENT_LEVEL = OBJENSIS.newInstance(levelClass) as ClientWorld
fun World.setDimension() {
getClass("net.minecraft.world.dimension.OverworldDimension", "net.minecraft.world.dimension.DimensionType")?.let {
val dimension = OBJENSIS.newInstance(it)
getField(DimensionType::class.java, "minimumY")?.set(dimension, 0)
getField(World::class.java, "dimensionEntry")?.let {
setFinalField(getField(World::class.java, "dimensionEntry")!!, this, getClass("net.minecraft.util.registry.RegistryEntry\$Direct")!!.getConstructor(Any::class.java).newInstance(dimension))
}
try {
setFinalField(getField(World::class.java, "dimension")!!, this, dimension)
} catch (ignored: Throwable) {
}
}
}
init {
val randomField = getField(World::class.java, "random")!!
@ -98,17 +112,8 @@ object EntitySpawner {
setFinalField(getField(World::class.java, "border")!!, CLIENT_LEVEL, WorldBorder())
setFinalField(getField(World::class.java, "properties")!!, CLIENT_LEVEL, OBJENSIS.newInstance(getClass("net.minecraft.world.level.LevelProperties")))
setFinalField(getField(levelClass, "scoreboard")!!, CLIENT_LEVEL, Scoreboard())
getClass("net.minecraft.world.dimension.OverworldDimension", "net.minecraft.world.dimension.DimensionType")?.let {
val dimension = OBJENSIS.newInstance(it)
getField(DimensionType::class.java, "minimumY")?.set(dimension, 0)
getField(World::class.java, "dimensionEntry")?.let {
setFinalField(getField(World::class.java, "dimensionEntry")!!, CLIENT_LEVEL, getClass("net.minecraft.util.registry.RegistryEntry\$Direct")!!.getConstructor(Any::class.java).newInstance(dimension))
}
try {
setFinalField(getField(World::class.java, "dimension")!!, CLIENT_LEVEL, dimension)
} catch (ignored: Throwable) {
}
}
CLIENT_LEVEL.setDimension()
val networkHandler = OBJENSIS.newInstance(ClientPlayNetworkHandler::class.java)
networkHandler.recipeManager = RecipeManager()
getField(ClientWorld::class.java, "networkHandler", "netHandler")!!.set(CLIENT_LEVEL, networkHandler)

View File

@ -1,5 +1,6 @@
package de.bixilon.pixlyzer
import de.bixilon.kutil.reflection.ReflectionUtil.forceInit
import de.bixilon.mbf.MBFBinaryWriter
import de.bixilon.mbf.MBFCompressionTypes
import de.bixilon.mbf.MBFData
@ -76,6 +77,14 @@ object PixLyzer {
println("Class loading done in ${System.currentTimeMillis() - classesLoadStartTime}ms")
val physics = getClass("de.bixilon.pixlyzer.physics.PhysicsExtractor")
if (physics == null) {
println("Physics module not found, ignoring")
} else {
physics.forceInit()
physics.getDeclaredMethod("start").invoke(null)
}
val all: MutableMap<String, Any> = mutableMapOf()
for (generator in Generators.GENERATORS) {
val startTime = System.currentTimeMillis()

View File

@ -42,6 +42,7 @@ LIBRARIES = [
("com.fasterxml.jackson.core", "jackson-annotations", JACKSON_VERSION),
("com.github.luben", "zstd-jni", "1.5.2-3"),
("de.bixilon", "mbf-kotlin", "0.2.1"),
("de.bixilon", "kutil", "1.17.1"),
]
VERSION_MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest.json"