net.minecraft.world.biome.BiomeCache Java Examples

The following examples show how to use net.minecraft.world.biome.BiomeCache. 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: 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 #2
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 4 votes vote down vote up
protected BiomeProviderTofu()
{
    this.biomeCache = new BiomeCache(this);
    this.biomesToSpawnIn = Lists.newArrayList(allowedBiomes);
}
 
Example #3
Source File: SpongeQueue_1_11.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkProviderOverworld generator = new ChunkProviderOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
            Arrays.fill(existingBiomes, base);
            fieldBiomes.set(generator, existingBiomes);
            boolean cold = base.getTemperature() <= 1;
            IChunkGenerator existingGenerator = (IChunkGenerator) fieldChunkGenerator.get(nmsWorld.getChunkProvider());
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}
 
Example #4
Source File: SpongeQueue_1_12.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkGeneratorOverworld generator = new ChunkGeneratorOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
            Arrays.fill(existingBiomes, base);
            fieldBiomes.set(generator, existingBiomes);
            IChunkGenerator existingGenerator = (IChunkGenerator) fieldChunkGenerator.get(nmsWorld.getChunkProvider());
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}
 
Example #5
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkGeneratorOverworld generator = new ChunkGeneratorOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            net.minecraft.world.biome.Biome[] existingBiomes = new net.minecraft.world.biome.Biome[256];
            Arrays.fill(existingBiomes, base);
            fieldBiomes.set(generator, existingBiomes);
            IChunkGenerator existingGenerator = (IChunkGenerator) fieldChunkGenerator.get(nmsWorld.getChunkProvider());
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}
 
Example #6
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean regenerateChunk(net.minecraft.world.World world, int x, int z, BaseBiome biome, Long seed) {
    if (biome != null) {
        try {
            if (seed == null) {
                seed = world.getSeed();
            }
            nmsWorld.getWorldInfo().getSeed();
            boolean result;
            ChunkProviderOverworld generator = new ChunkProviderOverworld(nmsWorld, seed, false, "");
            net.minecraft.world.biome.Biome base = net.minecraft.world.biome.Biome.getBiome(biome.getId());
            fieldBiomes.set(generator, new net.minecraft.world.biome.Biome[]{base});
            boolean cold = base.getTemperature() <= 1;
            IChunkGenerator existingGenerator = nmsWorld.getChunkProvider().chunkGenerator;
            long existingSeed = world.getSeed();
            {
                if (genLayer == null) genLayer = new MutableGenLayer(seed);
                genLayer.set(biome.getId());
                Object existingGenLayer1 = fieldGenLayer1.get(nmsWorld.provider.getBiomeProvider());
                Object existingGenLayer2 = fieldGenLayer2.get(nmsWorld.provider.getBiomeProvider());
                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), genLayer);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), genLayer);

                fieldSeed.set(nmsWorld.getWorldInfo(), seed);

                ReflectionUtils.setFailsafeFieldValue(fieldBiomeCache, this.nmsWorld.provider.getBiomeProvider(), new BiomeCache(this.nmsWorld.provider.getBiomeProvider()));

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), generator);

                result = regenerateChunk(world, x, z);

                ReflectionUtils.setFailsafeFieldValue(fieldChunkGenerator, this.nmsWorld.getChunkProvider(), existingGenerator);

                fieldSeed.set(nmsWorld.getWorldInfo(), existingSeed);

                fieldGenLayer1.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer1);
                fieldGenLayer2.set(nmsWorld.provider.getBiomeProvider(), existingGenLayer2);
            }
            return result;
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
    return regenerateChunk(world, x, z);
}