daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.mod.exonia.dynamite;
  2.  
  3. import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
  4. import io.netty.buffer.ByteBuf;
  5. import net.minecraft.entity.EntityLivingBase;
  6. import net.minecraft.entity.monster.EntityBlaze;
  7. import net.minecraft.entity.projectile.EntityThrowable;
  8. import net.minecraft.util.DamageSource;
  9. import net.minecraft.util.MovingObjectPosition;
  10. import net.minecraft.world.World;
  11.  
  12. public class EntityDynamite extends EntityThrowable implements IEntityAdditionalSpawnData
  13. {
  14.    private int fuseTime = 40;
  15.  
  16.    public EntityDynamite(World world)
  17.    {
  18.        super(world);
  19.    }
  20.  
  21.    public EntityDynamite(World world, EntityLivingBase thrower)
  22.    {
  23.        super(world, thrower);
  24.    }
  25.  
  26.    public EntityDynamite(World world, double x, double y, double z)
  27.    {
  28.        super(world, x, y, z);
  29.    }
  30.  
  31.    protected void onImpact(MovingObjectPosition mop)
  32.    {
  33.        this.motionX = 0;
  34.        this.motionY = 0;
  35.        this.motionZ = 0;
  36.        if (!this.worldObj.isRemote)
  37.        {
  38.  
  39.        }
  40.    }      
  41.    @Override
  42.    public void onUpdate()
  43.    {
  44.        super.onUpdate();
  45.        if(this.fuseTime > 0)
  46.        {
  47.            this.fuseTime --;
  48.        }
  49.  
  50.        else if(!this.worldObj.isRemote)
  51.        {
  52.            this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 5.0F, false, true);
  53.            this.setDead();
  54.        }
  55.  
  56.    }
  57.  
  58.    @Override
  59.    public void writeSpawnData(ByteBuf buffer)
  60.    {
  61.        buffer.writeInt(this.fuseTime);
  62.    }
  63.  
  64.    @Override
  65.    public void readSpawnData(ByteBuf additionalData)
  66.    {
  67.        this.fuseTime = additionalData.readInt();
  68.    }
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top