修改BEAST子弹范围判定增加

This commit is contained in:
Light_Quanta 2024-05-10 18:50:00 +08:00
parent 0a259bbb75
commit 0224bb1766
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -139,10 +139,6 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
double expandHeight = entity instanceof Player && !entity.isCrouching() ? 0.0625 : 0.0; double expandHeight = entity instanceof Player && !entity.isCrouching() ? 0.0625 : 0.0;
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
if (this.beast) {
boundingBox = boundingBox.inflate(3);
}
// 延迟补偿 // 延迟补偿
if (entity instanceof ServerPlayer && this.shooter != null) { if (entity instanceof ServerPlayer && this.shooter != null) {
int ping = (int) Math.floor((((ServerPlayer) this.shooter).latency / 1000.0) * 20.0 + 4.0); int ping = (int) Math.floor((((ServerPlayer) this.shooter).latency / 1000.0) * 20.0 + 4.0);
@ -150,6 +146,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
} }
boundingBox = boundingBox.expandTowards(0, expandHeight, 0); boundingBox = boundingBox.expandTowards(0, expandHeight, 0);
if (this.beast) {
boundingBox = boundingBox.inflate(3);
}
Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null); Vec3 hitPos = boundingBox.clip(startVec, endVec).orElse(null);
Vec3 grownHitPos = boundingBox.inflate(0.35, 0.2, 0.35).clip(startVec, endVec).orElse(null); Vec3 grownHitPos = boundingBox.inflate(0.35, 0.2, 0.35).clip(startVec, endVec).orElse(null);
if (hitPos == null && grownHitPos != null) { if (hitPos == null && grownHitPos != null) {
@ -325,7 +325,6 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
living.gameEvent(GameEvent.ENTITY_DIE); living.gameEvent(GameEvent.ENTITY_DIE);
} }
((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, living.getX(), living.getY() + .5, living.getZ(), 1000, .4, .7, .4, 0); ((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, living.getX(), living.getY() + .5, living.getZ(), 1000, .4, .7, .4, 0);
this.discard();
return; return;
} }