Posted January 1, 20196 yr Im making an enchantement that reflects arrows. My code works, but its causing a rather strange bug. When an arrow is deflected, it appears to fall to the ground, then teleport to where it should have impacted. My code: private static void reflect(Entity projectile, EntityPlayer player) { Vec3d vector = new Vec3d(-projectile.motionX,-projectile.motionY,-projectile.motionZ); vector = vector.normalize(); projectile.motionX = vector.x; projectile.motionY = vector.y; projectile.motionZ = vector.z; System.out.println("checkpoint 3"); } what could be causing this rather strange effect?
January 1, 20196 yr IIRC this happens with vanilla arrows too sometimes. Arrows in my experience are (one of) the most hacked together things in minecraft as they have special handling in many other classes. In the arrow code you can see that vanilla applies the deflection through motion *= -1 (it might be -0.1, I can’t check right now) instead of using a vector. This is probably unrelated to your problem, but worth a try IMO About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
January 2, 20196 yr Not having seen all your code, your symptoms (rubber banding) sound rather like you're updating the entity's motion on the server, but not the client. The server's position thus gets out of sync with the client's idea of the position, and you see the "teleport" effect when the server finally sync's up. Any changes to an entity's position should be done simultaneously on both server and client. Are you only calling your reflect() method on the server?
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.