mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-25 01:24:21 +00:00
Fix a bug with HatRacks parsing
This commit is contained in:
parent
c0adcef396
commit
7eddd4b495
1 changed files with 34 additions and 30 deletions
|
@ -743,21 +743,23 @@ class World:
|
||||||
elif te_type == 3:
|
elif te_type == 3:
|
||||||
item_flags = f.bits()
|
item_flags = f.bits()
|
||||||
dye_flags = f.bits()
|
dye_flags = f.bits()
|
||||||
mannequin_items = [None for _ in range(len(item_flags))]
|
mannequin_items: typing.List[typing.Optional[ItemStack]] = [None for _ in range(len(item_flags))]
|
||||||
mannequin_dyes = [None for _ in range(len(dye_flags))]
|
mannequin_dyes: typing.List[typing.Optional[ItemStack]] = [None for _ in range(len(dye_flags))]
|
||||||
for slot in range(len(item_flags)):
|
for index, flag in enumerate(item_flags):
|
||||||
if item_flags[slot]:
|
if not flag:
|
||||||
|
continue
|
||||||
slot_item_id = ItemType(f.int2())
|
slot_item_id = ItemType(f.int2())
|
||||||
slot_item_modifier = f.int1()
|
slot_item_modifier = f.int1()
|
||||||
slot_item_stack = f.int2()
|
slot_item_stack = f.int2()
|
||||||
mannequin_items[slot] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
mannequin_items[index] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
||||||
for slot in range(len(mannequin_dyes)):
|
for index, flag in enumerate(dye_flags):
|
||||||
if dye_flags[slot]:
|
if not flag:
|
||||||
|
continue
|
||||||
slot_item_id = ItemType(f.int2())
|
slot_item_id = ItemType(f.int2())
|
||||||
slot_item_modifier = f.int1()
|
slot_item_modifier = f.int1()
|
||||||
slot_item_stack = f.int2()
|
slot_item_stack = f.int2()
|
||||||
mannequin_dyes[slot] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
mannequin_dyes[index] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
||||||
te_extra = ClothingDisplay(item_flags, dye_flags, mannequin_items, mannequin_dyes, "mannequin")
|
te_extra = Mannequin(mannequin_items, mannequin_dyes)
|
||||||
# Weapon Rack
|
# Weapon Rack
|
||||||
elif te_type == 4:
|
elif te_type == 4:
|
||||||
rack_item = ItemStack(ItemType(f.int2()), f.int1(), f.int2())
|
rack_item = ItemStack(ItemType(f.int2()), f.int1(), f.int2())
|
||||||
|
@ -767,21 +769,23 @@ class World:
|
||||||
# This isn't 100% tested, but the first two flags should be items, and the second two should be dyes.
|
# This isn't 100% tested, but the first two flags should be items, and the second two should be dyes.
|
||||||
item_flags = f.bits()
|
item_flags = f.bits()
|
||||||
# Maximum of two items slots and two dye slots.
|
# Maximum of two items slots and two dye slots.
|
||||||
rack_items = [None for _ in range(2)]
|
rack_items: typing.List[typing.Optional[ItemStack]] = [None for _ in range(2)]
|
||||||
rack_dyes = [None for _ in range(2)]
|
rack_dyes: typing.List[typing.Optional[ItemStack]] = [None for _ in range(2)]
|
||||||
for slot in range(2):
|
for index, flag in enumerate(item_flags[0:2]):
|
||||||
if item_flags[slot]:
|
if not flag:
|
||||||
|
continue
|
||||||
slot_item_id = ItemType(f.int2())
|
slot_item_id = ItemType(f.int2())
|
||||||
slot_item_modifier = f.int1()
|
slot_item_modifier = f.int1()
|
||||||
slot_item_stack = f.int2()
|
slot_item_stack = f.int2()
|
||||||
rack_items[slot] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
rack_items[index] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
||||||
for slot in range(2):
|
for index, flag in enumerate(item_flags[2:4]):
|
||||||
if item_flags[slot + 2]:
|
if not flag:
|
||||||
|
continue
|
||||||
slot_item_id = ItemType(f.int2())
|
slot_item_id = ItemType(f.int2())
|
||||||
slot_item_modifier = f.int1()
|
slot_item_modifier = f.int1()
|
||||||
slot_item_stack = f.int2()
|
slot_item_stack = f.int2()
|
||||||
rack_dyes[slot] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
rack_dyes[index] = ItemStack(slot_item_id, slot_item_modifier, slot_item_stack)
|
||||||
te_extra = ClothingDisplay(item_flags, dye_flags, mannequin_items, mannequin_dyes, "hat_rack")
|
te_extra = HatRack(rack_items, rack_dyes)
|
||||||
# Food Plate
|
# Food Plate
|
||||||
elif te_type == 6:
|
elif te_type == 6:
|
||||||
plate_item = ItemStack(ItemType(f.int2()), f.int1(), f.int2())
|
plate_item = ItemStack(ItemType(f.int2()), f.int1(), f.int2())
|
||||||
|
|
Loading…
Reference in a new issue