net.minecraft.world.WorldProviderSurface Java Examples

The following examples show how to use net.minecraft.world.WorldProviderSurface. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TofuOreGenerator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@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);

    }
}
 
Example #2
Source File: TofuOreGenerator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
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));
        }
    }
}
 
Example #3
Source File: WorldGenLoader.java    From Sakura_mod with MIT License 5 votes vote down vote up
@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);
       }
}
 
Example #4
Source File: PacketChunkInfo.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
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();
		}
	}
}
 
Example #5
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License 5 votes vote down vote up
public DummyWorld(WorldSettings settings) {
	super(new DummySaveHandler(),
	      new WorldInfo(settings, "DummyWorld"),
	      new WorldProviderSurface(), null, true);
	provider.setWorld(this);
	player = new DummyPlayerSP(this);
}
 
Example #6
Source File: WorldUtils.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static boolean isOverworldDimension(World world)
{
    //return isEndDimension(world) == false && isNetherDimension(world) == false;
    return world.provider instanceof WorldProviderSurface ||
           world.provider.getDimensionType().getId() == 0;
}