Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.entities;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.LivingEntity;
- import net.minecraft.entity.projectile.ArrowEntity;
- import net.minecraft.particles.ParticleTypes;
- import net.minecraft.potion.Potions;
- import net.minecraft.util.math.MathHelper;
- import net.minecraft.util.math.RayTraceResult;
- import net.minecraft.util.math.Vec3d;
- import net.minecraft.world.Explosion;
- import net.minecraft.world.World;
- public class ExplosionSpellEntity extends ArrowEntity {
- public ExplosionSpellEntity(EntityType<? extends ArrowEntity> type, World worldIn) {
- super(type, worldIn);
- }
- public ExplosionSpellEntity(World worldIn, double x, double y, double z) {
- super(worldIn, x, y, z);
- }
- public ExplosionSpellEntity(World worldIn, LivingEntity shooter) {
- super(worldIn, shooter);
- }
- @Override
- public void shoot(Entity shooter, float pitch, float yaw, float p_184547_4_, float velocity, float inaccuracy) {
- float f = -MathHelper.sin(yaw * ((float)Math.PI / 180F)) * MathHelper.cos(pitch * ((float)Math.PI / 180F));
- float f1 = -MathHelper.sin(pitch * ((float)Math.PI / 180F));
- float f2 = MathHelper.cos(yaw * ((float)Math.PI / 180F)) * MathHelper.cos(pitch * ((float)Math.PI / 180F));
- this.shoot((double)f, (double)f1, (double)f2, velocity, inaccuracy);
- this.setMotion(this.getMotion().add(shooter.getMotion().x, shooter.onGround ? 0.0D : shooter.getMotion().y, shooter.getMotion().z));
- System.out.println("shot");
- }
- @Override
- public void onHit(RayTraceResult raytraceResultIn) {
- System.out.println("Debug: spell entity hit");
- this.world.createExplosion(this, this.getPosX(), this.getPosY(), this.getPosZ(), 20, false, Explosion.Mode.DESTROY);
- this.remove();
- }
- @Override
- public void tick() {
- super.tick();
- this.world.addParticle(ParticleTypes.FLAME, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0, 0.0, 0.0);
- System.out.println("DEBUG: arrow tick");
- }
- }
Add Comment
Please, Sign In to add comment