优化标枪锁定和修复攻顶模式鬼畜问题
This commit is contained in:
parent
9b5d17c304
commit
46f9428889
4 changed files with 30 additions and 16 deletions
|
@ -89,11 +89,16 @@ public class JavelinHudOverlay {
|
|||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
Entity targetEntity = EntityFindUtil.findEntity(player.level(), stack.getOrCreateTag().getString("TargetEntity"));
|
||||
List<Entity> entities = SeekTool.seekLivingEntities(player, player.level(), 512, 10);
|
||||
Entity naerestEntity = SeekTool.seekLivingEntity(player, player.level(), 512, 10);
|
||||
float fovAdjust = (float) Minecraft.getInstance().options.fov().get() / 80;
|
||||
|
||||
double zoom = 3;
|
||||
|
||||
Entity targetEntity = EntityFindUtil.findEntity(player.level(), stack.getOrCreateTag().getString("TargetEntity"));
|
||||
List<Entity> entities = SeekTool.seekLivingEntities(player, player.level(), 512, 10 * fovAdjust);
|
||||
Entity naerestEntity = SeekTool.seekLivingEntity(player, player.level(), 512, 8);
|
||||
|
||||
float fovAdjust2 = (float) (Minecraft.getInstance().options.fov().get() / 30) - 1;
|
||||
|
||||
double zoom = 3.1 + 0.5 * fovAdjust2;
|
||||
|
||||
for (var e : entities) {
|
||||
Vec3 pos = new Vec3(e.getX(), e.getEyeY(), e.getZ());
|
||||
|
|
|
@ -188,6 +188,12 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
|
|||
this.entityData.set(TARGET_Z, (float) entity.getZ());
|
||||
}
|
||||
|
||||
double px = this.getX();
|
||||
double ex = this.entityData.get(TARGET_X);
|
||||
double pz = this.getZ();
|
||||
double ez = this.entityData.get(TARGET_Z);
|
||||
boolean dir = Math.sqrt(Math.pow(px - ex, 2) + Math.pow(pz - ez, 2)) < 10;
|
||||
|
||||
if (this.tickCount == 4) {
|
||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CLOUD, this.xo, this.yo, this.zo, 15, 0.8, 0.8, 0.8, 0.01, true);
|
||||
|
@ -197,16 +203,13 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
|
|||
|
||||
if (this.tickCount > 3) {
|
||||
if (entityData.get(TOP)) {
|
||||
double px = this.getX();
|
||||
double ex = this.entityData.get(TARGET_X);
|
||||
double pz = this.getZ();
|
||||
double ez = this.entityData.get(TARGET_Z);
|
||||
|
||||
if (Math.sqrt(Math.pow(px - ex, 2) + Math.pow(pz - ez, 2)) > 10) {
|
||||
if (!dir) {
|
||||
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + Mth.clamp(4 * this.tickCount, 0, 90), this.entityData.get(TARGET_Z)));
|
||||
} else {
|
||||
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z)));
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(1.1));
|
||||
}
|
||||
|
||||
} else {
|
||||
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z)));
|
||||
}
|
||||
|
@ -214,9 +217,9 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
|
|||
|
||||
if (this.tickCount > 4) {
|
||||
this.setDeltaMovement(new Vec3(
|
||||
0.7f * this.getDeltaMovement().x + 1.3f * this.getLookAngle().x,
|
||||
0.7f * this.getDeltaMovement().y + 1.3f * this.getLookAngle().y,
|
||||
0.7f * this.getDeltaMovement().z + 1.3f * this.getLookAngle().z
|
||||
0.7f * this.getDeltaMovement().x + (dir ? 3 : 1.3f) * this.getLookAngle().x,
|
||||
0.7f * this.getDeltaMovement().y + (dir ? 3 : 1.3f) * this.getLookAngle().y,
|
||||
0.7f * this.getDeltaMovement().z + (dir ? 3 : 1.3f) * this.getLookAngle().z
|
||||
));
|
||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.xo, this.yo, this.zo, 1, 0, 0, 0, 0, true);
|
||||
|
|
|
@ -17,7 +17,7 @@ public class ProjectileTool {
|
|||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position());
|
||||
ParticleTool.spawnMediumExplosionParticles(projectile.level(), target.position());
|
||||
projectile.discard();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,11 @@ import com.atsuishio.superbwarfare.entity.IVehicleEntity;
|
|||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.ExperienceOrb;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import net.minecraft.world.entity.decoration.HangingEntity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
|
@ -25,8 +29,8 @@ public class SeekTool {
|
|||
&& e != entity
|
||||
&& e.isAlive()
|
||||
&& e.getVehicle() == null
|
||||
&& !(e instanceof ProjectileEntity)
|
||||
&& !(e instanceof Projectile)) {
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
) {
|
||||
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
||||
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
|
||||
}
|
||||
|
@ -40,6 +44,7 @@ public class SeekTool {
|
|||
if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle
|
||||
&& e != entity
|
||||
&& e.isAlive()
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
&& (e instanceof LivingEntity || e instanceof IVehicleEntity)
|
||||
&& !(e instanceof Player player && (player.isCreative() || player.isSpectator()))
|
||||
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
|
||||
|
@ -56,6 +61,7 @@ public class SeekTool {
|
|||
if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle
|
||||
&& e != entity
|
||||
&& e.isAlive()
|
||||
&& !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand)
|
||||
&& (e instanceof LivingEntity || e instanceof IVehicleEntity)
|
||||
&& !(e instanceof Player player && (player.isCreative() || player.isSpectator()))
|
||||
&& (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue