generated from MrSphay/codex-agent-repository-kit
Restore setup screen and force visible explosion behavior
All checks were successful
Build / build (push) Successful in 10m52s
All checks were successful
Build / build (push) Successful in 10m52s
This commit is contained in:
@@ -6,8 +6,10 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@@ -23,9 +25,11 @@ public class ServerExplosionHandler {
|
||||
}
|
||||
Vec3 center = explosion instanceof ExplosionAccessor accessor ? accessor.explosionoverhaul$getCenter() : Vec3.ZERO;
|
||||
int radius = Math.max(5, Math.min(18, Math.round(power * 2.0f * ((Double)Config.COMMON.craterSizeMultiplier.get()).floatValue())));
|
||||
ExplosionOverhaul.LOGGER.info("Explosion Overhaul handling explosion at {} with power {} and radius {}", center, power, radius);
|
||||
Set<BlockPos> existing = new HashSet<>(affectedBlocks);
|
||||
BlockPos origin = BlockPos.containing(center);
|
||||
double radiusSq = radius * radius;
|
||||
int directBlocksChanged = 0;
|
||||
for (BlockPos pos : BlockPos.betweenClosed(origin.offset(-radius, -radius, -radius), origin.offset(radius, radius, radius))) {
|
||||
double distanceSq = pos.distToCenterSqr(center);
|
||||
if (distanceSq > radiusSq) {
|
||||
@@ -39,7 +43,14 @@ public class ServerExplosionHandler {
|
||||
if (existing.add(immutable)) {
|
||||
affectedBlocks.add(immutable);
|
||||
}
|
||||
if (directBlocksChanged < 2500) {
|
||||
level.setBlock(immutable, Blocks.AIR.defaultBlockState(), 3);
|
||||
++directBlocksChanged;
|
||||
}
|
||||
}
|
||||
level.sendParticles(ParticleTypes.EXPLOSION_EMITTER, center.x(), center.y(), center.z(), Math.max(2, radius / 3), 0.5, 0.5, 0.5, 0.0);
|
||||
level.sendParticles(ParticleTypes.LARGE_SMOKE, center.x(), center.y(), center.z(), radius * 8, radius * 0.35, radius * 0.25, radius * 0.35, 0.08);
|
||||
level.sendParticles(ParticleTypes.FLAME, center.x(), center.y(), center.z(), radius * 4, radius * 0.25, radius * 0.2, radius * 0.25, 0.05);
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
|
||||
Reference in New Issue
Block a user