Add ability to generate structure.json files
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Iterable
|
||||
from mcpacker.format.datapack.biomemodifier import BiomeModifier
|
||||
from mcpacker.format.datapack.biomemodifier.generationstep import GenerationStep
|
||||
from mcpacker.format.datapack.generationstep import GenerationStep
|
||||
from mcpacker.json import JsonBlob
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Iterable
|
||||
from mcpacker.format.datapack.biomemodifier import BiomeModifier
|
||||
from mcpacker.format.datapack.biomemodifier.generationstep import GenerationStep
|
||||
from mcpacker.format.datapack.generationstep import GenerationStep
|
||||
from mcpacker.json import JsonBlob
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections.abc import Iterable
|
||||
from mcpacker.format.datapack.biomemodifier import BiomeModifier
|
||||
from mcpacker.model.core.resourceid import ResourceId
|
||||
from mcpacker.json import JsonBlob
|
||||
|
||||
|
||||
@@ -7,7 +8,7 @@ from mcpacker.json import JsonBlob
|
||||
|
||||
class RemoveSpawnBiomeModifier(BiomeModifier):
|
||||
|
||||
def __init__(self, biomes:Iterable[str]|str, entityTypes:Iterable[str]):
|
||||
def __init__(self, biomes:Iterable[str]|str, entityTypes:Iterable[ResourceId]):
|
||||
if isinstance(biomes, str):
|
||||
biomes = [biomes]
|
||||
|
||||
@@ -18,5 +19,5 @@ class RemoveSpawnBiomeModifier(BiomeModifier):
|
||||
return {
|
||||
"type": "neoforge:remove_spawns",
|
||||
"biomes": list(self.biomes),
|
||||
"entity_types": list(self.entityTypes),
|
||||
"entity_types": [str(r) for r in self.entityTypes],
|
||||
}
|
||||
|
||||
@@ -7,11 +7,17 @@ class HeightMapType:
|
||||
see: https://minecraft.wiki/w/Heightmap
|
||||
"""
|
||||
|
||||
def __init__(self, gameId:str):
|
||||
self.gameId = gameId
|
||||
def __init__(self, name:str):
|
||||
self.name = name
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"HeightMapType(name={self.name})"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
def asData(self) -> str:
|
||||
return self.gameId
|
||||
return self.name
|
||||
|
||||
|
||||
# Constants ########################################################################################
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
from collections.abc import Iterable
|
||||
from mcpacker.model.core.resourceid import ResourceId
|
||||
from mcpacker.json import JsonBlob
|
||||
|
||||
import mcpacker.format.datapack.heightmaptype as HM
|
||||
import mcpacker.format.datapack.generationstep as GS
|
||||
|
||||
|
||||
# Class ############################################################################################
|
||||
|
||||
class Structure:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
gameId:ResourceId,
|
||||
biomes:Iterable[ResourceId],
|
||||
):
|
||||
self.gameId = gameId
|
||||
self.biomes = list(biomes)
|
||||
|
||||
def asJsonBlob(self) -> JsonBlob:
|
||||
return {
|
||||
"biomes": [str(b) for b in self.biomes],
|
||||
"max_distance_from_center": 10,
|
||||
"project_start_to_heightmap": str(HM.OCEAN_FLOOR),
|
||||
"size": 1,
|
||||
"spawn_overrides": {},
|
||||
"start_height": { "absolute": 0 },
|
||||
"start_pool": f"{self.gameId.mod}:deposit/{self.gameId.name}_marker",
|
||||
"step": str(GS.SURFACE_STRUCTURES),
|
||||
"type": "minecraft:jigsaw",
|
||||
"use_expansion_hack": False,
|
||||
}
|
||||
Reference in New Issue
Block a user