net.minecraft.world.biome.BiomeProvider Java Examples

The following examples show how to use net.minecraft.world.biome.BiomeProvider. 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: TraverseCommon.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void init(FMLInitializationEvent event) {
	for (Block block : TraverseBlocks.oreDictNames.keySet()) {
		OreDictionary.registerOre(TraverseBlocks.oreDictNames.get(block), block);
	}
	for (TraverseWorld.TraverseBiomeEntry traverseBiome : TraverseWorld.biomeList) {
		BiomeManager.addBiome(traverseBiome.getType(), traverseBiome.getEntry());
		if (traverseBiome.hasVillages()) {
			BiomeManager.addVillageBiome(traverseBiome.getBiome(), traverseBiome.canSpawn());
		}
		if (traverseBiome.canSpawn()) {
			BiomeManager.addSpawnBiome(traverseBiome.getBiome());
		}
		BiomeProvider.allowedBiomes.add(traverseBiome.getBiome());
	}

	registerSmeltingRecipe(new ItemStack(Items.COAL, 1, 1), new ItemStack(TUtils.getBlock("fir_log")), 0.15F);
	registerSmeltingRecipe(new ItemStack(TUtils.getBlock("red_rock")), new ItemStack(TUtils.getBlock("red_rock_cobblestone")), 0.1F);
	registerSmeltingRecipe(new ItemStack(TUtils.getBlock("blue_rock")), new ItemStack(TUtils.getBlock("blue_rock_cobblestone")), 0.1F);
}
 
Example #2
Source File: CraftChunk.java    From Kettle with GNU General Public License v3.0 6 votes vote down vote up
private static float[] getTemperatures(BiomeProvider chunkmanager, int chunkX, int chunkZ) {
    Biome[] biomes = chunkmanager.getBiomes(null, chunkX, chunkZ, 16, 16);
    float[] temps = new float[biomes.length];

    for (int i = 0; i < biomes.length; i++) {
        float temp = biomes[i].getDefaultTemperature(); // Vanilla of olde: ((int) biomes[i].temperature * 65536.0F) / 65536.0F

        if (temp > 1F) {
            temp = 1F;
        }

        temps[i] = temp;
    }

    return temps;
}
 
Example #3
Source File: TraverseCommon.java    From Traverse-Legacy-1-12-2 with MIT License 6 votes vote down vote up
public void init(FMLInitializationEvent event) {
	for (Block block : TraverseBlocks.oreDictNames.keySet()) {
		OreDictionary.registerOre(TraverseBlocks.oreDictNames.get(block), block);
	}
	for (TraverseWorld.TraverseBiomeEntry traverseBiome : TraverseWorld.biomeList) {
		BiomeManager.addBiome(traverseBiome.getType(), traverseBiome.getEntry());
		if (traverseBiome.hasVillages()) {
			BiomeManager.addVillageBiome(traverseBiome.getBiome(), traverseBiome.canSpawn());
		}
		if (traverseBiome.canSpawn()) {
			BiomeManager.addSpawnBiome(traverseBiome.getBiome());
		}
		BiomeProvider.allowedBiomes.add(traverseBiome.getBiome());
	}

	registerSmeltingRecipe(new ItemStack(Items.COAL, 1, 1), new ItemStack(getBlock("fir_log")), 0.15F);
	registerSmeltingRecipe(new ItemStack(getBlock("red_rock")), new ItemStack(getBlock("red_rock_cobblestone")), 0.1F);
	registerSmeltingRecipe(new ItemStack(getBlock("blue_rock")), new ItemStack(getBlock("blue_rock_cobblestone")), 0.1F);
}
 
Example #4
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public ChunkManagerPlanet(long seed, WorldType default1, String str, DimensionProperties properties) {

		this.biomeCache = new BiomeCache(this);//new BiomeCacheExtended(this);
		//TODO: more biomes
		//TODO: remove rivers
		GenLayer[] agenlayer = initializeAllBiomeGenerators(seed, default1, str, properties);//GenLayer.initializeAllBiomeGenerators(seed, default1); //;
		agenlayer = getModdedBiomeGenerators(default1, seed, agenlayer);
		this.genBiomes = agenlayer[0];
		this.biomeIndexLayer = agenlayer[1];

		ReflectionHelper.setPrivateValue(BiomeProvider.class, this, this.genBiomes, "genBiomes", "field_76944_d");
		ReflectionHelper.setPrivateValue(BiomeProvider.class, this, this.biomeIndexLayer, "biomeIndexLayer", "field_76945_e");
		
		fBiomeCache = ReflectionHelper.findField(BiomeCache.class, "cache", "field_76841_d");
		fBiomeCache.setAccessible(true);

		fBiomeCacheMap = ReflectionHelper.findField(BiomeCache.class, "cacheMap", "field_76843_c");
		fBiomeCacheMap.setAccessible(true);
	}
 
Example #5
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public Start(BiomeProvider chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureTofuVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_) {
    super((Start) null, 0, rand, p_i2104_4_, p_i2104_5_);
    this.worldChunkMngr = chunkManagerIn;
    this.structureVillageWeightedPieceList = p_i2104_6_;
    this.terrainType = p_i2104_7_;
    Biome biome = chunkManagerIn.getBiome(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.DEFAULT);
    this.biome = biome;
    this.startPiece = this;
    this.func_189924_a(this.field_189928_h);
    this.field_189929_i = rand.nextInt(50) == 0;
}
 
