Ejemplo n.º 1
0
 public void func_176162_a(IBlockAccess p_176162_1_, Entity p_176162_2_) {
   this.field_176169_a = p_176162_1_;
   this.field_176167_b.clearMap();
   this.field_176168_c = MathHelper.floor_float(p_176162_2_.width + 1.0F);
   this.field_176165_d = MathHelper.floor_float(p_176162_2_.height + 1.0F);
   this.field_176166_e = MathHelper.floor_float(p_176162_2_.width + 1.0F);
 }
    protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) {
      if (this.visible) {
        if (this.field_146155_p) {
          this.field_146156_o = (float) (mouseX - (this.xPosition + 4)) / (float) (this.width - 8);
          this.field_146156_o = MathHelper.clamp_float(this.field_146156_o, 0.0F, 1.0F);
          mc.gameSettings.setSoundLevel(this.field_146153_r, this.field_146156_o);
          mc.gameSettings.saveOptions();
          this.displayString =
              this.field_146152_s
                  + ": "
                  + GuiScreenOptionsSounds.this.getSoundVolume(this.field_146153_r);
        }

        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.drawTexturedModalRect(
            this.xPosition + (int) (this.field_146156_o * (float) (this.width - 8)),
            this.yPosition,
            0,
            66,
            4,
            20);
        this.drawTexturedModalRect(
            this.xPosition + (int) (this.field_146156_o * (float) (this.width - 8)) + 4,
            this.yPosition,
            196,
            66,
            4,
            20);
      }
    }
