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,

 

I need to spawn an entity with the face always in front to the player but trying this code doesn't works:

 

 

 

    EntityBritch Logger = new EntityBritch(player.worldObj);

    Logger.setLocationAndAngles(event.x + 0.5D, event.y - 1, event.z + 0.5D, player.attackedAtYaw, 0.0F);

    player.worldObj.spawnEntityInWorld(Logger);

 

 

 

I mean the entity spawn correctly but with the face always to the same direction ... what am I doing wrong?

 

thank you.

  • Author

Why are you using

attackedAtYaw

? Use the correct values and it will work.

 

surely, but if i put "180.0F" or "90.0F" anyway it spawns always with yaw value equal to 0. why?

player.rotationYaw + 180 ?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

player.rotationYaw + 180 ?

 

yes but it isnt the player, it's a custom mob entity with model class. in summary i tried the follows solutions without success:

 

 

 

    EntityLoggyBritch Logger = new EntityLoggyBritch(player.worldObj);

    Logger.setLocationAndAngles(event.x + 0.5D, event.y - 1, event.z + 0.5D, 180.0F, 0.0F);

    player.worldObj.spawnEntityInWorld(Logger);

                                ....

    Logger.rotationYaw = 180.0F;

                                ....

    Logger.rotationYaw = player.rotationYaw + 180.0F;

 

 

 

Logger.setAngles(180, 0); ?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

Logger.setAngles(180, 0); ?

 

yes something similar: Logger.setRotationYawHead(180.0F); works!! but the body wont rotate :(

setAngles applies to the body, setRotationYawHead only affects the head, as indicated by the method name.

 

If that's not working, then it's clearly being changed by something else later.  Double check your updateTick method.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

setAngles applies to the body, setRotationYawHead only affects the head, as indicated by the method name.

 

If that's not working, then it's clearly being changed by something else later.  Double check your updateTick method.

 

nope, it doesn't works.

 

I think it's changed by the model class but setRotationYawHead is enough for me ..., thank you

  • Author

 

Why are you using

attackedAtYaw

? Use the correct values and it will work.

 

I tried to spawn also a Vanilla entity but same problem:

 

myYawVar = 90.0F;
EntityZombie eZombie = new EntityZombie(myPlayer.worldObj);
eZombie.setLocationAndAngles(X, Y, Z, myYawVar, 0.0F);
myPlayer.worldObj.spawnEntityInWorld(eZombie);
eZombie.rotationYaw = myYawVar;

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.