Skip to content

Commit

Permalink
Fix error in block define init (#988)
Browse files Browse the repository at this point in the history
Modified block define to accept string or NBT properties
  • Loading branch information
gentlegiantJGC authored Sep 30, 2023
1 parent 9910a1c commit 5ca1468
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions amulet_map_editor/api/wx/ui/block_select/block_define.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import wx
import wx.lib.scrolledpanel
from typing import Tuple, Optional, Dict
from typing import Tuple, Optional, Dict, Mapping, Union

import PyMCTranslate
from amulet.api.block import PropertyType, Block
from amulet.api.block import PropertyType, Block, PropertyValueType
from amulet.api.block_entity import BlockEntity
from amulet_nbt import SNBTType, AbstractBaseTag

from amulet_map_editor.api.wx.ui.base_define import BaseDefine
from amulet_map_editor.api.wx.ui.block_select import BlockSelect
Expand All @@ -27,7 +28,7 @@ def __init__(
force_blockstate: bool = None,
namespace: str = None,
block_name: str = None,
properties: PropertyType = None,
properties: Mapping[str, Union[SNBTType, PropertyValueType]] = None,
wildcard_properties=False,
show_pick_block: bool = False,
**kwargs,
Expand Down Expand Up @@ -60,9 +61,10 @@ def __init__(
self._version_picker.force_blockstate,
self._picker.namespace,
self._picker.name,
None
if properties is None
else {key: val.to_snbt() for key, val in properties.items()},
{
key: val.to_snbt() if isinstance(val, AbstractBaseTag) else val
for key, val in (properties or {}).items()
},
wildcard_properties,
)
right_sizer.Add(self._property_picker, 1, wx.EXPAND)
Expand Down

0 comments on commit 5ca1468

Please sign in to comment.