Example #6
Source File: TraverseCommon.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
	traverse_world_data = null;
	File rootDir = FMLCommonHandler.instance().getSavesDirectory();
	if (!rootDir.exists()) {
		rootDir.mkdir();
	}
	File worldDir = new File(rootDir, event.getServer().getFolderName());
	if (!worldDir.exists()) {
		worldDir.mkdir();
	}
	traverse_world_data = new TraverseWorldVersion(worldDir);

	for (TraverseWorld.TraverseBiomeEntry traverseBiome : TraverseWorld.biomeList) {
		BiomeProvider.allowedBiomes.remove(traverseBiome.getBiome());
		BiomeManager.removeSpawnBiome(traverseBiome.getBiome());
		BiomeManager.removeBiome(traverseBiome.getType(), traverseBiome.getEntry());

		boolean canRegister;

		if (!TraverseConfig.registerBiomesRegardless) {
			traverse_world_data.reloadVersionFile();
			canRegister = VersionUtils.isVersionLessOrEqual(traverseBiome.getVersionAdded(), traverse_world_data.version);
		} else {
			canRegister = true;
		}
		if (canRegister) {
			BiomeManager.addBiome(traverseBiome.getType(), traverseBiome.getEntry());
			if (traverseBiome.hasVillages()) {
				BiomeManager.addVillageBiome(traverseBiome.getBiome(), traverseBiome.canSpawn());
			}
			if (traverseBiome.canSpawn()) {
				BiomeManager.addSpawnBiome(traverseBiome.getBiome());
			}
			BiomeProvider.allowedBiomes.add(traverseBiome.getBiome());
		}
	}
}
 
Example #7
Source File: TraverseCommon.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
	traverse_world_data = null;
	File rootDir = FMLCommonHandler.instance().getSavesDirectory();
	if (!rootDir.exists()) {
		rootDir.mkdir();
	}
	File worldDir = new File(rootDir, event.getServer().getFolderName());
	if (!worldDir.exists()) {
		worldDir.mkdir();
	}
	traverse_world_data = new TraverseWorldVersion(worldDir);

	for (TraverseWorld.TraverseBiomeEntry traverseBiome : TraverseWorld.biomeList) {
		BiomeProvider.allowedBiomes.remove(traverseBiome.getBiome());
		BiomeManager.removeSpawnBiome(traverseBiome.getBiome());
		BiomeManager.removeBiome(traverseBiome.getType(), traverseBiome.getEntry());

		boolean canRegister;

		if (!TraverseConfig.registerBiomesRegardless) {
			traverse_world_data.reloadVersionFile();
			canRegister = VersionUtils.isVersionLessOrEqual(traverseBiome.getVersionAdded(), traverse_world_data.version);
		} else {
			canRegister = true;
		}
		if (canRegister) {
			BiomeManager.addBiome(traverseBiome.getType(), traverseBiome.getEntry());
			if (traverseBiome.hasVillages()) {
				BiomeManager.addVillageBiome(traverseBiome.getBiome(), traverseBiome.canSpawn());
			}
			if (traverseBiome.canSpawn()) {
				BiomeManager.addSpawnBiome(traverseBiome.getBiome());
			}
			BiomeProvider.allowedBiomes.add(traverseBiome.getBiome());
		}
	}
}
 
Example #8
Source File: CraftChunk.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
    Biome[] biome = null;
    double[] biomeTemp = null;
    double[] biomeRain = null;

    if (includeBiome || includeBiomeTempRain) {
        BiomeProvider wcm = world.getHandle().getBiomeProvider();

        if (includeBiome) {
            biome = new Biome[256];
            for (int i = 0; i < 256; i++) {
                biome[i] = world.getHandle().getBiome(new BlockPos((x << 4) + (i & 0xF), 0, (z << 4) + (i >> 4)));
            }
        }

        if (includeBiomeTempRain) {
            biomeTemp = new double[256];
            biomeRain = new double[256];
            float[] dat = getTemperatures(wcm, x << 4, z << 4);

            for (int i = 0; i < 256; i++) {
                biomeTemp[i] = dat[i];
            }

            /* Removed 15w46a
            dat = wcm.getWetness(null, x << 4, z << 4, 16, 16);

            for (int i = 0; i < 256; i++) {
                biomeRain[i] = dat[i];
            }
            */
        }
    }

    /* Fill with empty data */
    int hSection = world.getMaxHeight() >> 4;
    short[][] blockIDs = new short[hSection][];
    byte[][] skyLight = new byte[hSection][];
    byte[][] emitLight = new byte[hSection][];
    byte[][] blockData = new byte[hSection][];
    boolean[] empty = new boolean[hSection];

    for (int i = 0; i < hSection; i++) {
        blockIDs[i] = emptyBlockIDs;
        skyLight[i] = emptySkyLight;
        emitLight[i] = emptyData;
        blockData[i] = emptyData;
        empty[i] = true;
    }

    return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain);
}
 
Example #9
Source File: WorldTypePlanetGen.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public BiomeProvider getBiomeProvider(World world)
{
	return null;//new ChunkManagerPlanet(world); //new WorldChunkManager(world);//
}
 
Example #10
Source File: VoidWorldType.java    From YUNoMakeGoodMap with Apache License 2.0 4 votes vote down vote up
@Override
public BiomeProvider getBiomeProvider(World world)
{
    return new VoidWorldBiomeProvider(world);
}