调整fast projectile同步机制

This commit is contained in:
17146 2025-03-19 20:23:28 +08:00
parent bf9b9e9afa
commit cb958d805b

View file

@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.network.message.ClientMotionSyncMessage;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
@ -33,13 +32,7 @@ public abstract class FastThrowableProjectile extends ThrowableItemProjectile im
public void syncMotion() {
if (this.level().isClientSide) return;
var motion = this.getDeltaMovement();
double length = motion.length();
int tickNeeded = 5;
if (length > 0) {
tickNeeded = (int) Mth.clamp(10D / length, 1, 5);
}
if (this.tickCount % tickNeeded == 0) {
if (this.tickCount % this.getType().updateInterval() == 0) {
ModUtils.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new ClientMotionSyncMessage(this));
}
}