-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
226 changed files
with
3,977 additions
and
2,783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
extractor/src/main/kotlin/de/snowii/extractor/extractors/Entities.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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 | ||
import net.minecraft.entity.LivingEntity | ||
import net.minecraft.entity.SpawnReason | ||
import net.minecraft.registry.Registries | ||
import net.minecraft.server.MinecraftServer | ||
|
||
class Entities : Extractor.Extractor { | ||
override fun fileName(): String { | ||
return "entities.json" | ||
} | ||
|
||
override fun extract(server: MinecraftServer): JsonElement { | ||
val entitiesJson = JsonObject() | ||
for (entityType in Registries.ENTITY_TYPE) { | ||
val entity = entityType.create(server.overworld!!, SpawnReason.NATURAL) ?: continue | ||
val entityJson = JsonObject() | ||
entityJson.addProperty("id", Registries.ENTITY_TYPE.getRawId(entityType)) | ||
if (entity is LivingEntity) { | ||
entityJson.addProperty("max_health", entity.maxHealth) | ||
|
||
} | ||
entityJson.addProperty("attackable", entity.isAttackable) | ||
entityJson.addProperty("summonable", entityType.isSummonable) | ||
entityJson.addProperty("fire_immune", entityType.isFireImmune) | ||
val dimension = JsonArray() | ||
dimension.add(entityType.dimensions.width) | ||
dimension.add(entityType.dimensions.height) | ||
entityJson.add("dimension", dimension) | ||
|
||
entitiesJson.add( | ||
Registries.ENTITY_TYPE.getId(entityType).path, entityJson | ||
) | ||
} | ||
|
||
return entitiesJson | ||
} | ||
} |
Oops, something went wrong.