Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,16 +1,15 @@
|
|||
package WayofTime.bloodmagic.meteor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
public class Meteor
|
||||
{
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Meteor {
|
||||
private static final Random RAND = new Random();
|
||||
|
||||
private final ItemStack catalystStack;
|
||||
|
@ -20,8 +19,7 @@ public class Meteor
|
|||
private final int maxWeight;
|
||||
public int version;
|
||||
|
||||
public Meteor(ItemStack catalystStack, List<MeteorComponent> components, float explosionStrength, int radius)
|
||||
{
|
||||
public Meteor(ItemStack catalystStack, List<MeteorComponent> components, float explosionStrength, int radius) {
|
||||
this.catalystStack = catalystStack;
|
||||
this.components = components;
|
||||
this.explosionStrength = explosionStrength;
|
||||
|
@ -33,31 +31,24 @@ public class Meteor
|
|||
this.maxWeight = weight;
|
||||
}
|
||||
|
||||
public void generateMeteor(World world, BlockPos pos, IBlockState fillerBlock, double radiusModifier, double explosionModifier, double fillerChance)
|
||||
{
|
||||
public void generateMeteor(World world, BlockPos pos, IBlockState fillerBlock, double radiusModifier, double explosionModifier, double fillerChance) {
|
||||
world.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), (float) (explosionStrength * explosionModifier), true, true);
|
||||
int radius = (int) Math.ceil(getRadius() * radiusModifier);
|
||||
double floatingRadius = getRadius() * radiusModifier;
|
||||
|
||||
for (int i = -radius; i <= radius; i++)
|
||||
{
|
||||
for (int j = -radius; j <= radius; j++)
|
||||
{
|
||||
for (int k = -radius; k <= radius; k++)
|
||||
{
|
||||
if (i * i + j * j + k * k > (floatingRadius + 0.5) * (floatingRadius + 0.5))
|
||||
{
|
||||
for (int i = -radius; i <= radius; i++) {
|
||||
for (int j = -radius; j <= radius; j++) {
|
||||
for (int k = -radius; k <= radius; k++) {
|
||||
if (i * i + j * j + k * k > (floatingRadius + 0.5) * (floatingRadius + 0.5)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockPos newPos = pos.add(i, j, k);
|
||||
IBlockState state = world.getBlockState(newPos);
|
||||
|
||||
if (world.isAirBlock(newPos) || Utils.isBlockLiquid(state))
|
||||
{
|
||||
if (world.isAirBlock(newPos) || Utils.isBlockLiquid(state)) {
|
||||
IBlockState placedState = getRandomOreFromComponents(fillerBlock, fillerChance);
|
||||
if (placedState != null)
|
||||
{
|
||||
if (placedState != null) {
|
||||
world.setBlockState(newPos, placedState);
|
||||
}
|
||||
}
|
||||
|
@ -67,21 +58,16 @@ public class Meteor
|
|||
}
|
||||
|
||||
//fillerChance is the chance that the filler block will NOT be placed
|
||||
public IBlockState getRandomOreFromComponents(IBlockState fillerBlock, double fillerChance)
|
||||
{
|
||||
public IBlockState getRandomOreFromComponents(IBlockState fillerBlock, double fillerChance) {
|
||||
int goal = RAND.nextInt(getMaxWeight());
|
||||
|
||||
for (MeteorComponent component : getComponents())
|
||||
{
|
||||
for (MeteorComponent component : getComponents()) {
|
||||
goal -= component.getWeight();
|
||||
if (goal < 0)
|
||||
{
|
||||
if (goal < 0) {
|
||||
IBlockState state = component.getStateFromOre();
|
||||
if (state != null)
|
||||
{
|
||||
if (state != null) {
|
||||
return state;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
return RAND.nextDouble() > fillerChance ? fillerBlock : null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue