Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

World.getBlockId(insert stuff here)

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

  • Author

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

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.

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.