Page 1 of 1

Minecraft Block-id

PostPosted: Wed Aug 03, 2011 7:54 am
by efficacy
Right now, I can only change ALL the block types. But, I want a hack that changes only specific blocks. For this one, I want it to change everything non-air to wood. The code below doesn't work, so what's wrong with it? Here's my code:

Code: Select all
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(exit)
label(air)
label(other)
label(aoblab)
registersymbol(aoblab)
aobscan(aobaob,0f be 44 * 0c 81 e0 ff 00 00 00 83 c4 18) //Array is always correct and returns one result from scan

newmem:
cmp byte ptr [edi+edx+0C],0 //If is air, then do nothing
je air
cmp byte ptr [edi+edx+0C],0 //If not air, then change to wood
jne other

air:
movsx eax,byte ptr [edi+edx+0C] //Do nothing
jmp newmem

other:
mov byte ptr [edi+edx+0C],11 //Change to wood
jmp newmem

exit:
jmp returnhere

aobaob:
aoblab:
jmp newmem
returnhere:

[DISABLE]
dealloc(newmem)
aoblab:
movsx eax,byte ptr [edi+edx+0C]
unregistersymbol(aoblab)

Re: Minecraft Block-id

PostPosted: Wed Aug 03, 2011 6:10 pm
by L. Spiro
Make a working prototype in L. Spiro Script that works and prints which blocks are air and which are not.
Then convert to ASM. After doing so you should be able to find out what is wrong on your own.


L. Spiro

Minecraft Inconsistent Crashing

PostPosted: Wed Aug 03, 2011 11:35 pm
by efficacy
Ok, thanks L. Spiro. I have fixed the code, but now I have a new problem: Minecraft crashes sometimes. One time I turn it on, it works. The next time, it crashes.
Here's my new code:

Code: Select all
[ENABLE]
alloc(newmem,2048)
label(returnhere)
label(exit)
label(aoblab)
registersymbol(aoblab)
aobscan(aobaob,0f be 44 * 0c 81 e0 ff 00 00 00 83 c4 18) //Array is always correct and returns one result from scan

aobaob:
aoblab:
call newmem
returnhere:

newmem:
movsx eax,byte ptr [edi+edx+0C] //Orignal code
pushfd
cmp byte ptr [edi+edx+0C],0 //If the block is air...
je short exit //Go to exit
mov byte ptr [edi+edx+0C],11 //If the block is not air, then change to wood
exit:
popfd
ret

[DISABLE]
dealloc(newmem)
aoblab:
movsx eax,byte ptr [edi+edx+0C]
unregistersymbol(aoblab)


Thx for the reply btw. c:

Re: Minecraft Block-id

PostPosted: Fri Aug 05, 2011 12:15 pm
by L. Spiro
Are you using MHS for this?

You will have to debug it to find out why it crashes. There is no easy answer nor solution for this.
You can reduce possibilities by eliminating parts of your code at a time, but be sure that the code remains stable as you do so.


L. Spiro