Example #1
0
 @Override
 public boolean attackEntityFrom(DamageSource damagesource, float i) {
   if (worldObj.isRemote) {
     return true;
   }
   if (canBeDestroyedByPlayer(damagesource)) return true;
   super.attackEntityFrom(damagesource, i);
   setRollingDirection(-getRollingDirection());
   setRollingAmplitude(10);
   setBeenAttacked();
   setDamage(getDamage() + i * 10);
   if (getDamage() > 40) {
     if (riddenByEntity != null) {
       riddenByEntity.mountEntity(this);
     }
     this.setDead();
     boolean flag =
         damagesource.getEntity() instanceof EntityPlayer
             && ((EntityPlayer) damagesource.getEntity()).capabilities.isCreativeMode;
     if (!flag) {
       dropCartAsItem();
     }
   }
   return true;
 }
Example #2
0
 @Override
 public void onUpdate() {
   super.onUpdate();
   if (worldObj.isRemote) return;
   if (theTank != null && theTank.getFluid() != null) {
     this.dataWatcher.updateObject(18, theTank.getFluid().amount);
     this.dataWatcher.updateObject(4, theTank.getFluid().fluidID);
     if (theTank.getFluid().getFluid() != null)
       this.dataWatcher.updateObject(22, theTank.getFluid().getFluid().getName());
     handleMass();
   } else if (theTank != null && theTank.getFluid() == null) {
     this.dataWatcher.updateObject(18, 0);
     this.dataWatcher.updateObject(4, 0);
     this.dataWatcher.updateObject(22, "");
   }
 }
Example #3
0
 @Override
 protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   this.theTank.readFromNBT(nbttagcompound);
 }
Example #4
0
 @Override
 protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
   super.writeEntityToNBT(nbttagcompound);
   this.theTank.writeToNBT(nbttagcompound);
 }