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.

ImUnreal

Members
  • Joined

  • Last visited

Everything posted by ImUnreal

  1. Like i said, im a complete beginner and only know the really basic stuff, im learning it as i go i suppose. Do you know a good source where i can learn the basic java needed for modding(or just writing java in general), so i dont have to bother anyone like this ?
  2. this doesnt work either, and i have no idea why public ItemStack hitEntity(ItemStack itemStack, World world, EntityPlayer player) { world.playSoundAtEntity(player, "mod:lightsaberswing", 1.0F, 1.0F); return itemStack; }
  3. Yes, thats the problem, this is how it works with onItemRightClick, im trying to get it to work with hitEntity, but i have no idea how.
  4. So im trying to make my custom lightsaber item play a sound when hitting an entity. I got it to work with the method onItemRightClick, but i cant get it to work with hitEntity. Im rather new to modding and id like to get help. Here is the working code public class ItemModLightsaber extends ItemSword { public ItemModLightsaber(ToolMaterial Kyber, String unlocalizedName) { super(Kyber); this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(IRCrTab.tabIRItems); this.setTextureName("mod:" + unlocalizedName); } @Override public boolean hitEntity(ItemStack stack, EntityLivingBase hitEntity, EntityLivingBase attackingEntity) { hitEntity.setFire(4); return true; } public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { world.playSoundAtEntity(player, "mod:lightsaberswing", 1.0F, 1.0F); return itemStack; } }

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.