コード例 #1
0
 @Override
 protected Entity findPlayerToAttack() {
   Entity e =
       GenericUtils.getNearestEntityTo(
           this, GenericUtils.getEntitiesAround_CheckSight(this, 15.0, selector));
   if (e != null && e.getCommandSenderName().equals(throwerName)) return null;
   return e;
 }
コード例 #2
0
 /**
  * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define
  * their attack.
  */
 @Override
 protected void attackEntity(Entity par1Entity, float par2) {
   if (par2 < 4.0F && this.rand.nextInt(6) == 0 && !isCharging) {
     if (this.onGround && ticksExisted - lastShockTick > 40) {
       double d0 = par1Entity.posX - this.posX;
       double d1 = par1Entity.posZ - this.posZ;
       float f2 = MathHelper.sqrt_double(d0 * d0 + d1 * d1);
       this.motionX = -d0 / f2 * 0.2 + this.motionX;
       this.motionZ = -d1 / f2 * 0.2 + this.motionZ;
       this.motionY = 0.30;
       isCharging = true;
       chargeTick = 0;
       this.playSound(GenericUtils.getRandomSound("lambdacraft:mobs.he_attack", 3), 0.5F, 1.0F);
     }
   }
 }
コード例 #3
0
  @Override
  public void onUpdate() {
    super.onUpdate();

    if (!worldObj.isRemote && isCharging) {
      if (++chargeTick > 50) {
        worldObj.spawnEntityInWorld(new EntityShockwave(worldObj, this, posX, posY, posZ));
        this.playSound(GenericUtils.getRandomSound("lambdacraft:mobs.he_blast", 3), 0.5F, 1.0F);
        lastShockTick = ticksExisted;
        isCharging = false;
      }
    }

    if (worldObj.isRemote) {
      isCharging = dataWatcher.getWatchableObjectByte(20) > 0;
      chargeTick = dataWatcher.getWatchableObjectByte(20) - 1;
    } else {
      dataWatcher.updateObject(20, Byte.valueOf((byte) (isCharging ? chargeTick + 1 : 0)));
    }
  }
コード例 #4
0
 /** Returns the sound this mob makes on death. */
 @Override
 protected String getDeathSound() {
   return GenericUtils.getRandomSound("lambdacraft:mobs.he_die", 3);
 }
コード例 #5
0
 /** Returns the sound this mob makes when it is hurt. */
 @Override
 protected String getHurtSound() {
   return GenericUtils.getRandomSound("lambdacraft:mobs.he_pain", 5);
 }
コード例 #6
0
 /** Returns the sound this mob makes while it's alive. */
 @Override
 protected String getLivingSound() {
   return GenericUtils.getRandomSound("lambdacraft:mobs.he_idle", 4);
 }