Jump to content

Dimension Monster spawning problem


MegaGTA4Master

Recommended Posts

EDIT: Just fixed that issue. It was a problem with those ChunkProviders. Derp. Sorry 'bout this. If anyone is having those issues, add this to your ChunkProvider:

 

   

/**
     * Returns a list of creatures of the specified type that can spawn at the given location.
     */
    public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
    {
    	BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);
    	return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType);
    }

 

 

Hey guys,

 

I'm new to these forums. If I posted in the wrong section (unlikely) then I'm sorry.

 

Recently I started to code a new mod with forge, a continuation of my previous mod. It adds 2 dimensions.

However, while making the second dimension, I noticed in a problem with the monster spawning.

Even though I'm in Normal difficulty, they don't spawn! However, in the 1st dimension, they do spawn,

but rarely and also in some specific places. Like, 10 mobs spawns in 1 bit and the rest of the world has no mobs.

 

Peacefull mobs (e.g sheeps, pigs) spawns normally.

I've recently updated to Forge Build 6.6.1.527: 2013-02-15 05:42:01, but the problem remains.

Any help would be appreciated, since I'm new with forge, and I've searched a lot but I

did not find any people having this problem. So what am I doing wrong?

 

Here, have some code:

 

BiomeGenFlairen:

 

 

package net.minecraft.mineenhancerxtra;

import java.awt.Color;
import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.passive.EntityChicken;
import net.minecraft.entity.passive.EntityCow;
import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.passive.EntityPig;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.passive.EntitySquid;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;
import net.minecraft.world.gen.feature.WorldGenerator;

public class BiomeGenFlairen extends BiomeGenBase
{
FlairenBiomeDecoratorBase theFlarienBiomeDecorator;

    /** The big tree generator. */
    protected WorldGenFlairenBigTree worldGeneratorBigTree;
    
    /** The big tree generator. */
    protected WorldGenFlairenTrees worldGeneratorTrees;

    public BiomeGenFlairen(int par1)
    {
        super(par1);
        this.theBiomeDecorator.treesPerChunk = 25;
        this.theBiomeDecorator.grassPerChunk = 9;
        this.theBiomeDecorator.flowersPerChunk = 24;
        this.spawnableMonsterList.add(new SpawnListEntry(EntityOcelot.class, 3, 1, 1));
        this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10, 4, 4));
        this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 1, 1, 4));
        this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10, 4, 4));
        this.field_82914_M.add(new SpawnListEntry(EntityBat.class, 10, 8, );
        this.minHeight = 0.0F;
        this.maxHeight = 2.0F;
        this.rainfall = 1.0F;
        this.temperature = 1.0F;
        this.theBiomeDecorator = new FlairenBiomeDecoratorBase(this);
        this.topBlock = (byte) Block.grass.blockID;
        this.fillerBlock = (byte) MineEnhancerXtra.flairenDirt.blockID;
        this.worldGeneratorBigTree = new WorldGenFlairenBigTree(false);
    }
    
    /**
     * returns the chance a creature has to spawn.
     */
    public float getSpawningChance()
    {
        return 0.3F;
    }

    /**
     * Gets a WorldGen appropriate for this biome.
     */
    public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
    {
        return (WorldGenerator)(par1Random.nextInt(4) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenFlairenShrub(0, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenFlairenHugeTrees(false, 1 + par1Random.nextInt(21), 0, 3) : new WorldGenFlairenTrees(false, 1 + par1Random.nextInt(20), 0, 3, true))));
    }

    /**
     * Gets a WorldGen appropriate for this biome.
     */
    public WorldGenerator getRandomWorldGenForGrass(Random par1Random)
    {
        return par1Random.nextInt(3) == 0 ? new WorldGenFlairenTallGrass(Block.tallGrass.blockID, 2) : new WorldGenFlairenTallGrass(Block.tallGrass.blockID, 1);
    }
    
    public void decorate(World par1World, Random par2Random, int par3, int par4)
    {
        super.decorate(par1World, par2Random, par3, par4);
        WorldGenFlairenVines var5 = new WorldGenFlairenVines();

        for (int var6 = 0; var6 < 50; ++var6)
        {
            int var7 = par3 + par2Random.nextInt(16) + 8;
            byte var8 = 48;
            int var9 = par4 + par2Random.nextInt(16) + 8;
            var5.generate(par1World, par2Random, var7, var8, var9);
        }
    }
    
    @SideOnly(Side.CLIENT)
    public int getModdedBiomeGrassColor(int original)
    {
        return 0x00F9FF;
    }
    

    @SideOnly(Side.CLIENT)
    public int getModdedBiomeFoliageColor(int original)
    {
        return 0x52B7FF;
    }
    
    @SideOnly(Side.CLIENT)
    public int getWaterColorMultiplier()
    {
        return 0x00FF99;
    }
    
    /**
     * takes temperature, returns color
     */
    public int getSkyColorByTemp(float par1)
    {
        par1 /= 2.8F;

        if (par1 < -1.0F)
        {
            par1 = -1.0F;
        }

        if (par1 > 1.0F)
        {
            par1 = 1.0F;
        }

        return Color.getHSBColor(0.62222224F - par1 * 1.2F, 0.5F + par1 * 0.47F, 6.0215569F).getRGB();
    }
}

 

 

WorldProviderFlairen:

 

 

package net.minecraft.mineenhancerxtra;

import java.util.ArrayList;
import java.util.Arrays;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldProviderEnd;
import net.minecraft.world.WorldProviderHell;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.IRenderHandler;

public class WorldProviderFlairen extends WorldProvider
{
    /** Array for sunrise/sunset colors (RGBA) */
    private float[] colorsSunriseSunset = new float[4];
    
public void registerWorldChunkManager()
{
	this.worldChunkMgr = new WorldChunkManagerHell(MineEnhancerXtra.flairen, 0.5F, 1.0F);
	this.dimensionId = MineEnhancerXtra.flairenDimensionID;
}

public String getDimensionName() 
{
	return "Flairen";
}

public boolean canRespawnHere()
{
	return true;
}

    public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful)
    {
    	allowHostile = true;
    }

    public double getHorizon()
    {
        return 128D;
    }
    
    public String getSaveFolder()
    {
        return "FLAIREN";
    }
    
    /**
     * Creates the light to brightness table
     */
    protected void generateLightBrightnessTable()
    {
        float var1 = -0.005F;

        for (int var2 = 0; var2 <= 15; ++var2)
        {
            float var3 = 1.0F - (float)var2 / 15.0F;
            this.lightBrightnessTable[var2] = (1.0F - var3) / (var3 * 3.0F + 1.0F) * (1.0F - var1) + var1;
        }
    }
    
    @SideOnly(Side.CLIENT)
    /**
     * Returns array with sunrise/sunset colors
     */
    public float[] calcSunriseSunsetColors(float par1, float par2)
    {
        float var3 = 0.01F;
        float var4 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) - 0.0F;
        float var5 = -0.0F;

        if (var4 >= var5 - var3 && var4 <= var5 + var3)
        {
            float var6 = (var4 - var5) / var3 * 0.5F + 0.5F;
            float var7 = 1.0F - (1.0F - MathHelper.sin(var6 * (float)Math.PI)) * 0.99F;
            var7 *= var7;
            this.colorsSunriseSunset[0] = var6 * 0.3F + 0.7F;
            this.colorsSunriseSunset[1] = var6 * var6 * 0.7F + 0.2F;
            this.colorsSunriseSunset[2] = var6 * var6 * 0.0F + 0.2F;
            this.colorsSunriseSunset[3] = var7;
            return this.colorsSunriseSunset;
        }
        else
        {
            return null;
        }
    }

    @SideOnly(Side.CLIENT)
    /**
     * the y level at which clouds are rendered.
     */
    public float getCloudHeight()
    {
        return 256.0F;
    }

