Posted April 17, 201510 yr 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: If there are more than one eye blocks on the screen, none of them will look at me: (left side of the pic) 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
April 18, 201510 yr 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.
April 18, 201510 yr Author Okay, I've moved the calculations in the TESR, but it is still buggy if I place more eyes. 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.
April 18, 201510 yr 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.
April 18, 201510 yr 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/
April 18, 201510 yr Author Problem solved! 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.