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

I want to set certain tasks for my custom mob that involve it moving to fixed coordinate (x,y,z). It's seems that the

 

tryMoveToXYZ(x,y,z,speed)

 

method works fine, but only if the mob is within 16 blocks of (x,y,z). Otherwise, it appears that the vanilla code for something like EntityAIMoveIndoors has the mob move in a random direction towards (x,y,z) a number of times until it is within 16 blocks of (x,y,z), at which point it can finally move directly. This has the unfortunate side effect of the mob following a somewhat random walk (not entirely true since the direction vectors are towards (x,y,z) but still not ideal). I suppose I could change the code in RandomPositionGenerator so that the random direction vector and desired direction vector have dot product not just positive but also large enough to ensure the angle between them is less than pi/6 or so. But this seems rather complicated for what should be a simple task. Any ideas?

I don't work with entities much myself, but it seems to me that the simplest solution would be to calculate a series of coordinates 16 blocks apart, and have it move from one set of coordinates to the next. although, the standard minecraft method of doing it seems pretty good, because you have to be careful to make sure there are no obstructions

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

Entities have a "navigator" that is used in the AI. I would copy the EnityAIWander code and adjust it how you want. Basically the key point is that after determining where you want to go, you need to set the enitity's navigator to tryForXYZ() where you put in the position and speed.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.