减少A10锁定时间,提高空地导弹方块穿透力
This commit is contained in:
parent
9953409288
commit
9c1f9427db
4 changed files with 41 additions and 18 deletions
|
@ -285,7 +285,7 @@ public class AircraftOverlay implements LayeredDraw.Layer {
|
|||
if (lockOn) {
|
||||
RenderHelper.preciseBlit(guiGraphics, FRAME_LOCK, x - 12, y - 12, 24, 24, 0, 0, 24, 24, 24, 24);
|
||||
} else if (nearest) {
|
||||
lerpLock = Mth.lerp(partialTick, lerpLock, a10Entity.lockTime);
|
||||
lerpLock = Mth.lerp(partialTick, lerpLock, 2 * a10Entity.lockTime);
|
||||
float lockTime = Mth.clamp(20 - lerpLock, 0, 20);
|
||||
RenderHelper.preciseBlit(guiGraphics, IND_1, x - 12, y - 12 - lockTime, 24, 24, 0, 0, 24, 24, 24, 24);
|
||||
RenderHelper.preciseBlit(guiGraphics, IND_2, x - 12, y - 12 + lockTime, 24, 24, 0, 0, 24, 24, 24, 24);
|
||||
|
|
|
@ -33,8 +33,7 @@ import net.minecraft.world.entity.projectile.ThrownPotion;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BellBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
|
@ -58,6 +57,8 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
private float explosionDamage = ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get();
|
||||
private float explosionRadius = ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue();
|
||||
private boolean distracted = false;
|
||||
private int durability = 40;
|
||||
private boolean firstHit = true;
|
||||
|
||||
public Agm65Entity(EntityType<? extends Agm65Entity> type, Level world) {
|
||||
super(type, world);
|
||||
|
@ -173,21 +174,43 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
|
||||
@Override
|
||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||
super.onHitBlock(blockHitResult);
|
||||
BlockPos resultPos = blockHitResult.getBlockPos();
|
||||
BlockState state = this.level().getBlockState(resultPos);
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
double x = blockHitResult.getLocation().x;
|
||||
double y = blockHitResult.getLocation().y;
|
||||
double z = blockHitResult.getLocation().z;
|
||||
|
||||
if (state.getBlock() instanceof BellBlock bell) {
|
||||
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
|
||||
if (ExplosionConfig.EXPLOSION_DESTROY.get()) {
|
||||
float hardness = this.level().getBlockState(BlockPos.containing(x, y, z)).getBlock().defaultDestroyTime();
|
||||
if (hardness <= 50) {
|
||||
BlockPos blockPos = BlockPos.containing(x, y, z);
|
||||
Block.dropResources(this.level().getBlockState(blockPos), this.level(), BlockPos.containing(x, y, z), null);
|
||||
this.level().destroyBlock(blockPos, true);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
apExplode(blockHitResult, i);
|
||||
}
|
||||
|
||||
if (this.tickCount > 8) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
causeExplode(blockHitResult);
|
||||
}
|
||||
}
|
||||
|
||||
this.discard();
|
||||
private void apExplode(HitResult result, int index) {
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||
this,
|
||||
this.getOwner()),
|
||||
explosionDamage,
|
||||
result.getLocation().x + index * getDeltaMovement().normalize().x,
|
||||
result.getLocation().y + index * getDeltaMovement().normalize().y,
|
||||
result.getLocation().z + index * getDeltaMovement().normalize().z,
|
||||
0.5f * explosionRadius,
|
||||
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
|
||||
setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
EventHooks.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -438,7 +438,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
resetSeek(player);
|
||||
}
|
||||
|
||||
Entity entity = SeekTool.seekCustomSizeEntity(this, this.level(), 384, 20, 0.9, true);
|
||||
Entity entity = SeekTool.seekCustomSizeEntity(this, this.level(), 384, 18, 0.9, true);
|
||||
if (entity != null) {
|
||||
if (lockTime == 0) {
|
||||
setTargetUuid(String.valueOf(entity.getUUID()));
|
||||
|
@ -457,7 +457,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
}
|
||||
}
|
||||
|
||||
if (lockTime > 20) {
|
||||
if (lockTime > 10) {
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
SoundTool.playLocalSound(serverPlayer, ModSounds.JET_LOCKON.get(), 2, 1);
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
Agm65Entity.setTargetUuid(getTargetUuid());
|
||||
}
|
||||
Agm65Entity.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
Agm65Entity.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) getDeltaMovement().length() + 1, 1);
|
||||
Agm65Entity.shoot(getLookAngle().x, getLookAngle().y, getLookAngle().z, (float) getDeltaMovement().length() + 1, 1);
|
||||
player.level().addFreshEntity(Agm65Entity);
|
||||
|
||||
BlockPos pos = BlockPos.containing(new Vec3(worldPosition.x, worldPosition.y, worldPosition.z));
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue