为所有载具适配VehicleWeapon
This commit is contained in:
parent
d85b7150f3
commit
ba71610b38
16 changed files with 271 additions and 261 deletions
|
@ -4,12 +4,14 @@ import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.HelicopterEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.HelicopterEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.HeliRocketWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
@ -70,7 +72,6 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Float> PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> PROPELLER_ROT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
|
||||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> DECOY_COUNT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> DECOY_COUNT = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> LOADED_ROCKET = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> LOADED_ROCKET = SynchedEntityData.defineId(Ah6Entity.class, EntityDataSerializers.INT);
|
||||||
|
@ -99,13 +100,31 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
this.setMaxUpStep(1.1f);
|
this.setMaxUpStep(1.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new ProjectileWeapon()
|
||||||
|
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
|
||||||
|
.headShot(2)
|
||||||
|
.zoom(false)
|
||||||
|
.heBullet(1)
|
||||||
|
.bypassArmorRate(0.1f)
|
||||||
|
.sound(ModSounds.INTO_MISSILE.get()),
|
||||||
|
new HeliRocketWeapon()
|
||||||
|
.damage(VehicleConfig.AH_6_ROCKET_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
this.entityData.define(AMMO, 0);
|
this.entityData.define(AMMO, 0);
|
||||||
this.entityData.define(LOADED_ROCKET, 0);
|
this.entityData.define(LOADED_ROCKET, 0);
|
||||||
this.entityData.define(DELTA_ROT, 0f);
|
this.entityData.define(DELTA_ROT, 0f);
|
||||||
this.entityData.define(WEAPON_TYPE, 0);
|
|
||||||
this.entityData.define(PROPELLER_ROT, 0f);
|
this.entityData.define(PROPELLER_ROT, 0f);
|
||||||
this.entityData.define(DECOY_COUNT, 6);
|
this.entityData.define(DECOY_COUNT, 6);
|
||||||
}
|
}
|
||||||
|
@ -519,13 +538,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
worldPositionLeft = transformPosition(transform, x, y, z);
|
worldPositionLeft = transformPosition(transform, x, y, z);
|
||||||
|
|
||||||
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
||||||
ProjectileEntity projectileRight = new ProjectileEntity(player.level())
|
ProjectileEntity projectileRight = ((ProjectileWeapon) getWeapon(0)).create(player);
|
||||||
.shooter(player)
|
|
||||||
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
|
|
||||||
.headShot(2f)
|
|
||||||
.zoom(false)
|
|
||||||
.heBullet(1)
|
|
||||||
.bypassArmorRate(0.1f);
|
|
||||||
|
|
||||||
projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
|
projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
|
||||||
projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,
|
projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,
|
||||||
|
@ -538,13 +551,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
||||||
ProjectileEntity projectileLeft = new ProjectileEntity(player.level())
|
ProjectileEntity projectileLeft = ((ProjectileWeapon) getWeapon(0)).create(player);
|
||||||
.shooter(player)
|
|
||||||
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
|
|
||||||
.headShot(2f)
|
|
||||||
.zoom(false)
|
|
||||||
.heBullet(1)
|
|
||||||
.bypassArmorRate(0.1f);
|
|
||||||
|
|
||||||
projectileLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
|
projectileLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
|
||||||
projectileLeft.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,
|
projectileLeft.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,
|
||||||
|
@ -593,25 +600,17 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
worldPositionRight = transformPosition(transform, -x, y, z);
|
worldPositionRight = transformPosition(transform, -x, y, z);
|
||||||
worldPositionLeft = transformPosition(transform, x, y, z);
|
worldPositionLeft = transformPosition(transform, x, y, z);
|
||||||
|
|
||||||
if (fireIndex == 0) {
|
var heliRocketEntity = ((HeliRocketWeapon) getWeapon(0)).create(player);
|
||||||
HeliRocketEntity heliRocketEntityRight = new HeliRocketEntity(player, player.level(),
|
|
||||||
VehicleConfig.AH_6_ROCKET_DAMAGE.get(),
|
|
||||||
VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get(),
|
|
||||||
VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get());
|
|
||||||
|
|
||||||
heliRocketEntityRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
|
if (fireIndex == 0) {
|
||||||
heliRocketEntityRight.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.008, this.getLookAngle().z, 7, 0.25f);
|
heliRocketEntity.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
|
||||||
player.level().addFreshEntity(heliRocketEntityRight);
|
heliRocketEntity.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.008, this.getLookAngle().z, 7, 0.25f);
|
||||||
|
player.level().addFreshEntity(heliRocketEntity);
|
||||||
fireIndex = 1;
|
fireIndex = 1;
|
||||||
} else if (fireIndex == 1) {
|
} else if (fireIndex == 1) {
|
||||||
HeliRocketEntity heliRocketEntityLeft = new HeliRocketEntity(player, player.level(),
|
heliRocketEntity.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
|
||||||
VehicleConfig.AH_6_ROCKET_DAMAGE.get(),
|
heliRocketEntity.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.008, this.getLookAngle().z, 7, 0.25f);
|
||||||
VehicleConfig.AH_6_ROCKET_EXPLOSION_DAMAGE.get(),
|
player.level().addFreshEntity(heliRocketEntity);
|
||||||
VehicleConfig.AH_6_ROCKET_EXPLOSION_RADIUS.get());
|
|
||||||
|
|
||||||
heliRocketEntityLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
|
|
||||||
heliRocketEntityLeft.shoot(this.getLookAngle().x, this.getLookAngle().y + 0.008, this.getLookAngle().z, 7, 0.25f);
|
|
||||||
player.level().addFreshEntity(heliRocketEntityLeft);
|
|
||||||
fireIndex = 0;
|
fireIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,34 +727,6 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
|
||||||
if (index != 0) return;
|
|
||||||
|
|
||||||
var type = isScroll ? (value + getWeaponType(0) + 2) % 2 : value;
|
|
||||||
|
|
||||||
var sound = switch (type) {
|
|
||||||
case 0 -> ModSounds.INTO_MISSILE.get();
|
|
||||||
case 1 -> ModSounds.INTO_CANNON.get();
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
if (sound == null) return;
|
|
||||||
|
|
||||||
setWeaponType(0, type);
|
|
||||||
this.level().playSound(null, this, sound, this.getSoundSource(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
if (index == 0) return entityData.get(WEAPON_TYPE);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeaponType(int index, int type) {
|
|
||||||
entityData.set(WEAPON_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return ModUtils.loc("textures/vehicle_icon/ah_6_icon.png");
|
return ModUtils.loc("textures/vehicle_icon/ah_6_icon.png");
|
||||||
|
|
|
@ -6,6 +6,8 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.EnergyVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.EmptyWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.*;
|
||||||
|
@ -82,6 +84,15 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
this.noCulling = true;
|
this.noCulling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new EmptyWeapon()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
|
|
@ -3,13 +3,14 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.SmallCannonShellWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.WgMissileWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
@ -97,6 +98,30 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
this.setMaxUpStep(1.5f);
|
this.setMaxUpStep(1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new SmallCannonShellWeapon()
|
||||||
|
.damage(VehicleConfig.BMP_2_CANNON_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.BMP_2_CANNON_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.sound(ModSounds.INTO_MISSILE.get())
|
||||||
|
,
|
||||||
|
new ProjectileWeapon()
|
||||||
|
.damage(9.5f)
|
||||||
|
.headShot(2)
|
||||||
|
.zoom(false)
|
||||||
|
.sound(ModSounds.INTO_CANNON.get()),
|
||||||
|
new WgMissileWeapon()
|
||||||
|
.damage(ExplosionConfig.WIRE_GUIDE_MISSILE_DAMAGE.get())
|
||||||
|
.explosionDamage(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS.get())
|
||||||
|
.sound(ModSounds.INTO_MISSILE.get()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
@ -105,7 +130,6 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
this.entityData.define(DELTA_ROT, 0f);
|
this.entityData.define(DELTA_ROT, 0f);
|
||||||
this.entityData.define(HEAT, 0);
|
this.entityData.define(HEAT, 0);
|
||||||
this.entityData.define(COAX_HEAT, 0);
|
this.entityData.define(COAX_HEAT, 0);
|
||||||
this.entityData.define(WEAPON_TYPE, 0);
|
|
||||||
this.entityData.define(LOADED_MISSILE, 0);
|
this.entityData.define(LOADED_MISSILE, 0);
|
||||||
this.entityData.define(TRACK_L, 0f);
|
this.entityData.define(TRACK_L, 0f);
|
||||||
this.entityData.define(TRACK_R, 0f);
|
this.entityData.define(TRACK_R, 0f);
|
||||||
|
@ -318,10 +342,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
float z = 4.2f;
|
float z = 4.2f;
|
||||||
|
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(),
|
var smallCannonShell = ((SmallCannonShellWeapon) getWeapon(0)).create(player);
|
||||||
VehicleConfig.BMP_2_CANNON_DAMAGE.get(),
|
|
||||||
VehicleConfig.BMP_2_CANNON_EXPLOSION_DAMAGE.get(),
|
|
||||||
VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue());
|
|
||||||
|
|
||||||
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 20,
|
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 20,
|
||||||
|
@ -362,11 +383,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
boolean hasCreativeAmmo = player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()));
|
boolean hasCreativeAmmo = player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()));
|
||||||
|
|
||||||
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
||||||
ProjectileEntity projectileRight = new ProjectileEntity(player.level())
|
var projectileRight = ((ProjectileWeapon) getWeapon(0)).create(player);
|
||||||
.shooter(player)
|
|
||||||
.damage(9.5f)
|
|
||||||
.headShot(2f)
|
|
||||||
.zoom(false);
|
|
||||||
|
|
||||||
projectileRight.bypassArmorRate(0.2f);
|
projectileRight.bypassArmorRate(0.2f);
|
||||||
projectileRight.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
projectileRight.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
|
@ -404,10 +421,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
Matrix4f transformT = getBarrelTransform();
|
Matrix4f transformT = getBarrelTransform();
|
||||||
Vector4f worldPosition = transformPosition(transformT, 0, 1, 0);
|
Vector4f worldPosition = transformPosition(transformT, 0, 1, 0);
|
||||||
|
|
||||||
WgMissileEntity wgMissileEntity = new WgMissileEntity(player, player.level(),
|
var wgMissileEntity = ((WgMissileWeapon) getWeapon(0)).create(player);
|
||||||
ExplosionConfig.WIRE_GUIDE_MISSILE_DAMAGE.get(),
|
|
||||||
ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_DAMAGE.get(),
|
|
||||||
ExplosionConfig.WIRE_GUIDE_MISSILE_EXPLOSION_RADIUS.get());
|
|
||||||
|
|
||||||
wgMissileEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
wgMissileEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
wgMissileEntity.shoot(getBarrelVector(1).x, 0, getBarrelVector(1).z, 2f, 0f);
|
wgMissileEntity.shoot(getBarrelVector(1).x, 0, getBarrelVector(1).z, 2f, 0f);
|
||||||
|
@ -745,33 +759,6 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
|
||||||
if (index != 0) return;
|
|
||||||
|
|
||||||
var type = isScroll ? (value + getWeaponType(0) + 2) % 2 : value;
|
|
||||||
|
|
||||||
var sound = switch (type) {
|
|
||||||
case 0, 2 -> ModSounds.INTO_MISSILE.get();
|
|
||||||
case 1 -> ModSounds.INTO_CANNON.get();
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
if (sound == null) return;
|
|
||||||
|
|
||||||
setWeaponType(0, type);
|
|
||||||
this.level().playSound(null, this, sound, this.getSoundSource(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
return index == 0 ? entityData.get(WEAPON_TYPE) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeaponType(int index, int type) {
|
|
||||||
if (index == 0) entityData.set(WEAPON_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return ModUtils.loc("textures/vehicle_icon/bmp2_icon.png");
|
return ModUtils.loc("textures/vehicle_icon/bmp2_icon.png");
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.SmallCannonShellWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.AmmoType;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
@ -69,8 +70,6 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> COAX_HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COAX_HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
|
|
||||||
|
|
||||||
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
|
public static final float MAX_HEALTH = VehicleConfig.LAV_150_HP.get();
|
||||||
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
|
public static final int MAX_ENERGY = VehicleConfig.LAV_150_MAX_ENERGY.get();
|
||||||
|
|
||||||
|
@ -97,6 +96,24 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
this.setMaxUpStep(1.5f);
|
this.setMaxUpStep(1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new SmallCannonShellWeapon()
|
||||||
|
.damage(VehicleConfig.LAV_150_CANNON_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.LAV_150_CANNON_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.sound(ModSounds.INTO_MISSILE.get()),
|
||||||
|
new ProjectileWeapon()
|
||||||
|
.damage(9.5f)
|
||||||
|
.headShot(2)
|
||||||
|
.zoom(false)
|
||||||
|
.sound(ModSounds.INTO_CANNON.get()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
@ -105,7 +122,6 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
this.entityData.define(DELTA_ROT, 0f);
|
this.entityData.define(DELTA_ROT, 0f);
|
||||||
this.entityData.define(HEAT, 0);
|
this.entityData.define(HEAT, 0);
|
||||||
this.entityData.define(COAX_HEAT, 0);
|
this.entityData.define(COAX_HEAT, 0);
|
||||||
this.entityData.define(WEAPON_TYPE, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -289,10 +305,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
float z = 4f;
|
float z = 4f;
|
||||||
|
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(),
|
var smallCannonShell = ((SmallCannonShellWeapon) getWeapon(0)).create(player);
|
||||||
VehicleConfig.LAV_150_CANNON_DAMAGE.get(),
|
|
||||||
VehicleConfig.LAV_150_CANNON_EXPLOSION_DAMAGE.get(),
|
|
||||||
VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get().floatValue());
|
|
||||||
|
|
||||||
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 20,
|
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 20,
|
||||||
|
@ -333,17 +346,13 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
|
|
||||||
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
if (this.entityData.get(AMMO) > 0 || hasCreativeAmmo) {
|
||||||
ProjectileEntity projectileRight = new ProjectileEntity(player.level())
|
var projectile = ((ProjectileWeapon) getWeapon(0)).create(player);
|
||||||
.shooter(player)
|
|
||||||
.damage(9.5f)
|
|
||||||
.headShot(2f)
|
|
||||||
.zoom(false);
|
|
||||||
|
|
||||||
projectileRight.bypassArmorRate(0.2f);
|
projectile.bypassArmorRate(0.2f);
|
||||||
projectileRight.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
projectileRight.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.002f, getBarrelVector(1).z, 36,
|
projectile.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.002f, getBarrelVector(1).z, 36,
|
||||||
0.25f);
|
0.25f);
|
||||||
this.level().addFreshEntity(projectileRight);
|
this.level().addFreshEntity(projectile);
|
||||||
|
|
||||||
if (!hasCreativeAmmo) {
|
if (!hasCreativeAmmo) {
|
||||||
ItemStack ammoBox = this.getItemStacks().stream().filter(stack -> {
|
ItemStack ammoBox = this.getItemStacks().stream().filter(stack -> {
|
||||||
|
@ -689,34 +698,6 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
|
||||||
if (index != 0) return;
|
|
||||||
|
|
||||||
int type = isScroll ? (value + getWeaponType(0) + 2) % 2 : value;
|
|
||||||
|
|
||||||
var sound = switch (type) {
|
|
||||||
case 0 -> ModSounds.INTO_MISSILE.get();
|
|
||||||
case 1 -> ModSounds.INTO_CANNON.get();
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
if (sound == null) return;
|
|
||||||
|
|
||||||
setWeaponType(0, type);
|
|
||||||
this.level().playSound(null, this, sound, this.getSoundSource(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
return index == 0 ? entityData.get(WEAPON_TYPE) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeaponType(int index, int type) {
|
|
||||||
if (index != 0) return;
|
|
||||||
entityData.set(WEAPON_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getVehicleIcon() {
|
public ResourceLocation getVehicleIcon() {
|
||||||
return ModUtils.loc("textures/vehicle_icon/lav150_icon.png");
|
return ModUtils.loc("textures/vehicle_icon/lav150_icon.png");
|
||||||
|
|
|
@ -3,10 +3,11 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -60,7 +61,6 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> YAW = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
|
||||||
|
|
||||||
public Mk42Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Mk42Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.MK_42.get(), world);
|
this(ModEntities.MK_42.get(), world);
|
||||||
|
@ -76,7 +76,28 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
this.entityData.define(COOL_DOWN, 0);
|
this.entityData.define(COOL_DOWN, 0);
|
||||||
this.entityData.define(PITCH, 0f);
|
this.entityData.define(PITCH, 0f);
|
||||||
this.entityData.define(YAW, 0f);
|
this.entityData.define(YAW, 0f);
|
||||||
this.entityData.define(WEAPON_TYPE, 0);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new CannonShellWeapon()
|
||||||
|
.hitDamage(VehicleConfig.MK42_AP_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.MK42_AP_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.MK42_AP_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.durability(60)
|
||||||
|
.sound(ModSounds.CANNON_RELOAD.get()),
|
||||||
|
new CannonShellWeapon()
|
||||||
|
.hitDamage(VehicleConfig.MK42_HE_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.MK42_HE_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.MK42_HE_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.durability(1)
|
||||||
|
.fireProbability(0.18F)
|
||||||
|
.fireTime(2)
|
||||||
|
.sound(ModSounds.CANNON_RELOAD.get()),
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -252,33 +273,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
InventoryTool.consumeItem(player.getInventory().items, ammo, 1);
|
InventoryTool.consumeItem(player.getInventory().items, ammo, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float hitDamage;
|
var entityToSpawn = ((CannonShellWeapon) getWeapon(0)).create(player);
|
||||||
float explosionRadius;
|
|
||||||
float explosionDamage;
|
|
||||||
float fireProbability;
|
|
||||||
int fireTime;
|
|
||||||
int durability;
|
|
||||||
|
|
||||||
if (getWeaponType(0) == 0) {
|
|
||||||
// AP
|
|
||||||
hitDamage = VehicleConfig.MK42_AP_DAMAGE.get();
|
|
||||||
explosionRadius = VehicleConfig.MK42_AP_EXPLOSION_RADIUS.get();
|
|
||||||
explosionDamage = VehicleConfig.MK42_AP_EXPLOSION_DAMAGE.get();
|
|
||||||
fireProbability = 0;
|
|
||||||
fireTime = 0;
|
|
||||||
durability = 60;
|
|
||||||
} else {
|
|
||||||
// HE
|
|
||||||
hitDamage = VehicleConfig.MK42_HE_DAMAGE.get();
|
|
||||||
explosionRadius = VehicleConfig.MK42_HE_EXPLOSION_RADIUS.get();
|
|
||||||
explosionDamage = VehicleConfig.MK42_HE_EXPLOSION_DAMAGE.get();
|
|
||||||
fireProbability = 0.18F;
|
|
||||||
fireTime = 2;
|
|
||||||
durability = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
CannonShellEntity entityToSpawn = new CannonShellEntity(player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime)
|
|
||||||
.durability(durability);
|
|
||||||
|
|
||||||
entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ());
|
entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ());
|
||||||
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
|
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.05f);
|
||||||
|
@ -352,32 +347,6 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
entity.setXRot(entity.getXRot() + f1 - f);
|
entity.setXRot(entity.getXRot() + f1 - f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeaponType(int index, int type) {
|
|
||||||
if (index != 0) return;
|
|
||||||
entityData.set(WEAPON_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
|
||||||
if (index != 0) return;
|
|
||||||
|
|
||||||
int type = isScroll ? (value + getWeaponType(0) + 2) % 2 : value;
|
|
||||||
var sound = switch (type) {
|
|
||||||
case 0, 1 -> ModSounds.CANNON_RELOAD.get();
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
if (sound == null) return;
|
|
||||||
|
|
||||||
setWeaponType(0, type);
|
|
||||||
this.level().playSound(null, this, sound, this.getSoundSource(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
return index == 0 ? entityData.get(WEAPON_TYPE) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPassengerTurned(Entity entity) {
|
public void onPassengerTurned(Entity entity) {
|
||||||
this.clampRotation(entity);
|
this.clampRotation(entity);
|
||||||
|
|
|
@ -3,10 +3,11 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.CannonShellWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -62,8 +63,6 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public static final float MAX_HEALTH = VehicleConfig.MLE1934_HP.get();
|
public static final float MAX_HEALTH = VehicleConfig.MLE1934_HP.get();
|
||||||
|
|
||||||
public static final EntityDataAccessor<Integer> WEAPON_TYPE = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT);
|
|
||||||
|
|
||||||
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.MLE_1934.get(), world);
|
this(ModEntities.MLE_1934.get(), world);
|
||||||
}
|
}
|
||||||
|
@ -72,6 +71,28 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
super(type, world);
|
super(type, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new CannonShellWeapon()
|
||||||
|
.hitDamage(VehicleConfig.MLE1934_AP_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.MLE1934_AP_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.MLE1934_AP_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.durability(70)
|
||||||
|
.sound(ModSounds.CANNON_RELOAD.get()),
|
||||||
|
new CannonShellWeapon()
|
||||||
|
.hitDamage(VehicleConfig.MLE1934_HE_DAMAGE.get())
|
||||||
|
.explosionDamage(VehicleConfig.MLE1934_HE_EXPLOSION_DAMAGE.get())
|
||||||
|
.explosionRadius(VehicleConfig.MLE1934_HE_EXPLOSION_RADIUS.get().floatValue())
|
||||||
|
.durability(1)
|
||||||
|
.fireProbability(0.24F)
|
||||||
|
.fireTime(5)
|
||||||
|
.sound(ModSounds.CANNON_RELOAD.get()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
@ -79,7 +100,6 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
this.entityData.define(TYPE, 0);
|
this.entityData.define(TYPE, 0);
|
||||||
this.entityData.define(PITCH, 0f);
|
this.entityData.define(PITCH, 0f);
|
||||||
this.entityData.define(YAW, 0f);
|
this.entityData.define(YAW, 0f);
|
||||||
this.entityData.define(WEAPON_TYPE, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -307,8 +327,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
leftPos.rotateY(-yRot * Mth.DEG_TO_RAD);
|
leftPos.rotateY(-yRot * Mth.DEG_TO_RAD);
|
||||||
|
|
||||||
// 左炮管
|
// 左炮管
|
||||||
CannonShellEntity entityToSpawnLeft = new CannonShellEntity(player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime)
|
var entityToSpawnLeft = ((CannonShellWeapon) getWeapon(0)).create(player);
|
||||||
.durability(durability);
|
|
||||||
|
|
||||||
entityToSpawnLeft.setPos(this.getX() + leftPos.x,
|
entityToSpawnLeft.setPos(this.getX() + leftPos.x,
|
||||||
this.getEyeY() - 0.2 + leftPos.y,
|
this.getEyeY() - 0.2 + leftPos.y,
|
||||||
|
@ -352,8 +371,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
rightPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
|
rightPos.rotateZ(-this.getXRot() * Mth.DEG_TO_RAD);
|
||||||
rightPos.rotateY(-yRot * Mth.DEG_TO_RAD);
|
rightPos.rotateY(-yRot * Mth.DEG_TO_RAD);
|
||||||
|
|
||||||
CannonShellEntity entityToSpawnRight = new CannonShellEntity(player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime)
|
var entityToSpawnRight = ((CannonShellWeapon) getWeapon(0)).create(player);
|
||||||
.durability(durability);
|
|
||||||
|
|
||||||
entityToSpawnRight.setPos(this.getX() + rightPos.x,
|
entityToSpawnRight.setPos(this.getX() + rightPos.x,
|
||||||
this.getEyeY() - 0.2 + rightPos.y,
|
this.getEyeY() - 0.2 + rightPos.y,
|
||||||
|
@ -447,32 +465,6 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
entity.setXRot(entity.getXRot() + f1 - f);
|
entity.setXRot(entity.getXRot() + f1 - f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeaponType(int index, int type) {
|
|
||||||
if (index != 0) return;
|
|
||||||
entityData.set(WEAPON_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changeWeapon(int index, int value, boolean isScroll) {
|
|
||||||
if (index != 0) return;
|
|
||||||
|
|
||||||
int type = isScroll ? (value + getWeaponType(0) + 2) % 2 : value;
|
|
||||||
var sound = switch (type) {
|
|
||||||
case 0, 1 -> ModSounds.CANNON_RELOAD.get();
|
|
||||||
default -> null;
|
|
||||||
};
|
|
||||||
if (sound == null) return;
|
|
||||||
|
|
||||||
setWeaponType(0, type);
|
|
||||||
this.level().playSound(null, this, sound, this.getSoundSource(), 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
return index == 0 ? entityData.get(WEAPON_TYPE) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPassengerTurned(Entity entity) {
|
public void onPassengerTurned(Entity entity) {
|
||||||
this.clampRotation(entity);
|
this.clampRotation(entity);
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.ProjectileWeapon;
|
||||||
|
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
|
@ -87,6 +88,18 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
super(type, world);
|
super(type, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleWeapon[][] getAllWeapons() {
|
||||||
|
return new VehicleWeapon[][]{
|
||||||
|
new VehicleWeapon[]{
|
||||||
|
new ProjectileWeapon()
|
||||||
|
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
|
||||||
|
.headShot(2)
|
||||||
|
.zoom(false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
|
@ -241,11 +254,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
Vector4f worldPosition = transformPosition(transform, x, y, z);
|
||||||
|
|
||||||
|
|
||||||
ProjectileEntity projectile = new ProjectileEntity(player.level())
|
var projectile = ((ProjectileWeapon) getWeapon(0)).create(player);
|
||||||
.shooter(player)
|
|
||||||
.damage(VehicleConfig.SPEEDBOAT_GUN_DAMAGE.get())
|
|
||||||
.headShot(2f)
|
|
||||||
.zoom(false);
|
|
||||||
|
|
||||||
projectile.bypassArmorRate(0.4f);
|
projectile.bypassArmorRate(0.4f);
|
||||||
projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
|
@ -560,11 +569,6 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
return ModUtils.loc("textures/vehicle_icon/speedboat_icon.png");
|
return ModUtils.loc("textures/vehicle_icon/speedboat_icon.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getWeaponType(int index) {
|
|
||||||
return index == 0 ? 0 : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float turretYRotO() {
|
public float turretYRotO() {
|
||||||
return turretYRotO;
|
return turretYRotO;
|
||||||
|
|
|
@ -374,7 +374,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
Vector4f worldPosition = transformPosition(transform, 0, 0, 0);
|
Vector4f worldPosition = transformPosition(transform, 0, 0, 0);
|
||||||
|
|
||||||
var cannonShell = (CannonShellWeapon) getWeapon(0);
|
var cannonShell = (CannonShellWeapon) getWeapon(0);
|
||||||
var entityToSpawn = cannonShell.create(player, level());
|
var entityToSpawn = cannonShell.create(player);
|
||||||
|
|
||||||
entityToSpawn.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
entityToSpawn.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
|
||||||
entityToSpawn.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, cannonShell.velocity, 0.02f);
|
entityToSpawn.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, cannonShell.velocity, 0.02f);
|
||||||
|
|
|
@ -238,7 +238,7 @@ public abstract class VehicleEntity extends Entity {
|
||||||
this.availableWeapons = new VehicleWeapon[this.getMaxPassengers()][];
|
this.availableWeapons = new VehicleWeapon[this.getMaxPassengers()][];
|
||||||
|
|
||||||
var weapons = weaponVehicle.getAllWeapons();
|
var weapons = weaponVehicle.getAllWeapons();
|
||||||
for (int i = 0; i < weapons.length || i < this.getMaxPassengers(); i++) {
|
for (int i = 0; i < weapons.length && i < this.getMaxPassengers(); i++) {
|
||||||
this.availableWeapons[i] = weapons[i];
|
this.availableWeapons[i] = weapons[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,7 @@ public interface WeaponVehicleEntity extends ArmedVehicleEntity {
|
||||||
/**
|
/**
|
||||||
* 获取所有可用武器列表
|
* 获取所有可用武器列表
|
||||||
*/
|
*/
|
||||||
default VehicleWeapon[][] getAllWeapons() {
|
VehicleWeapon[][] getAllWeapons();
|
||||||
return new VehicleWeapon[0][];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取该槽位可用的武器列表
|
* 获取该槽位可用的武器列表
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.atsuishio.superbwarfare.entity.vehicle.weapon;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
|
|
||||||
public class CannonShellWeapon extends VehicleWeapon {
|
public class CannonShellWeapon extends VehicleWeapon {
|
||||||
public float hitDamage, explosionRadius, explosionDamage, fireProbability, velocity;
|
public float hitDamage, explosionRadius, explosionDamage, fireProbability, velocity;
|
||||||
|
@ -43,9 +42,9 @@ public class CannonShellWeapon extends VehicleWeapon {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CannonShellEntity create(Player player, Level level) {
|
public CannonShellEntity create(Player player) {
|
||||||
return new CannonShellEntity(player,
|
return new CannonShellEntity(player,
|
||||||
level,
|
player.level(),
|
||||||
this.hitDamage,
|
this.hitDamage,
|
||||||
this.explosionRadius,
|
this.explosionRadius,
|
||||||
this.explosionDamage,
|
this.explosionDamage,
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.weapon;
|
||||||
|
|
||||||
|
public class EmptyWeapon extends VehicleWeapon {
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.weapon;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
|
public class HeliRocketWeapon extends VehicleWeapon {
|
||||||
|
public float damage = 140, explosionDamage = 60, explosionRadius = 5;
|
||||||
|
|
||||||
|
public HeliRocketWeapon damage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeliRocketWeapon explosionDamage(float explosionDamage) {
|
||||||
|
this.explosionDamage = explosionDamage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeliRocketWeapon explosionRadius(float explosionRadius) {
|
||||||
|
this.explosionRadius = explosionRadius;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeliRocketEntity create(LivingEntity entity) {
|
||||||
|
return new HeliRocketEntity(entity, entity.level(), damage, explosionDamage, explosionRadius);
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
public class ProjectileWeapon extends VehicleWeapon {
|
public class ProjectileWeapon extends VehicleWeapon {
|
||||||
public float headShot, damage, bypassArmorRate;
|
public float headShot, damage, bypassArmorRate;
|
||||||
public boolean zoom;
|
public boolean zoom;
|
||||||
|
public int jhpLevel, heLevel;
|
||||||
|
|
||||||
public ProjectileWeapon headShot(float headShot) {
|
public ProjectileWeapon headShot(float headShot) {
|
||||||
this.headShot = headShot;
|
this.headShot = headShot;
|
||||||
|
@ -27,12 +28,24 @@ public class ProjectileWeapon extends VehicleWeapon {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProjectileWeapon jhpBullet(int jhpLevel) {
|
||||||
|
this.jhpLevel = jhpLevel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectileWeapon heBullet(int heLevel) {
|
||||||
|
this.heLevel = heLevel;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ProjectileEntity create(LivingEntity shooter) {
|
public ProjectileEntity create(LivingEntity shooter) {
|
||||||
return new ProjectileEntity(shooter.level())
|
return new ProjectileEntity(shooter.level())
|
||||||
.shooter(shooter)
|
.shooter(shooter)
|
||||||
.headShot(headShot)
|
.headShot(headShot)
|
||||||
.damage(damage)
|
.damage(damage)
|
||||||
.bypassArmorRate(bypassArmorRate)
|
.bypassArmorRate(bypassArmorRate)
|
||||||
.zoom(zoom);
|
.zoom(zoom)
|
||||||
|
.jhpBullet(jhpLevel)
|
||||||
|
.heBullet(heLevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.weapon;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
|
public class SmallCannonShellWeapon extends VehicleWeapon {
|
||||||
|
public float damage = 40, explosionDamage = 80, explosionRadius = 5;
|
||||||
|
|
||||||
|
public SmallCannonShellWeapon damage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmallCannonShellWeapon explosionDamage(float explosionDamage) {
|
||||||
|
this.explosionDamage = explosionDamage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmallCannonShellWeapon explosionRadius(float explosionRadius) {
|
||||||
|
this.explosionRadius = explosionRadius;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmallCannonShellEntity create(LivingEntity entity) {
|
||||||
|
return new SmallCannonShellEntity(entity, entity.level(), damage, explosionDamage, explosionRadius);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.atsuishio.superbwarfare.entity.vehicle.weapon;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
|
public class WgMissileWeapon extends VehicleWeapon {
|
||||||
|
public float damage = 250, explosionDamage = 200, explosionRadius = 10;
|
||||||
|
|
||||||
|
public WgMissileWeapon damage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WgMissileWeapon explosionDamage(float explosionDamage) {
|
||||||
|
this.explosionDamage = explosionDamage;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WgMissileWeapon explosionRadius(float explosionRadius) {
|
||||||
|
this.explosionRadius = explosionRadius;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WgMissileEntity create(LivingEntity entity) {
|
||||||
|
return new WgMissileEntity(entity, entity.level(), damage, explosionDamage, explosionRadius);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue