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.

BigSpidey

Members
  • Joined

  • Last visited

  1. Thanks to everyone here, I have solved the problem!
  2. My onItemRightClick event keeps going through twice, and even with diagnostics I can't find out why. Any help is appreciate, thank you! {note that many of the contents of this code are simply placeholders} .................................................................... public class BakugoQuirk extends ItemBase { public BakugoQuirk(String name) { super(name); this.setMaxDamage(500); this.isDamageable(); } public void onUpdate(ItemStack item, World worldIn, Entity playerIn) { if (item.getItemDamage() != 0) { item.setItemDamage(499); //Item damage gain per tick } } public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack item = playerIn.getHeldItem(handIn); Vec3d aim = playerIn.getLookVec(); System.out.println("testing for first condition, ItemDamage is " + item.getItemDamage()); if(item.getItemDamage() == 0) { playerIn.sendMessage(new TextComponentString("100% charge attack")); EntityLargeFireball fireball = new EntityLargeFireball(worldIn, playerIn, 1,1,1); fireball.setPosition(playerIn.posX + aim.x * 1.5D, playerIn.posY + aim.y * 1.5D , playerIn.posZ + aim.z * 1.5D); fireball.accelerationX = aim.x * 0.1; fireball.accelerationY = aim.y * 0.1; fireball.accelerationZ = aim.z * 0.1; worldIn.spawnEntity(fireball); item.setItemDamage(499); System.out.println("ItemDamage is " + item.getItemDamage() + " after test"); } else if(item.getItemDamage() > 0) { System.out.println("Going into second condition with " + item.getItemDamage() + " Item Damage"); EntityLargeFireball fireball = new EntityLargeFireball(worldIn, playerIn, 1,1,1); fireball.setPosition(playerIn.posX + aim.x * 1.5D, playerIn.posY + aim.y * 1.5D , playerIn.posZ + aim.z * 1.5D); fireball.accelerationX = aim.x * 0.1; fireball.accelerationY = aim.y * 0.1; fireball.accelerationZ = aim.z * 0.1; worldIn.spawnEntity(fireball); playerIn.sendMessage(new TextComponentString("50%-100% charge attack")); item.setItemDamage(item.getMaxDamage() - 1); } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, item); } EDIT {SOLVED}: Just ended up adding a broad "if (worldIn.isRemote == false )" over much of the code including the entity spawn and the chat message

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.