Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package top.mod.item;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.init.Items;
- import net.minecraft.item.Item;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.EnumParticleTypes;
- import net.minecraft.util.datafix.DataFixer;
- import net.minecraft.util.math.RayTraceResult;
- import net.minecraft.world.World;
- public class EntityKnife extends EntityThrowable{
- public EntityKnife(World worldIn) {
- super(worldIn);
- }
- public EntityKnife(World worldIn, EntityLivingBase throwerIn) {
- super(worldIn, throwerIn);
- }
- public EntityKnife(World worldIn, double x, double y, double z) {
- super(worldIn, x, y, z);
- }
- public static void func_189662_a(DataFixer p_189662_0_)
- {
- EntityThrowable.func_189661_a(p_189662_0_, "knife");
- }
- @Override
- protected void onImpact(RayTraceResult result)
- {
- if(result.entityHit != null)
- {
- result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 41.0F);
- }
- if(!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
- {
- int i = 1;
- if(this.rand.nextInt(32) == 0)
- {
- i = 4;
- }
- double d0 = 0.08D;
- for (int k = 0; k < 8; ++k)
- {
- this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, ((double) this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(Items.EGG)});
- {
- if (true) {
- this.worldObj.createExplosion((Entity) this, i, k, 10F, i, true);
- }
- this.kill();
- }
- if (!this.worldObj.isRemote)
- {
- this.setDead();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment