Guest User

Untitled

a guest
Jun 24th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. package me.entities;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.entity.EntityType;
  5. import net.minecraft.entity.LivingEntity;
  6. import net.minecraft.entity.projectile.ArrowEntity;
  7. import net.minecraft.particles.ParticleTypes;
  8. import net.minecraft.potion.Potions;
  9. import net.minecraft.util.math.MathHelper;
  10. import net.minecraft.util.math.RayTraceResult;
  11. import net.minecraft.util.math.Vec3d;
  12. import net.minecraft.world.Explosion;
  13. import net.minecraft.world.World;
  14.  
  15. public class ExplosionSpellEntity extends ArrowEntity {
  16. public ExplosionSpellEntity(EntityType<? extends ArrowEntity> type, World worldIn) {
  17. super(type, worldIn);
  18. }
  19.  
  20. public ExplosionSpellEntity(World worldIn, double x, double y, double z) {
  21. super(worldIn, x, y, z);
  22. }
  23.  
  24. public ExplosionSpellEntity(World worldIn, LivingEntity shooter) {
  25. super(worldIn, shooter);
  26. }
  27.  
  28. @Override
  29. public void shoot(Entity shooter, float pitch, float yaw, float p_184547_4_, float velocity, float inaccuracy) {
  30. float f = -MathHelper.sin(yaw * ((float)Math.PI / 180F)) * MathHelper.cos(pitch * ((float)Math.PI / 180F));
  31. float f1 = -MathHelper.sin(pitch * ((float)Math.PI / 180F));
  32. float f2 = MathHelper.cos(yaw * ((float)Math.PI / 180F)) * MathHelper.cos(pitch * ((float)Math.PI / 180F));
  33. this.shoot((double)f, (double)f1, (double)f2, velocity, inaccuracy);
  34. this.setMotion(this.getMotion().add(shooter.getMotion().x, shooter.onGround ? 0.0D : shooter.getMotion().y, shooter.getMotion().z));
  35. System.out.println("shot");
  36. }
  37.  
  38. @Override
  39. public void onHit(RayTraceResult raytraceResultIn) {
  40. System.out.println("Debug: spell entity hit");
  41. this.world.createExplosion(this, this.getPosX(), this.getPosY(), this.getPosZ(), 20, false, Explosion.Mode.DESTROY);
  42. this.remove();
  43. }
  44.  
  45. @Override
  46. public void tick() {
  47. super.tick();
  48. this.world.addParticle(ParticleTypes.FLAME, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0, 0.0, 0.0);
  49. System.out.println("DEBUG: arrow tick");
  50. }
  51.  
  52.  
  53. }
Add Comment
Please, Sign In to add comment