Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by gyro42

  • Author

It was another case of rereading my code after posting it and catching the error.

 

bonus points to the first one to find it ;)

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()

 

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.

  • Author

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?

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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.