Checkpoint initial implementation
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Class ############################################################################################
|
||||
|
||||
class Placement:
|
||||
|
||||
def __init__(self, gameId:str):
|
||||
self.gameId = gameId
|
||||
@@ -0,0 +1,13 @@
|
||||
from tungston.generator.datapack.placement import Placement
|
||||
from typing import Any
|
||||
|
||||
# Class ############################################################################################
|
||||
|
||||
class Biome(Placement):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("minecraft:biome")
|
||||
|
||||
def asData(self) -> dict[str,Any]:
|
||||
return { "type": self.gameId }
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
from pytest import fixture
|
||||
from tungston.generator.datapack.placement.biome import Biome
|
||||
|
||||
|
||||
# Fixtures #########################################################################################
|
||||
|
||||
@fixture(name="placement")
|
||||
def createPlacement():
|
||||
yield Biome()
|
||||
|
||||
|
||||
# Tests ############################################################################################
|
||||
|
||||
def test_asData(placement):
|
||||
assert placement.asData() == {
|
||||
"type": "minecraft:biome",
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
from tungston.generator.datapack.placement import Placement
|
||||
from tungston.generator.datapack.heightmaptype import HeightMapType
|
||||
from typing import Any
|
||||
|
||||
# Class ############################################################################################
|
||||
|
||||
class HeightMap(Placement):
|
||||
|
||||
def __init__(self, heightMap:HeightMapType):
|
||||
super().__init__("minecraft:heightmap")
|
||||
self.heightMap = heightMap
|
||||
|
||||
def asData(self) -> dict[str,Any]:
|
||||
return {
|
||||
"type": self.gameId,
|
||||
"heightmap": self.heightMap.asData()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
from pytest import fixture
|
||||
from tungston.generator.datapack.placement.heightmap import HeightMap
|
||||
from tungston.generator.datapack.heightmaptype import WORLD_SURFACE
|
||||
|
||||
|
||||
# Fixtures #########################################################################################
|
||||
|
||||
@fixture(name="placement")
|
||||
def createPlacement():
|
||||
yield HeightMap(WORLD_SURFACE)
|
||||
|
||||
|
||||
# Tests ############################################################################################
|
||||
|
||||
def test_asData(placement):
|
||||
assert placement.asData() == {
|
||||
"type": "minecraft:heightmap",
|
||||
"heightmap": "WORLD_SURFACE"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from tungston.generator.datapack.placement import Placement
|
||||
from typing import Any
|
||||
|
||||
# Class ############################################################################################
|
||||
|
||||
class InSquare(Placement):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__("minecraft:in_square")
|
||||
|
||||
def asData(self) -> dict[str,Any]:
|
||||
return { "type": self.gameId }
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
from pytest import fixture
|
||||
from tungston.generator.datapack.placement.insquare import InSquare
|
||||
|
||||
|
||||
# Fixtures #########################################################################################
|
||||
|
||||
@fixture(name="placement")
|
||||
def createPlacement():
|
||||
yield InSquare()
|
||||
|
||||
|
||||
# Tests ############################################################################################
|
||||
|
||||
def test_asData(placement):
|
||||
assert placement.asData() == {
|
||||
"type": "minecraft:in_square",
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
from tungston.generator.datapack.placement import Placement
|
||||
from typing import Any
|
||||
|
||||
# Class ############################################################################################
|
||||
|
||||
class RarityFilter(Placement):
|
||||
|
||||
def __init__(self, chance:int):
|
||||
super().__init__("minecraft:rarity_filter")
|
||||
self.chance = chance
|
||||
|
||||
def asData(self) -> dict[str,Any]:
|
||||
return {
|
||||
"type": self.gameId,
|
||||
"chance": self.chance
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from pytest import fixture
|
||||
from tungston.generator.datapack.placement.rarityfilter import RarityFilter
|
||||
|
||||
|
||||
# Fixtures #########################################################################################
|
||||
|
||||
@fixture(name="placement")
|
||||
def createPlacement():
|
||||
yield RarityFilter(4)
|
||||
|
||||
|
||||
# Tests ############################################################################################
|
||||
|
||||
def test_asData(placement):
|
||||
assert placement.asData() == {
|
||||
"type": "minecraft:rarity_filter",
|
||||
"chance": 4
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user