Ejemplo n.º 3
0
  /** Updates the JList with a new model. */
  public void update() {
    boolean var1 = this.isBurning();
    boolean var2 = false;

    if (this.isBurning()) {
      --this.furnaceBurnTime;
    }

    if (!this.worldObj.isRemote) {
      if (!this.isBurning()
          && (this.furnaceItemStacks[1] == null || this.furnaceItemStacks[0] == null)) {
        if (!this.isBurning() && this.field_174906_k > 0) {
          this.field_174906_k =
              MathHelper.clamp_int(this.field_174906_k - 2, 0, this.field_174905_l);
        }
      } else {
        if (!this.isBurning() && this.canSmelt()) {
          this.currentItemBurnTime =
              this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]);

          if (this.isBurning()) {
            var2 = true;

            if (this.furnaceItemStacks[1] != null) {
              --this.furnaceItemStacks[1].stackSize;

              if (this.furnaceItemStacks[1].stackSize == 0) {
                Item var3 = this.furnaceItemStacks[1].getItem().getContainerItem();
                this.furnaceItemStacks[1] = var3 != null ? new ItemStack(var3) : null;
              }
            }
          }
        }

        if (this.isBurning() && this.canSmelt()) {
          ++this.field_174906_k;

          if (this.field_174906_k == this.field_174905_l) {
            this.field_174906_k = 0;
            this.field_174905_l = this.func_174904_a(this.furnaceItemStacks[0]);
            this.smeltItem();
            var2 = true;
          }
        } else {
          this.field_174906_k = 0;
        }
      }

      if (var1 != this.isBurning()) {
        var2 = true;
        BlockFurnace.func_176446_a(this.isBurning(), this.worldObj, this.pos);
      }
    }

    if (var2) {
      this.markDirty();
    }
  }
  /** Updates the task */
  public void updateTask() {
    double var1 =
        this.entityHost.getDistanceSq(
            this.attackTarget.posX,
            this.attackTarget.getEntityBoundingBox().minY,
            this.attackTarget.posZ);
    boolean var3 = this.entityHost.getEntitySenses().canSee(this.attackTarget);

    if (var3) {
      ++this.field_75318_f;
    } else {
      this.field_75318_f = 0;
    }

    if (var1 <= (double) this.maxAttackDistance && this.field_75318_f >= 20) {
      this.entityHost.getNavigator().clearPathEntity();
    } else {
      this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed);
    }

    this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F);
    float var4;

    if (--this.rangedAttackTime == 0) {
      if (var1 > (double) this.maxAttackDistance || !var3) {
        return;
      }

      var4 = MathHelper.sqrt_double(var1) / this.field_96562_i;
      float var5 = MathHelper.clamp_float(var4, 0.1F, 1.0F);
      this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, var5);
      this.rangedAttackTime =
          MathHelper.floor_float(
              var4 * (float) (this.maxRangedAttackTime - this.field_96561_g)
                  + (float) this.field_96561_g);
    } else if (this.rangedAttackTime < 0) {
      var4 = MathHelper.sqrt_double(var1) / this.field_96562_i;
      this.rangedAttackTime =
          MathHelper.floor_float(
              var4 * (float) (this.maxRangedAttackTime - this.field_96561_g)
                  + (float) this.field_96561_g);
    }
  }
 public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
   if (super.mousePressed(mc, mouseX, mouseY)) {
     this.field_146156_o = (float) (mouseX - (this.xPosition + 4)) / (float) (this.width - 8);
     this.field_146156_o = MathHelper.clamp_float(this.field_146156_o, 0.0F, 1.0F);
     mc.gameSettings.setSoundLevel(this.field_146153_r, this.field_146156_o);
     mc.gameSettings.saveOptions();
     this.displayString =
         this.field_146152_s
             + ": "
             + GuiScreenOptionsSounds.this.getSoundVolume(this.field_146153_r);
     this.field_146155_p = true;
     return true;
   } else {
     return false;
   }
 }
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    this.prevPosX = this.posX;
    this.prevPosY = this.posY;
    this.prevPosZ = this.posZ;

    if (this.materialType == Material.water) {
      this.particleRed = 0.2F;
      this.particleGreen = 0.3F;
      this.particleBlue = 1.0F;
    } else {
      this.particleRed = 1.0F;
      this.particleGreen = 16.0F / (float) (40 - this.bobTimer + 16);
      this.particleBlue = 4.0F / (float) (40 - this.bobTimer + 8);
    }

    this.motionY -= (double) this.particleGravity;

    if (this.bobTimer-- > 0) {
      this.motionX *= 0.02D;
      this.motionY *= 0.02D;
      this.motionZ *= 0.02D;
      this.setParticleTextureIndex(113);
    } else {
      this.setParticleTextureIndex(112);
    }

    this.moveEntity(this.motionX, this.motionY, this.motionZ);
    this.motionX *= 0.9800000190734863D;
    this.motionY *= 0.9800000190734863D;
    this.motionZ *= 0.9800000190734863D;

    if (this.particleMaxAge-- <= 0) {
      this.setDead();
    }

    if (this.onGround) {
      if (this.materialType == Material.water) {
        this.setDead();
        this.worldObj.spawnParticle(
            EnumParticleTypes.WATER_SPLASH,
            this.posX,
            this.posY,
            this.posZ,
            0.0D,
            0.0D,
            0.0D,
            new int[0]);
      } else {
        this.setParticleTextureIndex(114);
      }

      this.motionX *= 0.699999988079071D;
      this.motionZ *= 0.699999988079071D;
    }

    BlockPos var1 = new BlockPos(this);
    IBlockState var2 = this.worldObj.getBlockState(var1);
    Material var3 = var2.getBlock().getMaterial();

    if (var3.isLiquid() || var3.isSolid()) {
      double var4 = 0.0D;

      if (var2.getBlock() instanceof BlockLiquid) {
        var4 =
            (double)
                BlockLiquid.getLiquidHeightPercent(
                    ((Integer) var2.getValue(BlockLiquid.LEVEL)).intValue());
      }

      double var6 = (double) (MathHelper.floor_double(this.posY) + 1) - var4;

      if (this.posY < var6) {
        this.setDead();
      }
    }
  }