1
Fork 0
mirror of https://github.com/Steffo99/lihzahrd.git synced 2024-11-21 15:44:24 +00:00

Implement LiquidType.SHIMMER

Co-authored-by: Martin George <martydingo@users.noreply.github.com>
This commit is contained in:
Steffo 2023-03-05 23:44:00 +01:00
parent f7fd651b85
commit d335e28007
2 changed files with 9 additions and 4 deletions

View file

@ -9,14 +9,17 @@ class LiquidType(enum.IntEnum):
WATER = 1 WATER = 1
LAVA = 2 LAVA = 2
HONEY = 3 HONEY = 3
SHIMMER = 4
@classmethod @classmethod
def from_flags(cls, flags1): def from_flags(cls, flags1, flags3=None):
return cls._from_flags(flags1[3], flags1[4]) return cls._from_flags(flags1[3], flags1[4], flags3[7] if flags3 else False)
@classmethod @classmethod
@functools.lru_cache(4) @functools.lru_cache(4)
def _from_flags(cls, flags13, flags14): def _from_flags(cls, flags13, flags14, flags37):
if flags37:
return cls.SHIMMER
if flags13 and flags14: if flags13 and flags14:
return cls.HONEY return cls.HONEY
if flags14: if flags14:

View file

@ -252,7 +252,6 @@ class World:
flags1 = fr.bits() flags1 = fr.bits()
has_block = flags1[1] has_block = flags1[1]
has_wall = flags1[2] has_wall = flags1[2]
liquid_type = LiquidType.from_flags(flags1)
has_extended_block_id = flags1[5] has_extended_block_id = flags1[5]
rle_compression = RLEEncoding.from_flags(flags1) rle_compression = RLEEncoding.from_flags(flags1)
# Parse flags # Parse flags
@ -261,6 +260,7 @@ class World:
block_shape = Shape.from_flags(flags2) block_shape = Shape.from_flags(flags2)
if flags2[0]: if flags2[0]:
flags3 = fr.bits() flags3 = fr.bits()
liquid_type = LiquidType.from_flags(flags1)
is_block_active = not flags3[2] is_block_active = not flags3[2]
wiring = Wiring.from_flags(flags2, flags3) wiring = Wiring.from_flags(flags2, flags3)
is_block_painted = flags3[3] is_block_painted = flags3[3]
@ -268,11 +268,13 @@ class World:
has_extended_wall_id = flags3[6] has_extended_wall_id = flags3[6]
else: else:
is_block_active = True is_block_active = True
liquid_type = LiquidType.from_flags(flags1)
wiring = Wiring.from_flags(flags2) wiring = Wiring.from_flags(flags2)
is_block_painted = False is_block_painted = False
is_wall_painted = False is_wall_painted = False
has_extended_wall_id = False has_extended_wall_id = False
else: else:
liquid_type = LiquidType.from_flags(flags1)
block_shape = Shape.NORMAL block_shape = Shape.NORMAL
is_block_active = True is_block_active = True
wiring = None wiring = None