添加混合爆炸效果

This commit is contained in:
Atsuihsio 2024-12-21 01:47:30 +08:00
parent b0f49d3c20
commit c392b62a97
2 changed files with 2 additions and 7 deletions

View file

@ -154,10 +154,6 @@ public class JavelinItem extends GunItem implements GeoItem, AnimatedItem {
}
if (seekingEntity != null && tag.getInt("SeekTime") > 20) {
// if (seekingEntity instanceof LivingEntity living) {
// living.addEffect(new MobEffectInstance(MobEffects.GLOWING, 40, 0));
// }
if (player instanceof ServerPlayer serverPlayer) {
SoundTool.playLocalSound(serverPlayer, ModSounds.JAVELIN_LOCKON.get(), 2, 1);
}

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
@ -65,15 +66,13 @@ public class CustomExplosion extends Explosion {
public CustomExplosion(Level pLevel, @Nullable Entity pSource, @Nullable DamageSource source, float damage, double pToBlowX, double pToBlowY, double pToBlowZ, float pRadius, Explosion.BlockInteraction pBlockInteraction) {
this(pLevel, pSource, source, null, damage, pToBlowX, pToBlowY, pToBlowZ, pRadius, pBlockInteraction);
final Vec3 center = new Vec3(pToBlowX, pToBlowY, pToBlowZ);
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4 * radius), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
if (target instanceof ServerPlayer serverPlayer) {
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> serverPlayer), new ShakeClientMessage(20 + 0.02 * damage,3 * pRadius,50 + 0.05 * damage, pToBlowX, pToBlowY, pToBlowZ));
}
}
pLevel.explode(source == null ? null : source.getEntity(), pToBlowX, pToBlowY, pToBlowZ, pRadius / 2, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Level.ExplosionInteraction.BLOCK : Level.ExplosionInteraction.NONE);
}
public CustomExplosion(Level pLevel, @Nullable Entity pSource, @Nullable DamageSource source, float damage, double pToBlowX, double pToBlowY, double pToBlowZ, float pRadius) {