Posted October 3, 20222 yr Long story short, I'm writing some mod which allows you to increase your arrow speed and bow draw speed. Currently I'm handling this though events. @SubscribeEvent public void onArrowSpeed(@NotNull EntityJoinLevelEvent event) { if (event.getEntity() instanceof Arrow arrow) { if (arrow.getOwner() instanceof ServerPlayer serverPlayer) { serverPlayer.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(capability -> { if (capability.isUnlocked(serverPlayer, ARROW_SPEED)) { int level = capability.getLevel(serverPlayer, ARROW_SPEED); //Level is value between 0 and 20; if (level > 0) { float modifier = 1.0F + level * 0.05F; arrow.setDeltaMovement(arrow.getDeltaMovement().scale(modifier)); } } }); } } } @SubscribeEvent public void onBowDraw(@NotNull ArrowNockEvent event) { if (event.getEntity() instanceof ServerPlayer serverPlayer) { if (event.getBow().getItem() instanceof BowItem) { serverPlayer.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(capability -> { if (capability.isUnlocked(serverPlayer, BOW_DRAW)) { int level = capability.getLevel(serverPlayer, BOW_DRAW); //Level is value between 0 and 10; if (level > 0) { //I have used AT to make this field public from protected; serverPlayer.useItemRemaining -= level; } } }); } } } } Problem I have is this delta movement data is not syncronized with the client, because when I shoot the arrow, at first the arrow goes in another direction and later actually syncs to it's real position. In other words client-side animation is bugged/not properly synced. To better visualize the problem I'm including a video: https://streamable.com/x741gp Any ideas how can I fix this?
October 3, 20222 yr Try setting arrow.hasImpulse = true after you change the velocity. If you look at ServerEntity.sendChanges() that should cause it to send an update packet instead of waiting 20 ticks (the arrow's updateInterval). Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
October 3, 20222 yr Author Already tried that, unfortunately it doesn't work. Also tried setting field arrow.hurtMarked = true; , but that also doesn't work.
October 3, 20222 yr I think your problem is caused by the ClientBoundSetEntityMotionPacket which clamps the maximum delta at +/- 3.9d Obviously, the same clamp doesn't happen to the real data on the server so there is an inconsistency. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
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.