1
Fork 0
mirror of https://github.com/Steffo99/lihzahrd.git synced 2024-11-21 07:34:23 +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
LAVA = 2
HONEY = 3
SHIMMER = 4
@classmethod
def from_flags(cls, flags1):
return cls._from_flags(flags1[3], flags1[4])
def from_flags(cls, flags1, flags3=None):
return cls._from_flags(flags1[3], flags1[4], flags3[7] if flags3 else False)
@classmethod
@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:
return cls.HONEY
if flags14:

View file

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