Skip to content

Commit

Permalink
Replaced value with py_data
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlegiantJGC committed Jul 10, 2022
1 parent 21db804 commit ccedd50
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion minecraft_model_reader/api/amulet/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def blockstate(self) -> str:
self._blockstate = self.namespaced_name
if self.properties:
props = [
f"{key}={value.value}"
f"{key}={value.py_data}"
for key, value in sorted(self.properties.items())
if isinstance(value, amulet_nbt.TAG_String)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def bounds(
self, block: Block
) -> Tuple[Tuple[float, float], Tuple[float, float], Tuple[float, float]]:
return (
(1 / 16 + block.properties["bite_counter"].value * 2 / 16, 15 / 16),
(1 / 16 + block.properties["bite_counter"].py_data * 2 / 16, 15 / 16),
(0, 0.5),
(1 / 16, 15 / 16),
)

def texture_index(self, block: Block, aux_value: int) -> int:
return min(block.properties["bite_counter"].value, 1)
return min(block.properties["bite_counter"].py_data, 1)

@property
def do_not_cull(self) -> Tuple[bool, bool, bool, bool, bool, bool]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_block_model(
modify_uv=True,
) -> BlockMesh:
rotation = {2: 2, 3: 0, 4: 1, 5: 3}.get(
block.properties["facing_direction"].value, 0
block.properties["facing_direction"].py_data, 0
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_block_model(
return (
super()
.get_block_model(block, down, up, north, east, south, west, transparency)
.rotate(0, block.properties["direction"].value)
.rotate(0, block.properties["direction"].py_data)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_block_model(
west: str,
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
if block.properties["upper_block_bit"].value:
if block.properties["upper_block_bit"].py_data:
return super().get_block_model(
block, north, north, north, north, north, north, transparency
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_block_model(
west: str,
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
if block.properties["upper_block_bit"].value:
if block.properties["upper_block_bit"].py_data:
return super().get_block_model(block, up, up, up, up, up, up, transparency)
else:
return super().get_block_model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_block_model(
west: str,
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
rotation = self.rotation_map.get(block.properties["facing_direction"].value, 0)
rotation = self.rotation_map.get(block.properties["facing_direction"].py_data, 0)

return (
super()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_block_model(
modify_uv=True,
) -> BlockMesh:
rotation = {2: 2, 3: 0, 4: 1, 5: 3}.get(
block.properties["facing_direction"].value, 0
block.properties["facing_direction"].py_data, 0
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_block_model(
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
rotation = self.rotation_map.get(
block.properties["facing_direction"].value, (0, 0)
block.properties["facing_direction"].py_data, (0, 0)
)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_block_model(
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
rotation = self.rotation_map.get(
block.properties["facing_direction"].value, (0, 0)
block.properties["facing_direction"].py_data, (0, 0)
)

return BlockMesh.merge(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def blockshape(self) -> str:
def bounds(
self, block: Block
) -> Tuple[Tuple[float, float], Tuple[float, float], Tuple[float, float]]:
if block.properties["redstone_signal"].value >= 1:
if block.properties["redstone_signal"].py_data >= 1:
return (1 / 16, 15 / 16), (0, 1 / 32), (1 / 16, 15 / 16)
else:
return (1 / 16, 15 / 16), (0, 1 / 16), (1 / 16, 15 / 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_block_model(
return (
super()
.get_block_model(block, down, up, north, east, south, west, transparency)
.rotate(0, block.properties["direction"].value)
.rotate(0, block.properties["direction"].py_data)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_block_model(
return (
super()
.get_block_model(block, down, up, north, east, south, west, transparency)
.rotate(0, block.properties["direction"].value)
.rotate(0, block.properties["direction"].py_data)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def texture_index(self, block: Block, aux_value: int) -> int:
def bounds(
self, block: Block
) -> Tuple[Tuple[float, float], Tuple[float, float], Tuple[float, float]]:
if block.properties["top_slot_bit"].value:
if block.properties["top_slot_bit"].py_data:
return (0, 1), (1 / 2, 1), (0, 1)
else:
return (0, 1), (0, 1 / 2), (0, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_block_model(
west: str,
transparency: Tuple[bool, bool, bool, bool, bool, bool],
) -> BlockMesh:
axis: str = block.properties["pillar_axis"].value
axis: str = block.properties["pillar_axis"].py_data

model = super().get_block_model(
block, down, up, north, east, south, west, transparency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_block_model(
modify_uv=True,
) -> BlockMesh:
models = []
data: int = block.properties["vine_direction_bits"].value
data: int = block.properties["vine_direction_bits"].py_data
if data:
model = super().get_block_model(
block, down, up, north, east, south, west, transparency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_aux_value(block: Block) -> int:
property_names, aux_map = AuxValues[name]
properties = block.properties
key = tuple(
properties[property_name].value if property_name in properties else default
properties[property_name].py_data if property_name in properties else default
for property_name, default in property_names
)
return aux_map.get(key, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _get_model(self, block: Block) -> BlockMesh:
block.properties.get(
match.group("name"),
amulet_nbt.TAG_String(match.group("value")),
).value
).py_data
== match.group("value")
for match in properties_match
):
Expand Down

0 comments on commit ccedd50

Please sign in to comment.