Ejemplo n.º 1
0
  private void setSize(Entity entity, float par1, float par2) {
    float f2;

    if (par1 != entity.width || par2 != entity.height) {
      f2 = entity.width;
      entity.width = par1;
      entity.height = par2;
      entity.boundingBox.maxX = entity.boundingBox.minX + (double) entity.width;
      entity.boundingBox.maxZ = entity.boundingBox.minZ + (double) entity.width;
      entity.boundingBox.maxY = entity.boundingBox.minY + (double) entity.height;

      if (entity.width > f2 && !entity.worldObj.isRemote) {
        entity.moveEntity((double) (f2 - entity.width), 0.0D, (double) (f2 - entity.width));
      }
    }

    f2 = par1 % 2.0F;

    if ((double) f2 < 0.375D) {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_1;
    } else if ((double) f2 < 0.75D) {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_2;
    } else if ((double) f2 < 1.0D) {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_3;
    } else if ((double) f2 < 1.375D) {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_4;
    } else if ((double) f2 < 1.75D) {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_5;
    } else {
      entity.myEntitySize = Entity.EnumEntitySize.SIZE_6;
    }
  }
Ejemplo n.º 2
0
  private void func_145863_a(float p_145863_1_, float p_145863_2_) {
    if (this.extending) {
      p_145863_1_ = 1.0F - p_145863_1_;
    } else {
      --p_145863_1_;
    }

    AxisAlignedBB var3 =
        Blocks.piston_extension.func_176424_a(
            this.worldObj, this.pos, this.field_174932_a, p_145863_1_, this.field_174931_f);

    if (var3 != null) {
      List var4 = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity) null, var3);

      if (!var4.isEmpty()) {
        this.field_174933_k.addAll(var4);
        Iterator var5 = this.field_174933_k.iterator();

        while (var5.hasNext()) {
          Entity var6 = (Entity) var5.next();

          if (this.field_174932_a.getBlock() == Blocks.slime_block && this.extending) {
            switch (TileEntityPiston.SwitchAxis.field_177248_a[
                this.field_174931_f.getAxis().ordinal()]) {
              case 1:
                var6.motionX = (double) this.field_174931_f.getFrontOffsetX();
                break;

              case 2:
                var6.motionY = (double) this.field_174931_f.getFrontOffsetY();
                break;

              case 3:
                var6.motionZ = (double) this.field_174931_f.getFrontOffsetZ();
            }
          } else {
            var6.moveEntity(
                (double) (p_145863_2_ * (float) this.field_174931_f.getFrontOffsetX()),
                (double) (p_145863_2_ * (float) this.field_174931_f.getFrontOffsetY()),
                (double) (p_145863_2_ * (float) this.field_174931_f.getFrontOffsetZ()));
          }
        }

        this.field_174933_k.clear();
      }
    }
  }