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.

richard

Members
  • Joined

  • Last visited

Everything posted by richard

  1. OK, thanks. I'm now looking into how to send packets from the client to the server! Solution: I ended up implementing InvokeWandMessage which encoded the RayTraceResult generated by PythonWandItem and sent it to the server for actioning. Works!!
  2. I've got a "wand" item that, on right-click, I wish to be able to inflict various things on mobs: set on fire or apply a potion effect to them. My two attempts at doing this are below. Apply a poison potion effect: @Nonnull @Override public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack itemstack, World world, EntityPlayer player, EnumHand hand) { RayTraceResult target = Minecraft.getMinecraft().objectMouseOver; if (target.typeOfHit == RayTraceResult.Type.ENTITY) { if (target.entityHit instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase) target.entityHit; Potion potion = Potion.REGISTRY.getObject(new ResourceLocation("poison")); PotionEffect potioneffect = new PotionEffect(potion, 50, 1); if (potion.isInstant()) { potion.affectEntity(null, null, entitylivingbase, potioneffect.getAmplifier(), 0.5D); } else { entitylivingbase.addPotionEffect(potioneffect); } } } return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack); } The result of the above is that the potion effect doesn't appear to be applied at all. Changing the code to instead set the entity on fire: @Nonnull @Override public ActionResult<ItemStack> onItemRightClick(@Nonnull ItemStack itemstack, World world, EntityPlayer player, EnumHand hand) { RayTraceResult target = Minecraft.getMinecraft().objectMouseOver; if (target.typeOfHit == RayTraceResult.Type.ENTITY) { target.entityHit.setFire(4); } return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack); } This results in a brief flash of fire effect on the entity, but it does not remain on fire for the full 4 seconds that I specify. I know that I've invoked the setFire method correctly because if I do so in a hitEntity() override like so: public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { target.setFire(4); return true; } The entity stays on fire!

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.