Improve intro UI and basic explosion effects
All checks were successful
Build / build (push) Successful in 14m31s

This commit is contained in:
MrSphay
2026-05-09 01:00:13 +02:00
parent ef71d03beb
commit b30f9355e9
15 changed files with 165 additions and 36 deletions

View File

@@ -3,15 +3,37 @@ package com.vinlanx.explosionoverhaul;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
public class DripstoneEffects {
public static void handleDripstoneFall(ServerLevel level, BlockPos center, int explosionPower, RandomSource random) {
if (!((Boolean)Config.COMMON.enableDripstoneFalling.get()).booleanValue()) {
return;
}
int radius = Math.min((Integer)Config.COMMON.dripstoneFallingSearchRadius.get(), Math.max(8, explosionPower * 4));
int fallPercent = getFallPercent(explosionPower);
int changed = 0;
for (BlockPos pos : BlockPos.betweenClosed(center.offset(-radius, -radius, -radius), center.offset(radius, radius, radius))) {
if (changed >= 400) {
break;
}
BlockState state = level.getBlockState(pos);
if (!state.is(Blocks.POINTED_DRIPSTONE) || random.nextInt(100) >= fallPercent) {
continue;
}
BlockPos immutable = pos.immutable();
level.levelEvent(2001, immutable, Block.getId(state));
level.setBlock(immutable, Blocks.AIR.defaultBlockState(), 3);
++changed;
}
}
public static void onServerTick(ServerLevel level) {
}
public static int getFallPercent(int explosionPower) {
return 0;
return Math.max(10, Math.min(90, explosionPower * 7));
}
}