generated from MrSphay/codex-agent-repository-kit
Improve intro UI and basic explosion effects
All checks were successful
Build / build (push) Successful in 14m31s
All checks were successful
Build / build (push) Successful in 14m31s
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user