Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package top.mod.item;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.effect.EntityLightningBolt;
- import net.minecraft.entity.monster.EntityBlaze;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.init.Blocks;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.EnumParticleTypes;
- import net.minecraft.util.datafix.DataFixer;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.util.math.RayTraceResult;
- import net.minecraft.world.World;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- public class EntityLightningstaff extends EntityThrowable
- {
- public EntityLightningstaff(World worldIn)
- {
- super(worldIn);
- }
- public EntityLightningstaff(World worldIn, EntityLivingBase throwerIn)
- {
- super(worldIn, throwerIn);
- }
- public EntityLightningstaff(World worldIn, double x, double y, double z)
- {
- super(worldIn, x, y, z);
- }
- public static void registerFixesSnowball(DataFixer fixer)
- {
- EntityThrowable.registerFixesThrowable(fixer, "lightningentity");
- }
- @SideOnly(Side.CLIENT)
- public void handleStatusUpdate(byte id)
- {
- if (id == 3)
- {
- for (int i = 0; i < 8; ++i)
- {
- this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
- }
- }
- }
- /**
- * Called when this EntityThrowable hits a block or entity.
- */
- protected void onImpact(RayTraceResult result)
- {
- if (result.entityHit != null)
- {
- int i = 0;
- if (result.entityHit instanceof EntityBlaze)
- {
- i = 3;
- }
- result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 41.0F);
- }
- if (!this.world.isRemote)
- {
- this.world.setEntityState(this, (byte)3);
- world.spawnEntity(new EntityLightningBolt(world, this.posX, this.posY, this.posZ, false));
- this.setDead();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement