diff --git a/aiocraft/mc/types.py b/aiocraft/mc/types.py index 4b56bee..b1c0f0d 100644 --- a/aiocraft/mc/types.py +++ b/aiocraft/mc/types.py @@ -20,6 +20,17 @@ class Type(object): """Check if this type exists in this context""" return True +class VoidType(Type): + pytype : type = type(None) + + def write(self, v:None, buffer:io.BytesIO, ctx:object=None): + pass + + def read(self, buffer:io.BytesIO, ctx:object=None) -> None: + return None + +Void = VoidType() + class UnimplementedDataType(Type): pytype : type = bytes diff --git a/compiler/proto.py b/compiler/proto.py index fdae4b3..941e5fe 100644 --- a/compiler/proto.py +++ b/compiler/proto.py @@ -72,6 +72,7 @@ TYPE_MAP = { "position": Ref('Position'), "entityMetadataItem": Ref('EntityMetadataItem'), "entityMetadata": Ref('EntityMetadata'), + "void": Ref('Void'), } HINT_MAP = { @@ -138,6 +139,8 @@ def mctype(slot_type:Any) -> Ref: v["default"] if "default" in v and v['default'] != 'void' else None, ) # return SwitchType(mctype(v)) # TODO + elif t == "bitfield": + return Ref('Int') # elif t == "mapper": # ???? # return TrailingData else: