Skip to content

Commit

Permalink
optimize extractors
Browse files Browse the repository at this point in the history
  • Loading branch information
user622628252416 committed Dec 1, 2024
1 parent e0ac3fb commit ffd6bda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ class BlockCollisionShapes : Extractor.Extractor {
val shapesJson = JsonArray()
for (shape in shapes.keys) {
val shapeJson = JsonObject()
shapeJson.addProperty("min_x", shape.minX)
shapeJson.addProperty("min_y", shape.minY)
shapeJson.addProperty("min_z", shape.minZ)
shapeJson.addProperty("max_x", shape.maxX)
shapeJson.addProperty("max_y", shape.maxY)
shapeJson.addProperty("max_z", shape.maxZ)
shapeJson.addProperty("x1", shape.minX)
shapeJson.addProperty("y1", shape.minY)
shapeJson.addProperty("z1", shape.minZ)
shapeJson.addProperty("x2", shape.maxX)
shapeJson.addProperty("y2", shape.maxY)
shapeJson.addProperty("z2", shape.maxZ)
shapesJson.add(shapeJson)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.snowii.extractor.extractors

import com.google.gson.JsonArray
import com.google.gson.JsonElement
import com.google.gson.JsonObject
import de.snowii.extractor.Extractor
Expand All @@ -13,15 +12,11 @@ class BlockEntities : Extractor.Extractor {
}

override fun extract(server: MinecraftServer): JsonElement {
val blockEntitiesJson = JsonArray()
val blockEntitiesJson = JsonObject()
for (blockEntity in Registries.BLOCK_ENTITY_TYPE) {
val blockEntityJson = JsonObject()

blockEntityJson.addProperty("id", Registries.BLOCK_ENTITY_TYPE.getRawId(blockEntity))
blockEntityJson.addProperty("ident", Registries.BLOCK_ENTITY_TYPE.getId(blockEntity).toString())
blockEntityJson.addProperty("name", Registries.BLOCK_ENTITY_TYPE.getId(blockEntity)!!.path)

blockEntitiesJson.add(blockEntityJson)
val identifier = Registries.BLOCK_ENTITY_TYPE.getId(blockEntity)!!.toString()
val id = Registries.BLOCK_ENTITY_TYPE.getRawId(blockEntity)
blockEntitiesJson.addProperty(identifier, id)
}
return blockEntitiesJson
}
Expand Down

0 comments on commit ffd6bda

Please sign in to comment.