net.minecraft.world.biome.BiomeGenBase Java Examples

The following examples show how to use net.minecraft.world.biome.BiomeGenBase. 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: MoCChunkProviderWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Populates chunk with ores etc etc
 */
public void populate_old(IChunkProvider par1IChunkProvider, int par2, int par3)
{
    BlockSand.fallInstantly = true;

    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, worldObj.rand, par2, par3, false));

    int var4 = par2 * 16;
    int var5 = par3 * 16;
    BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16);
    var6.decorate(this.worldObj, this.worldObj.rand, var4, var5);

    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, worldObj.rand, par2, par3, false));

    BlockSand.fallInstantly = false;
}
 
Example #2
Source File: BlockColourGen.java    From mapwriter with MIT License 6 votes vote down vote up
private static void genBiomeColours(BlockColours bc) {
	// generate array of foliage, grass, and water colour multipliers
	// for each biome.
	
	for (int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++) {
		if (BiomeGenBase.getBiomeGenArray()[i] != null) {
			bc.setBiomeWaterShading(i, BiomeGenBase.getBiomeGenArray()[i].getWaterColorMultiplier() & 0xffffff);
			bc.setBiomeGrassShading(i, BiomeGenBase.getBiomeGenArray()[i].getBiomeGrassColor(0,0,0) & 0xffffff); //FIXME 0,0,0?
			bc.setBiomeFoliageShading(i, BiomeGenBase.getBiomeGenArray()[i].getBiomeFoliageColor(0,0,0) & 0xffffff); //FIXME 0,0,0?
		} else {
			bc.setBiomeWaterShading(i, 0xffffff);
			bc.setBiomeGrassShading(i, 0xffffff);
			bc.setBiomeFoliageShading(i, 0xffffff);
		}
	}
}
 
Example #3
Source File: WorldGenCandelilla.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
    int x = chunkX * 16;
    int z = chunkZ * 16;

    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
    if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD)
        || BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)
        || BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WET)
        || BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WASTELAND)
        || BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY))
        return;

    if (!BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY))
        return;

    if (random.nextInt(10) > 0)
        return;

    generate(world, random, x, world.getActualHeight() - 1, z);
}
 
Example #4
Source File: ItemSoilKit.java    From GardenCollection with MIT License 6 votes vote down vote up
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    if (player.inventory.getFirstEmptyStack() == -1 && player.inventory.getCurrentItem().stackSize > 1)
        return false;

    BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
    int temperature = (int)(Math.min(1, Math.max(0, biome.temperature)) * 255) & 255;
    int rainfall = (int)(Math.min(1, Math.max(0, biome.rainfall)) * 255) & 255;

    ItemStack usedKit = new ItemStack(ModItems.usedSoilTestKit, 1, rainfall << 8 | temperature);

    world.playSoundAtEntity(player, "step.grass", 1.0f, 1.0f);

    if (player.inventory.getCurrentItem().stackSize == 1)
        player.inventory.setInventorySlotContents(player.inventory.currentItem, usedKit);
    else {
        stack.stackSize--;
        player.inventory.setInventorySlotContents(player.inventory.getFirstEmptyStack(), usedKit);
    }

    return true;
}
 
Example #5
Source File: MobileChunk.java    From archimedes-ships with MIT License 6 votes vote down vote up
public MobileChunk(World world, EntityShip entityship)
{
	worldObj = world;
	entityShip = entityship;
	blockStorageMap = new HashMap<ChunkPosition, ExtendedBlockStorage>(1);
	chunkTileEntityMap = new HashMap<ChunkPosition, TileEntity>(2);
	
	isChunkLoaded = false;
	isModified = false;
	
	boundsInit = false;
	minX = minY = minZ = maxX = maxY = maxZ = -1;
	blockCount = 0;
	
	creationSpotBiome = BiomeGenBase.ocean;
}
 
