Not working generator in the world of Mars.
I tried two ways - either not working alone.
Use code approximately such content
1 way: To register the generator through event
2 way: Using standard IWorldGenerator
I tried two ways - either not working alone.
Use code approximately such content
1 way: To register the generator through event
Code:
public class EventGenMarsSand {
@SubscribeEvent
public void onPlanetDecorated(GCCoreEventPopulate.Post event)
{
if(event.world.provider.getDimension() == -29){
new WorldGenMars().generateSand(event.world, event.world.rand, event.pos);
}
}
}
Code:
public class WorldGenMars implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.getDimension()){
case -29: generateMars(random, chunkX * 16, chunkZ * 16, world, chunkGenerator, chunkProvider);
break;
}
System.out.println(world.provider.getDimensionType());
}
public void generateMars(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
System.out.println("generateMars Complete!!");
BlockPos pos = new BlockPos(chunkX, chunkZ, chunkZ);
generateSand(world, random, pos);
}
public void generateSand(World world, Random random, BlockPos pos){
int x = pos.getX();
int y = random.nextInt(128);
int z = pos.getZ();
for(int i = x; i < x + 16; i++){
for (int j = z; j < z + 16; j++){
for(int k = 100; k > 0; k--){
if(world.getBlockState(new BlockPos(i, k, j)).getBlock() == MarsBlocks.marsBlock.getDefaultState().withProperty(BlockBasicMars.BASIC_TYPE,BlockBasicMars.EnumBlockBasic.SURFACE)){
world.setBlockState(new BlockPos(i, k + 1, j), BlocksSA.marssand.getDefaultState());
}
}
}
}
}
}