@Override
public IChunkProvider createChunkGenerator()
{
	return new ChunkProviderFlairen(worldObj, worldObj.getSeed(), true);
}

    /**
     * A message to display to the user when they transfer to this dimension.
     *
     * @return The message to be displayed
     */
    public String getWelcomeMessage()
    {
    	return "Warping to Flairen Dimension";
    }
    
    /**
     * A Message to display to the user when they transfer out of this dismension.
     *
     * @return The message to be displayed
     */
    public String getDepartMessage()
    {
    	return "Warping back to Overworld";
    }
    
    /**
     * The dimensions movement factor. Relative to normal overworld.
     * It is applied to the players position when they transfer dimensions.
     * Exa: Nether movement is 8.0
     * @return The movement factor
     */
    public double getMovementFactor()
    {
        return 4.0;
    }
    
    @SideOnly(Side.CLIENT)
    /**
     * Return Vec3D with biome specific fog color
     */
    public Vec3 getFogColor(float par1, float par2)
    {
        float var3 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;

        if (var3 < 0.0F)
        {
            var3 = 0.0F;
        }

        if (var3 > 1.0F)
        {
            var3 = 1.0F;
        }

        float var4 = 0.0F;
        float var5 = 1.0F;
        float var6 = 1.0F;
        var4 *= var3 * 0.00F + 0.00F;
        var5 *= var3 * 0.75F + 0.00F;
        var6 *= var3 * 0.50F + 1.00F;
        return this.worldObj.getWorldVec3Pool().getVecFromPool((double)var4, (double)var5, (double)var6);
    }
    
    public boolean canDoLightning(Chunk chunk)
    {
        return true;
    }
    
    @SideOnly(Side.CLIENT)
    public boolean isSkyColored()
    {
        return true;
    }
    
    /**
     * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
     */
    public boolean isSurfaceWorld()
    {
        return true;
    }

    /**
     * Will check if the x, z position specified is alright to be set as the map spawn point
     */
    public boolean canCoordinateBeSpawn(int par1, int par2)
    {
        int var3 = this.getFirstUncoveredBlock(par1, par2);
        return var3 == Block.grass.blockID;
    }
    
    /**
     * Returns the block ID of the first block at this (x,z) location with air above it, searching from sea level
     * upwards.
     */
    public int getFirstUncoveredBlock(int par1, int par2)
    {
        int var3;

        for (var3 = 256; !this.worldObj.isAirBlock(par1, var3 + 1, par2); ++var3)
        {
            ;
        }

        return this.worldObj.getBlockId(par1, var3, par2);
    }
    
    /**
     * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
     */
    public float calculateCelestialAngle(long par1, float par3)
    {
        int var4 = (int)(par1 % 24000L);
        float var5 = ((float)var4 + par3) / 24000.0F - 0.25F;

        if (var5 < 0.0F)
        {
            ++var5;
        }

        if (var5 > 1.0F)
        {
            --var5;
        }

        float var6 = var5;
        var5 = 1.0F - (float)((Math.cos((double)var5 * Math.PI) + 1.0D) / 2.0D);
        var5 = var6 + (var5 - var6) / 3.0F;
        return var5;
    }

    @SideOnly(Side.CLIENT)
    public int getMoonPhase(long par1, float par3)
    {
        return (int)(par1 / 24000L) % 8;
    }
    
    @SideOnly(Side.CLIENT)
    /**
     * returns true if this dimension is supposed to display void particles and pull in the far plane based on the
     * user's Y offset.
     */
    public boolean getWorldHasVoidParticles()
    {
        return true;
    }
}

 

 

BiomeGenBloodReaver:

 

 

package net.minecraft.mineenhancerxtra;

import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.SpawnListEntry;

public class BiomeGenBloodReaver extends BiomeGenBase
{
    public BiomeGenBloodReaver(int var1)
    {
        super(var1);
        this.spawnableMonsterList.clear();
        this.spawnableCreatureList.clear();
        this.spawnableMonsterList.add(new SpawnListEntry(EntityBlaze.class, 1, 1, 2));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 25, 1, 2));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 55, 4, 4));
        this.spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4));
        this.temperature = 100;
    }
}

 

 

This is the problem, difficulty hard:

 

 

20130218203014.png

 

 

Exploring won't fix anything. No monsters are spawning. Did the monster spawning change in 1.4?

Any help would be appreciated, I'm having this issue for the past 2 days. It might be a silly mistake, but I'm not seeing it.

 

EDIT: After I done some research, aparently mobs only spawns in vanilla blocks under some circustances. I tested it in my Flairen dimension and loads of them spawned in a custom mineshaft, on a small, dungeon shaped like room with a dirt floor.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.