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 noticed I have to implement getIcon and getIconForUseDuration and registerIcons, and also probably onItemRightClick if I want to change the damage my bow causes to entities. I read a (very old) tutorial about bows, but I was hoping someone could either link me to a more recent and clearer one, or give me a quick explanation of how this is done. I don't really like just copy-pasting stuff, I prefer to actually undestand what I'm doing, so, a link to a plain coded example, while appreciated, is not exactly what I'm looking for. thanks.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

You could just extend ItemBow and override what you need to make changes to. Extending it would only allow you to get away with not writing all of the methods because its already done for you.

 

You could also create a class extending item, override the methods onItemRightClick, getMaxItemUseDuration, onItemStoppedUsing, getEnumAction, etc. It shouldn't be hard at all, all the information is in the bow class itself ready to use. Also, one thing to note is that the bow's damage depends on the entity arrow being spawned. It is increased depending on the bow's use time (this is seen in the EntityArrow class).

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

I see, so if I just extend ItemBow all I have to override is what, onPlayerStoppedUsing, and change the code where it sets be arrow damage? what about the icons? this is the hardest part for me, I have a hard time understanding everything that's related to graphics or art in general.

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

I imagine it would be something like this (a little code example).

 


public class ExampleBow extends ItemBow
{

public static final String[]	 ICONNAMES = new String[] {"modid:pulling_0", "modid:pulling_1", "modid:pulling_2"};

/** We call super to initialize the values in the parent constructor - if you don't you may modify these values **/
public ExampleBow()
{
	super();
}

/** We call the super method to execute it instead - if you want to spawn an arrow with more damage, ignore the super call and modify **/
@Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
{
	super.onPlayerStoppedUsing(stack, worldIn, playerIn, timeLeft);
}

}

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

This is the line that interests me:

 

public static final String[]	 ICONNAMES = new String[] {"modid:pulling_0", "modid:pulling_1", "modid:pulling_2"};

 

I imagine I need to have (inside assets\textures\items\) textures with the names

<bow>_pulling_0.png

,

<bow>_pulling_1.png

,

<bow>_pulling_2.png

and

<bow>_standby.png

, where

<bow>

is the name of my Bow's class?

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

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.