private float calculateAdditionalDifficulty( EnumDifficulty difficulty, long worldTime, long chunkInhabitedTime, float moonPhaseFactor) { if (difficulty == EnumDifficulty.PEACEFUL) { return 0.0F; } else { boolean flag = difficulty == EnumDifficulty.HARD; float f1 = 0.75F; float f2 = MathHelper.clamp_float(((float) worldTime + -72000.0F) / 1440000.0F, 0.0F, 1.0F) * 0.25F; f1 += f2; float f3 = 0.0F; f3 += MathHelper.clamp_float((float) chunkInhabitedTime / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F); f3 += MathHelper.clamp_float(moonPhaseFactor * 0.25F, 0.0F, f2); if (difficulty == EnumDifficulty.EASY) { f3 *= 0.5F; } f1 += f3; return (float) difficulty.getDifficultyId() * f1; } }
public EnumDifficulty getDifficulty() { return EnumDifficulty.getById(this.propertyManager.getInt("difficulty", 1)); }