- 2,955
- 12
Генерировать несколько блоков снега за раз, а не один?
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
package blessentumble.moons.europajupiter.world.gen;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.feature.WorldGenerator;
import java.util.Random;
import blessentumble.moons.europajupiter.blocks.EuropaBlocks;
public class WorldGenSnow extends WorldGenMinable
{
public WorldGenSnow(Block block, int meta)
{
super(block, meta);
}
private Block snowBlock;
public boolean generate(World par1World, Random par2Random, int x, int y, int z)
{
for (int j1 = 1; j1 < par1World.getHeight(); ++j1) {
int i1 = x;
//int j1 = y + par2Random.nextInt(4);
int k1 = z;
if (par1World.getBlock(i1, j1 - 1, k1) == EuropaBlocks.EuropaIce && par1World.isAirBlock(i1, j1, k1))
{
par1World.setBlock(i1, j1, k1, Blocks.snow_layer);
}
}
return true;
}
}
par1World.setBlock(i1, j1, k1, Blocks.snow_layer);
package tests;
public class OreGenerator implements IWorldGenerator
{
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
switch (world.provider.dimensionId)
{
case -1:
generateNether();
break;
case 0:
generateSurface(world, random, chunkX * 16, chunkZ * 16);
break;
case 1:
generateEnd();
break;
}
}
public void generateEnd()
{
// were not going to generate in the end
}
public void generateNether()
{
// were not doing ore ore in the nether either
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for (int i = 0; i < 10; i++) // 10 попыток на чанк
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(15);
int randPosZ = chunkZ + rand.nextInt(16);
new WorldGenMinable(Blocks.snow_layer, 50, 72, Blocks.air).generate(world, rand, randPosX, randPosY, randPosZ);
}
}
}