调整fast projectile同步机制
This commit is contained in:
parent
bf9b9e9afa
commit
cb958d805b
1 changed files with 1 additions and 8 deletions
|
@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.network.message.ClientMotionSyncMessage;
|
import com.atsuishio.superbwarfare.network.message.ClientMotionSyncMessage;
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||||
|
@ -33,13 +32,7 @@ public abstract class FastThrowableProjectile extends ThrowableItemProjectile im
|
||||||
public void syncMotion() {
|
public void syncMotion() {
|
||||||
if (this.level().isClientSide) return;
|
if (this.level().isClientSide) return;
|
||||||
|
|
||||||
var motion = this.getDeltaMovement();
|
if (this.tickCount % this.getType().updateInterval() == 0) {
|
||||||
double length = motion.length();
|
|
||||||
int tickNeeded = 5;
|
|
||||||
if (length > 0) {
|
|
||||||
tickNeeded = (int) Mth.clamp(10D / length, 1, 5);
|
|
||||||
}
|
|
||||||
if (this.tickCount % tickNeeded == 0) {
|
|
||||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new ClientMotionSyncMessage(this));
|
ModUtils.PACKET_HANDLER.send(PacketDistributor.ALL.noArg(), new ClientMotionSyncMessage(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue