Skip to content
Snippets Groups Projects
Commit e7fcc08d authored by Perttu Ahola's avatar Perttu Ahola
Browse files

Fix minetestmapper.py

parent 520b4702
No related branches found
No related tags found
No related merge requests found
...@@ -88,9 +88,19 @@ def int_to_hex4(i): ...@@ -88,9 +88,19 @@ def int_to_hex4(i):
def getBlockAsInteger(p): def getBlockAsInteger(p):
return p[2]*16777216 + p[1]*4096 + p[0] return p[2]*16777216 + p[1]*4096 + p[0]
def getIntegerAsBlock(i): def unsignedToSigned(i, max_positive):
return i%4096, int(i/4096)%4096, int(i/16777216)%4096 if i < max_positive:
return i
else:
return i - 2*max_positive
def getIntegerAsBlock(i):
x = unsignedToSigned(i % 4096, 2048)
i = int((i - x) / 4096)
y = unsignedToSigned(i % 4096, 2048)
i = int((i - y) / 4096)
z = unsignedToSigned(i % 4096, 2048)
return x,y,z
def limit(i, l, h): def limit(i, l, h):
if(i > h): if(i > h):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment