コード例 #1
0
ファイル: Sheep.java プロジェクト: speaw/OpenClassic
  public void die(Entity cause) {
    if (cause != null) {
      cause.awardKillScore(this, 10);
    }

    int drops = (int) (Math.random() + Math.random() + 1.0D);

    for (int count = 0; count < drops; ++count) {
      this.level.addEntity(
          new Item(this.level, this.x, this.y, this.z, VanillaBlock.WHITE_CLOTH.getId()));
    }

    super.die(cause);
  }
コード例 #2
0
ファイル: Sheep.java プロジェクト: speaw/OpenClassic
  public void hurt(Entity cause, int damage) {
    if (this.hasFur && cause instanceof Player) {
      this.hasFur = false;
      int wool = (int) (Math.random() * 3.0D + 1.0D);

      for (int count = 0; count < wool; ++count) {
        this.level.addEntity(
            new Item(this.level, this.x, this.y, this.z, VanillaBlock.WHITE_CLOTH.getId()));
      }

    } else {
      super.hurt(cause, damage);
    }
  }
コード例 #3
0
ファイル: Sheep.java プロジェクト: speaw/OpenClassic
  public void aiStep() {
    super.aiStep();
    this.grazeO = this.graze;
    if (this.grazing) {
      this.graze += 0.2F;
    } else {
      this.graze -= 0.2F;
    }

    if (this.graze < 0.0F) {
      this.graze = 0.0F;
    }

    if (this.graze > 1.0F) {
      this.graze = 1.0F;
    }
  }
コード例 #4
0
ファイル: Sheep.java プロジェクト: speaw/OpenClassic
  public void renderModel(
      TextureManager textures,
      float var2,
      float var3,
      float var4,
      float var5,
      float var6,
      float var7) {
    AnimalModel model = (AnimalModel) modelCache.getModel(this.modelName);
    float var9 = model.head.y;
    float var10 = model.head.z;
    model.head.y += (this.grazeO + (this.graze - this.grazeO) * var3) * 8.0F;
    model.head.z -= this.grazeO + (this.graze - this.grazeO) * var3;
    super.renderModel(textures, var2, var3, var4, var5, var6, var7);
    if (this.hasFur) {
      RenderHelper.getHelper().bindTexture("/mob/sheep_fur.png", true);
      GL11.glDisable(GL11.GL_CULL_FACE);
      AnimalModel fur = (AnimalModel) modelCache.getModel("sheep.fur");
      fur.head.yaw = model.head.yaw;
      fur.head.pitch = model.head.pitch;
      fur.head.y = model.head.y;
      fur.head.x = model.head.x;
      fur.body.yaw = model.body.yaw;
      fur.body.pitch = model.body.pitch;
      fur.leg1.pitch = model.leg1.pitch;
      fur.leg2.pitch = model.leg2.pitch;
      fur.leg3.pitch = model.leg3.pitch;
      fur.leg4.pitch = model.leg4.pitch;
      fur.head.render(var7);
      fur.body.render(var7);
      fur.leg1.render(var7);
      fur.leg2.render(var7);
      fur.leg3.render(var7);
      fur.leg4.render(var7);
    }

    model.head.y = var9;
    model.head.z = var10;
  }