gyro42 Posted May 3, 2018 Posted May 3, 2018 (edited) I am having issues getting my custom axe to show up in game, but no problems getting the other tools working. I tried a youtube video but it wasnt much help. Basically im unsure whether to have my class extend ItemTool or ItemAxe and how to set it up. Heres my code for the class. When the game loads the axe just doesnt appear and im not noticing any error messages in my console output. If i try the commented out bit instead, it just crashes. public class ToolAxe extends ItemTool implements IHasModel{ public static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.WOODEN_BUTTON, Blocks.LADDER, Blocks.WOODEN_PRESSURE_PLATE); public ToolAxe(String name, ToolMaterial material) { super(material, EFFECTIVE_ON); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.TOOLS); } public float getDestroySpeed(ItemStack stack, IBlockState state){ Material material = state.getMaterial(); return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getDestroySpeed(stack, state) : this.efficiency; } //public class ToolAxe extends ItemAxe implements IHasModel{ //public ToolAxe(String name, ToolMaterial material, float damage, float speed) { // super(material); // setUnlocalizedName(name); // setRegistryName(name); // attackDamage = damage; // attackSpeed = speed; // setCreativeTab(CreativeTabs.TOOLS); // ModItems.ITEMS.add(this); //} Edited May 3, 2018 by gyro42 Quote
gyro42 Posted May 3, 2018 Author Posted May 3, 2018 It was another case of rereading my code after posting it and catching the error. bonus points to the first one to find it Quote
Draco18s Posted May 3, 2018 Posted May 3, 2018 extend ItemAxe? And use the correct constructor (the one with two floats) You don't need Set<Block> EFFECTIVE_ON, that's handled by setHarvestLevel() Quote 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.
gyro42 Posted May 3, 2018 Author Posted May 3, 2018 extending ItemAxe is the one that caused me to crash in the first place. I tried the constructor both with and without the floats, and attempted to deal with the damage and attack speed in a couple different ways. No Dice. If i could understand the error outputs correctly it was handling the attack damage that caused me to crash, but im not 100% on that. My solution was the convoluted mess that mimics the ItemAxe class. At least its working now.... isn't setHarvestLevel for the pickaxe types? Quote
Draco18s Posted May 3, 2018 Posted May 3, 2018 10 hours ago, gyro42 said: If i could understand the error outputs correctly it was handling the attack damage that caused me to crash, but im not 100% on that. Did it ever occur to you to post it and let us look at it? Quote 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.
Recommended Posts
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.