Posted March 10, 201312 yr In ItemBow, there's a bit that says: ArrowLooseEvent event = new ArrowLooseEvent(player, bow, var6); MinecraftForge.EVENT_BUS.post(event); I'm trying to find the handler that handles this event. I tried looking through the call hierarchy, did a search within eclipse, even ran my mod in debug mode, but I could not find it. Does anyone know where it is or what it's called? Essentially, I'm trying to make a custom arrow start out straight. For some reason, even with the same code as the normal bow/arrow, its angle is weird at first but then fixes itself in a couple seconds (if it makes it that far). Also, shooting a normal arrow with my modified bow works just fine, so I'm guessing it's something in the arrow entity class. So, I wrote this method to fix it and call it right after it's fired, but it doesn't seem to make any changes whatsoever. public void setAngles(Vec3 v) { double x = v.xCoord; double y = v.yCoord; double z = v.zCoord; float a = MathHelper.sqrt_double(x * x + z * z); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)a) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); }
March 10, 201312 yr Author So, I hacked together a quick "fix." It still has the same problem, but it fixes itself so quick that it doesn't matter that much now. I just changed the onUpdate() method in my custom EntityArrow class to force a fix if ticksInAir < 4. public void onUpdate() { super.onUpdate(); if((!this.inGround && this.ticksInAir < 4) || (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)) { float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var1) * 180.0D / Math.PI); } ... If anyone knows a proper fix though, please let me know.
March 10, 201312 yr here go to my channel i do modding tutorials and i cover a custom bow and arrow link: http://www.youtube.com/user/TheGrovesyProject101 My youtube channel for forge tutorials: http://www.youtube.com/user/TheGrovesyProject101?feature=mhee if i helped please press thank you
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.