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

Does anyone know of a relatively easy way to significantly increase custom mobs' movement/flying speed?

 

I've been able to set the base movement speed of attributes, add modifiers, etc., but it seems like there's an underlying movement speed cap on mobs (it's not very fast, at all, you can still outrun them going backwards).

 

Is this the case? Am I doing something wrong? 

 

Some examples of what I'm trying to do now...

 

this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(10f);
this.getEntityAttribute(SharedMonsterAttributes.FLYING_SPEED).setBaseValue(10f);
		

 

 

and in the custom AI class...

 

ghost.moveHelper.setMoveTo(ghost.getAttackTarget().posX, ghost.getAttackTarget().posY, ghost.getAttackTarget().posZ, 15);
				
ghost.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(new AttributeModifier("dive_speed", 10, 0));
ghost.getEntityAttribute(SharedMonsterAttributes.FLYING_SPEED).applyModifier(new AttributeModifier("dive_speed", 10, 0));

 

 

 

But still no fast ghost :(

  • Author

Figured it out! For anyone who wants to know this in the future, I could NOT for the life of me find ANY way to reasonably do this with the native Minecraft path finders or move helpers.

 

What I did is in my custom entity AI's UpdateTask method, directly calculate the proper movement vector for the ghost and directly set the entity's movementX, movementY, movementZ, etc.

 

example: 

	Vec3d moveVec = ghost.getAttackTarget().getPositionVector().subtract(ghost.getPositionVector())
	moveVec = moveVec.normalize();
				
	moveVec = moveVec.scale(.5);
				
	double dx = ghost.posX - ghost.getAttackTarget().posX;
	double dz = ghost.posZ - ghost.getAttackTarget().posZ;
							
	float angle = (float)(MathHelper.atan2(dz, dx) * (180D / Math.PI)) + 90.0F;
	
	//this limitAngle method is copied from the vanilla EntityMovementHelper
	ghost.rotationYaw = this.limitAngle(ghost.rotationYaw, angle, 90.0F);
				
	ghost.motionX = moveVec.x;
	ghost.motionY = moveVec.y;
	ghost.motionZ = moveVec.z;

 

 

It's fairly simple for my purposes, since I just wanted to make a ghost fly up into the air and then quickly dive down at its target.

 

 

Also, be on the lookout for my mod in the coming year, it's going to be the biggest Minecraft MMORPG ever ;) 

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.