Example #6
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static String BiomeName(World world, int i, int j, int k)
{
    WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
    if (worldchunkmanager == null) { return null; }
    //BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAt(i >> 4, k >> 4);
    BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAt(i, k);
    //TODO works?

    if (biomegenbase == null)
    {
        return null;
    }
    else
    {
        return biomegenbase.biomeName;
    }
}
 
Example #7
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static BiomeGenBase whatBiome(World world, int i, int j, int k)
{
    WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
    if (worldchunkmanager == null) { return null; }
    //TODO works?
    //BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAt(i >> 4, k >> 4);
    BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAt(i, k);
    //BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAtChunkCoord(new ChunkCoordIntPair(i >> 4, k >> 4));
    if (biomegenbase == null)
    {
        return null;
    }
    else
    {
        return biomegenbase;
    }
}
 
Example #8
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaSpawnLists()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPig.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySheep.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityChicken.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityWolf.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySquid.class, EnumCreatureType.waterCreature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityBat.class, EnumCreatureType.ambient, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #9
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaMobSpawns()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCreeper.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySkeleton.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityEnderman.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityCaveSpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySlime.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityGhast.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPigZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityMagmaCube.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #10
Source File: ChunkProviderTCOuter.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
    net.minecraft.block.BlockFalling.fallInstantly = true;
    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false));

    int k = p_73153_2_ * 16;
    int l = p_73153_3_ * 16;
    BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
    biomegenbase.decorate(this.worldObj, this.worldObj.rand, k, l);

    MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, this.worldObj, this.worldObj.rand, p_73153_2_, p_73153_3_, false));
    net.minecraft.block.BlockFalling.fallInstantly = false;
}
 
Example #11
Source File: WorldChunkManagerWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns an array of biomes for the location input.
 */
public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
    if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
    {
        par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
    }

    Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
    return par1ArrayOfBiomeGenBase;
}
 
Example #12
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns a list of creatures of the specified type (mob/aquatic/animal)
 * that can spawn at the given XYZ location, based on biomes.
 */
public List getPossibleCustomCreatures(World worldObj, EnumCreatureType enumcreaturetype, int pX, int pY, int pZ)
{
    BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(pX, pZ);
    if (biomegenbase == null)
    {
        //System.out.println("null biome");
        return null;
    }
    else
    {
        return getCustomBiomeSpawnList(getCustomSpawnableList(enumcreaturetype), biomegenbase);
    }
}
 
Example #13
Source File: OceanMonument.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
public static boolean canSpawnAt(World worldObj, int chunkX, int chunkZ) {
	int spacing = 32;
	int separation = 5;
	int xx = chunkX;
	int zz = chunkZ;

	if (chunkX < 0)
		chunkX -= spacing - 1;

	if (chunkZ < 0)
		chunkZ -= spacing - 1;

	int i1 = chunkX / spacing;
	int j1 = chunkZ / spacing;
	Random random = worldObj.setRandomSeed(i1, j1, 10387313);
	i1 *= spacing;
	j1 *= spacing;
	i1 += (random.nextInt(spacing - separation) + random.nextInt(spacing - separation)) / 2;
	j1 += (random.nextInt(spacing - separation) + random.nextInt(spacing - separation)) / 2;

	if (xx == i1 && zz == j1) {
		if (worldObj.getWorldChunkManager().getBiomeGenAt(xx * 16 + 8, zz * 16 + 8) != BiomeGenBase.deepOcean)
			return false;
		if (worldObj.getWorldChunkManager().areBiomesViable(xx * 16 + 8, zz * 16 + 8, 29, validBiomes))
			return true;
	}

	return false;
}
 
Example #14
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public void RemoveCustomSpawn(Class class1, EnumCreatureType enumcreaturetype, BiomeGenBase abiomegenbase[])
{
    if (class1 == null) { throw new IllegalArgumentException("entityClass cannot be null"); }
    if (enumcreaturetype == null) { throw new IllegalArgumentException("spawnList cannot be null"); }
    if (abiomegenbase == null)
    {
        abiomegenbase = new BiomeGenBase[biomeList.size()];
        abiomegenbase = biomeList.toArray(abiomegenbase);
    }

    for (BiomeGenBase element : abiomegenbase)
    {
        List[] fulllist = getCustomSpawnableList(enumcreaturetype);

        if (fulllist != null)
        {
            int x = biomeList.indexOf(element.biomeName);
            for (Iterator iterator = fulllist[x].iterator(); iterator.hasNext();)
            {
                if (iterator != null)
                {
                    SpawnListEntry spawnlistentry = (SpawnListEntry) iterator.next();
                    if (spawnlistentry.entityClass == class1)
                    {
                        iterator.remove();
                    }
                }
            }

        }

    }

}
 
Example #15
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public CustomSpawner()
{
    biomeList = new ArrayList<BiomeGenBase>();
    log.setParent(FMLLog.getLogger());
    try
    {
        for (BiomeGenBase biomegenbase : BiomeGenBase.biomeList)
        {
            if (biomegenbase == null)
            {
                continue;
            }
            biomeList.add(biomegenbase);
        }

        customCreatureSpawnList = new List[biomeList.size()];
        customMobSpawnList = new List[biomeList.size()];
        customAmbientSpawnList = new List[biomeList.size()];
        customAquaticSpawnList = new List[biomeList.size()];
        entityClasses = new List[4];
        vanillaClassList = new ArrayList<Class>();
        vanillaClassList.add(EntityChicken.class);
        vanillaClassList.add(EntityCow.class);
        vanillaClassList.add(EntityPig.class);
        vanillaClassList.add(EntitySheep.class);
        vanillaClassList.add(EntityWolf.class);
        vanillaClassList.add(EntitySquid.class);
        vanillaClassList.add(EntityOcelot.class);
        vanillaClassList.add(EntityBat.class);
        clearLists();
    }
    catch (Exception ex)
    {
        throw new RuntimeException(ex);
    }
}
 
Example #16
Source File: ThaumcraftHandler.java    From bartworks with MIT License 5 votes vote down vote up
public static boolean isMagicalForestBiome(int biomeID){
    if (ThaumcraftHandler.magicalForestBiomeID == null) {
        try {
            BiomeGenBase biome = (BiomeGenBase) Class.forName("thaumcraft.common.lib.world.ThaumcraftWorldGenerator").getField("biomeMagicalForest").get(null);
            return biomeID == (ThaumcraftHandler.magicalForestBiomeID = biome.biomeID);
        } catch (ClassCastException | ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
            return false;
        }
    }
    return biomeID == ThaumcraftHandler.magicalForestBiomeID;
}
 
Example #17
Source File: CraftBlock.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public static Biome biomeBaseToBiome(BiomeGenBase base) {
    if (base == null) {
        return null;
    }

    return BIOME_MAPPING[base.biomeID];
}
 
Example #18
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public static BiomeGenBase Biomekind(World world, int i, int j, int k)
{
    WorldChunkManager worldchunkmanager = world.getWorldChunkManager();
    if (worldchunkmanager == null) { return null; }
    BiomeGenBase biomegenbase = worldchunkmanager.getBiomeGenAt(i, k);
    if (biomegenbase == null)
    {
        return null;
    }
    else
    {
        return biomegenbase;
    }
}
 
Example #19
Source File: ThaumcraftHandler.java    From bartworks with MIT License 5 votes vote down vote up
public static boolean isTaintBiome(int biomeID){
    if (ThaumcraftHandler.taintBiomeID == null) {
        try {
            BiomeGenBase TaintBiome = (BiomeGenBase) Class.forName("thaumcraft.common.lib.world.ThaumcraftWorldGenerator").getField("biomeTaint").get(null);
            return biomeID == (ThaumcraftHandler.taintBiomeID = TaintBiome.biomeID);
        } catch (ClassCastException | ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
            return false;
        }
    }
    return biomeID == ThaumcraftHandler.taintBiomeID;
}
 
