Files
Meteor-Rejects/src/main/java/anticope/rejects/utils/TntDamage.java
stormybytes 2e1abe481e Fixed snail breaking addons again
Cope

- Utils.mc --> MeteorClient.mc
- MeteorClient.screenToOpen --> Utils.mc
- others (too lazy)
2021-10-29 19:07:24 +07:00

39 lines
1.4 KiB
Java

package anticope.rejects.utils;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.block.BlockState;
import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
import java.util.Optional;
public class TntDamage {
public static int calculate(BlockPos bp) {
if (!Utils.canUpdate()) return 0;
int score = 0;
for(int j = -5; j <= 5; ++j) {
for(int k = -5; k <= 5; ++k) {
for(int l = -5; l <= 5; ++l) {
BlockPos blockPos = new BlockPos(j, k, l);
BlockState blockState = MeteorClient.mc.world.getBlockState(blockPos);
FluidState fluidState = MeteorClient.mc.world.getFluidState(blockPos);
float h = 2.8F;
Optional<Float> optional = blockState.isAir() && fluidState.isEmpty() ? Optional.empty() : Optional.of(Math.max(blockState.getBlock().getBlastResistance(), fluidState.getBlastResistance()));;
if (optional.isPresent()) {
h -= (optional.get() + 0.3F) * 0.3F;
}
if (h > 0.0F) {
score++;
}
}
}
}
return score;
}
}