Jump to content

Recommended Posts

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 :(

Posted

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

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