reformatted all src files (#141)

This commit is contained in:
YoungOnion
2022-09-17 05:08:02 -06:00
committed by GitHub
parent 3328bfcda2
commit 9011273229
1056 changed files with 88127 additions and 110597 deletions
@@ -19,97 +19,81 @@
package appeng.worldgen.meteorite;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import appeng.util.Platform;
public class ChunkOnly extends StandardWorld {
public class ChunkOnly extends StandardWorld
{
private final Chunk target;
private final int cx;
private final int cz;
private int verticalBits = 0;
private final Chunk target;
private final int cx;
private final int cz;
private int verticalBits = 0;
public ChunkOnly(final World w, final int cx, final int cz) {
super(w);
this.target = w.getChunkFromChunkCoords(cx, cz);
this.cx = cx;
this.cz = cz;
}
public ChunkOnly( final World w, final int cx, final int cz )
{
super( w );
this.target = w.getChunkFromChunkCoords( cx, cz );
this.cx = cx;
this.cz = cz;
}
@Override
public int minX(final int in) {
return Math.max(in, this.cx << 4);
}
@Override
public int minX( final int in )
{
return Math.max( in, this.cx << 4 );
}
@Override
public int minZ(final int in) {
return Math.max(in, this.cz << 4);
}
@Override
public int minZ( final int in )
{
return Math.max( in, this.cz << 4 );
}
@Override
public int maxX(final int in) {
return Math.min(in, (this.cx + 1) << 4);
}
@Override
public int maxX( final int in )
{
return Math.min( in, ( this.cx + 1 ) << 4 );
}
@Override
public int maxZ(final int in) {
return Math.min(in, (this.cz + 1) << 4);
}
@Override
public int maxZ( final int in )
{
return Math.min( in, ( this.cz + 1 ) << 4 );
}
@Override
public Block getBlock(final int x, final int y, final int z) {
if (this.range(x, y, z)) {
return this.target.getBlockState(x, y, z).getBlock();
}
return Platform.AIR_BLOCK;
}
@Override
public Block getBlock( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.target.getBlockState( x, y, z ).getBlock();
}
return Platform.AIR_BLOCK;
}
@Override
public void setBlock(final int x, final int y, final int z, final Block blk) {
if (this.range(x, y, z)) {
this.verticalBits |= 1 << (y >> 4);
this.getWorld().setBlockState(new BlockPos(x, y, z), blk.getDefaultState());
}
}
@Override
public void setBlock( final int x, final int y, final int z, final Block blk )
{
if( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() );
}
}
@Override
public void setBlock(final int x, final int y, final int z, final IBlockState state, final int flags) {
if (this.range(x, y, z)) {
this.verticalBits |= 1 << (y >> 4);
this.getWorld().setBlockState(new BlockPos(x, y, z), state, flags & (~2));
}
}
@Override
public void setBlock( final int x, final int y, final int z, final IBlockState state, final int flags )
{
if( this.range( x, y, z ) )
{
this.verticalBits |= 1 << ( y >> 4 );
this.getWorld().setBlockState( new BlockPos( x, y, z ), state, flags & ( ~2 ) );
}
}
@Override
public void done() {
if (this.verticalBits != 0) {
Platform.sendChunk(this.target, this.verticalBits);
}
}
@Override
public void done()
{
if( this.verticalBits != 0 )
{
Platform.sendChunk( this.target, this.verticalBits );
}
}
@Override
public boolean range( final int x, final int y, final int z )
{
return this.cx == ( x >> 4 ) && this.cz == ( z >> 4 );
}
@Override
public boolean range(final int x, final int y, final int z) {
return this.cx == (x >> 4) && this.cz == (z >> 4);
}
}
@@ -19,75 +19,51 @@
package appeng.worldgen.meteorite;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
import appeng.util.Platform;
import net.minecraft.init.Blocks;
public class Fallout
{
private final MeteoriteBlockPutter putter;
private final IBlockDefinition skyStoneDefinition;
public class Fallout {
private final MeteoriteBlockPutter putter;
private final IBlockDefinition skyStoneDefinition;
public Fallout( final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition )
{
this.putter = putter;
this.skyStoneDefinition = skyStoneDefinition;
}
public Fallout(final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition) {
this.putter = putter;
this.skyStoneDefinition = skyStoneDefinition;
}
public int adjustCrater()
{
return 0;
}
public int adjustCrater() {
return 0;
}
public void getRandomFall( final IMeteoriteWorld w, final int x, final int y, final int z )
{
final double a = Math.random();
if( a > 0.9 )
{
this.putter.put( w, x, y, z, Blocks.STONE );
}
else if( a > 0.8 )
{
this.putter.put( w, x, y, z, Blocks.COBBLESTONE );
}
else if( a > 0.7 )
{
this.putter.put( w, x, y, z, Blocks.DIRT );
}
else
{
this.putter.put( w, x, y, z, Blocks.GRAVEL );
}
}
public void getRandomFall(final IMeteoriteWorld w, final int x, final int y, final int z) {
final double a = Math.random();
if (a > 0.9) {
this.putter.put(w, x, y, z, Blocks.STONE);
} else if (a > 0.8) {
this.putter.put(w, x, y, z, Blocks.COBBLESTONE);
} else if (a > 0.7) {
this.putter.put(w, x, y, z, Blocks.DIRT);
} else {
this.putter.put(w, x, y, z, Blocks.GRAVEL);
}
}
public void getRandomInset( final IMeteoriteWorld w, final int x, final int y, final int z )
{
final double a = Math.random();
if( a > 0.9 )
{
this.putter.put( w, x, y, z, Blocks.COBBLESTONE );
}
else if( a > 0.8 )
{
this.putter.put( w, x, y, z, Blocks.STONE );
}
else if( a > 0.7 )
{
this.putter.put( w, x, y, z, Blocks.GRASS );
}
else if( a > 0.6 )
{
this.skyStoneDefinition.maybeBlock().ifPresent( block -> this.putter.put( w, x, y, z, block ) );
}
else if( a > 0.5 )
{
this.putter.put( w, x, y, z, Blocks.GRAVEL );
}
else
{
this.putter.put( w, x, y, z, Platform.AIR_BLOCK );
}
}
public void getRandomInset(final IMeteoriteWorld w, final int x, final int y, final int z) {
final double a = Math.random();
if (a > 0.9) {
this.putter.put(w, x, y, z, Blocks.COBBLESTONE);
} else if (a > 0.8) {
this.putter.put(w, x, y, z, Blocks.STONE);
} else if (a > 0.7) {
this.putter.put(w, x, y, z, Blocks.GRASS);
} else if (a > 0.6) {
this.skyStoneDefinition.maybeBlock().ifPresent(block -> this.putter.put(w, x, y, z, block));
} else if (a > 0.5) {
this.putter.put(w, x, y, z, Blocks.GRAVEL);
} else {
this.putter.put(w, x, y, z, Platform.AIR_BLOCK);
}
}
}
@@ -19,62 +19,48 @@
package appeng.worldgen.meteorite;
import net.minecraft.block.state.IBlockState;
import appeng.api.definitions.IBlockDefinition;
import appeng.util.Platform;
import net.minecraft.block.state.IBlockState;
public class FalloutCopy extends Fallout
{
private static final double SPECIFIED_BLOCK_THRESHOLD = 0.9;
private static final double AIR_BLOCK_THRESHOLD = 0.8;
private static final double BLOCK_THRESHOLD_STEP = 0.1;
public class FalloutCopy extends Fallout {
private static final double SPECIFIED_BLOCK_THRESHOLD = 0.9;
private static final double AIR_BLOCK_THRESHOLD = 0.8;
private static final double BLOCK_THRESHOLD_STEP = 0.1;
private final IBlockState block;
private final MeteoriteBlockPutter putter;
private final IBlockState block;
private final MeteoriteBlockPutter putter;
public FalloutCopy( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition )
{
super( putter, skyStoneDefinition );
this.putter = putter;
this.block = w.getBlockState( x, y, z );
}
public FalloutCopy(final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition) {
super(putter, skyStoneDefinition);
this.putter = putter;
this.block = w.getBlockState(x, y, z);
}
@Override
public void getRandomFall( final IMeteoriteWorld w, final int x, final int y, final int z )
{
final double a = Math.random();
if( a > SPECIFIED_BLOCK_THRESHOLD )
{
this.putter.put( w, x, y, z, this.block, 3 );
}
else
{
this.getOther( w, x, y, z, a );
}
}
@Override
public void getRandomFall(final IMeteoriteWorld w, final int x, final int y, final int z) {
final double a = Math.random();
if (a > SPECIFIED_BLOCK_THRESHOLD) {
this.putter.put(w, x, y, z, this.block, 3);
} else {
this.getOther(w, x, y, z, a);
}
}
public void getOther( final IMeteoriteWorld w, final int x, final int y, final int z, final double a )
{
public void getOther(final IMeteoriteWorld w, final int x, final int y, final int z, final double a) {
}
}
@Override
public void getRandomInset( final IMeteoriteWorld w, final int x, final int y, final int z )
{
final double a = Math.random();
if( a > SPECIFIED_BLOCK_THRESHOLD )
{
this.putter.put( w, x, y, z, this.block, 3 );
}
else if( a > AIR_BLOCK_THRESHOLD )
{
this.putter.put( w, x, y, z, Platform.AIR_BLOCK );
}
else
{
this.getOther( w, x, y, z, a - BLOCK_THRESHOLD_STEP );
}
}
@Override
public void getRandomInset(final IMeteoriteWorld w, final int x, final int y, final int z) {
final double a = Math.random();
if (a > SPECIFIED_BLOCK_THRESHOLD) {
this.putter.put(w, x, y, z, this.block, 3);
} else if (a > AIR_BLOCK_THRESHOLD) {
this.putter.put(w, x, y, z, Platform.AIR_BLOCK);
} else {
this.getOther(w, x, y, z, a - BLOCK_THRESHOLD_STEP);
}
}
}
@@ -19,34 +19,28 @@
package appeng.worldgen.meteorite;
import appeng.api.definitions.IBlockDefinition;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
public class FalloutSand extends FalloutCopy {
private static final double GLASS_THRESHOLD = 0.66;
private final MeteoriteBlockPutter putter;
public class FalloutSand extends FalloutCopy
{
private static final double GLASS_THRESHOLD = 0.66;
private final MeteoriteBlockPutter putter;
public FalloutSand(final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition) {
super(w, x, y, z, putter, skyStoneDefinition);
this.putter = putter;
}
public FalloutSand( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition )
{
super( w, x, y, z, putter, skyStoneDefinition );
this.putter = putter;
}
@Override
public int adjustCrater() {
return 2;
}
@Override
public int adjustCrater()
{
return 2;
}
@Override
public void getOther( final IMeteoriteWorld w, final int x, final int y, final int z, final double a )
{
if( a > GLASS_THRESHOLD )
{
this.putter.put( w, x, y, z, Blocks.GLASS );
}
}
@Override
public void getOther(final IMeteoriteWorld w, final int x, final int y, final int z, final double a) {
if (a > GLASS_THRESHOLD) {
this.putter.put(w, x, y, z, Blocks.GLASS);
}
}
}
@@ -19,39 +19,31 @@
package appeng.worldgen.meteorite;
import appeng.api.definitions.IBlockDefinition;
import net.minecraft.init.Blocks;
import appeng.api.definitions.IBlockDefinition;
public class FalloutSnow extends FalloutCopy {
private static final double SNOW_THRESHOLD = 0.7;
private static final double ICE_THRESHOLD = 0.5;
private final MeteoriteBlockPutter putter;
public class FalloutSnow extends FalloutCopy
{
private static final double SNOW_THRESHOLD = 0.7;
private static final double ICE_THRESHOLD = 0.5;
private final MeteoriteBlockPutter putter;
public FalloutSnow(final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition) {
super(w, x, y, z, putter, skyStoneDefinition);
this.putter = putter;
}
public FalloutSnow( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition )
{
super( w, x, y, z, putter, skyStoneDefinition );
this.putter = putter;
}
@Override
public int adjustCrater() {
return 2;
}
@Override
public int adjustCrater()
{
return 2;
}
@Override
public void getOther( final IMeteoriteWorld w, final int x, final int y, final int z, final double a )
{
if( a > SNOW_THRESHOLD )
{
this.putter.put( w, x, y, z, Blocks.SNOW );
}
else if( a > ICE_THRESHOLD )
{
this.putter.put( w, x, y, z, Blocks.ICE );
}
}
@Override
public void getOther(final IMeteoriteWorld w, final int x, final int y, final int z, final double a) {
if (a > SNOW_THRESHOLD) {
this.putter.put(w, x, y, z, Blocks.SNOW);
} else if (a > ICE_THRESHOLD) {
this.putter.put(w, x, y, z, Blocks.ICE);
}
}
}
@@ -25,31 +25,30 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public interface IMeteoriteWorld
{
int minX( int in );
public interface IMeteoriteWorld {
int minX(int in);
int minZ( int in );
int minZ(int in);
int maxX( int in );
int maxX(int in);
int maxZ( int in );
int maxZ(int in);
boolean isNether();
boolean isNether();
Block getBlock( int x, int y, int z );
Block getBlock(int x, int y, int z);
boolean canBlockSeeTheSky( int i, int j, int k );
boolean canBlockSeeTheSky(int i, int j, int k);
TileEntity getTileEntity( int x, int y, int z );
TileEntity getTileEntity(int x, int y, int z);
World getWorld();
World getWorld();
void setBlock( int i, int j, int k, Block blk );
void setBlock(int i, int j, int k, Block blk);
void setBlock( int i, int j, int k, IBlockState state, int l );
void setBlock(int i, int j, int k, IBlockState state, int l);
void done();
void done();
IBlockState getBlockState( int x, int y, int z );
IBlockState getBlockState(int x, int y, int z);
}
@@ -24,28 +24,23 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
public class MeteoriteBlockPutter
{
public boolean put( final IMeteoriteWorld w, final int i, final int j, final int k, final Block blk )
{
final Block original = w.getBlock( i, j, k );
public class MeteoriteBlockPutter {
public boolean put(final IMeteoriteWorld w, final int i, final int j, final int k, final Block blk) {
final Block original = w.getBlock(i, j, k);
if( original == Blocks.BEDROCK || original == blk )
{
return false;
}
if (original == Blocks.BEDROCK || original == blk) {
return false;
}
w.setBlock( i, j, k, blk );
return true;
}
w.setBlock(i, j, k, blk);
return true;
}
void put( final IMeteoriteWorld w, final int i, final int j, final int k, final IBlockState state, final int meta )
{
if( w.getBlock( i, j, k ) == Blocks.BEDROCK )
{
return;
}
void put(final IMeteoriteWorld w, final int i, final int j, final int k, final IBlockState state, final int meta) {
if (w.getBlock(i, j, k) == Blocks.BEDROCK) {
return;
}
w.setBlock( i, j, k, state, 3 );
}
w.setBlock(i, j, k, state, 3);
}
}
@@ -19,6 +19,7 @@
package appeng.worldgen.meteorite;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -26,121 +27,97 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.util.Platform;
public class StandardWorld implements IMeteoriteWorld {
public class StandardWorld implements IMeteoriteWorld
{
private final World w;
private final World w;
public StandardWorld(final World w) {
this.w = w;
}
public StandardWorld( final World w )
{
this.w = w;
}
@Override
public int minX(final int in) {
return in;
}
@Override
public int minX( final int in )
{
return in;
}
@Override
public int minZ(final int in) {
return in;
}
@Override
public int minZ( final int in )
{
return in;
}
@Override
public int maxX(final int in) {
return in;
}
@Override
public int maxX( final int in )
{
return in;
}
@Override
public int maxZ(final int in) {
return in;
}
@Override
public int maxZ( final int in )
{
return in;
}
@Override
public boolean isNether() {
return !this.getWorld().provider.isNether();
}
@Override
public boolean isNether()
{
return !this.getWorld().provider.isNether();
}
@Override
public Block getBlock(final int x, final int y, final int z) {
if (this.range(x, y, z)) {
return this.getWorld().getBlockState(new BlockPos(x, y, z)).getBlock();
}
return Platform.AIR_BLOCK;
}
@Override
public Block getBlock( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.getWorld().getBlockState( new BlockPos( x, y, z ) ).getBlock();
}
return Platform.AIR_BLOCK;
}
@Override
public boolean canBlockSeeTheSky(final int x, final int y, final int z) {
if (this.range(x, y, z)) {
return this.getWorld().canBlockSeeSky(new BlockPos(x, y, z));
}
return false;
}
@Override
public boolean canBlockSeeTheSky( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.getWorld().canBlockSeeSky( new BlockPos( x, y, z ) );
}
return false;
}
@Override
public TileEntity getTileEntity(final int x, final int y, final int z) {
if (this.range(x, y, z)) {
return this.getWorld().getTileEntity(new BlockPos(x, y, z));
}
return null;
}
@Override
public TileEntity getTileEntity( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.getWorld().getTileEntity( new BlockPos( x, y, z ) );
}
return null;
}
@Override
public World getWorld() {
return this.w;
}
@Override
public World getWorld()
{
return this.w;
}
@Override
public void setBlock(final int x, final int y, final int z, final Block blk) {
if (this.range(x, y, z)) {
this.getWorld().setBlockState(new BlockPos(x, y, z), blk.getDefaultState());
}
}
@Override
public void setBlock( final int x, final int y, final int z, final Block blk )
{
if( this.range( x, y, z ) )
{
this.getWorld().setBlockState( new BlockPos( x, y, z ), blk.getDefaultState() );
}
}
@Override
public void done() {
@Override
public void done()
{
}
}
public boolean range(final int x, final int y, final int z) {
return true;
}
public boolean range( final int x, final int y, final int z )
{
return true;
}
@Override
public void setBlock(final int x, final int y, final int z, final IBlockState state, final int l) {
if (this.range(x, y, z)) {
this.w.setBlockState(new BlockPos(x, y, z), state, l);
}
}
@Override
public void setBlock( final int x, final int y, final int z, final IBlockState state, final int l )
{
if( this.range( x, y, z ) )
{
this.w.setBlockState( new BlockPos( x, y, z ), state, l );
}
}
@Override
public IBlockState getBlockState( final int x, final int y, final int z )
{
if( this.range( x, y, z ) )
{
return this.w.getBlockState( new BlockPos( x, y, z ) );
}
return Blocks.AIR.getDefaultState();
}
@Override
public IBlockState getBlockState(final int x, final int y, final int z) {
if (this.range(x, y, z)) {
return this.w.getBlockState(new BlockPos(x, y, z));
}
return Blocks.AIR.getDefaultState();
}
}