
JelloMOO
Members-
Posts
58 -
Joined
-
Last visited
Everything posted by JelloMOO
-
[1.8.9] [UNSOLVED] Constantly get player's hand position
JelloMOO replied to JelloMOO's topic in Modder Support
I need to be able to hold a chicken in my hand. I want to be able to get the hand position in third person. d0 = player.posX; d1 = player.posY + 2; d2 = player.posZ; distance = player.renderOffsetX + -2; //how far from parent's center; f1 = player.renderYawOffset + 10; double f2 = distance * MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI); double f3 = distance * MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI); newPosX = d0 + f3; newPosY = d1; newPosZ = d2 + f2; With this code I calculate to move the chicken to stay in the Player's hands when I turn in a circle. This doesnt account for when the player moves without rotating, however. Where is the vanilla code calculating hand position located? -
Hello. I have some code with which I'm trying to constantly get the player's hand position. It calculates correctly when I turn. However, when I move the player's body without turning, the hand moves, but the position it's calculating stays in the same position. So if I'm holding a chicken, and I move my body without turning or rotating, the chicken doesnt move, but the player's body and hand does. How do I take into account the player's body movements to be able to constantly get the player's hand position no matter what? I used rotationYaw to take into account the player's head movements.
-
bump
-
Or should I use OpenGL to hold an entity, like holding an item?
-
So recently I created a method to hold a chicken. However I've been experiencing some high fashion glitches with it. So I'm on the search for a new method, if it's possible How do I get the position of the Player's arm? What event would be best to use and what function? e.g. event.model.rightarm.posX or something along the lines of this? Any help is appreciated.
-
[SOLVED] [1.8.9] Rotating an entity with the player.
JelloMOO replied to JelloMOO's topic in Modder Support
Multiplying it by pi/180 alone would put the entity across the angle behind me. Like if you would look on a unit circle, if I wanted the entity to be at pi/2, they'd be at 3pi/2. Subtracting pi from it fixed this. EDIT: Added to the rotationYaw and it gave me the desired result. The chicken now stays in my hands. Thank you, Draco18s. Not only for helping me get to this result, but for also being so patient with me. You rock, man. -
[SOLVED] [1.8.9] Rotating an entity with the player.
JelloMOO replied to JelloMOO's topic in Modder Support
Alright, so I found a solution to the circle being too small and stuff by multiplying the rotationYaw with pi/180 and subtracting that by pi, and it creates a proper circle. The thing is, the rotationYaw moves even when my head moves. I want it to only calculate based on my body, not my head, so that if I simply turn my head, the chicken doesnt move out of place. -
[SOLVED] [1.8.9] Rotating an entity with the player.
JelloMOO replied to JelloMOO's topic in Modder Support
Oh I was trying to fix the chicken's position with that. Forgot to remove it when the distance value fixed it. But the circle still is small, for some reason. Am I doing it wrong? -
[SOLVED] [1.8.9] Rotating an entity with the player.
JelloMOO replied to JelloMOO's topic in Modder Support
double distance = -3; float f1 = thePlayer.rotationYaw; double d1 = thePlayer.posY + 6; double d0 = thePlayer.posX; double d2 = thePlayer.posZ; double f2 = distance * MathHelper.cos(f1); double f3 = distance * MathHelper.sin(f1); double newPosX = d0 + f3; double newPosZ = d2 + f2; theEntity.setPosition(newPosX + - 4, d1, newPosZ + 4); I'm think I'm doing something wrong. -
[SOLVED] [1.8.9] Rotating an entity with the player.
JelloMOO replied to JelloMOO's topic in Modder Support
Didn't seem to work. It rotates in a circular motion when I move, but the circle is so small and the chicken is like 5 blocks adjacent from me, now. Although, that could be that I'm adding the cosine and sin of the rotationYaw of the player with the posX and posZ of the player. -
Picture this. You're holding a chicken in your hands. You turn around, but the chicken stays in the same spot. So, now the chicken is literally floating behind you. That's the problem I'm having right now. I'm heavily assuming trigonometry is involved with a solution to this. I've looked at the Item.java class to see how an item follows the player's hand. It's been hours, and I've been staring at this code, but I can't seem to get it to work. Taken from the Item.java Class protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) { float f = playerIn.rotationPitch; float f1 = playerIn.rotationYaw; double d0 = playerIn.posX; double d1 = playerIn.posY + (double)playerIn.getEyeHeight(); double d2 = playerIn.posZ; Vec3 vec3 = new Vec3(d0, d1, d2); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI); float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI); float f4 = -MathHelper.cos(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F); float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; if (playerIn instanceof net.minecraft.entity.player.EntityPlayerMP) { d3 = ((net.minecraft.entity.player.EntityPlayerMP)playerIn).theItemInWorldManager.getBlockReachDistance(); } Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); } My code: float f1 = thePlayer.rotationYaw; double d1 = thePlayer.posY + 6; float f = thePlayer.rotationPitch; double d0 = thePlayer.posX; double d2 = thePlayer.posZ; Vec3 vec3 = new Vec3(d0, d1, d2); float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI); float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI); float f4 = -MathHelper.cos(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F); float f6 = f3 * f4; float f7 = f2 * f4; double d3 = 5.0D; if (thePlayer instanceof net.minecraft.entity.player.EntityPlayerMP) { d3 = ((net.minecraft.entity.player.EntityPlayerMP)thePlayer).theItemInWorldManager.getBlockReachDistance(); } Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); theEntity.setPosition(d0 * (f2 * Math.PI), d1 , d2 * (f3 * -Math.PI)); This code did some improvement, but I feel like I'm doing the Math wrong. What am I doing wrong? Please help. Thank you.
-
Then PLEASE tell me how to do it. Please. It's been weeks. I just need someone to help me cancel the rendering and re-render and everything I've tried didnt work so please tell me how to do it man just please.
-
JD-GUI is very annoying. While its the only thing possible to decompile a mod, it is very obfuscated and it requires another program to manually type in each and every function or method and in a class with 200 lines of obfuscated code, this method become impractical at best. I'm not trying to make them aim like a bow, I'm trying to make it so that the arm rotates LIKE it does when you aim a bow, but I want the rotation to be completely different.
-
1.8.8 is somehow cursed. You have less usability, and if you need help on something with 1.8.8, no one will help you. But if it's 1.7.10 theyll help you till the sun stops shining. Take it from my terrible personal experiences.
-
Welp. Can a moderator mark this as Unsolved? Maybe some day in 10 years someone will figure it out.
-
bump
-
Is there seriously no way to do this? The player's arms rotate when you aim the bow. There has to be a way.
-
I've tried that. Hasn't worked.
-
I've looked everywhere but I'm not sure how to model the player in 1.8.8 I'm trying to override the player's model and rotate his right arm 90 degrees. I know it can be done because in the ModelBiped class, the player can rotate his arms when he/she/it aims a bow. Thanks in advance.
-
I really dont know how to apply what you just said to my code
-
Still, it's possible, correct?
-
Someone's got to know. Did I mess it up?
-
Anyone know if I did this wrong?
-
[1.8 Forge] How to change the player's eye height?
JelloMOO replied to JelloMOO's topic in Modder Support
In normal 1.8 ( not 1.8.8 ) I wanted to change the player's camera view. I've tried using methods from the morph mod but it's proving to be stubborn and not working properly. -
You know when a player aims a bow and the player's arms rotate up a bit? I'm trying to rotate the player's arms in a similar fashion. I've overrided the player model and the player renderer. This is my code: This code doesn't work. The customrenderplayer and customrendermodel dont even get called for some reason. CustomRenderPlayer public class CustomRenderPlayer extends RenderPlayer { Minecraft minecraft = Minecraft.getMinecraft(); EntityPlayer player = minecraft.thePlayer; public CustomRenderPlayer(RenderManager renderManager) { super(renderManager); // TODO Auto-generated constructor stub mainModel = new CustomRenderModel(); } } CustomRenderModel public class CustomRenderModel extends ModelPlayer { public CustomRenderModel() { super(0.0F, false); } @Override public void setRotationAngles(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, net.minecraft.entity.Entity paramEntity) { System.out.println("pls"); this.bipedRightArm.rotateAngleX = 90.0F; } } ClientProxy @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { private static final Minecraft mc = Minecraft.getMinecraft(); public static CustomRenderPlayer renderCustomPlayer; @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); renderCustomPlayer = new CustomRenderPlayer(Minecraft.getMinecraft().getRenderManager()); } @Override public void init(FMLInitializationEvent event) { super.init(event); } @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(EntityPlayer.class, renderCustomPlayer); } ClientEventHandler public class ClientEventHandler { public void rplyr(RenderPlayerEvent.Post event){ Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(EntityPlayer.class, ClientProxy.renderCustomPlayer); } }