示例#1
0
  /** Handles the water game logic. */
  public void onUpdate(EntityPlayer par1EntityPlayer) {
    if (par1EntityPlayer.playerTemperature.getIsHot()) {
      baseWaterExhaustionValue = baseWaterExhaustionValueWhenIsHot;
    } else {
      baseWaterExhaustionValue = baseWaterExhaustionValueNormal;
    }

    int i = par1EntityPlayer.worldObj.difficultySetting;
    prevWaterLevel = waterLevel;

    if (waterExhaustionLevel > 4F) {
      waterExhaustionLevel -= 4F;

      if (i > 0) {
        waterLevel = Math.max(waterLevel - 1, 0);
      }
    }

    if (waterLevel <= 0) {
      waterTimer++;

      if (waterTimer >= 80) {
        if (par1EntityPlayer.getHealth() > 10
            || i >= 3
            || par1EntityPlayer.getHealth() > 1 && i >= 2) {
          par1EntityPlayer.attackEntityFrom(DamageSource.dehydrated, 1);
        }

        waterTimer = 0;
      }
    } else {
      waterTimer = 0;
    }
  }
示例#2
0
 public void processCommand(ICommandSender par1ICommandSender, String par2ArrayOfStr[]) {
   EntityPlayer entityplayer = getCommandSenderAsPlayer(par1ICommandSender);
   entityplayer.attackEntityFrom(DamageSource.outOfWorld, 1000);
   par1ICommandSender.sendChatToPlayer("Ouch. That look like it hurt.");
 }