Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Tinn

Members
  • Posts

    5
  • Joined

  • Last visited

Tinn's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I just checked and InteractionResultHolder.sidedSuccess does exist however I am not sure as to how I would implement it. When I add it as in the code below I receive an error. Sorry for my inexperience. @Override public InteractionResultHolder.sidedSuccess<ItemStack> use(Level world, Player player, InteractionHand hand) { LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(world); if(!world.isClientSide) { lightningBolt.moveTo(player.position()); world.addFreshEntity(lightningBolt); player.getCooldowns().addCooldown(this, 60); } return super.use(world, player, hand); }
  2. Nevermind I found the solution to the lightning not appearing. I had to summon the lightningBolt after giving the location. Thanks for helping!
  3. I've made a few changes and added a position for the bolt, but the lightning bolt is still not being rendered. The effects are taking place for example, the player takes damage and catches on fire, the sky blinks and sound effects still play but the lightning just doesn't appear. I've also added a cooldown time for fun (just to learn more methods). @Override public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) { LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(world); if(!world.isClientSide) { world.addFreshEntity(lightningBolt); lightningBolt.moveTo(player.position()); player.getCooldowns().addCooldown(this, 100); } return super.use(world, player, hand); }
  4. I am not able to find InteractionResultHolder.sidedSuccess, I can find InteractionResultHolder. I'm currently modding on version 1.18.1 if that helps
  5. Hello, I'm new to modding and have only started a few weeks ago. I'm currently trying to create a SwordItem that upons being right-clicked will summon lightning in front of the player. The problem is, when I right-click the sword it only plays the sound effects of the lightning bolt and change the sky's color for a bit. No actual lightning is being summoned. Here is my code for the lightning functionality: @Override public InteractionResultHolder<ItemStack> use(Level world, Player player, InteractionHand hand) { LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(world); if(!world.isClientSide()) { world.addFreshEntity(lightningBolt); } return super.use(world, player, hand); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.