又还是调整数值平衡
This commit is contained in:
parent
b646f7ae8d
commit
1ba09cac8b
17 changed files with 122 additions and 61 deletions
|
@ -12,7 +12,7 @@ public class RangeHelper {
|
||||||
* @param thetaDegrees 发射角度(以度为单位),需要根据实际情况修改
|
* @param thetaDegrees 发射角度(以度为单位),需要根据实际情况修改
|
||||||
*/
|
*/
|
||||||
public static double getRange(double thetaDegrees) {
|
public static double getRange(double thetaDegrees) {
|
||||||
double initialVelocity = 14.741; // 初始速度 8 m/s
|
double initialVelocity = 8; // 初始速度 8 m/s
|
||||||
double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度
|
double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度
|
||||||
double gravity = 0.05; // 重力加速度
|
double gravity = 0.05; // 重力加速度
|
||||||
double velocityDecay = 0.99; // 速度衰减系数
|
double velocityDecay = 0.99; // 速度衰减系数
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class MortarEntity extends Entity implements GeoEntity, AnimatedEntity {
|
||||||
if (level instanceof ServerLevel server) {
|
if (level instanceof ServerLevel server) {
|
||||||
MortarShellEntity entityToSpawn = new MortarShellEntity(player, level);
|
MortarShellEntity entityToSpawn = new MortarShellEntity(player, level);
|
||||||
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, 14.741f, (float) 0.3);
|
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 8f, (float) 0.3);
|
||||||
level.addFreshEntity(entityToSpawn);
|
level.addFreshEntity(entityToSpawn);
|
||||||
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, (this.getX() + 3 * this.getLookAngle().x), (this.getY() + 0.1 + 3 * this.getLookAngle().y), (this.getZ() + 3 * this.getLookAngle().z), 8, 0.4, 0.4, 0.4,
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, (this.getX() + 3 * this.getLookAngle().x), (this.getY() + 0.1 + 3 * this.getLookAngle().y), (this.getZ() + 3 * this.getLookAngle().z), 8, 0.4, 0.4, 0.4,
|
||||||
0.007);
|
0.007);
|
||||||
|
@ -212,7 +212,7 @@ public class MortarEntity extends Entity implements GeoEntity, AnimatedEntity {
|
||||||
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(targetX, targetY, targetZ));
|
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(targetX, targetY, targetZ));
|
||||||
|
|
||||||
double[] angles = new double[2];
|
double[] angles = new double[2];
|
||||||
boolean flag = RangeHelper.canReachTarget(14.741, 0.05, 0.99,
|
boolean flag = RangeHelper.canReachTarget(8, 0.05, 0.99,
|
||||||
new BlockPos((int) this.getX(), (int) this.getEyeY(), (int) this.getZ()),
|
new BlockPos((int) this.getX(), (int) this.getEyeY(), (int) this.getZ()),
|
||||||
new BlockPos(targetX, targetY, targetZ),
|
new BlockPos(targetX, targetY, targetZ),
|
||||||
angles);
|
angles);
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
this.durability -= 2;
|
this.durability -= 2;
|
||||||
if (this.durability <= 0) {
|
if (this.durability <= 0) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
causeExplode(entityHitResult);
|
causeExplode(entity);
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
BlockState blockState = this.level().getBlockState(BlockPos.containing(x, y, z));
|
BlockState blockState = this.level().getBlockState(BlockPos.containing(x, y, z));
|
||||||
if (blockState.is(Blocks.BEDROCK) || blockState.is(Blocks.BARRIER)) {
|
if (blockState.is(Blocks.BEDROCK) || blockState.is(Blocks.BARRIER)) {
|
||||||
this.discard();
|
this.discard();
|
||||||
causeExplode(blockHitResult);
|
causeExplodeBlock(blockHitResult);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
|
|
||||||
if (this.durability <= 0) {
|
if (this.durability <= 0) {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
causeExplode(blockHitResult);
|
causeExplodeBlock(blockHitResult);
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -244,7 +244,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
if (ExplosionDestroyConfig.EXPLOSION_DESTROY.get()) {
|
if (ExplosionDestroyConfig.EXPLOSION_DESTROY.get()) {
|
||||||
if (this.firstHit) {
|
if (this.firstHit) {
|
||||||
ParticleTool.cannonHitParticles(this.level(), this.position());
|
ParticleTool.cannonHitParticles(this.level(), this.position());
|
||||||
causeExplode(blockHitResult);
|
causeExplodeBlock(blockHitResult);
|
||||||
this.firstHit = false;
|
this.firstHit = false;
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -257,7 +257,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
if (this.durability > 0) {
|
if (this.durability > 0) {
|
||||||
ModUtils.queueServerWork(2, () -> {
|
ModUtils.queueServerWork(2, () -> {
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
causeExplode(blockHitResult);
|
causeExplodeBlock(blockHitResult);
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -284,7 +284,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void causeExplode(HitResult result) {
|
private void causeExplode(Entity entity) {
|
||||||
if (Math.random() > fireProbability) {
|
if (Math.random() > fireProbability) {
|
||||||
fireTime = 0;
|
fireTime = 0;
|
||||||
}
|
}
|
||||||
|
@ -294,9 +294,40 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
this,
|
this,
|
||||||
this.getOwner()),
|
this.getOwner()),
|
||||||
explosionDamage,
|
explosionDamage,
|
||||||
this.getX(),
|
entity.getX(),
|
||||||
this.getEyeY(),
|
entity.getY() + 0.5 * entity.getBbHeight(),
|
||||||
this.getZ(),
|
entity.getZ(),
|
||||||
|
radius,
|
||||||
|
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
||||||
|
setDamageMultiplier(1).setFireTime(fireTime);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
if (radius > 7) {
|
||||||
|
ParticleTool.spawnHugeExplosionParticles(this.level(), new Vec3(entity.getX(),
|
||||||
|
entity.getY() + 0.5 * entity.getBbHeight(),
|
||||||
|
entity.getZ()));
|
||||||
|
} else {
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), new Vec3(entity.getX(),
|
||||||
|
entity.getY() + 0.5 * entity.getBbHeight(),
|
||||||
|
entity.getZ()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void causeExplodeBlock(HitResult result) {
|
||||||
|
if (Math.random() > fireProbability) {
|
||||||
|
fireTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||||
|
this,
|
||||||
|
this.getOwner()),
|
||||||
|
explosionDamage,
|
||||||
|
result.getLocation().x,
|
||||||
|
result.getLocation().y,
|
||||||
|
result.getLocation().z,
|
||||||
radius,
|
radius,
|
||||||
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
||||||
setDamageMultiplier(1).setFireTime(fireTime);
|
setDamageMultiplier(1).setFireTime(fireTime);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.minecraft.world.phys.EntityHitResult;
|
import net.minecraft.world.phys.EntityHitResult;
|
||||||
import net.minecraft.world.phys.HitResult;
|
import net.minecraft.world.phys.HitResult;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.minecraftforge.network.PlayMessages;
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
@ -92,7 +93,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
|
||||||
|
|
||||||
if (this.tickCount > 0) {
|
if (this.tickCount > 0) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeExplode(result);
|
causeExplode(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
|
@ -107,20 +108,41 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
|
||||||
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
|
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
|
||||||
}
|
}
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeExplode(blockHitResult);
|
causeExplodeBlock(blockHitResult);
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void causeExplode(HitResult result) {
|
private void causeExplode(Entity entity) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||||
this,
|
this,
|
||||||
this.getOwner()),
|
this.getOwner()),
|
||||||
explosionDamage,
|
explosionDamage,
|
||||||
this.getX(),
|
entity.getX(),
|
||||||
this.getEyeY(),
|
entity.getY() + 0.6 * entity.getBbHeight(),
|
||||||
this.getZ(),
|
entity.getZ(),
|
||||||
|
explosionRadius,
|
||||||
|
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
||||||
|
setDamageMultiplier(1.25f);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
ParticleTool.spawnSmallExplosionParticles(this.level(),
|
||||||
|
new Vec3(entity.getX(),
|
||||||
|
entity.getY() + 0.5 * entity.getBbHeight(),
|
||||||
|
entity.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void causeExplodeBlock(HitResult result) {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||||
|
this,
|
||||||
|
this.getOwner()),
|
||||||
|
explosionDamage,
|
||||||
|
result.getLocation().x,
|
||||||
|
result.getLocation().y,
|
||||||
|
result.getLocation().z,
|
||||||
explosionRadius,
|
explosionRadius,
|
||||||
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
|
||||||
setDamageMultiplier(1.25f);
|
setDamageMultiplier(1.25f);
|
||||||
|
|
|
@ -154,17 +154,17 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
amount *= 2f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 3.5f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 3.5f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
amount *= 0.5f;
|
amount *= 1.5f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||||
amount *= 0.5f;
|
amount *= 1.5f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.MINE)) {
|
if (source.is(ModDamageTypes.MINE)) {
|
||||||
amount *= 0.5f;
|
amount *= 0.5f;
|
||||||
|
|
|
@ -142,10 +142,10 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
amount *= 0f;
|
amount *= 0f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 0.5f;
|
amount *= 0.75f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 0.5f;
|
amount *= 0.75f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
|
|
@ -160,11 +160,10 @@ public class Bmp2Entity extends ContainerMobileEntity implements GeoEntity, ICha
|
||||||
amount *= 2.5f;
|
amount *= 2.5f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
@ -177,7 +176,7 @@ public class Bmp2Entity extends ContainerMobileEntity implements GeoEntity, ICha
|
||||||
amount *= 0.14f;
|
amount *= 0.14f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.LUNGE_MINE)) {
|
if (source.is(ModDamageTypes.LUNGE_MINE)) {
|
||||||
amount *= 0.14f;
|
amount *= 0.18f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
||||||
amount *= 0.3f;
|
amount *= 0.3f;
|
||||||
|
@ -360,7 +359,7 @@ public class Bmp2Entity extends ContainerMobileEntity implements GeoEntity, ICha
|
||||||
VehicleConfig.BMP_2_CANNON_EXPLOSION_RADIUS.get().floatValue());
|
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, 22,
|
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 15,
|
||||||
0.25f);
|
0.25f);
|
||||||
this.level().addFreshEntity(smallCannonShell);
|
this.level().addFreshEntity(smallCannonShell);
|
||||||
|
|
||||||
|
|
|
@ -157,10 +157,10 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
amount *= 2.5f;
|
amount *= 2.5f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1.2f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
@ -173,7 +173,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
amount *= 0.15f;
|
amount *= 0.15f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.LUNGE_MINE)) {
|
if (source.is(ModDamageTypes.LUNGE_MINE)) {
|
||||||
amount *= 0.15f;
|
amount *= 0.2f;
|
||||||
}
|
}
|
||||||
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
if (source.is(ModDamageTypes.CANNON_FIRE)) {
|
||||||
amount *= 0.3f;
|
amount *= 0.3f;
|
||||||
|
@ -375,7 +375,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
VehicleConfig.LAV_150_CANNON_EXPLOSION_RADIUS.get().floatValue());
|
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, 24,
|
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 15,
|
||||||
0.25f);
|
0.25f);
|
||||||
this.level().addFreshEntity(smallCannonShell);
|
this.level().addFreshEntity(smallCannonShell);
|
||||||
|
|
||||||
|
|
|
@ -133,11 +133,10 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
|
||||||
amount *= 2.5f;
|
amount *= 2.5f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
|
|
@ -140,11 +140,10 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
|
||||||
amount *= 2.5f;
|
amount *= 2.5f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 2f;
|
amount *= 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
|
|
@ -145,10 +145,10 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
|
||||||
amount *= 2f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.EXPLOSION)) {
|
if (source.is(DamageTypes.EXPLOSION)) {
|
||||||
amount *= 3.5f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
if (source.is(DamageTypes.PLAYER_EXPLOSION)) {
|
||||||
amount *= 3.5f;
|
amount *= 2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.atsuishio.superbwarfare.mixins;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.level.Explosion;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
|
@Mixin(Explosion.class)
|
||||||
|
public class ExplosionMixin {
|
||||||
|
@ModifyVariable(method = "explode()V", at = @At(value = "STORE", opcode = Opcodes.DSTORE), ordinal = 14)
|
||||||
|
private double modifyD11(double d) {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
Player player = mc.player;
|
||||||
|
|
||||||
|
if (player == null) return d;
|
||||||
|
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ package com.atsuishio.superbwarfare.tools;
|
||||||
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.ExplosionDestroyConfig;
|
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
|
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -12,10 +11,8 @@ import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.item.PrimedTnt;
|
import net.minecraft.world.entity.item.PrimedTnt;
|
||||||
import net.minecraft.world.entity.monster.Monster;
|
import net.minecraft.world.entity.monster.Monster;
|
||||||
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
|
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -192,20 +189,6 @@ public class CustomExplosion extends Explosion {
|
||||||
if (fireTime > 0) {
|
if (fireTime > 0) {
|
||||||
entity.setSecondsOnFire(fireTime);
|
entity.setSecondsOnFire(fireTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
double d11;
|
|
||||||
if (entity instanceof LivingEntity livingentity) {
|
|
||||||
d11 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(livingentity, damagePercent);
|
|
||||||
} else {
|
|
||||||
d11 = damagePercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
yDistance *= d11;
|
|
||||||
|
|
||||||
if (entity instanceof VehicleEntity vehicle && !bullet) {
|
|
||||||
Vec3 knockbackVec = new Vec3(0, -0.2 * yDistance, 0);
|
|
||||||
vehicle.setDeltaMovement(vehicle.getDeltaMovement().add(knockbackVec));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,10 @@ public class ProjectileTool {
|
||||||
|
|
||||||
public static void causeCustomExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius, float damageMultiplier) {
|
public static void causeCustomExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius, float damageMultiplier) {
|
||||||
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage,
|
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage,
|
||||||
projectile.getX(), projectile.getEyeY(), projectile.getZ(), radius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier);
|
target.getX(),
|
||||||
|
target.getY() + 0.5 * target.getBbHeight(),
|
||||||
|
target.getZ(),
|
||||||
|
radius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Magazine": 1,
|
"Magazine": 1,
|
||||||
"Weight": 10,
|
"Weight": 10,
|
||||||
"EmptyReloadTime": 78,
|
"EmptyReloadTime": 78,
|
||||||
"Damage": 450,
|
"Damage": 250,
|
||||||
"ExplosionDamage": 50,
|
"ExplosionDamage": 50,
|
||||||
"ExplosionRadius": 4
|
"ExplosionRadius": 4
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
"Spread": 5,
|
"Spread": 5,
|
||||||
"RecoilX": 0.008,
|
"RecoilX": 0.008,
|
||||||
"RecoilY": 0.018,
|
"RecoilY": 0.018,
|
||||||
"Damage": 250,
|
"Damage": 175,
|
||||||
"ExplosionDamage": 130,
|
"ExplosionDamage": 130,
|
||||||
"ExplosionRadius": 7,
|
"ExplosionRadius": 7,
|
||||||
"Velocity": 4,
|
"Velocity": 4,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"refmap": "mixins.superbwarfare.refmap.json",
|
"refmap": "mixins.superbwarfare.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ClientboundSetEntityMotionPacketMixin",
|
"ClientboundSetEntityMotionPacketMixin",
|
||||||
|
"ExplosionMixin",
|
||||||
"LivingEntityMixin",
|
"LivingEntityMixin",
|
||||||
"PlayerEntityMixin"
|
"PlayerEntityMixin"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue