Jump to content

[1.7.10] Mob Look Vector synchronization


Thornack

Recommended Posts

Hi Everyone,

 

So I have been developing a system where I have items that launch projectiles. I want these items to work for both the player and mobs. They work perfectly fine for the player atm but for the mob the projectiles are launched at the incorrect lookvector. I noticed that the client and server values for the look vector are not in sync. How does minecraft sync them up?

Link to comment
Share on other sites

So it seems that for mobs the throwable heading is incorrect if you calculate it the way that EntityThrowable calculates it. The way around this was to instead use the entitites look vector.x (y and z) coordinates inside the setThrowableHeading method  to calculate the correct heading after you create an instance of your EntityThrowable.

 

EntityRangedAttackBase distanceAttack = new EntityRangedAttack(world, entityUsingAttackItem).setType(attackType).setAreaOfEffectRadius(damageRadius);
      				distanceAttack.setBaseDamageForProjectileAttack(baseDmg);
      				distanceAttack.setThrowableHeading(entityUsingAttackItem.getLookVec().xCoord, entityUsingAttackItem.getLookVec().yCoord + 0.1, entityUsingAttackItem.getLookVec().zCoord, 1.5F, 1.0F);

 

 

Link to comment
Share on other sites

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.