Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package theishiopian.ppd.entity.spells;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.init.MobEffects;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.EnumParticleTypes;
- import net.minecraft.util.math.RayTraceResult;
- import net.minecraft.util.math.RayTraceResult.Type;
- import net.minecraft.world.World;
- import theishiopian.ppd.entity.EntitySpell;
- public class EntityPoison extends EntitySpell
- {
- public EntityPoison(World world)
- {
- super(world);
- }
- public EntityPoison(World world, EntityLivingBase entity)
- {
- super(world, entity);
- caster = entity;
- }
- public EntityPoison(World world, double x, double y, double z)
- {
- super(world, x, y, z);
- }
- @Override
- protected void onImpact(RayTraceResult result)
- {
- if(result.typeOfHit == Type.BLOCK)
- {
- if(world.getBlockState(result.getBlockPos()).getCollisionBoundingBox(world, result.getBlockPos()) != null)setDead();
- }
- else if(result.entityHit != null && result.entityHit != caster && result.entityHit instanceof EntityLivingBase)
- {
- ((EntityLivingBase) result.entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON, 100));
- ((EntityLivingBase) result.entityHit).setLastAttacker(caster);
- ((EntityLivingBase) result.entityHit).setRevengeTarget(caster);
- setDead();
- }
- }
- @Override
- public void onUpdate()
- {
- super.onUpdate();
- this.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, true, this.posX, this.posY, this.posZ, this.motionX,
- this.motionY, this.motionZ, new int[0]);
- this.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, true, this.posX, this.posY, this.posZ, 0, 0, 0,
- new int[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement