Results 1 to 2 of 2
  1. #1
    Physcadelic's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Australia <3
    Posts
    4,450
    Reputation
    323
    Thanks
    828
    My Mood
    Breezy

    Basic Modding : Stage 2

    Trying to do this without reading my other tutorial is like trying to teach a baby algebra - you can't substitute numbers with letters if you don't know what those letters and numbers are. You can find my first tutorial here.

    So you can change obvious variables..well done. You know have the mental capacity of a 10 year old. But wait..you are not clever enough to start adding you own code...but you are too clever to change easy variables. Let's show you some different variables you can mod giving you a much more satisfying result.

    Let's show you guys cooler operations you can achieve. Firstly, I will show you how to make Creeper explosions either bigger or smaller. Then, I will show you how to make eggs spawn the mob of your choice instead of those annoying chickens. (Does this ring a bell anyone?)

    Let's start with those Creepers!
    Obviously you are going to open EntityCreeper. Remember, we open all our files with Notepad++, or the editor of your choice. I wonder if you can find the piece of code that controls the force of a explosion..
    Code:
    package net.minecraft.src;
    // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
    // Jad home page: https://www.kpdus.com/jad.html
    // Decompiler options: packimports(3) braces deadcode 
    
    import java.util.Random;
    
    public class EntityCreeper extends EntityMobs
    {
    
        public EntityCreeper(World world)
        {
            super(world);
            texture = "/mob/creeper.png";
        }
    
        protected void entityInit()
        {
            super.entityInit();
            dataWatcher.addObject(16, Byte.valueOf((byte)-1));
        }
    
        public void writeEntityToNBT(NBTTagCompound nbttagcompound)
        {
            super.writeEntityToNBT(nbttagcompound);
        }
    
        public void readEntityFromNBT(NBTTagCompound nbttagcompound)
        {
            super.readEntityFromNBT(nbttagcompound);
        }
    
        public void onUpdate()
        {
            lastActiveTime = timeSinceIgnited;
            if(worldObj.multiplayerWorld)
            {
                int i = func_21091_q();
                if(i > 0 && timeSinceIgnited == 0)
                {
                    worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F);
                }
                timeSinceIgnited += i;
                if(timeSinceIgnited < 0)
                {
                    timeSinceIgnited = 0;
                }
                if(timeSinceIgnited >= 30)
                {
                    timeSinceIgnited = 30;
                }
            }
            super.onUpdate();
        }
    
        protected String getHurtSound()
        {
            return "mob.creeper";
        }
    
        protected String getDeathSound()
        {
            return "mob.creeperdeath";
        }
    
        public void onDeath(Entity entity)
        {
            super.onDeath(entity);
            if(entity instanceof EntitySkeleton)
            {
                dropItem(Item.record13.shiftedIndex + rand.nextInt(2), 1);
            }
        }
    
        protected void attackEntity(Entity entity, float f)
        {
            int i = func_21091_q();
            if(i <= 0 && f < 3F || i > 0 && f < 7F)
            {
                if(timeSinceIgnited == 0)
                {
                    worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F);
                }
                func_21090_e(1);
                timeSinceIgnited++;
                if(timeSinceIgnited >= 30)
                {
                    worldObj.createExplosion(this, posX, posY, posZ, 3F);
                    setEntityDead();
                }
                hasAttacked = true;
            } else
            {
                func_21090_e(-1);
                timeSinceIgnited--;
                if(timeSinceIgnited < 0)
                {
                    timeSinceIgnited = 0;
                }
            }
        }
    
        public float func_440_b(float f)
        {
            return ((float)lastActiveTime + (float)(timeSinceIgnited - lastActiveTime) * f) / 28F;
        }
    
        protected int getDropItemId()
        {
            return Item.gunpowder.shiftedIndex;
        }
    
        private int func_21091_q()
        {
            return dataWatcher.getWatchableObjectByte(16);
        }
    
        private void func_21090_e(int i)
        {
            dataWatcher.updateObject(16, Byte.valueOf((byte)i));
        }
    
        int timeSinceIgnited;
        int lastActiveTime;
    }
    That's right!
    Code:
    worldObj.createExplosion(this, posX, posY, posZ, 3F);
                    setEntityDead();
    Now what is going to create that explosion?! There's the piece of code that actually tells Minecraft it wants this mob to explode, then it tells where you want the explosion and finally it tells it to kill the Entity after it explodes. Wait..I missed something.. That '3F'. What could that mean? A F (Float) is a function used in lots of Java coding. Read more about float functions here. It's not really important now. All we know is that float is the thing that controls those pesky Creeper explosions. Increase or decrease to suit you! DON'T GO ANYTHING PAST 10, OR IT WILL JUST CREATE A HUGE HOLE AND KILL YOU INSTANTLY.

    Now let's start with those eggs.
    Obviously, we open EntityEgg. I am not going to go through all that shit, just find this
    Code:
     EntityChicken entitychicken = new EntityChicken(worldObj);
                        entitychicken.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);
                        worldObj.entityJoinedWorld(entitychicken);
    This part really isn't hard. Seriously, you should know how to make it change to the entity of your choice. -Sigh- , replace all the parts that say chicken to any mob. You can choose from : Cow, Creeper, Fish, Ghast, Pig, PigZombie, Sheep, Slime, Zombie, Spider, Skeleton, Squid or Wolf.


    I hope you guys enjoy your new mod(s)!

    DISCLAIMER: Yes, you just made a mod. Congrats. Pat yourself on the back. This Doesn't mean you have to make a new thread just to show you can follow a tutorial. Please. The Minecraft section will take a turn for the worst if we continue to live our lives un-minioned. You are not making it any better by making a new thread for every mod you make.


    These tutorials are time consuming. If you want me to continue writing Minecraft tutorials, please thank and/or rep. It is not necessary, but it is appreciated. I guarantee it won't take half the time it took me to write this paragraph.
    Last edited by Physcadelic; 04-12-2011 at 01:31 AM.

    R.I.P a great GM




    Quote Originally Posted by Assalamu alaikum View Post
    what? maybe stop talk with riddles and with words i am not even know.

  2. The Following 8 Users Say Thank You to Physcadelic For This Useful Post:

    dimy (04-22-2011),dylankrajewski (07-19-2011),ewok11 (04-16-2011),FullStatic (04-12-2011),joquelekok (09-05-2011),pwnagebeef (10-09-2011),[MPGH]Thunder (04-16-2011),XxprokillahxX (04-20-2011)

  3. #2
    FullStatic's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Minecraft Section
    Posts
    935
    Reputation
    -41
    Thanks
    55
    My Mood
    Aggressive
    Thanks for this mate.
    reading it now and ill try them
    (You were my insration with your sexy thread)