Example #20
Source File: ChunkProviderRoss128b.java    From bartworks with MIT License 5 votes vote down vote up
public Chunk provideChunk(int p_73154_1_, int p_73154_2_) {
    this.rand.setSeed((long) p_73154_1_ * 341873128712L + (long) p_73154_2_ * 132897987541L);
    Block[] ablock = new Block[65536];
    byte[] abyte = new byte[65536];
    this.func_147424_a(p_73154_1_, p_73154_2_, ablock);
    this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16);
    for (int i = 0; i < this.biomesForGeneration.length; i++) {
        BiomeGenBase biomeGenBase = this.biomesForGeneration[i];
        if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) {
            this.biomesForGeneration[i] = BiomeGenBase.taiga;
        } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) {
            this.biomesForGeneration[i] = BiomeGenBase.stoneBeach;
        }
        if (LoaderReference.Thaumcraft) {
            if (ThaumcraftHandler.isTaintBiome(biomeGenBase.biomeID))
                this.biomesForGeneration[i] = BiomeGenBase.taiga;
            else if (ConfigHandler.disableMagicalForest && ThaumcraftHandler.isMagicalForestBiome(biomeGenBase.biomeID))
                this.biomesForGeneration[i] = BiomeGenBase.birchForest;
        }
    }
    this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration);
    this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);
    this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

    Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_);
    byte[] abyte1 = chunk.getBiomeArray();

    for (int k = 0; k < abyte1.length; ++k) {
        abyte1[k] = (byte) this.biomesForGeneration[k].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
}
 
Example #21
Source File: MoCEntityBigCat.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean checkSpawningBiome()
{
    int i = MathHelper.floor_double(posX);
    int j = MathHelper.floor_double(boundingBox.minY);
    int k = MathHelper.floor_double(posZ);
    //String s = MoCTools.BiomeName(worldObj, i, j, k);
    BiomeGenBase currentbiome = MoCTools.Biomekind(worldObj, i, j, k);
    
    if (currentbiome.temperature <= 0.05F)
    {
        setType(6); //snow leopard
        return true;
    }
    
    int l = 0;
    {
        l = checkNearBigKitties(12D);
        if (l == 7)
        {
            l = 5;
        }
    }
    setType(l);
   /* if (s.equals("Taiga") || s.equals("FrozenOcean") || s.equals("FrozenRiver") || s.equals("Ice Plains") || s.equals("Ice Mountains") || s.equals("TaigaHills"))
    {
        setType(6);// = 6;//snow leopard
        //return true;
    }*/
    return true;
}
 
Example #22
Source File: MoCEntityFox.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean checkSpawningBiome()
{
    int i = MathHelper.floor_double(posX);
    int j = MathHelper.floor_double(boundingBox.minY);
    int k = MathHelper.floor_double(posZ);
    BiomeGenBase currentbiome = MoCTools.Biomekind(worldObj, i, j, k);
    
    String s = MoCTools.BiomeName(worldObj, i, j, k);
    if (currentbiome.temperature <= 0.05F)
    {
        setType(2);
    }
    return true;
}
 
Example #23
Source File: MoCEntityScorpion.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean checkSpawningBiome()
{
	if (worldObj.provider.isHellWorld)
    {
        setType(3);
        isImmuneToFire = true;
        return true;
    }
	
    int i = MathHelper.floor_double(posX);
    int j = MathHelper.floor_double(boundingBox.minY);
    int k = MathHelper.floor_double(posZ);

    String s = MoCTools.BiomeName(worldObj, i, j, k);
    BiomeGenBase currentbiome = MoCTools.Biomekind(worldObj, i, j, k);
    
    //if (s.equals("Taiga") || s.equals("Frozen Ocean") || s.equals("Frozen River") || s.equals("Ice Plains") || s.equals("Ice Mountains") || s.equals("TaigaHills"))
    if (currentbiome.temperature <= 0.05F)
    {
        setType(4);
    }
    else if (!worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && (posY < 50D))
    {
    	setType(2);
        return true;
    }

    return true;

}
 
