• 0

    posted a message on How do I make my block drop two things? PLEASE HELP!!
    You are bump spamming....some of my threads never get replies and I don't resort to constantly replying to it. As well your not always going to get a straight up answer, your going to have to learn how to go through the original source and figure out what does what and then apply that to your mods. Not only that but when you do tutorials you should always read and try and figure out what exactly every line of code does, if you did you would at least be able to answer your second question.

    Fortunately I'm going to help you, but I doubt I'll you'll ever get much help again if you post a thread and bump spam it constantly.

    First, I'm going to answer your second question.

    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random) //This tells the game which item should be dropped when the block is mined, this is limited to one item.
        {
           return A.B.C;
        }
        public int quantityDropped(Random random) //This tells the game the amount of the item that should be dropped when the block is mined
        {
                return 1; //This would drop 1
        }
    }
    
    A = If the drop is in the original game and is an item, A would be Item. If the drop is in the original game and is a block, A would be Block. If the drop is in my mod, it would be mod_Namehere.
    B = The name of the item/block you want to drop.
    C = If what you want to drop is an item, this would be shiftedIndex. If what you want to drop is a block, this would be blockID.


    So just a quick clarification because that might be confusing. Say I want the block to drop an item I created for my mod and I named it ItemA. Let's also say that my mod's class/constructor is called mod_Stuff, the block code would look like this:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Stuff.ItemA.shiftedIndex;
        }
        public int quantityDropped(Random random)
        {
                return 1;
        }
    }


    Now let's say I wanted to drop an item from the original game, in this case it will be a dirt block. If so my block file would look like this:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return Block.dirt.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 1;
        }
    }


    Now on to your first question. Now the way I do it may not be the best way but so far it's the way I've gotten to work.
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return A.B.C; //The first item/block you would like to drop
        }
        public int quantityDropped(Random random)
        {
                return 1; //How many of the first item/block you would like to drop
        }
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
            float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(A.:cool.gif:); 
    //A = if drop is a block, this would be Block, if it is an item, this would be Item.
    //B = the item/block name.
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    
        }
    
    }


    Hope that helps, I kind of rushed through it but I do have a tutorial located here that shows you how to make a block that drops a random item a random amount of times and I think you might be able to learn something from it.
    Posted in: Modification Development
  • 0

    posted a message on Coding Help
    Now post the error log, just looking at the code my guess would be maybe the fact that your AddRecipe is blank.
    Posted in: Modification Development
  • 0

    posted a message on Help with error
    The source code would be helpful, that way we can actually see what you did. But with what you provided all I can say is that from reading this line:
    at net.minecraft.src.BlockFlamestoneOre.<init>(BlockFlamestoneOre.java:10)


    That there is most likely something wrong in BlockFlamestoneOre.java around line 10, so double check that area and see if you can find any mistakes.
    Posted in: Modification Development
  • 0

    posted a message on Block Help
    Quote from Bakker

    Hello I need help with me block how would I make my block drop two different Items random maybe it would drop this time but it would drop the other time kinda deal. Can anyone help?


    Something like this would work:
    package net.minecraft.src;
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    	public BlockTest(int i, int j)
    	{
    		super(i,j,Material.ground);
    	}
    	public int idDropped(int i, Random random)
    	{
                    int x = random.NextInt(1);
                    if (x == 0) { return A.B.C }
                    if (x == 1) { return A.B.C }
                    else { return A.B.C }
    	}
    	public int quantityDropped(Random random)
    	{
    		return 1;
    	}
            private int x;
    }
    
    A = Prefix, if drop is a block, A would be Block. If A is an item, it would be Item.
    B = Item/Block name of drop.
    C = If drop is a block, this would be .blockID. If drop is an item, this would be .shiftedIndex.


    Now I'm not a 100% comfortable with java's random function, but to my knowledge it generates between 0 and whatever you put in random.NextInt(x). Also I put else's when using if commands just to be on the safe side, more of a personal preference I suppose.
    Posted in: Modification Development
  • 0

    posted a message on Crafting Recipe Crash!!
    ModLoader.AddRecipe(new ItemStack(mod_Lamp.lamp, 1), new Object[] {
    " # ", "#X#", "$%$", Character.valueOf('#'), Block.glass.blockID, Character.valueOf('X'), Block.torchWood.blockID, Character.valueOf('$'), Item.ingotIron.shiftedIndex, Character.valueOf('%'), Block.redstoneWire.blockID 
                    });


    When referring items/blocks in recipes, there is no need to get the ID. So first remove .blockID from each entry and remove .shiftedIndex as well. Also, your recipe won't work because you can't use Block.redstoneWire, when redstone is in your inventory it's referred to as, might want to double check, Item.redstone. Last, you don't need mod_Lamp.lamp, just the name of the item/block which would be lamp.

     ModLoader.AddRecipe(new ItemStack(lamp, 1), new Object[] {
    " # ", "#X#", "$%$", Character.valueOf('#'), Block.glass, Character.valueOf('X'), Block.torchWood, Character.valueOf('$'), Item.ingotIron, Character.valueOf('%'), Block.redstone 
    });
    Posted in: Modification Development
  • 0

    posted a message on [Block Mod] Java Error Help
    I believe it's because your block ID is too high. I think the limit on blocks atm is a max ID of 250(somewhere around there, not exactly sure atm), so try lowering the block ID significantly.
    Posted in: Modification Development
  • 0

    posted a message on mod Error help.
    Quote from Monkey2334

    Ok I have a error with this bit of my mod, what should I do?

    public mod_Block()

    Then the error is


    src/minecraft/net/minecraft/src/mod_Shadow.java:14: invalid method declaration; return type required
    public mod_Block()
    ^


    1) You should always use the {code}{/code} tags(replace {}'s with []'s) when displaying code and errors.
    2) You should provide the source code so we can help, sometimes the error can occur before or after the line the recompiler gives.


    If in your mod_Shadow.java file, you have something like this:
    package net.minecraft.src;
    
    public class mod_Shadow extends BaseMod
    {
          public mod_Block()
          {
          }
          public String Version()
          {
          }
    }


    If this is true change mod_Block to mod_Shadow as well. When using constructors, it has to match the class name otherwise it requires a return type.
    Posted in: Modification Development
  • 0

    posted a message on [1.8.1] Some Turtle's *Not your average tutorials*
    Quote from DjGyarados

    Oh thank god, I've been looking all over the place for how to tame/ride and cannot find a single one, could you please pm me when you're done making the tut?
    Thank you so much.


    I'll do my best but no promises, most of the things I'm doing are going to pertain to my modding interest, atm the I'm trying to make custom work benches as well as special chests.

    In the meantime you should defiantly look into it yourself, check out the files in the original source relating to the wolf.
    Posted in: Tutorials
  • 1

    posted a message on [1.8.1] Some Turtle's *Not your average tutorials*
    Quote from DjGyarados

    Can you make a tutorial for taming+riding mobs and probably how to create a mob for people that don't know.


    I could look into taming/riding mobs but there are an overabundance of creating a mob tutorials. Thanks for your feedback!
    Posted in: Tutorials
  • 0

    posted a message on @Override Questions
    Quote from nerd-boy

    @Override tells the java compiler that you are rewriting the code for a method you are inheriting from (the parent class you are extending from).

    So in this example, the parent class is BaseMod. The compiler is throwing back an error because BaseMod doe not contain the method getBlockReachDistance().

    You don't actually NEED the @Override annotation, it is always good practice for 2 reasons
    A: easier makes it easier to follow your code (i.e. you know you overriden this method)
    B: compiler checks such as the one you got (to make sure you are actually overridding what you thought)

    hope that helps

    nerd-boy


    Thank you for your response and your explanation, it does help a little bit. Now my question is how would I go about editing this method then without touching the original files? Or is this not possible?

    I'll play around with some concepts to see if I can get it before a response but any help is appreciated.
    Posted in: Modification Development
  • 0

    posted a message on @Override Questions
    So I've been wanting to edit more and more of Minecraft without touching the base files but as of right now I'm stuck.

    I'm curious what are the uses of @Override and what are it's limitations?

    Recently I tried to use @Override to hopefully change a method getBlockReachDistance() within PlayerControllerSP.java.

    I tried this:
    package net.minecraft.src;
    
    public class mod_HermesBoots extends BaseMod
    {
    	public mod_HermesBoots()
    	{	
    	}
    	
    	public String Version()
    	{
    		return "Hermes Boots v1";
    	}
    	
    	@Override
            public float getBlockReachDistance()
            {
                     return 4F;
            }
    }


    And received this error:
    Method does not override or implement a method from a supertype


    It was a shot in the dark so I might have misinterpreted the uses of @Override, but any help would be appreciated.
    Posted in: Modification Development
  • 0

    posted a message on [1.8.1] [Creating Mods] Minecraft Forge Tutorials
    Quote from cheesy919

    ****IN HAPPY?


    This comment alone makes me want to ignore everything you've posted, he made a valid request and even included please and yet you had to respond like you did?

    It's only expected for you to use code tags because it looks better and makes it easier to read.
    Posted in: Tutorials
  • 0

    posted a message on Error at startclient? [UNANSWERED]
    Quote from XAwsomoX

    I know this is probably a common question but after I get finished coding and recompiling (Perfectly) I excitedly try to run Minecraft (Through MCP) and it fails :sad.gif:
    If you want I will upload the crash (If I can get to it before it closes...)



    After you run recompile.bat, run startclient.bat. This will allow you to read/copy and paste the error that is causing Minecraft to crash.
    Posted in: Modification Development
  • 1

    posted a message on [1.8.1] Some Turtle's *Not your average tutorials*
    I decided to make this my personal place to deposit tutorials, I've added two tutorials, one about adding new fuels(more descriptive I personally think then most) plus my randomized drop/drop type tutorials(which is also on Mad's Modding Thread).
    Posted in: Tutorials
  • 0

    posted a message on NPC size help?
    I have even bothered to scratch the surface when it comes to NPCs but I'm guessing you can find your answer within RenderPlayer.java.

    It's going to take some backtracking and jumping around, but I assume the information is in there(I did a quick search for glScale and there are 3 entries).

    Hope this helps.
    Posted in: Modification Development
  • To post a comment, please or register a new account.