Proper doors.
Quite the complex workaround, but this results in doors not needing fixing unless they (unlikely) are across a block boundary.
This commit is contained in:
parent
47fdccec5b
commit
63afc25900
35
block.py
35
block.py
@ -225,15 +225,46 @@ class MTBlock:
|
||||
content[i], param2[i] = conversion_table[blocks[i]][data[i]]
|
||||
param1[i] = max(blocklight[i], skylight[i])|(blocklight[i]<<4)
|
||||
mcblockidentifier[i] = str(blocks[i]) + ':' + str(data[i])
|
||||
if content[i]==0 and param2[i]==0 and not (blocks[i]==0):
|
||||
print('Unknown Minecraft Block:' + str(mcblockidentifier[i])) # This is the minecraft ID#/data as listed in map_content.txt
|
||||
|
||||
# pressure plates - append mesecons node timer
|
||||
if blocks[i] == 70 or blocks[i] == 72:
|
||||
self.timers.append(((i&0xf)|((i>>4)&0xf)<<8|((i>>8)&0xf)<<4, 100, 0))
|
||||
# rotate lily pads randomly
|
||||
elif blocks[i] == 111:
|
||||
param2[i] = random.randint(0,3)
|
||||
# grass of varying length randomly
|
||||
elif blocks[i] == 31 and data[i] == 1:
|
||||
content[i], param2[i] = conversion_table[931][random.randint(0,4)]
|
||||
# fix doors based on top/bottom bits
|
||||
elif blocks[i] == 64 and data[i] < 8:
|
||||
above = i + 256
|
||||
if (above >= 4096):
|
||||
print('Unable to fix door - top part is across block boundary!')
|
||||
elif blocks[above] == 64 and data[above] < 7:
|
||||
print('Unable to fix door - bottom part on top of bottom part!')
|
||||
else:
|
||||
d_right = data[above] & 1 # 0 - left, 1 - right
|
||||
d_open = data[i] & 4 # 0 - closed, 1 - open
|
||||
d_face = data[i] & 3 # n,e,s,w orientation
|
||||
content[i], param2[i] = conversion_table[964][d_face|d_open|(d_right<<3)]
|
||||
if d_right == 1:
|
||||
self.metadata[(i & 0xf, (i>>8) & 0xf, (i>>4) & 0xf)] = ({ "right": "1" }, {})
|
||||
elif blocks[i] == 64 and data[i] >= 8:
|
||||
below = i - 256
|
||||
if (below < 0):
|
||||
print('Unable to fix door - bottom part is across block boundary!')
|
||||
elif blocks[below] == 64 and data[below] >= 8:
|
||||
print('Unable to fix door - top part below top part!')
|
||||
else:
|
||||
d_right = data[i] & 1 # 0 - left, 1 - right
|
||||
d_open = data[below] & 4 # 0 - closed, 1 - open
|
||||
d_face = data[below] & 3 # n,e,s,w orientation
|
||||
content[i], param2[i] = conversion_table[965][d_face|d_open|(d_right<<3)]
|
||||
if d_right == 1:
|
||||
self.metadata[(i & 0xf, (i>>8) & 0xf, (i>>4) & 0xf)] = ({ "right": "1" }, {})
|
||||
|
||||
if content[i]==0 and param2[i]==0 and not (blocks[i]==0):
|
||||
print('Unknown Minecraft Block:' + str(mcblockidentifier[i])) # This is the minecraft ID#/data as listed in map_content.txt
|
||||
|
||||
for te in mcblock.tile_entities:
|
||||
id = te["id"]
|
||||
|
@ -239,6 +239,8 @@
|
||||
56 default:stone_with_diamond
|
||||
57 default:diamondblock
|
||||
|
||||
58 air // IGNORE
|
||||
|
||||
59 0 farming:wheat_1
|
||||
59 1 farming:wheat_2
|
||||
59 2 farming:wheat_3
|
||||
@ -277,14 +279,7 @@
|
||||
63 14 signs:sign_yard 1
|
||||
63 15 signs:sign_yard 2
|
||||
|
||||
64 0,4 doors:door_wood_b_1 0 //FIXME: doors fix themselves after open/close
|
||||
64 1,5 doors:door_wood_b_1 1
|
||||
64 2,6 doors:door_wood_b_1 2
|
||||
64 3,7 doors:door_wood_b_1 3
|
||||
64 8 doors:door_wood_t_1
|
||||
64 9 doors:door_wood_t_1
|
||||
64 10 doors:door_wood_t_1
|
||||
64 11 doors:door_wood_t_1
|
||||
64 air // door parts get fixed up in code
|
||||
|
||||
65 2 default:ladder 4
|
||||
65 3 default:ladder 5
|
||||
@ -654,8 +649,6 @@
|
||||
182 8 stairs:slab_desert_stone 22
|
||||
182 stairs:slab_desert_stone
|
||||
|
||||
321 homedecor:painting_1 // FIXME random 1-20
|
||||
|
||||
324 0,4 doors:door_wood_b_1 0
|
||||
324 1,5 doors:door_wood_b_1 1
|
||||
324 2,6 doors:door_wood_b_1 2
|
||||
@ -675,3 +668,37 @@
|
||||
931 3 default:grass_4
|
||||
931 4 default:grass_5
|
||||
|
||||
964 0 doors:door_wood_b_1 3
|
||||
964 1 doors:door_wood_b_1 0
|
||||
964 2 doors:door_wood_b_1 1
|
||||
964 3 doors:door_wood_b_1 2
|
||||
964 4 doors:door_wood_b_2 0
|
||||
964 5 doors:door_wood_b_2 1
|
||||
964 6 doors:door_wood_b_2 2
|
||||
964 7 doors:door_wood_b_2 3
|
||||
964 8 doors:door_wood_b_2 3
|
||||
964 9 doors:door_wood_b_2 0
|
||||
964 10 doors:door_wood_b_2 1
|
||||
964 11 doors:door_wood_b_2 2
|
||||
964 12 doors:door_wood_b_1 2
|
||||
964 13 doors:door_wood_b_1 3
|
||||
964 14 doors:door_wood_b_1 0
|
||||
964 15 doors:door_wood_b_1 1
|
||||
|
||||
965 0 doors:door_wood_t_1 3
|
||||
965 1 doors:door_wood_t_1 0
|
||||
965 2 doors:door_wood_t_1 1
|
||||
965 3 doors:door_wood_t_1 2
|
||||
965 4 doors:door_wood_t_2 0
|
||||
965 5 doors:door_wood_t_2 1
|
||||
965 6 doors:door_wood_t_2 2
|
||||
965 7 doors:door_wood_t_2 3
|
||||
965 8 doors:door_wood_t_2 3
|
||||
965 9 doors:door_wood_t_2 0
|
||||
965 10 doors:door_wood_t_2 1
|
||||
965 11 doors:door_wood_t_2 2
|
||||
965 12 doors:door_wood_t_1 2
|
||||
965 13 doors:door_wood_t_1 3
|
||||
965 14 doors:door_wood_t_1 0
|
||||
965 15 doors:door_wood_t_1 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user