Jump to content

Recommended Posts

Posted

Hello their, before you read the rest of the post please note this is in no way for a hacked client (On other forums people took this question the wrong way); I am interested in making an AI that can solve puzzles (like finding a block, and how to get to it without falling in lava). This will be used on a multiplayer server, but a private server run by me, the server will have no mods, like I said, this is in no way for hacking.

 

Ok, hopefully I won't get banned by a ton of Admins now (:P), me and my friend enjoy java AI, but were new to it, and forge, so we though this would be the best place to ask questions. What we are trying to achieve is a mod that will walk towards a detected block. The first part we need to learn is how to detect blocks in the first place.

 

Could I please ask for any information/tutorials for how to detect a blocks ID, from a set of coordinates. Say the coordinates X1, Z1, Y50 where given to the client, I think I can detect the players coords and add 1 to X ETC, what I need is to return a variable on what the Data Value of the block is, and if rotated/has subitem ID, what that is (Like 36:2 ETC).

 

If anyone knows how to please tell me. I had a search on the web but my keywords returned nothing of any use, the words Find, block and ID seem to pull up a lot of useless block creating tutorials :P

 

Thank you very much, sorry if it is a easy answer that I should know

 

~Joe

Posted

Is there any chance you could give me an example of that code in use please?

 

Would I be able to do something like this:

 

int id_block = World.getBlockId(6,50,6);

 

(X6, Y50, Z6)

 

Sorry to be a n00b, I couldn't really get it working like that.

 

Thanks

 

~Joe

Posted

for(int i = -2; i <= 2; i++){
for(int j = -2; j <= 2; j++){
for(int k = -2; k <= 2; k++){
int blockID = world.getBlockID(player.posX + i, player.posY + j, player.posZ + k);
if(blockID == checkBlockID){
//Do Something
}
}
}
}

That would search a 5x5x5 area around the player, the if statement to catch the block you are looking for.

Posted

Thank you! Ok, this makes sense to me now, I am still getting my wits about functions and using APIs, I am only use to creating small-non graphical programs.

 

Just wondering, is it essential that I make a server side mod, or would I be able to apply this to my server without a server side mod, this way my friend would be able to see me use it without him having the mod. Right now were having a bit of a contest, who can make the first client side logic to chop down a tree and return it to a chest on flat grass.

 

Thanks for that,

 

~Joe

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.