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

Hi, I am working with a block that has a custom model. This block is an eye that always looks at the player. If I place this block somewhere, it will look at me, so it works, but if I place more than one block, both of them will go crazy. If the game only renders one of them (ex. the other eye is behind me) it works without any problem. So my question is how can I make the eye movement per block so if I place more than one eyes next to each other, they would both look at me? Pics and code files below.

 

If only one block is on the screen, it will look at me:

mPObNEH.png

 

If there are more than one eye blocks on the screen, none of them will look at me: (left side of the pic)

U0HRK5s.png

 

This is my TileEntity code: https://gist.github.com/Voldemort127/4c2e1d86fb3f732e2df1

Render code: https://gist.github.com/Voldemort127/46f428cc65f97f7a6c54

Block code: https://gist.github.com/Voldemort127/3d2346d00d9ac698e142

 

Pls tell me if I forgot something

Well I can tell you right now that this:

 

	@Override
public void updateEntity() {
	this.moveEye();
}

@SideOnly(Side.CLIENT)
public void moveEye() {
	//...
}

 

Will crash the dedicated server.

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

Okay, I've moved the calculations in the TESR, but it is still buggy if I place more eyes. :(

 

D37rfJX.png

 

I've noticed something while moving around in the front of the blocks: The eye on the left looks exactly where the one on the right should look at and vice versa.

How can I fix it?

 

worldObject.isRemote

http://www.minecraftforge.net/forum/index.php/topic,22764.0.html

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.

I've noticed something while moving around in the front of the blocks: The eye on the left looks exactly where the one on the right should look at and vice versa.

Well, inverse the values...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

Problem solved! :D

I made a separate method in the model class, that renders the pupil separately.

This is my render code:

EntityPlayer ep = Minecraft.getMinecraft().thePlayer;
float eyeX = Math.max(Math.min((float) ((ac1_rot == 0 ? tee.xCoord : (ac1_rot == 90 ? -tee.zCoord - 1.0F : (ac1_rot == 180 ? -tee.xCoord - 1.0F : tee.zCoord))) + 0.5F - (ac1_rot == 0 ? ep.posX : (ac1_rot == 90 ? -ep.posZ : (ac1_rot == 180 ? -ep.posX : ep.posZ)))), 1.0F), -1.0F) * 1.8F;
float eyeY = Math.max(Math.min((float) ((tee.yCoord) + 0.5F - (ep.posY)), 1.0F), -1.0F) * 1.8F;
this.model.renderModel(0.0625F);
GL11.glTranslatef(eyeX / 12.0F, eyeY / 12.0F, 0.0F);
this.model.renderPupil(0.0625F);

Now, all the eyes are staring at me :)

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.