Posted February 19, 201312 yr I want to make hoes which are already in Minecraft a new type of tool that can accelerate the gathering of certain blocks. In this case, straw. Here's my main code: package xergz.minecraft.medievalCivilization; import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "XergzMedievalCivilization", name = "Medieval Civilization", version = "Alpha 1.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class MedievalCivilization { public static final Block straw = new BlockStraw(3000, 0, Material.cloth) .setHardness(0.8F).setStepSound(Block.soundGrassFootstep) .setBlockName("Straw").setCreativeTab(CreativeTabs.tabBlock); // The instance of your mod that Forge uses. @Instance("XergzMedievalCivilization") public static MedievalCivilization instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide = "xergz.minecraft.medievalCivilization.client.ClientProxy", serverSide = "xergz.minecraft.medievalCivilization.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event){ // Stub Method } @Init public void load(FMLInitializationEvent event){ proxy.registerRenderers(); MinecraftForge.setToolClass(Item.hoeWood, "hoe", 0); MinecraftForge.setToolClass(Item.hoeStone, "hoe", 1); MinecraftForge.setToolClass(Item.hoeSteel, "hoe", 2); MinecraftForge.setToolClass(Item.hoeGold, "hoe", 2); MinecraftForge.setToolClass(Item.hoeDiamond, "hoe", 3); GameRegistry.registerBlock(straw, "Straw"); LanguageRegistry.addName(straw, "Straw"); MinecraftForge.setBlockHarvestLevel(straw, "hoe", 0); ItemStack wheatStack = new ItemStack(Item.wheat); ItemStack strawStack = new ItemStack(straw); GameRegistry.addShapelessRecipe(strawStack, wheatStack, wheatStack, wheatStack, wheatStack, wheatStack, wheatStack, wheatStack, wheatStack, wheatStack); } @PostInit public void postInit(FMLPostInitializationEvent event){ // Stub Method } } And here's my block code if ever you need it. package xergz.minecraft.medievalCivilization; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BlockStraw extends Block { public BlockStraw(int id, int texture, Material material){ super(id, texture, material); } @Override public String getTextureFile(){ return CommonProxy.BLOCK_PNG; } } There is no mistake when I run it, but hoes don't accelerate the gathering of straw blocks... If anyone can explain me what I'm missing in this I'd be very thankful. Each day's a gift and not a given right, so live them all like your last.
February 19, 201312 yr I'm not sure since I'm on my mobile right now but I think in your hoe class you should add a method that you can find in Item.java. Not completely sure what it was called but I think it was getStrengthVsBlock(some stuff here) and I think you can then return that it is stronger when it hits your block.
February 19, 201312 yr Author But ain't that method just returning the strength of the item? I can't modify that strenght using this... Or if I can't I don't know how. Each day's a gift and not a given right, so live them all like your last.
February 19, 201312 yr Are you trying to make a new item or do you want the existing hoes to be better and stronger ect?
February 19, 201312 yr Author I want the existing hoes to be better to mine a block I've created. Each day's a gift and not a given right, so live them all like your last.
February 19, 201312 yr Findthis package in eclipse asuming your useing that: net.minecraft.item And open up the file called EnumToolMaterial. This is were the tools power comes from. read the NOTES under the materiel types and you should be able to change the existing tools power and durability. If you need help doing that just ask.
February 20, 201312 yr Author It wouldn't work since if I change the material strength it won't just make hoes stronger against a specific block, it's going to make every tool stronger against all blocks. And if I change that it could create incompatibilities with other mod. I'd know how to do it, but I'd have to modify the ItemHoe class which would, again, create possible incompatibilities... I want to make it without creating any incompatibilities. Each day's a gift and not a given right, so live them all like your last.
February 20, 201312 yr There is a thing called enum helper which lets you make a material in 1 line of code, you should look into it "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
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.