Jump to content

Blade Avuari

Forge Modder
  • Posts

    41
  • Joined

  • Last visited

Posts posted by Blade Avuari

  1. That would be a good idea, but it might get a little annoying to work with, assuming that nobody makes a base for the Mod Option GUI pages. I could get to work on that right now, actually.

     

    EDIT: I just realized that that might also require config updating, which I'm not good with...

  2. Goto is saying that you should move all the information from the static method into the method, right after the config.

     

    By the way, I've started work on a similar mod, (although my work is currently on hold while I work on my Mega Man mod, and involves adding all the important side-items from across the series, instead of all the primaries from Ocarina of Time,) so if you ever want any help, or would like to organize your codebase, ask me. Oh, and you spelt Rupee wrong.

     

    EDIT: Thanking Goto

  3. (Knowing that this will probably not be fun to hear...) Are you running the jar, or extracting it? Have you followed the instructions from Direwolf20's 1.6.2 forge installation video? If not, try that. If all else fails, send a message to the javaxdelta team about this problem, so it can be fixed.

     

    EDIT: Aww, lex, you didn't have to smite me for my statement involving bug reports...

  4. Unfortunately i haven't gotten this to work :( still.

     

    I don't have to make a custom WorldChunkManager, GenLayer (+ all subGenLayer), WorldType, WorldTypeEvent, IntCache, BiomeCacheBlock, BiomeCache etc would i?

    I believe you do, sadly. At least, that's what I had to do when I made my "Dig Deeper!" mod. I'll give you some of the basic stuff from my MCM here.

     

    
    public class WorldChunkManagerDeeper extends WorldChunkManager
    {
        private GenLayer genBiomes;
    
        /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
        private GenLayer biomeIndexLayer;
    
        /** The BiomeCache object for this world. */
        private BiomeCacheDeeper biomeCache;
    
        /** A list of biomes that the player can spawn in. */
        private List biomesToSpawnIn;
    
        protected WorldChunkManagerDeeper()
        {
            biomeCache = new BiomeCacheDeeper(this);
            biomesToSpawnIn = new ArrayList();
            biomesToSpawnIn.add(BiomeGenBase.forest);
    
            biomesToSpawnIn.add(BiomeGenBase.jungleHills);
        }
    
        public WorldChunkManagerDeeper(long par1, WorldType par3WorldType)
        {
            this();
            GenLayer agenlayer[] = GenLayer.initializeAllBiomeGenerators(par1, par3WorldType);
            genBiomes = agenlayer[0];
            biomeIndexLayer = agenlayer[1];
        }
    
        public WorldChunkManagerDeeper(World par1World)
        {
            this(par1World.getSeed(), par1World.getWorldInfo().getTerrainType());
        }
    
        /**
         * Gets the list of valid biomes for the player to spawn in.
         */
        public List getBiomesToSpawnIn()
        {
            return biomesToSpawnIn;
        }
    
        /**
         * Returns the BiomeGenBase related to the x, z position on the world.
         */
        public BiomeGenBase getBiomeGenAt(int par1, int par2)
        {
            return biomeCache.getBiomeGenAt(par1, par2);
        }
    
        /**
         * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length.
         */
        public float[] getRainfall(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
        {
            IntCache.resetIntCache();
    
            if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
            {
                par1ArrayOfFloat = new float[par4 * par5];
            }
    
            int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
    
            for (int i = 0; i < par4 * par5; i++)
            {
                float f = (float)BiomeGenBase.biomeList[ai[i]].getIntRainfall() / 65536F;
    
                if (f > 1.0F)
                {
                    f = 1.0F;
                }
    
                par1ArrayOfFloat[i] = f;
            }
    
            return par1ArrayOfFloat;
        }
    
        /**
         * Return an adjusted version of a given temperature based on the y height
         */
        public float getTemperatureAtHeight(float par1, int par2)
        {
            return par1;
        }
    
        /**
         * Returns a list of temperatures to use for the specified blocks.  Args: listToReuse, x, y, width, length
         */
        public float[] getTemperatures(float par1ArrayOfFloat[], int par2, int par3, int par4, int par5)
        {
            IntCache.resetIntCache();
    
            if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5)
            {
                par1ArrayOfFloat = new float[par4 * par5];
            }
    
            int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
    
            for (int i = 0; i < par4 * par5; i++)
            {
                float f = (float)BiomeGenBase.biomeList[ai[i]].getIntTemperature() / 65536F;
    
                if (f > 1.0F)
                {
                    f = 1.0F;
                }
    
                par1ArrayOfFloat[i] = f;
            }
    
            return par1ArrayOfFloat;
        }
    
        /**
         * Returns an array of biomes for the location input.
         */
        public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase par1ArrayOfBiomeGenBase[], int par2, int par3, int par4, int par5)
        {
            IntCache.resetIntCache();
    
            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
            {
                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
            }
    
            int ai[] = genBiomes.getInts(par2, par3, par4, par5);
    
            for (int i = 0; i < par4 * par5; i++)
            {
                par1ArrayOfBiomeGenBase[i] = BiomeGenBase.biomeList[ai[i]];
            }
    
            return par1ArrayOfBiomeGenBase;
        }
    
        /**
         * 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)
        {
            return getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true);
        }
    
        /**
         * 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)
        {
            IntCache.resetIntCache();
    
            if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5)
            {
                par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
            }
    
            if (par6 && par4 == 16 && par5 == 16 && (par2 & 0xf) == 0 && (par3 & 0xf) == 0)
            {
                BiomeGenBase abiomegenbase[] = biomeCache.getCachedBiomes(par2, par3);
                System.arraycopy(abiomegenbase, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5);
                return par1ArrayOfBiomeGenBase;
            }
    
            int ai[] = biomeIndexLayer.getInts(par2, par3, par4, par5);
    
            for (int i = 0; i < par4 * par5; i++)
            {
                par1ArrayOfBiomeGenBase[i] = BiomeGenBase.biomeList[ai[i]];
            }
    
            return par1ArrayOfBiomeGenBase;
        }
    
        /**
         * checks given Chunk's Biomes against List of allowed ones
         */
        public boolean areBiomesViable(int par1, int par2, int par3, List par4List)
        {
            int i = par1 - par3 >> 2;
            int j = par2 - par3 >> 2;
            int k = par1 + par3 >> 2;
            int l = par2 + par3 >> 2;
            int i1 = (k - i) + 1;
            int j1 = (l - j) + 1;
            int ai[] = genBiomes.getInts(i, j, i1, j1);
    
            for (int k1 = 0; k1 < i1 * j1; k1++)
            {
                BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[k1]];
    
                if (!par4List.contains(biomegenbase))
                {
                    return false;
                }
            }
    
            return true;
        }
    
        /**
         * Finds a valid position within a range, that is once of the listed biomes.
         */
        public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random)
        {
            int i = par1 - par3 >> 2;
            int j = par2 - par3 >> 2;
            int k = par1 + par3 >> 2;
            int l = par2 + par3 >> 2;
            int i1 = (k - i) + 1;
            int j1 = (l - j) + 1;
            int ai[] = genBiomes.getInts(i, j, i1, j1);
            ChunkPosition chunkposition = null;
            int k1 = 0;
    
            for (int l1 = 0; l1 < ai.length; l1++)
            {
                int i2 = i + l1 % i1 << 2;
                int j2 = j + l1 / i1 << 2;
                BiomeGenBase biomegenbase = BiomeGenBase.biomeList[ai[l1]];
    
                if (par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(k1 + 1) == 0))
                {
                    chunkposition = new ChunkPosition(i2, 0, j2);
                    k1++;
                }
            }
    
            return chunkposition;
        }
    
        /**
         * Calls the WorldChunkManager's biomeCache.cleanupCache()
         */
        public void cleanupCache()
        {
            biomeCache.cleanupCache();
        }
    }
    

  5. Hey, I would like to know how to check a value of an item that another player/mob is holding.  It would also have to return if an item is not being held, or if the value is null.

    Here is the class for my base item, from which three different types of items extend.

     

    package blade.weapons;
    
    import net.minecraft.src.CreativeTabs;
    import net.minecraft.src.EntityLiving;
    import net.minecraft.src.EnumToolMaterial;
    import net.minecraft.src.Item;
    import net.minecraft.src.ItemStack;
    
    public class ItemWeapon extends Item {
    
    private int weaponType;
    private int weaponMight;
    private int weaponDamage;
    private EnumToolMaterial toolMaterial;
    private int vsWeapon;
    private boolean isReaver;
    
    public ItemWeapon(int par1ID, int par2MT, int par3WeaponType, int par4Uses) {
    	super(par1ID);
            this.maxStackSize = 1;
            this.setMaxDamage(par4Uses);
            this.setCreativeTab(CreativeTabs.tabCombat);
            this.weaponDamage = this.weaponMight * this.vsWeapon / 100;
    }
    
    private void Advantage(){
    	if (weaponType == enemyWeaponType()){
    		this.vsWeapon = 100;
    	} else {
    		if ((weaponType + 1) == enemyWeaponType() || (weaponType - 2) == enemyWeaponType()){
    			this.vsWeapon = 125;
    		} else {
    			if ((weaponType - 1) == enemyWeaponType() || (weaponType + 2) == enemyWeaponType()){
    				this.vsWeapon = 75;
    			} else {
    				this.vsWeapon = 100;
    			}
    		}
    	}
    }
    
        public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
        {
            par1ItemStack.damageItem(1, par3EntityLiving);
            return true;
        }
    
    private int enemyWeaponType() {
    
    	return 1;
    // TODO: getEnemyWeaponType
    }
    
    
    }

     

     

    And the calling line for the item

     

     

    public static final Item ironSword = new WeaponSword(7900, 5, 46).setIconCoord(5, 0).setItemName("ironSword");
    

     

     

    And the weaponsword

     

     

    package blade.weapons;
    
    import net.minecraft.src.Item;
    
    public class WeaponSword extends ItemWeapon {
    
    /**
     * Info for sword-type items
     * @param par1ID Item ID
     * @param par2mt Base Damage
     * @param par4Uses Max uses
     */
    public WeaponSword(int par1ID, int par2mt, int par4Uses) {
    	super(par1ID, par2mt, 1, par4Uses);
    	// TODO Auto-generated constructor stub
    }
    
    public String getTextureFile () {
    	return "/just/a.png";
    }
    
    }
    

     

  6. I don't know if this works with other players, but in many of the animal class files, there is a boolean that causes something to happen when you right-click on a mob.

     

    Right click on wolf makes it sit, dyes it, feeds it, etc.

     

        public boolean interact(EntityPlayer par1EntityPlayer)
        {
            ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
    
            if (this.isTamed())
            {
                if (var2 != null)
                {
                    if (Item.itemsList[var2.itemID] instanceof ItemFood)
                    {
                        ItemFood var3 = (ItemFood)Item.itemsList[var2.itemID];
    
                        if (var3.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectInt(18) < 20)
                        {
                            if (!par1EntityPlayer.capabilities.isCreativeMode)
                            {
                                --var2.stackSize;
                            }
    
                            this.heal(var3.getHealAmount());
    
                            if (var2.stackSize <= 0)
                            {
                                par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
                            }
    
                            return true;
                        }
                    }
                    else if (var2.itemID == Item.dyePowder.shiftedIndex)
                    {
                        int var4 = BlockCloth.getBlockFromDye(var2.getItemDamage());
    
                        if (var4 != this.getCollarColor())
                        {
                            this.setCollarColor(var4);
    
                            if (!par1EntityPlayer.capabilities.isCreativeMode && --var2.stackSize <= 0)
                            {
                                par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
                            }
    
                            return true;
                        }
                    }
                }
    
                if (par1EntityPlayer.username.equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && !this.isBreedingItem(var2))
                {
                    this.aiSit.setSitting(!this.isSitting());
                    this.isJumping = false;
                    this.setPathToEntity((PathEntity)null);
                }
            }
            else if (var2 != null && var2.itemID == Item.bone.shiftedIndex && !this.isAngry())
            {
                if (!par1EntityPlayer.capabilities.isCreativeMode)
                {
                    --var2.stackSize;
                }
    
                if (var2.stackSize <= 0)
                {
                    par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null);
                }
    
                if (!this.worldObj.isRemote)
                {
                    if (this.rand.nextInt(3) == 0)
                    {
                        this.setTamed(true);
                        this.setPathToEntity((PathEntity)null);
                        this.setAttackTarget((EntityLiving)null);
                        this.aiSit.setSitting(true);
                        this.setEntityHealth(20);
                        this.setOwner(par1EntityPlayer.username);
                        this.playTameEffect(true);
                        this.worldObj.setEntityState(this, (byte)7);
                    }
                    else
                    {
                        this.playTameEffect(false);
                        this.worldObj.setEntityState(this, (byte)6);
                    }
                }
    
                return true;
            }
    
            return super.interact(par1EntityPlayer);
        }

     

  7. I have just started on a mod that will add at least 51 different items. The problem is, to be kind to other modders, I only want to use up one ID for each of my three different categories of items, (swords, axes, and lances,) one of these categories having 24 different items. As well, each item needs to be breakable. Is it possible to do this? If so, would I need to use only one class for each item, would I have to use a different class for each item, or can I have some items have their own class and have other ones be in the same class?

    Thanks.

  8. ChunkProviderDeeper

     

    package blade.depth;
    
    import java.util.List;
    import java.util.Random;
    
    import net.minecraft.src.Block;
    import net.minecraft.src.BlockSand;
    import net.minecraft.src.Chunk;
    import net.minecraft.src.ChunkPosition;
    import net.minecraft.src.EnumCreatureType;
    import net.minecraft.src.ExtendedBlockStorage;
    import net.minecraft.src.IChunkProvider;
    import net.minecraft.src.IProgressUpdate;
    import net.minecraft.src.MapGenBase;
    import net.minecraft.src.MapGenCaves;
    import net.minecraft.src.MapGenMineshaft;
    import net.minecraft.src.MapGenRavine;
    import net.minecraft.src.MapGenScatteredFeature;
    import net.minecraft.src.MapGenStronghold;
    import net.minecraft.src.MapGenVillage;
    import net.minecraft.src.MathHelper;
    import net.minecraft.src.NoiseGeneratorOctaves;
    import net.minecraft.src.SpawnerAnimals;
    import net.minecraft.src.World;
    import net.minecraft.src.WorldGenDungeons;
    import net.minecraft.src.WorldGenLakes;
    import net.minecraft.src.BiomeGenBase;
    
    public class ChunkProviderDeeper implements IChunkProvider
    {
        private static final BiomeGenBase BiomeGenBase = null;
    
    /** RNG. */
        private Random rand;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen1;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen2;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen3;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen4;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        public NoiseGeneratorOctaves noiseGen5;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        public NoiseGeneratorOctaves noiseGen6;
        public NoiseGeneratorOctaves mobSpawnerNoise;
    
        /** Reference to the World object. */
        private World worldObj;
    
        /** are map structures going to be generated (e.g. strongholds) */
        private final boolean mapFeaturesEnabled;
        private double noiseArray[];
        private double stoneNoise[];
        private MapGenBase caveGenerator;
    
        /** Holds Stronghold Generator */
        private MapGenStronghold strongholdGenerator;
    
        /** Holds Village Generator */
        private MapGenVillage villageGenerator;
    
        /** Holds Mineshaft Generator */
        private MapGenMineshaft mineshaftGenerator;
        private MapGenScatteredFeature field_73233_x;
    
        /** Holds ravine generator */
        private MapGenBase ravineGenerator;
        private BiomeGenBase biomesForGeneration[];
        double noise3[];
        double noise1[];
        double noise2[];
        double noise5[];
        double noise6[];
        float parabolicField[];
        int field_73219_j[][];
    
        public ChunkProviderDeeper(World par1World, long par2, boolean par4)
        {
            stoneNoise = new double[256];
            caveGenerator = new MapGenCaves();
            strongholdGenerator = new MapGenStronghold();
            villageGenerator = new MapGenVillage();//was = new MapGenVillage(0);
            mineshaftGenerator = new MapGenMineshaft();
            field_73233_x = new MapGenScatteredFeature();
            ravineGenerator = new MapGenRavine();
            field_73219_j = new int[32][32];
            worldObj = par1World;
            mapFeaturesEnabled = par4;
            rand = new Random(par2);
            noiseGen1 = new NoiseGeneratorOctaves(rand, 16);
            noiseGen2 = new NoiseGeneratorOctaves(rand, 16);
            noiseGen3 = new NoiseGeneratorOctaves(rand, ;
            noiseGen4 = new NoiseGeneratorOctaves(rand, 4);
            noiseGen5 = new NoiseGeneratorOctaves(rand, 10);
            noiseGen6 = new NoiseGeneratorOctaves(rand, 16);
            mobSpawnerNoise = new NoiseGeneratorOctaves(rand, ;
        }
    
        /**
         * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the
         * temperature is low enough
         */
        public void generateTerrain(int par1, int par2, byte par3ArrayOfByte[])
        {
            byte byte0 = 4;
            byte byte1 = 32;
            int byte2 = 128;
            int i = byte0 + 1;
            byte byte3 = 33;//was 17
            int j = byte0 + 1;
            biomesForGeneration = worldObj.getWorldChunkManager().getBiomesForGeneration(biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, i + 5, j + 5);
            noiseArray = initializeNoiseField(noiseArray, par1 * byte0, 0, par2 * byte0, i, byte3, j);
    
            for (int k = 0; k < byte0; k++)
            {
                for (int l = 0; l < byte0; l++)
                {
                    for (int i1 = 0; i1 < byte1; i1++)
                    {
                        double d = 0.125D;
                        double d1 = noiseArray[((k + 0) * j + (l + 0)) * byte3 + (i1 + 0)];
                        double d2 = noiseArray[((k + 0) * j + (l + 1)) * byte3 + (i1 + 0)];
                        double d3 = noiseArray[((k + 1) * j + (l + 0)) * byte3 + (i1 + 0)];
                        double d4 = noiseArray[((k + 1) * j + (l + 1)) * byte3 + (i1 + 0)];
                        double d5 = (noiseArray[((k + 0) * j + (l + 0)) * byte3 + (i1 + 1)] - d1) * d;
                        double d6 = (noiseArray[((k + 0) * j + (l + 1)) * byte3 + (i1 + 1)] - d2) * d;
                        double d7 = (noiseArray[((k + 1) * j + (l + 0)) * byte3 + (i1 + 1)] - d3) * d;
                        double d8 = (noiseArray[((k + 1) * j + (l + 1)) * byte3 + (i1 + 1)] - d4) * d;
    
                        for (int j1 = 0; j1 < 8; j1++)
                        {
                            double d9 = 0.25D;
                            double d10 = d1;
                            double d11 = d2;
                            double d12 = (d3 - d1) * d9;
                            double d13 = (d4 - d2) * d9;
    
                            for (int k1 = 0; k1 < 4; k1++)
                            {
                                int l1 = k1 + k * 4 << 12 | 0 + l * 4 << 8 | i1 * 8 + j1;
                                int c = 256;//char c = '\200';
                                l1 -= c;
                                double d14 = 0.25D;
                                double d15 = d10;
                                double d16 = (d11 - d10) * d14;
                                d15 -= d16;
    
                                for (int i2 = 0; i2 < 4; i2++)
                                {
                                    if ((d15 += d16) > 0.0D)
                                    {
                                        par3ArrayOfByte[l1 += c] = (byte)Block.stone.blockID;
                                        continue;
                                    }
    
                                    if (i1 * 8 + j1 < byte2)
                                    {
                                        par3ArrayOfByte[l1 += c] = (byte)Block.waterStill.blockID;
                                    }
                                    else
                                    {
                                        par3ArrayOfByte[l1 += c] = 0;
                                    }
                                }
    
                                d10 += d12;
                                d11 += d13;
                            }
    
                            d1 += d5;
                            d2 += d6;
                            d3 += d7;
                            d4 += d8;
                        }
                    }
                }
            }
        }
    
        /**
         * Replaces the stone that was placed in with blocks that match the biome
         */
        public void replaceBlocksForBiome(int par1, int par2, byte par3ArrayOfByte[], BiomeGenBase par4ArrayOfBiomeGenBase[])
        {
        	int byte0 = 128;
            double d = 0.03125D;
            stoneNoise = noiseGen4.generateNoiseOctaves(stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d * 2D, d * 2D, d * 2D);
    
            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[j + i * 16];
                    float f = biomegenbase.getFloatTemperature();
                    int k = (int)(stoneNoise[i + j * 16] / 3D + 3D + rand.nextDouble() * 0.25D);
                    int l = -1;
                    byte byte1 = biomegenbase.topBlock;
                    byte byte2 = biomegenbase.fillerBlock;
    
                    for (int i1 = 255; i1 >= 0; i1--)
                    {
                    	int j1 = (j * 16 + i) * 256 + i1;
    
                        if (i1 <= 0 + rand.nextInt(5))
                        {
                            par3ArrayOfByte[j1] = (byte)Block.bedrock.blockID;
                            continue;
                        }
    
                        byte byte3 = par3ArrayOfByte[j1];
    
                        if (byte3 == 0)
                        {
                            l = -1;
                            continue;
                        }
    
                        if (byte3 != Block.stone.blockID)
                        {
                            continue;
                        }
    
                        if (l == -1)
                        {
                            if (k <= 0)
                            {
                                byte1 = 0;
                                byte2 = (byte)Block.stone.blockID;
                            }
                            else if (i1 >= byte0 - 4 && i1 <= byte0 + 1)
                            {
                                byte1 = biomegenbase.topBlock;
                                byte2 = biomegenbase.fillerBlock;
                            }
    
                            if (i1 < byte0 && byte1 == 0)
                            {
                                if (f < 0.15F)
                                {
                                    byte1 = (byte)Block.ice.blockID;
                                }
                                else
                                {
                                    byte1 = (byte)Block.waterStill.blockID;
                                }
                            }
    
                            l = k;
    
                            if (i1 >= byte0 - 1)
                            {
                                par3ArrayOfByte[j1] = byte1;
                            }
                            else
                            {
                                par3ArrayOfByte[j1] = byte2;
                            }
    
                            continue;
                        }
    
                        if (l <= 0)
                        {
                            continue;
                        }
    
                        l--;
                        par3ArrayOfByte[j1] = byte2;
    
                        if (l == 0 && byte2 == Block.sand.blockID)
                        {
                            l = rand.nextInt(4);
                            byte2 = (byte)Block.sandStone.blockID;
                        }
                    }
                }
            }
        }
    
        /**
         * loads or generates the chunk at the chunk location specified
         */
        public Chunk loadChunk(int par1, int par2)
        {
            return provideChunk(par1, par2);
        }
    
        /**
         * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
         * specified chunk from the map seed and chunk seed
         **/
        /**public Chunk provideChunk(int par1, int par2)
    
        {
            rand.setSeed((long)par1 * 0x4f9939f508L + (long)par2 * 0x1ef1565bd5L);
            byte abyte0[] = new byte[32768];
            generateTerrain(par1, par2, abyte0);
            biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
            replaceBlocksForBiome(par1, par2, abyte0, biomesForGeneration);
            caveGenerator.generate(this, worldObj, par1, par2, abyte0);
            ravineGenerator.generate(this, worldObj, par1, par2, abyte0);
    
            if (mapFeaturesEnabled)
            {
                mineshaftGenerator.generate(this, worldObj, par1, par2, abyte0);
                villageGenerator.generate(this, worldObj, par1, par2, abyte0);
                strongholdGenerator.generate(this, worldObj, par1, par2, abyte0);
                field_73233_x.generate(this, worldObj, par1, par2, abyte0);
            }
    
            Chunk chunk = new Chunk(worldObj, abyte0, par1, par2);
            byte abyte1[] = chunk.getBiomeArray();
    
            for (int i = 0; i < abyte1.length; i++)
            {
                abyte1[i] = (byte)biomesForGeneration[i].biomeID;
            }
    
            chunk.generateSkylightMap();
            return chunk;
        }**/
        /**public Chunk provideChunk(int par1, int par2)
        {
        this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
        byte[] abyte0 = new byte[65536];
        this.generateTerrain(par1, par2, abyte0);
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
        this.replaceBlocksForBiome(par1, par2, abyte0, this.biomesForGeneration);
        this.caveGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.ravineGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        if (this.mapFeaturesEnabled)
        {
        this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.villageGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.strongholdGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        }
        Chunk byte0 = new Chunk(this.worldObj, par1, par2);
        ExtendedBlockStorage[] byte1 = byte0.getBlockStorageArray();
        for (int byte2 = 0; byte2 < 16; ++byte2)
        {
        for (int k = 0; k < 16; ++k)
        {
        for (int byte3 = 0; byte3 < 256; ++byte3)
        {
        byte l = abyte0[byte2 << 12 | k << 8 | byte3];
    
    
        if (l != 0)
        {
        int i1 = byte3 >> 4;
    
        if (byte1[i1] == null)
        {
        byte1[i1] = new ExtendedBlockStorage(i1 << 4);
        }
    
        byte1[i1].setExtBlockID(byte2, byte3 & 15, k, l & 0xff);
        }
        }
        }
        }
        byte0.generateSkylightMap();
        return byte0;
        }**/
        
        public Chunk provideChunk(int par1, int par2)
        {
        this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
        byte[] abyte0 = new byte[65536];
        this.generateTerrain(par1, par2, abyte0);
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
        this.replaceBlocksForBiome(par1, par2, abyte0, this.biomesForGeneration);
        this.caveGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.ravineGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        if (this.mapFeaturesEnabled)
        {
        this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.villageGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        this.strongholdGenerator.generate(this, this.worldObj, par1, par2, abyte0);
        }
        Chunk byte0 = new Chunk(this.worldObj, par1, par2);
        ExtendedBlockStorage[] byte1 = byte0.getBlockStorageArray();
        for (int byte2 = 0; byte2 < 16; ++byte2)
        {
        for (int i = 0; i < 16; ++i)
        {
        for (int byte3 = 0; byte3 < 256; ++byte3)
        {
        byte j = abyte0[byte2 << 12 | i << 8 | byte3];
    
    
        if (j != 0)
        {
        int biomegenbase = byte3 >> 4;
    
        if (byte1[biomegenbase] == null)
        {
        byte1[biomegenbase] = new ExtendedBlockStorage(biomegenbase << 4);
        }
    
        byte1[biomegenbase].setExtBlockID(byte2, byte3 & 15, i, j & 0xff);
        }
        }
        }
        }
        byte0.generateSkylightMap();
        return byte0;
        }
         /** generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the
         * size.
         **/
        private double[] initializeNoiseField(double par1ArrayOfDouble[], int par2, int par3, int par4, int par5, int par6, int par7)
        {
            if (par1ArrayOfDouble == null)
            {
                par1ArrayOfDouble = new double[par5 * par6 * par7];
            }
    
            if (parabolicField == null)
            {
                parabolicField = new float[25];
    
                for (int i = -2; i <= 2; i++)
                {
                    for (int j = -2; j <= 2; j++)
                    {
                        float f = 10F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F);
                        parabolicField[i + 2 + (j + 2) * 5] = f;
                    }
                }
            }
    
            double d = 684.41200000000003D;
            double d1 = 684.41200000000003D;
            noise5 = noiseGen5.generateNoiseOctaves(noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
            noise6 = noiseGen6.generateNoiseOctaves(noise6, par2, par4, par5, par7, 200D, 200D, 0.5D);
            noise3 = noiseGen3.generateNoiseOctaves(noise3, par2, par3, par4, par5, par6, par7, d / 80D, d1 / 160D, d / 80D);
            noise1 = noiseGen1.generateNoiseOctaves(noise1, par2, par3, par4, par5, par6, par7, d, d1, d);
            noise2 = noiseGen2.generateNoiseOctaves(noise2, par2, par3, par4, par5, par6, par7, d, d1, d);
            par2 = par4 = 0;
            int k = 0;
            int l = 0;
    
            for (int i1 = 0; i1 < par5; i1++)
            {
                for (int j1 = 0; j1 < par7; j1++)
                {
                    float f1 = 0.0F;
                    float f2 = 0.0F;
                    float f3 = 0.0F;
                    byte byte0 = 2;
                    BiomeGenBase biomegenbase = biomesForGeneration[i1 + 2 + (j1 + 2) * (par5 + 5)];
    
                    for (int k1 = -byte0; k1 <= byte0; k1++)
                    {
                        for (int l1 = -byte0; l1 <= byte0; l1++)
                        {
                            BiomeGenBase biomegenbase1 = biomesForGeneration[i1 + k1 + 2 + (j1 + l1 + 2) * (par5 + 5)];
                            float f4 = parabolicField[k1 + 2 + (l1 + 2) * 5] / (biomegenbase1.minHeight + 2.0F);
    
                            if (biomegenbase1.minHeight > biomegenbase.minHeight)
                            {
                                f4 /= 2.0F;
                            }
    
                            f1 += biomegenbase1.maxHeight * f4;
                            f2 += biomegenbase1.minHeight * f4;
                            f3 += f4;
                        }
                    }
    
                    f1 /= f3;
                    f2 /= f3;
                    f1 = f1 * 0.9F + 0.1F;
                    f2 = (f2 * 4F - 1.0F) / 8F;
                    double d2 = noise6[l] / 8000D;
    
                    if (d2 < 0.0D)
                    {
                        d2 = -d2 * 0.29999999999999999D;
                    }
    
                    d2 = d2 * 3D - 2D;
    
                    if (d2 < 0.0D)
                    {
                        d2 /= 2D;
    
                        if (d2 < -1D)
                        {
                            d2 = -1D;
                        }
    
                        d2 /= 1.3999999999999999D;
                        d2 /= 2D;
                    }
                    else
                    {
                        if (d2 > 1.0D)
                        {
                            d2 = 1.0D;
                        }
    
                        d2 /= 8D;
                    }
    
                    l++;
    
                    for (int i2 = 0; i2 < par6; i2++)
                    {
                        double d3 = f2;
                        double d4 = f1;
                        d3 += d2 * 0.20000000000000001D;
                        d3 = (d3 * (double)par6) / 16D;
                        double d5 = (double)par6 / 2D + d3 * 4D;
                        double d6 = 0.0D;
                        double d7 = (((double)i2 - d5) * 12D * 128D) / 128D / d4;
    
                        if (d7 < 0.0D)
                        {
                            d7 *= 4D;
                        }
    
                        double d8 = noise1[k] / 512D;
                        double d9 = noise2[k] / 512D;
                        double d10 = (noise3[k] / 10D + 1.0D) / 2D;
    
                        if (d10 < 0.0D)
                        {
                            d6 = d8;
                        }
                        else if (d10 > 1.0D)
                        {
                            d6 = d9;
                        }
                        else
                        {
                            d6 = d8 + (d9 - d8) * d10;
                        }
    
                        d6 -= d7;
    
                        if (i2 > par6 - 4)
                        {
                            double d11 = (float)(i2 - (par6 - 4)) / 3F;
                            d6 = d6 * (1.0D - d11) + -10D * d11;
                        }
    
                        par1ArrayOfDouble[k] = d6;
                        k++;
                    }
                }
            }
    
            return par1ArrayOfDouble;
        }
    
        /**
         * Checks to see if a chunk exists at x, y
         */
        public boolean chunkExists(int par1, int par2)
        {
            return true;
        }
    
        /**
         * Populates chunk with ores etc etc
         */
        public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
        {
            BlockSand.fallInstantly = true;
            int i = par2 * 16;
            int j = par3 * 16;
            BiomeGenBase biomegenbase = worldObj.getBiomeGenForCoords(i + 16, j + 16);
            rand.setSeed(worldObj.getSeed());
            long l = (rand.nextLong() / 2L) * 2L + 1L;
            long l1 = (rand.nextLong() / 2L) * 2L + 1L;
            rand.setSeed((long)par2 * l + (long)par3 * l1 ^ worldObj.getSeed());
            boolean flag = false;
    
            if (mapFeaturesEnabled)
            {
                mineshaftGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
                flag = villageGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
                strongholdGenerator.generateStructuresInChunk(worldObj, rand, par2, par3);
                field_73233_x.generateStructuresInChunk(worldObj, rand, par2, par3);
            }
    
            if (!flag && rand.nextInt(4) == 0)
            {
                int k = i + rand.nextInt(16) + 8;
                int i2 = rand.nextInt(256);
                int i3 = j + rand.nextInt(16) + 8;
                (new WorldGenLakes(Block.waterStill.blockID)).generate(worldObj, rand, k, i2, i3);
            }
    
            if (!flag && rand.nextInt( == 0)
            {
                int i1 = i + rand.nextInt(16) + 8;
                int j2 = rand.nextInt(rand.nextInt(180) + ;
                int j3 = j + rand.nextInt(16) + 8;
    
                if (j2 < 63 || rand.nextInt(10) == 0)
                {
                    (new WorldGenLakes(Block.lavaStill.blockID)).generate(worldObj, rand, i1, j2, j3);
                }
            }
    
            for (int j1 = 0; j1 < 8; j1++)
            {
                int k2 = i + rand.nextInt(16) + 8;
                int k3 = rand.nextInt(128);
                int i4 = j + rand.nextInt(16) + 8;
    
                if (!(new WorldGenDungeons()).generate(worldObj, rand, k2, k3, i4));
            }
    
            new BiomeDecoratorDeeper(biomegenbase).decorate(this.worldObj, this.rand, i, j);//biomegenbase.decorate(worldObj, rand, i, j);
            SpawnerAnimals.performWorldGenSpawning(worldObj, biomegenbase, i + 8, j + 8, 16, 16, rand);
            i += 8;
            j += 8;
    
            for (int k1 = 0; k1 < 16; k1++)
            {
                for (int l2 = 0; l2 < 16; l2++)
                {
                    int l3 = worldObj.getPrecipitationHeight(i + k1, j + l2);
    
                    if (worldObj.isBlockFreezable(k1 + i, l3 - 1, l2 + j))
                    {
                        worldObj.setBlockWithNotify(k1 + i, l3 - 1, l2 + j, Block.ice.blockID);
                    }
    
                    if (worldObj.canSnowAt(k1 + i, l3, l2 + j))
                    {
                        worldObj.setBlockWithNotify(k1 + i, l3, l2 + j, Block.snow.blockID);
                    }
                }
            }
    
            BlockSand.fallInstantly = false;
        }
    
        /**
         * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
         * Return true if all chunks have been saved.
         */
        public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
        {
            return true;
        }
    
        /**
         * Unloads the 100 oldest chunks from memory, due to a bug with chunkSet.add() never being called it thinks the list
         * is always empty and will not remove any chunks.
         */
        public boolean unload100OldestChunks()
        {
            return false;
        }
    
        /**
         * Returns if the IChunkProvider supports saving.
         */
        public boolean canSave()
        {
            return true;
        }
    
        /**
         * Converts the instance data to a readable string.
         */
        public String makeString()
        {
            return "RandomLevelSource";
        }
    
        /**
         * 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 biomegenbase = worldObj.getBiomeGenForCoords(par2, par4);
    
            if (biomegenbase == null)
            {
                return null;
            }
            else
            {
                return biomegenbase.getSpawnableList(par1EnumCreatureType);
            }
        }
        protected BiomeDecoratorDeeper createBiomeDecorator()
        {
            return new BiomeDecoratorDeeper(BiomeGenBase);
        }
        /**
         * Returns the location of the closest structure of the specified type. If not found returns null.
         */
        public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
        {
            if ("Stronghold".equals(par2Str) && strongholdGenerator != null)
            {
                return strongholdGenerator.getNearestInstance(par1World, par3, par4, par5);
            }
            else
            {
                return null;
            }
        }
    
        public int func_73152_e()
        {
            return 0;
        }
    
    @Override
    public int getLoadedChunkCount() {
    	// TODO Auto-generated method stub
    	return 0;
    }
    
    @Override
    public void func_82695_e(int var1, int var2) {
    	// TODO Auto-generated method stub
    
    }
    }
    

     

    The two "todo"s aren't part of generation.

  9. Take a look at BlockMobSpawner and TileEntityMobSpawner

     

    Block

     

     

    package net.minecraft.src;
    
    import cpw.mods.fml.common.Side;
    import cpw.mods.fml.common.asm.SideOnly;
    import java.util.Random;
    
    public class BlockMobSpawner extends BlockContainer
    {
        protected BlockMobSpawner(int par1, int par2)
        {
            super(par1, par2, Material.rock);
        }
    
        /**
         * Returns a new instance of a block's tile entity class. Called on placing the block.
         */
        public TileEntity createNewTileEntity(World par1World)
        {
            return new TileEntityMobSpawner();
        }
    
        /**
         * Returns the ID of the items to drop on destruction.
         */
        public int idDropped(int par1, Random par2Random, int par3)
        {
            return 0;
        }
    
        /**
         * Returns the quantity of items to drop on block destruction.
         */
        public int quantityDropped(Random par1Random)
        {
            return 0;
        }
    
        /**
         * Drops the block items with a specified chance of dropping the specified items
         */
        public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
        {
            super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
            int var8 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15);
            this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8);
        }
    
        /**
         * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two
         * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
         */
        public boolean isOpaqueCube()
        {
            return false;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
         */
        public int idPicked(World par1World, int par2, int par3, int par4)
        {
            return 0;
        }
    }
    

     

     

    Tile Entity

     

     

    package net.minecraft.src;
    
    import cpw.mods.fml.common.Side;
    import cpw.mods.fml.common.asm.SideOnly;
    import java.util.Iterator;
    
    public class TileEntityMobSpawner extends TileEntity
    {
        /** The stored delay before a new spawn. */
        public int delay = -1;
    
        /**
         * The string ID of the mobs being spawned from this spawner. Defaults to pig, apparently.
         */
        private String mobID = "Pig";
    
        /** The extra NBT data to add to spawned entities */
        private NBTTagCompound spawnerTags = null;
        public double yaw;
        public double yaw2 = 0.0D;
        private int minSpawnDelay = 200;
        private int maxSpawnDelay = 800;
        private int spawnCount = 4;
        @SideOnly(Side.CLIENT)
        private Entity spawnedMob;
        private int field_82350_j = 6;
        private int field_82349_r = 16;
        private int field_82348_s = 4;
    
        public TileEntityMobSpawner()
        {
            this.delay = 20;
        }
    
        @SideOnly(Side.CLIENT)
        public String getMobID()
        {
            return this.mobID;
        }
    
        public void setMobID(String par1Str)
        {
            this.mobID = par1Str;
        }
    
        /**
         * Returns true if there is a player in range (using World.getClosestPlayer)
         */
        public boolean anyPlayerInRange()
        {
            return this.worldObj.getClosestPlayer((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D, (double)this.field_82349_r) != null;
        }
    
        /**
         * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
         * ticks and creates a new spawn inside its implementation.
         */
        public void updateEntity()
        {
            if (this.anyPlayerInRange())
            {
                if (this.worldObj.isRemote)
                {
                    double var1 = (double)((float)this.xCoord + this.worldObj.rand.nextFloat());
                    double var3 = (double)((float)this.yCoord + this.worldObj.rand.nextFloat());
                    double var5 = (double)((float)this.zCoord + this.worldObj.rand.nextFloat());
                    this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
                    this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);
    
                    if (this.delay > 0)
                    {
                        --this.delay;
                    }
    
                    this.yaw2 = this.yaw;
                    this.yaw = (this.yaw + (double)(1000.0F / ((float)this.delay + 200.0F))) % 360.0D;
                }
                else
                {
                    if (this.delay == -1)
                    {
                        this.updateDelay();
                    }
    
                    if (this.delay > 0)
                    {
                        --this.delay;
                        return;
                    }
    
                    for (int var11 = 0; var11 < this.spawnCount; ++var11)
                    {
                        Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);
    
                        if (var2 == null)
                        {
                            return;
                        }
    
                        int var12 = this.worldObj.getEntitiesWithinAABB(var2.getClass(), AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand((double)(this.field_82348_s * 2), 4.0D, (double)(this.field_82348_s * 2))).size();
    
                        if (var12 >= this.field_82350_j)
                        {
                            this.updateDelay();
                            return;
                        }
    
                        if (var2 != null)
                        {
                            double var4 = (double)this.xCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double)this.field_82348_s;
                            double var6 = (double)(this.yCoord + this.worldObj.rand.nextInt(3) - 1);
                            double var8 = (double)this.zCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double)this.field_82348_s;
                            EntityLiving var10 = var2 instanceof EntityLiving ? (EntityLiving)var2 : null;
                            var2.setLocationAndAngles(var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);
    
                            if (var10 == null || var10.getCanSpawnHere())
                            {
                                this.writeNBTTagsTo(var2);
                                this.worldObj.spawnEntityInWorld(var2);
                                this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);
    
                                if (var10 != null)
                                {
                                    var10.spawnExplosionParticle();
                                }
    
                                this.updateDelay();
                            }
                        }
                    }
                }
    
                super.updateEntity();
            }
        }
    
        public void writeNBTTagsTo(Entity par1Entity)
        {
            if (this.spawnerTags != null)
            {
                NBTTagCompound var2 = new NBTTagCompound();
                par1Entity.addEntityID(var2);
                Iterator var3 = this.spawnerTags.getTags().iterator();
    
                while (var3.hasNext())
                {
                    NBTBase var4 = (NBTBase)var3.next();
                    var2.setTag(var4.getName(), var4.copy());
                }
    
                par1Entity.readFromNBT(var2);
            }
            else if (par1Entity instanceof EntityLiving && par1Entity.worldObj != null)
            {
                ((EntityLiving)par1Entity).initCreature();
            }
        }
    
        /**
         * Sets the delay before a new spawn (base delay of 200 + random number up to 600).
         */
        private void updateDelay()
        {
            if (this.maxSpawnDelay <= this.minSpawnDelay)
            {
                this.delay = this.minSpawnDelay;
            }
            else
            {
                this.delay = this.minSpawnDelay + this.worldObj.rand.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
            }
    
            this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType().blockID, 1, 0);
        }
    
        /**
         * Reads a tile entity from NBT.
         */
        public void readFromNBT(NBTTagCompound par1NBTTagCompound)
        {
            super.readFromNBT(par1NBTTagCompound);
            this.mobID = par1NBTTagCompound.getString("EntityId");
            this.delay = par1NBTTagCompound.getShort("Delay");
    
            if (par1NBTTagCompound.hasKey("SpawnData"))
            {
                this.spawnerTags = par1NBTTagCompound.getCompoundTag("SpawnData");
            }
            else
            {
                this.spawnerTags = null;
            }
    
            if (par1NBTTagCompound.hasKey("MinSpawnDelay"))
            {
                this.minSpawnDelay = par1NBTTagCompound.getShort("MinSpawnDelay");
                this.maxSpawnDelay = par1NBTTagCompound.getShort("MaxSpawnDelay");
                this.spawnCount = par1NBTTagCompound.getShort("SpawnCount");
            }
    
            if (par1NBTTagCompound.hasKey("MaxNearbyEntities"))
            {
                this.field_82350_j = par1NBTTagCompound.getShort("MaxNearbyEntities");
                this.field_82349_r = par1NBTTagCompound.getShort("RequiredPlayerRange");
            }
    
            if (par1NBTTagCompound.hasKey("SpawnRange"))
            {
                this.field_82348_s = par1NBTTagCompound.getShort("SpawnRange");
            }
        }
    
        /**
         * Writes a tile entity to NBT.
         */
        public void writeToNBT(NBTTagCompound par1NBTTagCompound)
        {
            super.writeToNBT(par1NBTTagCompound);
            par1NBTTagCompound.setString("EntityId", this.mobID);
            par1NBTTagCompound.setShort("Delay", (short)this.delay);
            par1NBTTagCompound.setShort("MinSpawnDelay", (short)this.minSpawnDelay);
            par1NBTTagCompound.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay);
            par1NBTTagCompound.setShort("SpawnCount", (short)this.spawnCount);
            par1NBTTagCompound.setShort("MaxNearbyEntities", (short)this.field_82350_j);
            par1NBTTagCompound.setShort("RequiredPlayerRange", (short)this.field_82349_r);
            par1NBTTagCompound.setShort("SpawnRange", (short)this.field_82348_s);
    
            if (this.spawnerTags != null)
            {
                par1NBTTagCompound.setCompoundTag("SpawnData", this.spawnerTags);
            }
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * will create the entity from the internalID the first time it is accessed
         */
        public Entity getMobEntity()
        {
            if (this.spawnedMob == null)
            {
                Entity var1 = EntityList.createEntityByName(this.getMobID(), (World)null);
                this.writeNBTTagsTo(var1);
                this.spawnedMob = var1;
            }
    
            return this.spawnedMob;
        }
    
        /**
         * Overriden in a sign to provide the text.
         */
        public Packet getDescriptionPacket()
        {
            NBTTagCompound var1 = new NBTTagCompound();
            this.writeToNBT(var1);
            return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, var1);
        }
    
        /**
         * Called when a client event is received with the event number and argument, see World.sendClientEvent
         */
        public void receiveClientEvent(int par1, int par2)
        {
            if (par1 == 1 && this.worldObj.isRemote)
            {
                this.delay = this.minSpawnDelay;
            }
        }
    }
    

     

     

    Check out these two functions

     

    anyPlayerInRange()

     

    public boolean anyPlayerInRange()
        {
            return this.worldObj.getClosestPlayer((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D, (double)this.field_82349_r) != null;
        }

     

     

    updateEntity()

     

       /**
         * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
         * ticks and creates a new spawn inside its implementation.
         */
        public void updateEntity()
        {
            if (this.anyPlayerInRange())
            {
                if (this.worldObj.isRemote)
                {
                    double var1 = (double)((float)this.xCoord + this.worldObj.rand.nextFloat());
                    double var3 = (double)((float)this.yCoord + this.worldObj.rand.nextFloat());
                    double var5 = (double)((float)this.zCoord + this.worldObj.rand.nextFloat());
                    this.worldObj.spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D);
                    this.worldObj.spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D);
    
                    if (this.delay > 0)
                    {
                        --this.delay;
                    }
    
                    this.yaw2 = this.yaw;
                    this.yaw = (this.yaw + (double)(1000.0F / ((float)this.delay + 200.0F))) % 360.0D;
                }
                else
                {
                    if (this.delay == -1)
                    {
                        this.updateDelay();
                    }
    
                    if (this.delay > 0)
                    {
                        --this.delay;
                        return;
                    }
    
                    for (int var11 = 0; var11 < this.spawnCount; ++var11)
                    {
                        Entity var2 = EntityList.createEntityByName(this.mobID, this.worldObj);
    
                        if (var2 == null)
                        {
                            return;
                        }
    
                        int var12 = this.worldObj.getEntitiesWithinAABB(var2.getClass(), AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double)this.xCoord, (double)this.yCoord, (double)this.zCoord, (double)(this.xCoord + 1), (double)(this.yCoord + 1), (double)(this.zCoord + 1)).expand((double)(this.field_82348_s * 2), 4.0D, (double)(this.field_82348_s * 2))).size();
    
                        if (var12 >= this.field_82350_j)
                        {
                            this.updateDelay();
                            return;
                        }
    
                        if (var2 != null)
                        {
                            double var4 = (double)this.xCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double)this.field_82348_s;
                            double var6 = (double)(this.yCoord + this.worldObj.rand.nextInt(3) - 1);
                            double var8 = (double)this.zCoord + (this.worldObj.rand.nextDouble() - this.worldObj.rand.nextDouble()) * (double)this.field_82348_s;
                            EntityLiving var10 = var2 instanceof EntityLiving ? (EntityLiving)var2 : null;
                            var2.setLocationAndAngles(var4, var6, var8, this.worldObj.rand.nextFloat() * 360.0F, 0.0F);
    
                            if (var10 == null || var10.getCanSpawnHere())
                            {
                                this.writeNBTTagsTo(var2);
                                this.worldObj.spawnEntityInWorld(var2);
                                this.worldObj.playAuxSFX(2004, this.xCoord, this.yCoord, this.zCoord, 0);
    
                                if (var10 != null)
                                {
                                    var10.spawnExplosionParticle();
                                }
    
                                this.updateDelay();
                            }
                        }
                    }
                }
    
                super.updateEntity();
            }
        }
    

     

  10. Well, I guess you could sumulate it, in a way.

    Here is the code that makes the enderman check if a player is wearing a pumpkin:

     

     

        /**
         * Checks to see if this enderman should be attacking this player
         */
        private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer)
        {
            ItemStack var2 = par1EntityPlayer.inventory.armorInventory[3];
    
            if (var2 != null && var2.itemID == Block.pumpkin.blockID)
            {
                return false;
            }
            else
            {
                Vec3 var3 = par1EntityPlayer.getLook(1.0F).normalize();
                Vec3 var4 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX - par1EntityPlayer.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - (par1EntityPlayer.posY + (double)par1EntityPlayer.getEyeHeight()), this.posZ - par1EntityPlayer.posZ);
                double var5 = var4.lengthVector();
                var4 = var4.normalize();
                double var7 = var3.dotProduct(var4);
                return var7 > 1.0D - 0.025D / var5 ? par1EntityPlayer.canEntityBeSeen(this) : false;
            }
        }

     

     

    You could add something that checks if the player is wearing a specific armour piece every few seconds, and give them a potion effect if they are wearing it.

  11. Still in the process of changing all this to Forge-forum stuff, but hopefully all the BBCode works.

     

    I made this mod for Owen9456 of Minecraft Forums after he posted this:

    How hard would it to be, say, make the limit of depth in minecraft higher so that we can dig/go deeper beneath the service? Or is it possible to change the 'ground' level of minecraft to be higher and thus have more depth? Just curious, I'm wondering if its even possible. It would be nice to be able to go deeper in minecraft, I always found the depths of minecraft to be a bit small.

    I opted for the second choice-- changing the ground level of the world. As it turned out, that was harder than I thought, and it took alot of help, but I soon completed everything needed: Ores are at the correct heights, and the height level is doubled from original minecraft.

     

    LEGAL

     

    This document is Copyright © and is the intellectual

    property of the author. Only Minecraftforum.net and http://www.minecraftforge.net is able to host any of my material without my consent. It may not be placed on any web site or otherwise distributed publicly without advance written permission. If you mirror this mod page or anything I've made on any other site without crediting me, I(Blade Avuari/Soandso2) may express my angst at you in the form of a lawsuit.

     

     

    Version Notes

     

    ALPHA
    v0.1 Started mod
    v0.3 Edited "World Type" Class File
    v0.3.1 Eateded Cookie Files
    v0.5 Set up the class file for the new world type
    v0.7 Fixed layering glitches
    v0.9 Squashed bugs
    BETA
    v1.0.0 Touched up mod, Released as open beta
    v1.1.0 Now does not modify any other class files
    V1.2.0 Total rebuild of mod, now has everything that is needed to count as 'Ready'
    V1.3.0 Supposed to work with forge (it didn't)
    V1.3.1 Added the mcmod.info file, which fixed the problem
    

     

     

    The mod!

     

    This mod requires modloader to work!

    It is placed in the mods folder to work.

    Found at:

    http://www.mediafire...63t78mlyl55p4h1

    It uses Forge, which you can get here:

    Main Forge Download June 13th

    Old versions:

     

     

     

     

    Images

     

     

     

    How to install the mod:

     

    1. Download both the mod and forge.

    2. Get to the .minecraft folder (which can be done by going to texture packs then "Texture Pack Folder," then going up one folder to '.minecraft'

    3. Go to 'Bin"

    4. Add forge to the Minecraft.jar; Delete META-INF!

    5. Run minecraft

    6. Close minecraft, and go to the mods folder in .minecraft

    7. Add the mod's zip folder to .minecraft

     

     

    To do:

     

     

    Done:

    Post Mod

    Make it not modify any class files

    Change ore gen locations

    Change sea level to 127 instead of 95

    Make it work in mods folder

     

    Not done:

    Add a reason to dig deeper!

    Make the mod work in SMP

    Add Large Biomes version

    Create an API for other mods to make their ores gen in DD

     

     

    I can't give enough credit to Volgon8, who really DID everything that was done in the mod. Please try his mod at the below banner to check out the mod which let this one become what it is.MZsXI.png

×
×
  • Create New...

Important Information

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