Posted September 13, 20196 yr Hey all! So I'm trying to add tools based on what I learned from a tutorial. Other code in github repo here SO this work for regular items Spoiler package com.majicmaj.majcraft.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class AdamantineOre extends Block{ public AdamantineOre() { super(Properties.create(Material.IRON) .sound(SoundType.METAL) .hardnessAndResistance(5.0f) //.lightValue(14) .harvestLevel(2) .harvestTool(ToolType.PICKAXE) ); setRegistryName("adamantine_ore"); } } Would you say this is an acceptable way of making a pickaxe? How can I make it better/refactor it? also, if this is the right way, how would you added the repair ingredient? Spoiler package com.majicmaj.majcraft.items; import com.majicmaj.majcraft.Majcraft; import com.majicmaj.majcraft.blocks.ModBlocks; import net.minecraft.block.material.Material; import net.minecraft.item.IItemTier; import net.minecraft.item.Item; import net.minecraft.item.PickaxeItem; import net.minecraft.item.TieredItem; import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.common.ToolType; public class AdamantinePickaxe extends PickaxeItem{ public AdamantinePickaxe() { super(new IItemTier() { @Override public Ingredient getRepairMaterial() { return null; } @Override public int getMaxUses() { return 556; } @Override public int getHarvestLevel() { return 3; } @Override public int getEnchantability() { return 5; } @Override public float getEfficiency() { return 6; } @Override public float getAttackDamage() { return 6; } }, 1, 1.0f, new Item.Properties() .addToolType(ToolType.PICKAXE, 2) .maxStackSize(1) .group(Majcraft.setup.itemGroup)); setRegistryName("adamantine_pickaxe"); } } Edited September 13, 20196 yr by majicmaj
September 13, 20196 yr new PickaxeItem(...)? Seriously, you don't need to make a new class for it. Also don't make your ItemTier an anonymous class. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 13, 20196 yr Author 11 minutes ago, Draco18s said: new PickaxeItem(...)? Seriously, you don't need to make a new class for it. Also don't make your ItemTier an anonymous class. In the tutorial that I followed that showed the creation of 1 item and 1 block, he used a new class for each one and so now that I have like 10 items and a few blocks I have a class for each on... I'm guessing this is not the best way to go about it...
September 13, 20196 yr 1 hour ago, majicmaj said: I'm guessing this is not the best way to go about it Usually not. The only reason to create a new class is if you need custom behavior that is different from the parent class. You want a new pickaxe. You want it to function exactly like the existing pickaxes. The only difference is the tool material (the item tier). Which is a parameter to the constructor. Passing a parameter does not require a class. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.