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.

Vamaka12

Members
  • Joined

  • Last visited

  1. I am trying to spawn Fireball when player right clicks, I was following 1.12.2 tutorial but I am modding for 1.18.1. So I changed up code but it doesn't works This is my code: package com.vamaka12.magiccraft.objects.tools; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.LargeFireball; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; public class FireStaff extends Item { public FireStaff(Properties properties) { super(properties); } // @Override Gives error, It was in tutorial public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { ItemStack item = player.getItemInHand(hand); Vec3 aim = player.getLookAngle(); LargeFireball fireBall = new LargeFireball(level, player, 1, 1, 1); // gives error "Cannot resolve constructor", I don't know why fireBall.setPos(player.position().x + aim.x * 1.5D, player.position().y + aim.y * 1.5D, player.position().z + aim.z * 1.5D); // fireBall.accelerationX = aim.x * 0.1; fireBall.accelerationY = aim.y * 0.1; fireBall.accelerationZ = aim.z * 0.1; acceleration doesn't exists // level.spawnEntity doesn't exists item.setDamageValue(1); return InteractionResult.SUCCESS; } } Tutorial code: public class FireStaff extends ItemBase { public FireStaff(String name) { super(name); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack item = playerIn.getHeldItem(handIn); Vec3d aim = playerIn.getLookVec(); EntityLargeFireBall fireball = new EntityLargeFirball(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.damageItem(1, playerIn); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, item); } } Somebody please help, I spended already 1 day

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.