Posted January 20, 201312 yr Hello. I got Some problems with my Block Drops. File: package spmod.tools.src.blocks; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.Material; public class BlockCustomDirt extends Block { public BlockCustomDirt(int par1, int par2) { super(par1, par2, Material.ground); this.setHardness(0.5F); } public int idDropped(int par1, Random par2Random, int par3, EntityPlayer par4) { ItemStack par5 = par4.getCurrentEquippedItem(); if(par5 != null && par5.itemID == Item.stick.shiftedIndex) { return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID; } else { return this.blockID; } } } But it do not Drop Flint. What do i do wrong?
January 20, 201312 yr Did you tried to add messages to check what is going in the code? System.out.println("This will appear in the console."); Do you know what the par3 mean in the idDropped() ? Btw,the problem could be at par2Random.nextInt(10 - par3 * 3). Check the Minecraft's source next time. (BlockGravel) Add this snippet if (par3 > 3) { par3 = 3; } before return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID;
January 20, 201312 yr Author When i copy the code from gravel and paste it in my customdirt than it do drop flint. But the thing what does not work when i write the if(he has a stick in his hand) than he only drops dirt nothing else. same as change it (than he would drop only flint and sometimes dirt. but that didn't work too. and no i do not know what par3 means. par1 is for the metadata but par3 idk. befor i send this answer i tell you what i want to do. Gravel is very rare at minecraft (At the start). And my mod do need it at the start so without you are stuck. To help the player i want that when the player holds a stick in his hand and mines dirt than he has a chance to get flint, and when i paste the gravelcode. and a technic moduser use my mod he has to much flint because a quarry mines everything.
January 21, 201312 yr Author The code did not work. with this i override the dirt: Block.blockslist[3] = null; Block.blockslist[3] = new BlockCustomDirt(3, 2).setBlockName("dirt"); Here my code of the dirt package spmod.tools.src.blocks; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.Material; public class BlockCustomDirt extends Block { public BlockCustomDirt(int par1, int par2) { super(par1, par2, Material.ground); this.setHardness(0.5F); } public int idDropped(int par1, Random par2Random, int par3, EntityPlayer par4) { ItemStack par5 = par4.getCurrentEquippedItem(); //to change to inventory didnt bring anything if(par5 != null && par5.itemID == Item.stick.shiftedIndex) { return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID; } else { return this.blockID; } } }
January 21, 201312 yr Author I am at version 1.2.5 not 1.3.2 or 1.4.6 How Can make it to drop something else than dirt when the player hold a stick in his hand.
January 21, 201312 yr Author Ill change my workspace to 1.3.2 at the 1.2.2013. But every event what forge add comes from the minecraft source and this is compatible to the most versions. Try to use my code and finish it please. And please try to use only minecraft and no forge.
January 21, 201312 yr Author English is not my motherlanguage. I do not have the knowlegde to tell what i want to tell. My mod tries to hold it self*. *Does not need other mods and apis And only 5 things does my mod uses from forge. 1st: Config File 2nd: Texture Provider 3rd: Furnace Recipes 4th: CraftDamage (Crafting Handler) 5th: ToolClass
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.