Example #24
Source File: ChunkProviderRoss128b.java    From bartworks with MIT License 5 votes vote down vote up
@Override
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas, BiomeGenBase[] p_147422_5_) {
    super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_);
    for (int i = 0; i < blocks.length; i++) {
        if (blocks[i] == Blocks.grass) {
            blocks[i] = Blocks.dirt;
            metas[i] = 2;
        }
    }
}
 
Example #25
Source File: WorldChunkManagerWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the
 * WorldChunkManager Args: oldBiomeList, x, z, width, depth
 */
public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5)
{
    if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
    {
        par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
    }

    Arrays.fill(par1ArrayOfBiomeGenBase, 0, par4 * par5, this.biomeGenerator);
    return par1ArrayOfBiomeGenBase;
}
 
Example #26
Source File: MoCBiomeData.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public MoCBiomeData(Class<? extends BiomeGenBase> biomeClass, BiomeGenBase biome)
{
    this.clazz = biomeClass;
    this.biome = biome;
    this.defined = false;
}
 
Example #27
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public List getCustomBiomeSpawnList(BiomeGenBase biome)
{
    int x = biomeList.indexOf(biome);
    if (x >= 0) { return this.customCreatureSpawnList[x]; }
    return null;
}
 
Example #28
Source File: MoCChunkProviderWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{
    byte var5 = 2;
    int var6 = var5 + 1;
    byte var7 = 33;
    int var8 = var5 + 1;
    this.densities = this.initializeNoiseField(this.densities, par1 * var5, 0, par2 * var5, var6, var7, var8);

    for (int var9 = 0; var9 < var5; ++var9)
    {
        for (int var10 = 0; var10 < var5; ++var10)
        {
            for (int var11 = 0; var11 < 32; ++var11)
            {
                double var12 = 0.25D;
                double var14 = this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 0];
                double var16 = this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 0];
                double var18 = this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 0];
                double var20 = this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 0];
                double var22 = (this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 1] - var14) * var12;
                double var24 = (this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 1] - var16) * var12;
                double var26 = (this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 1] - var18) * var12;
                double var28 = (this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 1] - var20) * var12;

                for (int var30 = 0; var30 < 4; ++var30)
                {
                    double var31 = 0.125D;
                    double var33 = var14;
                    double var35 = var16;
                    double var37 = (var18 - var14) * var31;
                    double var39 = (var20 - var16) * var31;

                    for (int var41 = 0; var41 < 8; ++var41)
                    {
                        int var42 = var41 + var9 * 8 << 11 | 0 + var10 * 8 << 7 | var11 * 4 + var30;
                        short var43 = 128;
                        double var44 = 0.125D;
                        double var46 = var33;
                        double var48 = (var35 - var33) * var44;

                        for (int var50 = 0; var50 < 8; ++var50)
                        {
                            int var51 = 0;

                            if (var46 > 0.0D)
                            {
                                var51 = MoCreatures.mocStone.blockID;
                            }

                            par3ArrayOfByte[var42] = (byte)var51;
                            var42 += var43;
                            var46 += var48;
                        }

                        var33 += var37;
                        var35 += var39;
                    }

                    var14 += var22;
                    var16 += var24;
                    var18 += var26;
                    var20 += var28;
                }
            }
        }
    }
}
 
Example #29
Source File: WorldChunkManagerWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false,
 * don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
 */
public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6)
{
    return this.loadBlockGeneratorData(par1ArrayOfBiomeGenBase, par2, par3, par4, par5);
}
 
Example #30
Source File: WorldChunkManagerWyvernLair.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the BiomeGenBase related to the x, z position on the world.
 */
public BiomeGenBase getBiomeGenAt(int par1, int par2)
{
    return this.biomeGenerator;
}