Java源码示例:net.minecraft.world.WorldProviderSurface

示例1
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.provider instanceof WorldProviderSurface) {
        this.generateOre(world, random, chunkX << 4, chunkZ << 4);

    }
}
 
示例2
private void generateOre(World world, Random random, int x, int z) {
    if (world.provider instanceof WorldProviderSurface) {
        for (int i = 0; i < 9; i++) {
            int genX = x + random.nextInt(16);
            int genY = 10 + random.nextInt(60);
            int genZ = z + random.nextInt(16);
            new WorldGenMinable(
                    BlockLoader.TOFUGEM_ORE.getDefaultState(), 3 + random.nextInt(6)).generate(world, random, new BlockPos(genX, genY, genZ));
        }
    }
}
 
示例3
@SubscribeEvent
   public void HotSpringGen(Decorate event) {
   	if(Loader.isModLoaded("tfc"))
   		return;
   	BlockPos pos = event.getChunkPos().getBlock(event.getRand().nextInt(16) + 8, 0, event.getRand().nextInt(16) + 8);
   	BlockPos newPos = WorldUtil.findGround(event.getWorld(),pos, true, false, true);
   	Biome biome = event.getWorld().getBiome(pos);
       
   	if (newPos != null&&event.getWorld().provider instanceof WorldProviderSurface&&biome != Biomes.DESERT && biome != Biomes.DESERT_HILLS && event.getRand().nextFloat() < SakuraConfig.hotspring_weight / 10000.0F) {
           new WorldGenHotSpring().generate(event.getWorld(), event.getRand(), newPos);
       }
}
 
示例4
public void handle(EntityPlayer player, byte[] chunkData, int dim, int xPos, int zPos, boolean reqinit, short yPos, short yMSBPos) {
	WorldClient proxyworld = ProxyWorldManager.getProxyworld(dim);
	if (proxyworld == null) return;
	if (proxyworld.provider.dimensionId != dim) return;

	//TODO: Test to see if this first part is even necessary
	Chunk chunk = proxyworld.getChunkProvider().provideChunk(xPos, zPos);
	if (reqinit && (chunk == null || chunk.isEmpty())) {
		if (yPos == 0) {
			proxyworld.doPreChunk(xPos, zPos, false);
			return;
		}
		proxyworld.doPreChunk(xPos, zPos, true);
	}
	// End possible removal section
	proxyworld.invalidateBlockReceiveRegion(xPos << 4, 0, zPos << 4, (xPos << 4) + 15, 256, (zPos << 4) + 15);
	chunk = proxyworld.getChunkFromChunkCoords(xPos, zPos);
	if (reqinit && (chunk == null || chunk.isEmpty())) {
		proxyworld.doPreChunk(xPos, zPos, true);
		chunk = proxyworld.getChunkFromChunkCoords(xPos, zPos);
	}
	if (chunk != null) {
		chunk.fillChunk(chunkData, yPos, yMSBPos, reqinit);
		receivedChunk(proxyworld, xPos, zPos);
		if (!reqinit || !(proxyworld.provider instanceof WorldProviderSurface)) {
			chunk.resetRelightChecks();
		}
	}
}
 
示例5
public DummyWorld(WorldSettings settings) {
	super(new DummySaveHandler(),
	      new WorldInfo(settings, "DummyWorld"),
	      new WorldProviderSurface(), null, true);
	provider.setWorld(this);
	player = new DummyPlayerSP(this);
}
 
示例6
public static boolean isOverworldDimension(World world)
{
    //return isEndDimension(world) == false && isNetherDimension(world) == false;
    return world.provider instanceof WorldProviderSurface ||
           world.provider.getDimensionType().getId() == 0;
}