尝试重置投射物音效
This commit is contained in:
parent
709d4b64ea
commit
f49316cbc1
14 changed files with 88 additions and 97 deletions
|
@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare;
|
||||||
import com.atsuishio.superbwarfare.api.event.RegisterContainersEvent;
|
import com.atsuishio.superbwarfare.api.event.RegisterContainersEvent;
|
||||||
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
import com.atsuishio.superbwarfare.client.MouseMovementHandler;
|
||||||
import com.atsuishio.superbwarfare.client.renderer.molang.MolangVariable;
|
import com.atsuishio.superbwarfare.client.renderer.molang.MolangVariable;
|
||||||
|
import com.atsuishio.superbwarfare.client.sound.FastProjectileSoundInstance;
|
||||||
import com.atsuishio.superbwarfare.client.sound.VehicleFireSoundInstance;
|
import com.atsuishio.superbwarfare.client.sound.VehicleFireSoundInstance;
|
||||||
import com.atsuishio.superbwarfare.client.sound.VehicleSoundInstance;
|
import com.atsuishio.superbwarfare.client.sound.VehicleSoundInstance;
|
||||||
import com.atsuishio.superbwarfare.compat.CompatHolder;
|
import com.atsuishio.superbwarfare.compat.CompatHolder;
|
||||||
|
@ -11,6 +12,7 @@ import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||||
import com.atsuishio.superbwarfare.config.ClientConfig;
|
import com.atsuishio.superbwarfare.config.ClientConfig;
|
||||||
import com.atsuishio.superbwarfare.config.CommonConfig;
|
import com.atsuishio.superbwarfare.config.CommonConfig;
|
||||||
import com.atsuishio.superbwarfare.config.ServerConfig;
|
import com.atsuishio.superbwarfare.config.ServerConfig;
|
||||||
|
import com.atsuishio.superbwarfare.entity.projectile.FastThrowableProjectile;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Hpj11Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Hpj11Entity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||||
|
@ -135,6 +137,9 @@ public class Mod {
|
||||||
|
|
||||||
A10Entity.fireSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(vehicle));
|
A10Entity.fireSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(vehicle));
|
||||||
Hpj11Entity.fireSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(vehicle));
|
Hpj11Entity.fireSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(vehicle));
|
||||||
|
|
||||||
|
FastThrowableProjectile.flySound = entity -> Minecraft.getInstance().getSoundManager().play(new FastProjectileSoundInstance.FlySound(entity));
|
||||||
|
FastThrowableProjectile.nearFlySound = entity -> Minecraft.getInstance().getSoundManager().play(new FastProjectileSoundInstance.NearFlySound(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.client.sound;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.neoforged.api.distmarker.Dist;
|
|
||||||
import net.neoforged.api.distmarker.OnlyIn;
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public class ClientSoundHandler {
|
|
||||||
|
|
||||||
public static void playClientSoundInstance(Entity entity) {
|
|
||||||
if (entity instanceof LoudlyEntity) {
|
|
||||||
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(entity));
|
|
||||||
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(entity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +1,23 @@
|
||||||
package com.atsuishio.superbwarfare.client.sound;
|
package com.atsuishio.superbwarfare.client.sound;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.FastThrowableProjectile;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
import net.minecraft.client.resources.sounds.AbstractTickableSoundInstance;
|
||||||
import net.minecraft.sounds.SoundEvent;
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public abstract class LoudlyEntitySoundInstance extends AbstractTickableSoundInstance {
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
public abstract class FastProjectileSoundInstance extends AbstractTickableSoundInstance {
|
||||||
|
|
||||||
private final Minecraft client;
|
private final Minecraft client;
|
||||||
private final Entity entity;
|
private final FastThrowableProjectile entity;
|
||||||
private double lastDistance;
|
private double lastDistance;
|
||||||
private int fade = 0;
|
private int fade = 0;
|
||||||
private boolean die = false;
|
private boolean die = false;
|
||||||
|
|
||||||
public LoudlyEntitySoundInstance(SoundEvent sound, Minecraft client, Entity entity) {
|
public FastProjectileSoundInstance(SoundEvent sound, Minecraft client, FastThrowableProjectile entity) {
|
||||||
super(sound, SoundSource.AMBIENT, entity.getCommandSenderWorld().getRandom());
|
super(sound, SoundSource.AMBIENT, entity.getCommandSenderWorld().getRandom());
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
|
@ -23,11 +25,11 @@ public abstract class LoudlyEntitySoundInstance extends AbstractTickableSoundIns
|
||||||
this.delay = 0;
|
this.delay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean canPlay(Entity entity);
|
protected abstract boolean canPlay(FastThrowableProjectile entity);
|
||||||
|
|
||||||
protected abstract float getPitch(Entity entity);
|
protected abstract float getPitch(FastThrowableProjectile entity);
|
||||||
|
|
||||||
protected abstract float getVolume(Entity entity);
|
protected abstract float getVolume(FastThrowableProjectile entity);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
@ -67,51 +69,49 @@ public abstract class LoudlyEntitySoundInstance extends AbstractTickableSoundIns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySound extends LoudlyEntitySoundInstance {
|
@OnlyIn(Dist.CLIENT)
|
||||||
public EntitySound(Entity entity) {
|
public static class FlySound extends FastProjectileSoundInstance {
|
||||||
super(entity instanceof LoudlyEntity loudlyEntity ? loudlyEntity.getSound() : null, Minecraft.getInstance(), entity);
|
|
||||||
|
public FlySound(FastThrowableProjectile entity) {
|
||||||
|
super(entity.getSound(), Minecraft.getInstance(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canPlay(Entity entity) {
|
protected boolean canPlay(FastThrowableProjectile entity) {
|
||||||
return true;
|
return entity.isFastMoving();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getPitch(Entity entity) {
|
protected float getPitch(FastThrowableProjectile entity) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getVolume(Entity entity) {
|
protected float getVolume(FastThrowableProjectile entity) {
|
||||||
if (entity instanceof LoudlyEntity loudlyEntity) {
|
return (float) Math.min(entity.getVolume() * 0.1 * entity.getDeltaMovement().length(), 1.5);
|
||||||
return (float) Math.min(loudlyEntity.getVolume() * 0.1 * entity.getDeltaMovement().length(), 1.5);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySoundClose extends LoudlyEntitySoundInstance {
|
@OnlyIn(Dist.CLIENT)
|
||||||
public EntitySoundClose(Entity entity) {
|
public static class NearFlySound extends FastProjectileSoundInstance {
|
||||||
super(entity instanceof LoudlyEntity loudlyEntity ? loudlyEntity.getCloseSound() : null, Minecraft.getInstance(), entity);
|
|
||||||
|
public NearFlySound(FastThrowableProjectile entity) {
|
||||||
|
super(entity.getCloseSound(), Minecraft.getInstance(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canPlay(Entity entity) {
|
protected boolean canPlay(FastThrowableProjectile entity) {
|
||||||
return true;
|
return entity.isFastMoving();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getPitch(Entity entity) {
|
protected float getPitch(FastThrowableProjectile entity) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getVolume(Entity entity) {
|
protected float getVolume(FastThrowableProjectile entity) {
|
||||||
if (entity instanceof LoudlyEntity loudlyEntity) {
|
return (float) Math.min(entity.getVolume() * 0.1 * entity.getDeltaMovement().length(), 1.5);
|
||||||
return (float) Math.min(loudlyEntity.getVolume() * 0.1 * entity.getDeltaMovement().length(), 1.5);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity;
|
|
||||||
|
|
||||||
import net.minecraft.sounds.SoundEvent;
|
|
||||||
import net.minecraft.sounds.SoundEvents;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface LoudlyEntity {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
default SoundEvent getCloseSound() {
|
|
||||||
return SoundEvents.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
SoundEvent getSound();
|
|
||||||
|
|
||||||
float getVolume();
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
@ -41,6 +40,7 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.neoforged.neoforge.event.EventHooks;
|
import net.neoforged.neoforge.event.EventHooks;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.joml.Math;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
|
@ -48,7 +48,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, ExplosiveProjectile {
|
public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
||||||
|
@ -42,7 +41,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class CannonShellEntity extends FastThrowableProjectile implements GeoEntity, LoudlyEntity, ExplosiveProjectile {
|
public class CannonShellEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
private float damage = 0;
|
private float damage = 0;
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.network.message.receive.ClientMotionSyncMessage;
|
import com.atsuishio.superbwarfare.network.message.receive.ClientMotionSyncMessage;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraft.sounds.SoundEvents;
|
||||||
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;
|
||||||
|
@ -9,11 +11,20 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.neoforged.neoforge.entity.IEntityWithComplexSpawn;
|
import net.neoforged.neoforge.entity.IEntityWithComplexSpawn;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public abstract class FastThrowableProjectile extends ThrowableItemProjectile implements CustomSyncMotionEntity, IEntityWithComplexSpawn {
|
public abstract class FastThrowableProjectile extends ThrowableItemProjectile implements CustomSyncMotionEntity, IEntityWithComplexSpawn {
|
||||||
|
|
||||||
|
public static Consumer<FastThrowableProjectile> flySound = projectile -> {
|
||||||
|
};
|
||||||
|
public static Consumer<FastThrowableProjectile> nearFlySound = projectile -> {
|
||||||
|
};
|
||||||
|
|
||||||
|
private boolean isFastMoving = false;
|
||||||
|
|
||||||
public FastThrowableProjectile(EntityType<? extends ThrowableItemProjectile> pEntityType, Level pLevel) {
|
public FastThrowableProjectile(EntityType<? extends ThrowableItemProjectile> pEntityType, Level pLevel) {
|
||||||
super(pEntityType, pLevel);
|
super(pEntityType, pLevel);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +45,12 @@ public abstract class FastThrowableProjectile extends ThrowableItemProjectile im
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
|
if (!this.isFastMoving && this.isFastMoving() && this.level().isClientSide) {
|
||||||
|
flySound.accept(this);
|
||||||
|
nearFlySound.accept(this);
|
||||||
|
}
|
||||||
|
this.isFastMoving = this.isFastMoving();
|
||||||
|
|
||||||
Vec3 vec3 = this.getDeltaMovement();
|
Vec3 vec3 = this.getDeltaMovement();
|
||||||
float friction;
|
float friction;
|
||||||
if (this.isInWater()) {
|
if (this.isInWater()) {
|
||||||
|
@ -62,6 +79,10 @@ public abstract class FastThrowableProjectile extends ThrowableItemProjectile im
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFastMoving() {
|
||||||
|
return this.getDeltaMovement().lengthSqr() >= 2500;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean shouldSyncMotion() {
|
public boolean shouldSyncMotion() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -78,4 +99,18 @@ public abstract class FastThrowableProjectile extends ThrowableItemProjectile im
|
||||||
public void readSpawnData(RegistryFriendlyByteBuf additionalData) {
|
public void readSpawnData(RegistryFriendlyByteBuf additionalData) {
|
||||||
this.setDeltaMovement(additionalData.readFloat(), additionalData.readFloat(), additionalData.readFloat());
|
this.setDeltaMovement(additionalData.readFloat(), additionalData.readFloat(), additionalData.readFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public SoundEvent getCloseSound() {
|
||||||
|
return SoundEvents.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public SoundEvent getSound() {
|
||||||
|
return SoundEvents.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getVolume() {
|
||||||
|
return 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -35,7 +34,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class HeliRocketEntity extends FastThrowableProjectile implements GeoEntity, LoudlyEntity, ExplosiveProjectile {
|
public class HeliRocketEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
private float damage = 140f;
|
private float damage = 140f;
|
||||||
|
@ -59,14 +58,8 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
this.explosionRadius = explosionRadius;
|
this.explosionRadius = explosionRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 音效
|
|
||||||
// public HeliRocketEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
|
||||||
// this(ModEntities.HELI_ROCKET.get(), level);
|
|
||||||
// DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ClientSoundHandler.playClientSoundInstance(this));
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addAdditionalSaveData(CompoundTag pCompound) {
|
public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||||
super.addAdditionalSaveData(pCompound);
|
super.addAdditionalSaveData(pCompound);
|
||||||
pCompound.putFloat("Damage", this.damage);
|
pCompound.putFloat("Damage", this.damage);
|
||||||
pCompound.putFloat("ExplosionDamage", this.explosionDamage);
|
pCompound.putFloat("ExplosionDamage", this.explosionDamage);
|
||||||
|
@ -74,7 +67,7 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag pCompound) {
|
public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||||
super.readAdditionalSaveData(pCompound);
|
super.readAdditionalSaveData(pCompound);
|
||||||
if (pCompound.contains("Damage")) {
|
if (pCompound.contains("Damage")) {
|
||||||
this.damage = pCompound.getFloat("Damage");
|
this.damage = pCompound.getFloat("Damage");
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
@ -50,7 +49,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, ExplosiveProjectile {
|
public class JavelinMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.STRING);
|
||||||
public static final EntityDataAccessor<Boolean> TOP = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.BOOLEAN);
|
public static final EntityDataAccessor<Boolean> TOP = SynchedEntityData.defineId(JavelinMissileEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
|
@ -27,7 +26,8 @@ import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, AerialBombEntity {
|
public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, AerialBombEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk82Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk82Entity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
@ -152,11 +152,6 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
||||||
return this.cache;
|
return this.cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @NotNull SoundEvent getCloseSound() {
|
|
||||||
return LoudlyEntity.super.getCloseSound();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull SoundEvent getSound() {
|
public @NotNull SoundEvent getSound() {
|
||||||
return ModSounds.SHELL_FLY.get();
|
return ModSounds.SHELL_FLY.get();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -47,7 +46,8 @@ import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MortarShellEntity extends FastThrowableProjectile implements GeoEntity, LoudlyEntity, ExplosiveProjectile {
|
public class MortarShellEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
private float damage = 50;
|
private float damage = 50;
|
||||||
private float explosionDamage = ExplosionConfig.MORTAR_SHELL_EXPLOSION_DAMAGE.get();
|
private float explosionDamage = ExplosionConfig.MORTAR_SHELL_EXPLOSION_DAMAGE.get();
|
||||||
private int life = 600;
|
private int life = 600;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -37,7 +36,7 @@ import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.animation.*;
|
import software.bernie.geckolib.animation.*;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
public class RpgRocketEntity extends FastThrowableProjectile implements GeoEntity, LoudlyEntity, ExplosiveProjectile {
|
public class RpgRocketEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
import com.atsuishio.superbwarfare.init.ModItems;
|
||||||
|
@ -45,7 +44,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, ExplosiveProjectile {
|
public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.STRING);
|
||||||
public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> TARGET_X = SynchedEntityData.defineId(SwarmDroneEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
@ -44,7 +43,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, LoudlyEntity, ExplosiveProjectile {
|
public class WgMissileEntity extends FastThrowableProjectile implements GeoEntity, DestroyableProjectileEntity, ExplosiveProjectile {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(WgMissileEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(WgMissileEntity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue