Advertisement
Guest User

Untitled

a guest
May 8th, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. public class DiamondStaffItem extends AbstractStaffItem
  2. {
  3. public DiamondStaffItem(IItemTier tierIn, float attackSpeedIn, Properties properties) {
  4. super(tierIn, attackSpeedIn, properties);
  5. this.setDamage(2);
  6. this.setXpAmount(10);
  7. this.setVelocity(2.0F);
  8. this.setInnacuracy(1.5F);
  9. this.setStaffName("DIAMOND STAFF");
  10. this.setSpellSound(SoundInit.BASIC_MAGIC_SHOOT);
  11. this.setEmptySound(SoundEvents.BLOCK_DISPENSER_FAIL);
  12. }
  13. @Override
  14. public Entity getProjectile(LivingEntity shooter, ItemStack stack) {
  15. Multimap<Attribute, AttributeModifier> attributes = stack.getAttributeModifiers(EquipmentSlotType.MAINHAND);
  16. double total = 0.0D;
  17.  
  18. AttributeModifier modifier;
  19. for (Iterator var5 = attributes.get(Attributes.ATTACK_SPEED).iterator(); var5.hasNext(); total += modifier.getAmount()) {
  20. modifier = (AttributeModifier) var5.next();
  21. }
  22.  
  23. Vector3d vec3d = shooter.getLook(1.0F);
  24. Vector3f vec3f = new Vector3f(vec3d);
  25. DiamondBoltEntity diamondBolt = new DiamondBoltEntity(EntityTypeInit.DIAMOND_BOLT.get(), shooter, shooter.world, (total * this.getDamage()) * 0.5D);
  26. diamondBolt.setShooter(shooter);
  27. diamondBolt.shoot((double) vec3f.getX(), (double) vec3f.getY(), (double) vec3f.getZ(), this.getVelocity(), ((float) total * this.getInnacuracy()) * 0.5F);
  28. return diamondBolt;
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement