诱饵将影响蜂群无人机追踪目标
This commit is contained in:
parent
fefc2303aa
commit
da7bb84159
2 changed files with 16 additions and 5 deletions
|
@ -128,10 +128,6 @@ public class Yx100Renderer extends GeoEntityRenderer<Yx100Entity> {
|
|||
}
|
||||
|
||||
if (name.equals("base")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
float a = animatable.getEntityData().get(YAW);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
|
@ -154,6 +150,11 @@ public class Yx100Renderer extends GeoEntityRenderer<Yx100Entity> {
|
|||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 1.5f);
|
||||
}
|
||||
|
||||
if (name.equals("root")) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 41; i++) {
|
||||
float tO = animatable.leftTrackO + 2 * i;
|
||||
float t = animatable.getLeftTrack() + 2 * i;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessag
|
|||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.SeekTool;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
|
@ -40,6 +41,7 @@ import software.bernie.geckolib.animation.*;
|
|||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity {
|
||||
|
||||
|
@ -49,6 +51,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
|||
public static final EntityDataAccessor<Float> TARGET_Z = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
|
||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
private boolean distracted = false;
|
||||
|
||||
private float explosionDamage = 80f;
|
||||
private float explosionRadius = 5f;
|
||||
|
@ -189,8 +192,15 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
|||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
Entity entity = EntityFindUtil.findEntity(this.level(), entityData.get(TARGET_UUID));
|
||||
List<Entity> decoy = SeekTool.seekLivingEntities(this, this.level(), 32, 90);
|
||||
|
||||
for (var e : decoy) {
|
||||
if (e instanceof DecoyEntity decoyEntity && !distracted) {
|
||||
this.entityData.set(TARGET_UUID, decoyEntity.getStringUUID());
|
||||
distracted = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.tickCount == 1) {
|
||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel serverLevel) {
|
||||
|
|
Loading…
Add table
Reference in a new issue