move worldgen to server
This commit is contained in:
parent
e26938ee77
commit
111226fe28
159 changed files with 1917 additions and 1951 deletions
106
server/src/server/worldgen/feature/WorldGenDesertWells.java
Executable file
106
server/src/server/worldgen/feature/WorldGenDesertWells.java
Executable file
|
@ -0,0 +1,106 @@
|
|||
package server.worldgen.feature;
|
||||
|
||||
import common.block.BlockSand;
|
||||
import common.block.BlockSlab;
|
||||
import common.init.Blocks;
|
||||
import common.pattern.BlockStateHelper;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.util.Predicates;
|
||||
import common.world.State;
|
||||
import server.world.WorldServer;
|
||||
import server.worldgen.FeatureGenerator;
|
||||
|
||||
public class WorldGenDesertWells extends FeatureGenerator
|
||||
{
|
||||
private static final BlockStateHelper field_175913_a = BlockStateHelper.forBlock(Blocks.sand).where(BlockSand.VARIANT, Predicates.equalTo(BlockSand.EnumType.SAND));
|
||||
private final State field_175911_b = Blocks.sandstone_slab.getState().withProperty(BlockSlab.FACING, Facing.DOWN);
|
||||
private final State field_175912_c = Blocks.sandstone.getState();
|
||||
private final State field_175910_d = Blocks.flowing_water.getState();
|
||||
|
||||
public boolean generate(WorldServer worldIn, Random rand, BlockPos position)
|
||||
{
|
||||
while (worldIn.isAirBlock(position) && position.getY() > 2)
|
||||
{
|
||||
position = position.down();
|
||||
}
|
||||
|
||||
if (!field_175913_a.test(worldIn.getState(position)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = -2; i <= 2; ++i)
|
||||
{
|
||||
for (int j = -2; j <= 2; ++j)
|
||||
{
|
||||
if (worldIn.isAirBlock(position.add(i, -1, j)) && worldIn.isAirBlock(position.add(i, -2, j)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = -1; l <= 0; ++l)
|
||||
{
|
||||
for (int l1 = -2; l1 <= 2; ++l1)
|
||||
{
|
||||
for (int k = -2; k <= 2; ++k)
|
||||
{
|
||||
worldIn.setState(position.add(l1, l, k), this.field_175912_c, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.setState(position, this.field_175910_d, 2);
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
worldIn.setState(position.offset(enumfacing), this.field_175910_d, 2);
|
||||
}
|
||||
|
||||
for (int i1 = -2; i1 <= 2; ++i1)
|
||||
{
|
||||
for (int i2 = -2; i2 <= 2; ++i2)
|
||||
{
|
||||
if (i1 == -2 || i1 == 2 || i2 == -2 || i2 == 2)
|
||||
{
|
||||
worldIn.setState(position.add(i1, 1, i2), this.field_175912_c, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
worldIn.setState(position.add(2, 1, 0), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(-2, 1, 0), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(0, 1, 2), this.field_175911_b, 2);
|
||||
worldIn.setState(position.add(0, 1, -2), this.field_175911_b, 2);
|
||||
|
||||
for (int j1 = -1; j1 <= 1; ++j1)
|
||||
{
|
||||
for (int j2 = -1; j2 <= 1; ++j2)
|
||||
{
|
||||
if (j1 == 0 && j2 == 0)
|
||||
{
|
||||
worldIn.setState(position.add(j1, 4, j2), this.field_175912_c, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(position.add(j1, 4, j2), this.field_175911_b, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int k1 = 1; k1 <= 3; ++k1)
|
||||
{
|
||||
worldIn.setState(position.add(-1, k1, -1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(-1, k1, 1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(1, k1, -1), this.field_175912_c, 2);
|
||||
worldIn.setState(position.add(1, k1, 1), this.field_175912_c, 2);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue